vendor.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!*********************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js ***!
  5. \*********************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", {
  10. value: true
  11. });
  12. exports.default = void 0;
  13. var objectKeys = ['qy', 'env', 'error', 'version', 'lanDebug', 'cloud', 'serviceMarket', 'router', 'worklet', '__webpack_require_UNI_MP_PLUGIN__'];
  14. var singlePageDisableKey = ['lanDebug', 'router', 'worklet'];
  15. var target = typeof globalThis !== 'undefined' ? globalThis : function () {
  16. return this;
  17. }();
  18. var key = ['w', 'x'].join('');
  19. var oldWx = target[key];
  20. var launchOption = oldWx.getLaunchOptionsSync ? oldWx.getLaunchOptionsSync() : null;
  21. function isWxKey(key) {
  22. if (launchOption && launchOption.scene === 1154 && singlePageDisableKey.includes(key)) {
  23. return false;
  24. }
  25. return objectKeys.indexOf(key) > -1 || typeof oldWx[key] === 'function';
  26. }
  27. function initWx() {
  28. var newWx = {};
  29. for (var _key in oldWx) {
  30. if (isWxKey(_key)) {
  31. // TODO wrapper function
  32. newWx[_key] = oldWx[_key];
  33. }
  34. }
  35. return newWx;
  36. }
  37. target[key] = initWx();
  38. var _default = target[key];
  39. exports.default = _default;
  40. /***/ }),
  41. /***/ 10:
  42. /*!****************************************************************!*\
  43. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  44. \****************************************************************/
  45. /*! no static exports found */
  46. /***/ (function(module, exports) {
  47. function _nonIterableRest() {
  48. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  49. }
  50. module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
  51. /***/ }),
  52. /***/ 11:
  53. /*!***************************************************************!*\
  54. !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!
  55. \***************************************************************/
  56. /*! no static exports found */
  57. /***/ (function(module, exports, __webpack_require__) {
  58. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  59. function _defineProperty(obj, key, value) {
  60. key = toPropertyKey(key);
  61. if (key in obj) {
  62. Object.defineProperty(obj, key, {
  63. value: value,
  64. enumerable: true,
  65. configurable: true,
  66. writable: true
  67. });
  68. } else {
  69. obj[key] = value;
  70. }
  71. return obj;
  72. }
  73. module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
  74. /***/ }),
  75. /***/ 116:
  76. /*!************************************************!*\
  77. !*** E:/work/mdapp/js_sdk/xb-copy/uni-copy.js ***!
  78. \************************************************/
  79. /*! no static exports found */
  80. /***/ (function(module, exports, __webpack_require__) {
  81. "use strict";
  82. /* WEBPACK VAR INJECTION */(function(uni) {
  83. Object.defineProperty(exports, "__esModule", {
  84. value: true
  85. });
  86. exports.default = uniCopy;
  87. function uniCopy(_ref) {
  88. var content = _ref.content,
  89. _success = _ref.success,
  90. error = _ref.error;
  91. if (!content) return error('复制的内容不能为空 !');
  92. content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  93. /**
  94. * 小程序端 和 app端的复制逻辑
  95. */
  96. uni.setClipboardData({
  97. data: content,
  98. success: function success() {
  99. _success("复制成功~");
  100. console.log('success');
  101. },
  102. fail: function fail() {
  103. _success("复制失败~");
  104. }
  105. });
  106. /**
  107. * H5端的复制逻辑
  108. */
  109. }
  110. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  111. /***/ }),
  112. /***/ 12:
  113. /*!**************************************************************!*\
  114. !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
  115. \**************************************************************/
  116. /*! no static exports found */
  117. /***/ (function(module, exports, __webpack_require__) {
  118. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  119. var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ 14);
  120. function _toPropertyKey(arg) {
  121. var key = toPrimitive(arg, "string");
  122. return _typeof(key) === "symbol" ? key : String(key);
  123. }
  124. module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
  125. /***/ }),
  126. /***/ 13:
  127. /*!*******************************************************!*\
  128. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  129. \*******************************************************/
  130. /*! no static exports found */
  131. /***/ (function(module, exports) {
  132. function _typeof(obj) {
  133. "@babel/helpers - typeof";
  134. return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  135. return typeof obj;
  136. } : function (obj) {
  137. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  138. }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
  139. }
  140. module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
  141. /***/ }),
  142. /***/ 14:
  143. /*!************************************************************!*\
  144. !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!
  145. \************************************************************/
  146. /*! no static exports found */
  147. /***/ (function(module, exports, __webpack_require__) {
  148. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  149. function _toPrimitive(input, hint) {
  150. if (_typeof(input) !== "object" || input === null) return input;
  151. var prim = input[Symbol.toPrimitive];
  152. if (prim !== undefined) {
  153. var res = prim.call(input, hint || "default");
  154. if (_typeof(res) !== "object") return res;
  155. throw new TypeError("@@toPrimitive must return a primitive value.");
  156. }
  157. return (hint === "string" ? String : Number)(input);
  158. }
  159. module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
  160. /***/ }),
  161. /***/ 15:
  162. /*!**********************************************************!*\
  163. !*** ./node_modules/@babel/runtime/helpers/construct.js ***!
  164. \**********************************************************/
  165. /*! no static exports found */
  166. /***/ (function(module, exports, __webpack_require__) {
  167. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  168. var isNativeReflectConstruct = __webpack_require__(/*! ./isNativeReflectConstruct.js */ 17);
  169. function _construct(Parent, args, Class) {
  170. if (isNativeReflectConstruct()) {
  171. module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports;
  172. } else {
  173. module.exports = _construct = function _construct(Parent, args, Class) {
  174. var a = [null];
  175. a.push.apply(a, args);
  176. var Constructor = Function.bind.apply(Parent, a);
  177. var instance = new Constructor();
  178. if (Class) setPrototypeOf(instance, Class.prototype);
  179. return instance;
  180. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  181. }
  182. return _construct.apply(null, arguments);
  183. }
  184. module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  185. /***/ }),
  186. /***/ 16:
  187. /*!***************************************************************!*\
  188. !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
  189. \***************************************************************/
  190. /*! no static exports found */
  191. /***/ (function(module, exports) {
  192. function _setPrototypeOf(o, p) {
  193. module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  194. o.__proto__ = p;
  195. return o;
  196. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  197. return _setPrototypeOf(o, p);
  198. }
  199. module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  200. /***/ }),
  201. /***/ 17:
  202. /*!*************************************************************************!*\
  203. !*** ./node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js ***!
  204. \*************************************************************************/
  205. /*! no static exports found */
  206. /***/ (function(module, exports) {
  207. function _isNativeReflectConstruct() {
  208. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  209. if (Reflect.construct.sham) return false;
  210. if (typeof Proxy === "function") return true;
  211. try {
  212. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
  213. return true;
  214. } catch (e) {
  215. return false;
  216. }
  217. }
  218. module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports;
  219. /***/ }),
  220. /***/ 173:
  221. /*!*************************************!*\
  222. !*** E:/work/mdapp/utils/qrcode.js ***!
  223. \*************************************/
  224. /*! no static exports found */
  225. /***/ (function(module, exports, __webpack_require__) {
  226. "use strict";
  227. /* WEBPACK VAR INJECTION */(function(uni) {
  228. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  229. Object.defineProperty(exports, "__esModule", {
  230. value: true
  231. });
  232. exports.default = void 0;
  233. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  234. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  235. /**
  236. * qrcode-wx-miniprogram
  237. */
  238. var QRMode = {
  239. MODE_NUMBER: 1 << 0,
  240. MODE_ALPHA_NUM: 1 << 1,
  241. MODE_8BIT_BYTE: 1 << 2,
  242. MODE_KANJI: 1 << 3
  243. },
  244. QRErrorCorrectLevel = {
  245. L: 1,
  246. M: 0,
  247. Q: 3,
  248. H: 2
  249. },
  250. QRMaskPattern = {
  251. PATTERN000: 0,
  252. PATTERN001: 1,
  253. PATTERN010: 2,
  254. PATTERN011: 3,
  255. PATTERN100: 4,
  256. PATTERN101: 5,
  257. PATTERN110: 6,
  258. PATTERN111: 7
  259. },
  260. QRUtil = {
  261. PATTERN_POSITION_TABLE: [[], [6, 18], [6, 22], [6, 26], [6, 30], [6, 34], [6, 22, 38], [6, 24, 42], [6, 26, 46], [6, 28, 50], [6, 30, 54], [6, 32, 58], [6, 34, 62], [6, 26, 46, 66], [6, 26, 48, 70], [6, 26, 50, 74], [6, 30, 54, 78], [6, 30, 56, 82], [6, 30, 58, 86], [6, 34, 62, 90], [6, 28, 50, 72, 94], [6, 26, 50, 74, 98], [6, 30, 54, 78, 102], [6, 28, 54, 80, 106], [6, 32, 58, 84, 110], [6, 30, 58, 86, 114], [6, 34, 62, 90, 118], [6, 26, 50, 74, 98, 122], [6, 30, 54, 78, 102, 126], [6, 26, 52, 78, 104, 130], [6, 30, 56, 82, 108, 134], [6, 34, 60, 86, 112, 138], [6, 30, 58, 86, 114, 142], [6, 34, 62, 90, 118, 146], [6, 30, 54, 78, 102, 126, 150], [6, 24, 50, 76, 102, 128, 154], [6, 28, 54, 80, 106, 132, 158], [6, 32, 58, 84, 110, 136, 162], [6, 26, 54, 82, 110, 138, 166], [6, 30, 58, 86, 114, 142, 170]],
  262. G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
  263. G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
  264. G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
  265. getBCHTypeInfo: function getBCHTypeInfo(data) {
  266. var d = data << 10;
  267. while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
  268. d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
  269. }
  270. return (data << 10 | d) ^ QRUtil.G15_MASK;
  271. },
  272. getBCHTypeNumber: function getBCHTypeNumber(data) {
  273. var d = data << 12;
  274. while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
  275. d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
  276. }
  277. return data << 12 | d;
  278. },
  279. getBCHDigit: function getBCHDigit(data) {
  280. var digit = 0;
  281. while (data != 0) {
  282. digit++;
  283. data >>>= 1;
  284. }
  285. return digit;
  286. },
  287. getPatternPosition: function getPatternPosition(typeNumber) {
  288. return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
  289. },
  290. getMask: function getMask(maskPattern, i, j) {
  291. switch (maskPattern) {
  292. case QRMaskPattern.PATTERN000:
  293. return (i + j) % 2 == 0;
  294. case QRMaskPattern.PATTERN001:
  295. return i % 2 == 0;
  296. case QRMaskPattern.PATTERN010:
  297. return j % 3 == 0;
  298. case QRMaskPattern.PATTERN011:
  299. return (i + j) % 3 == 0;
  300. case QRMaskPattern.PATTERN100:
  301. return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
  302. case QRMaskPattern.PATTERN101:
  303. return i * j % 2 + i * j % 3 == 0;
  304. case QRMaskPattern.PATTERN110:
  305. return (i * j % 2 + i * j % 3) % 2 == 0;
  306. case QRMaskPattern.PATTERN111:
  307. return (i * j % 3 + (i + j) % 2) % 2 == 0;
  308. default:
  309. //throw new Error("bad maskPattern:" + maskPattern);
  310. throwError("bad maskPattern:" + maskPattern);
  311. }
  312. },
  313. getErrorCorrectPolynomial: function getErrorCorrectPolynomial(errorCorrectLength) {
  314. var a = new QRPolynomial([1], 0);
  315. for (var i = 0; i < errorCorrectLength; i++) {
  316. a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
  317. }
  318. return a;
  319. },
  320. getLengthInBits: function getLengthInBits(mode, type) {
  321. if (1 <= type && type < 10) {
  322. switch (mode) {
  323. case QRMode.MODE_NUMBER:
  324. return 10;
  325. case QRMode.MODE_ALPHA_NUM:
  326. return 9;
  327. case QRMode.MODE_8BIT_BYTE:
  328. return 8;
  329. case QRMode.MODE_KANJI:
  330. return 8;
  331. default:
  332. //throw new Error("mode:" + mode);
  333. throwError("mode:" + mode);
  334. }
  335. } else if (type < 27) {
  336. switch (mode) {
  337. case QRMode.MODE_NUMBER:
  338. return 12;
  339. case QRMode.MODE_ALPHA_NUM:
  340. return 11;
  341. case QRMode.MODE_8BIT_BYTE:
  342. return 16;
  343. case QRMode.MODE_KANJI:
  344. return 10;
  345. default:
  346. //throw new Error("mode:" + mode);
  347. throwError("mode:" + mode);
  348. }
  349. } else if (type < 41) {
  350. switch (mode) {
  351. case QRMode.MODE_NUMBER:
  352. return 14;
  353. case QRMode.MODE_ALPHA_NUM:
  354. return 13;
  355. case QRMode.MODE_8BIT_BYTE:
  356. return 16;
  357. case QRMode.MODE_KANJI:
  358. return 12;
  359. default:
  360. //throw new Error("mode:" + mode);
  361. throwError("mode:" + mode);
  362. }
  363. } else {
  364. //throw new Error("type:" + type);
  365. throwError("type:" + type);
  366. }
  367. },
  368. getLostPoint: function getLostPoint(qrCode) {
  369. var moduleCount = qrCode.getModuleCount();
  370. var lostPoint = 0;
  371. for (var row = 0; row < moduleCount; row++) {
  372. for (var col = 0; col < moduleCount; col++) {
  373. var sameCount = 0;
  374. var dark = qrCode.isDark(row, col);
  375. for (var r = -1; r <= 1; r++) {
  376. if (row + r < 0 || moduleCount <= row + r) {
  377. continue;
  378. }
  379. for (var c = -1; c <= 1; c++) {
  380. if (col + c < 0 || moduleCount <= col + c) {
  381. continue;
  382. }
  383. if (r == 0 && c == 0) {
  384. continue;
  385. }
  386. if (dark == qrCode.isDark(row + r, col + c)) {
  387. sameCount++;
  388. }
  389. }
  390. }
  391. if (sameCount > 5) {
  392. lostPoint += 3 + sameCount - 5;
  393. }
  394. }
  395. }
  396. for (var row = 0; row < moduleCount - 1; row++) {
  397. for (var col = 0; col < moduleCount - 1; col++) {
  398. var count = 0;
  399. if (qrCode.isDark(row, col)) count++;
  400. if (qrCode.isDark(row + 1, col)) count++;
  401. if (qrCode.isDark(row, col + 1)) count++;
  402. if (qrCode.isDark(row + 1, col + 1)) count++;
  403. if (count == 0 || count == 4) {
  404. lostPoint += 3;
  405. }
  406. }
  407. }
  408. for (var row = 0; row < moduleCount; row++) {
  409. for (var col = 0; col < moduleCount - 6; col++) {
  410. if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
  411. lostPoint += 40;
  412. }
  413. }
  414. }
  415. for (var col = 0; col < moduleCount; col++) {
  416. for (var row = 0; row < moduleCount - 6; row++) {
  417. if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
  418. lostPoint += 40;
  419. }
  420. }
  421. }
  422. var darkCount = 0;
  423. for (var col = 0; col < moduleCount; col++) {
  424. for (var row = 0; row < moduleCount; row++) {
  425. if (qrCode.isDark(row, col)) {
  426. darkCount++;
  427. }
  428. }
  429. }
  430. var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
  431. lostPoint += ratio * 10;
  432. return lostPoint;
  433. }
  434. },
  435. QRMath = {
  436. glog: function glog(n) {
  437. if (n < 1) {
  438. //throw new Error("glog(" + n + ")");
  439. throwError("glog(" + n + ")");
  440. }
  441. return QRMath.LOG_TABLE[n];
  442. },
  443. gexp: function gexp(n) {
  444. while (n < 0) {
  445. n += 255;
  446. }
  447. while (n >= 256) {
  448. n -= 255;
  449. }
  450. return QRMath.EXP_TABLE[n];
  451. },
  452. EXP_TABLE: new Array(256),
  453. LOG_TABLE: new Array(256)
  454. };
  455. for (var i = 0; i < 8; i++) {
  456. QRMath.EXP_TABLE[i] = 1 << i;
  457. }
  458. for (var _i = 8; _i < 256; _i++) {
  459. QRMath.EXP_TABLE[_i] = QRMath.EXP_TABLE[_i - 4] ^ QRMath.EXP_TABLE[_i - 5] ^ QRMath.EXP_TABLE[_i - 6] ^ QRMath.EXP_TABLE[_i - 8];
  460. }
  461. for (var _i2 = 0; _i2 < 255; _i2++) {
  462. QRMath.LOG_TABLE[QRMath.EXP_TABLE[_i2]] = _i2;
  463. }
  464. /*
  465. * class QR8bitByte
  466. * */
  467. var QR8bitByte = /*#__PURE__*/function () {
  468. function QR8bitByte(data) {
  469. (0, _classCallCheck2.default)(this, QR8bitByte);
  470. this.mode = QRMode.MODE_8BIT_BYTE;
  471. this.data = data;
  472. this.parsedData = [];
  473. // Added to support UTF-8 Characters
  474. for (var _i3 = 0, l = this.data.length; _i3 < l; _i3++) {
  475. var byteArray = [],
  476. code = this.data.charCodeAt(_i3);
  477. if (code > 0x10000) {
  478. byteArray[0] = 0xF0 | (code & 0x1C0000) >>> 18;
  479. byteArray[1] = 0x80 | (code & 0x3F000) >>> 12;
  480. byteArray[2] = 0x80 | (code & 0xFC0) >>> 6;
  481. byteArray[3] = 0x80 | code & 0x3F;
  482. } else if (code > 0x800) {
  483. byteArray[0] = 0xE0 | (code & 0xF000) >>> 12;
  484. byteArray[1] = 0x80 | (code & 0xFC0) >>> 6;
  485. byteArray[2] = 0x80 | code & 0x3F;
  486. } else if (code > 0x80) {
  487. byteArray[0] = 0xC0 | (code & 0x7C0) >>> 6;
  488. byteArray[1] = 0x80 | code & 0x3F;
  489. } else {
  490. byteArray[0] = code;
  491. }
  492. this.parsedData.push(byteArray);
  493. }
  494. this.parsedData = Array.prototype.concat.apply([], this.parsedData);
  495. if (this.parsedData.length !== this.data.length) {
  496. this.parsedData.unshift(191);
  497. this.parsedData.unshift(187);
  498. this.parsedData.unshift(239);
  499. }
  500. }
  501. (0, _createClass2.default)(QR8bitByte, [{
  502. key: "getLength",
  503. value: function getLength(buffer) {
  504. return this.parsedData.length;
  505. }
  506. }, {
  507. key: "write",
  508. value: function write(buffer) {
  509. for (var _i4 = 0, l = this.parsedData.length; _i4 < l; _i4++) {
  510. buffer.put(this.parsedData[_i4], 8);
  511. }
  512. }
  513. }]);
  514. return QR8bitByte;
  515. }();
  516. /*
  517. * class QRCodeModel
  518. * */
  519. var QRCodeModel = /*#__PURE__*/function () {
  520. function QRCodeModel(typeNumber, errorCorrectLevel) {
  521. (0, _classCallCheck2.default)(this, QRCodeModel);
  522. this.typeNumber = typeNumber;
  523. this.errorCorrectLevel = errorCorrectLevel;
  524. this.modules = null;
  525. this.moduleCount = 0;
  526. this.dataCache = null;
  527. this.dataList = [];
  528. }
  529. (0, _createClass2.default)(QRCodeModel, [{
  530. key: "addData",
  531. value: function addData(data) {
  532. var newData = new QR8bitByte(data);
  533. this.dataList.push(newData);
  534. this.dataCache = null;
  535. }
  536. }, {
  537. key: "isDark",
  538. value: function isDark(row, col) {
  539. if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
  540. //throw new Error(row + ',' + col);
  541. throwError(row + ',' + col);
  542. }
  543. return this.modules[row][col];
  544. }
  545. }, {
  546. key: "getModuleCount",
  547. value: function getModuleCount() {
  548. return this.moduleCount;
  549. }
  550. }, {
  551. key: "make",
  552. value: function make() {
  553. this.makeImpl(false, this.getBestMaskPattern());
  554. }
  555. }, {
  556. key: "makeImpl",
  557. value: function makeImpl(test, maskPattern) {
  558. this.moduleCount = this.typeNumber * 4 + 17;
  559. this.modules = new Array(this.moduleCount);
  560. for (var row = 0; row < this.moduleCount; row++) {
  561. this.modules[row] = new Array(this.moduleCount);
  562. for (var col = 0; col < this.moduleCount; col++) {
  563. this.modules[row][col] = null;
  564. }
  565. }
  566. this.setupPositionProbePattern(0, 0);
  567. this.setupPositionProbePattern(this.moduleCount - 7, 0);
  568. this.setupPositionProbePattern(0, this.moduleCount - 7);
  569. this.setupPositionAdjustPattern();
  570. this.setupTimingPattern();
  571. this.setupTypeInfo(test, maskPattern);
  572. if (this.typeNumber >= 7) {
  573. this.setupTypeNumber(test);
  574. }
  575. if (this.dataCache == null) {
  576. this.dataCache = QRCodeModel.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
  577. }
  578. this.mapData(this.dataCache, maskPattern);
  579. }
  580. }, {
  581. key: "setupPositionProbePattern",
  582. value: function setupPositionProbePattern(row, col) {
  583. for (var r = -1; r <= 7; r++) {
  584. if (row + r <= -1 || this.moduleCount <= row + r) {
  585. continue;
  586. }
  587. for (var c = -1; c <= 7; c++) {
  588. if (col + c <= -1 || this.moduleCount <= col + c) {
  589. continue;
  590. }
  591. this.modules[row + r][col + c] = 0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4;
  592. }
  593. }
  594. }
  595. }, {
  596. key: "getBestMaskPattern",
  597. value: function getBestMaskPattern() {
  598. var minLostPoint = 0,
  599. pattern = 0;
  600. for (var _i5 = 0; _i5 < 8; _i5++) {
  601. this.makeImpl(true, _i5);
  602. var lostPoint = QRUtil.getLostPoint(this);
  603. if (_i5 == 0 || minLostPoint > lostPoint) {
  604. minLostPoint = lostPoint;
  605. pattern = _i5;
  606. }
  607. }
  608. return pattern;
  609. }
  610. }, {
  611. key: "setupTimingPattern",
  612. value: function setupTimingPattern() {
  613. for (var r = 8; r < this.moduleCount - 8; r++) {
  614. if (this.modules[r][6] != null) {
  615. continue;
  616. }
  617. this.modules[r][6] = r % 2 == 0;
  618. }
  619. for (var c = 8; c < this.moduleCount - 8; c++) {
  620. if (this.modules[6][c] != null) {
  621. continue;
  622. }
  623. this.modules[6][c] = c % 2 == 0;
  624. }
  625. }
  626. }, {
  627. key: "setupPositionAdjustPattern",
  628. value: function setupPositionAdjustPattern() {
  629. var pos = QRUtil.getPatternPosition(this.typeNumber);
  630. for (var _i6 = 0; _i6 < pos.length; _i6++) {
  631. for (var j = 0; j < pos.length; j++) {
  632. var row = pos[_i6],
  633. col = pos[j];
  634. if (this.modules[row][col] != null) {
  635. continue;
  636. }
  637. for (var r = -2; r <= 2; r++) {
  638. for (var c = -2; c <= 2; c++) {
  639. this.modules[row + r][col + c] = r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0;
  640. }
  641. }
  642. }
  643. }
  644. }
  645. }, {
  646. key: "setupTypeNumber",
  647. value: function setupTypeNumber(test) {
  648. var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
  649. for (var _i7 = 0; _i7 < 18; _i7++) {
  650. this.modules[Math.floor(_i7 / 3)][_i7 % 3 + this.moduleCount - 8 - 3] = !test && (bits >> _i7 & 1) == 1;
  651. }
  652. for (var _i8 = 0; _i8 < 18; _i8++) {
  653. this.modules[_i8 % 3 + this.moduleCount - 8 - 3][Math.floor(_i8 / 3)] = !test && (bits >> _i8 & 1) == 1;
  654. }
  655. }
  656. }, {
  657. key: "setupTypeInfo",
  658. value: function setupTypeInfo(test, maskPattern) {
  659. var data = this.errorCorrectLevel << 3 | maskPattern,
  660. bits = QRUtil.getBCHTypeInfo(data);
  661. for (var _i9 = 0; _i9 < 15; _i9++) {
  662. var mod = !test && (bits >> _i9 & 1) == 1;
  663. if (_i9 < 6) {
  664. this.modules[_i9][8] = mod;
  665. } else if (_i9 < 8) {
  666. this.modules[_i9 + 1][8] = mod;
  667. } else {
  668. this.modules[this.moduleCount - 15 + _i9][8] = mod;
  669. }
  670. }
  671. for (var _i10 = 0; _i10 < 15; _i10++) {
  672. var _mod = !test && (bits >> _i10 & 1) == 1;
  673. if (_i10 < 8) {
  674. this.modules[8][this.moduleCount - _i10 - 1] = _mod;
  675. } else if (_i10 < 9) {
  676. this.modules[8][15 - _i10 - 1 + 1] = _mod;
  677. } else {
  678. this.modules[8][15 - _i10 - 1] = _mod;
  679. }
  680. }
  681. this.modules[this.moduleCount - 8][8] = !test;
  682. }
  683. }, {
  684. key: "mapData",
  685. value: function mapData(data, maskPattern) {
  686. var inc = -1,
  687. row = this.moduleCount - 1,
  688. bitIndex = 7,
  689. byteIndex = 0;
  690. for (var col = this.moduleCount - 1; col > 0; col -= 2) {
  691. if (col == 6) col--;
  692. while (true) {
  693. for (var c = 0; c < 2; c++) {
  694. if (this.modules[row][col - c] == null) {
  695. var dark = false;
  696. if (byteIndex < data.length) {
  697. dark = (data[byteIndex] >>> bitIndex & 1) == 1;
  698. }
  699. var mask = QRUtil.getMask(maskPattern, row, col - c);
  700. if (mask) {
  701. dark = !dark;
  702. }
  703. this.modules[row][col - c] = dark;
  704. bitIndex--;
  705. if (bitIndex == -1) {
  706. byteIndex++;
  707. bitIndex = 7;
  708. }
  709. }
  710. }
  711. row += inc;
  712. if (row < 0 || this.moduleCount <= row) {
  713. row -= inc;
  714. inc = -inc;
  715. break;
  716. }
  717. }
  718. }
  719. }
  720. }]);
  721. return QRCodeModel;
  722. }();
  723. QRCodeModel.PAD0 = 0xEC;
  724. QRCodeModel.PAD1 = 0x11;
  725. QRCodeModel.createData = function (typeNumber, errorCorrectLevel, dataList) {
  726. var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel),
  727. buffer = new QRBitBuffer();
  728. for (var _i11 = 0; _i11 < dataList.length; _i11++) {
  729. var data = dataList[_i11];
  730. buffer.put(data.mode, 4);
  731. buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
  732. data.write(buffer);
  733. }
  734. var totalDataCount = 0;
  735. for (var _i12 = 0; _i12 < rsBlocks.length; _i12++) {
  736. totalDataCount += rsBlocks[_i12].dataCount;
  737. }
  738. if (buffer.getLengthInBits() > totalDataCount * 8) {
  739. /*
  740. throw new Error("code length overflow. (" +
  741. buffer.getLengthInBits() +
  742. ">" +
  743. totalDataCount * 8 +
  744. ")");
  745. */
  746. throwError("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
  747. }
  748. if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
  749. buffer.put(0, 4);
  750. }
  751. while (buffer.getLengthInBits() % 8 != 0) {
  752. buffer.putBit(false);
  753. }
  754. while (true) {
  755. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  756. break;
  757. }
  758. buffer.put(QRCodeModel.PAD0, 8);
  759. if (buffer.getLengthInBits() >= totalDataCount * 8) {
  760. break;
  761. }
  762. buffer.put(QRCodeModel.PAD1, 8);
  763. }
  764. return QRCodeModel.createBytes(buffer, rsBlocks);
  765. };
  766. QRCodeModel.createBytes = function (buffer, rsBlocks) {
  767. var offset = 0,
  768. maxDcCount = 0,
  769. maxEcCount = 0,
  770. dcData = new Array(rsBlocks.length),
  771. ecData = new Array(rsBlocks.length);
  772. for (var r = 0; r < rsBlocks.length; r++) {
  773. var dcCount = rsBlocks[r].dataCount,
  774. ecCount = rsBlocks[r].totalCount - dcCount;
  775. maxDcCount = Math.max(maxDcCount, dcCount);
  776. maxEcCount = Math.max(maxEcCount, ecCount);
  777. dcData[r] = new Array(dcCount);
  778. for (var _i13 = 0; _i13 < dcData[r].length; _i13++) {
  779. dcData[r][_i13] = 0xff & buffer.buffer[_i13 + offset];
  780. }
  781. offset += dcCount;
  782. var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount),
  783. rawPoly = new QRPolynomial(dcData[r], rsPoly.getLength() - 1),
  784. modPoly = rawPoly.mod(rsPoly);
  785. ecData[r] = new Array(rsPoly.getLength() - 1);
  786. for (var _i14 = 0; _i14 < ecData[r].length; _i14++) {
  787. var modIndex = _i14 + modPoly.getLength() - ecData[r].length;
  788. ecData[r][_i14] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
  789. }
  790. }
  791. var totalCodeCount = 0;
  792. for (var _i15 = 0; _i15 < rsBlocks.length; _i15++) {
  793. totalCodeCount += rsBlocks[_i15].totalCount;
  794. }
  795. var data = new Array(totalCodeCount),
  796. index = 0;
  797. for (var _i16 = 0; _i16 < maxDcCount; _i16++) {
  798. for (var _r = 0; _r < rsBlocks.length; _r++) {
  799. if (_i16 < dcData[_r].length) {
  800. data[index++] = dcData[_r][_i16];
  801. }
  802. }
  803. }
  804. for (var _i17 = 0; _i17 < maxEcCount; _i17++) {
  805. for (var _r2 = 0; _r2 < rsBlocks.length; _r2++) {
  806. if (_i17 < ecData[_r2].length) {
  807. data[index++] = ecData[_r2][_i17];
  808. }
  809. }
  810. }
  811. return data;
  812. };
  813. /*
  814. * class QRPolynomial
  815. * */
  816. var QRPolynomial = /*#__PURE__*/function () {
  817. function QRPolynomial(num, shift) {
  818. (0, _classCallCheck2.default)(this, QRPolynomial);
  819. if (num.length == undefined) {
  820. //throw new Error(num.length + '/' + shift);
  821. throwError(num.length + '/' + shift);
  822. }
  823. var offset = 0;
  824. while (offset < num.length && num[offset] == 0) {
  825. offset++;
  826. }
  827. this.num = new Array(num.length - offset + shift);
  828. for (var _i18 = 0; _i18 < num.length - offset; _i18++) {
  829. this.num[_i18] = num[_i18 + offset];
  830. }
  831. }
  832. (0, _createClass2.default)(QRPolynomial, [{
  833. key: "get",
  834. value: function get(index) {
  835. return this.num[index];
  836. }
  837. }, {
  838. key: "getLength",
  839. value: function getLength() {
  840. return this.num.length;
  841. }
  842. }, {
  843. key: "multiply",
  844. value: function multiply(e) {
  845. var num = new Array(this.getLength() + e.getLength() - 1);
  846. for (var _i19 = 0; _i19 < this.getLength(); _i19++) {
  847. for (var j = 0; j < e.getLength(); j++) {
  848. num[_i19 + j] ^= QRMath.gexp(QRMath.glog(this.get(_i19)) + QRMath.glog(e.get(j)));
  849. }
  850. }
  851. return new QRPolynomial(num, 0);
  852. }
  853. }, {
  854. key: "mod",
  855. value: function mod(e) {
  856. if (this.getLength() - e.getLength() < 0) {
  857. return this;
  858. }
  859. var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0)),
  860. num = new Array(this.getLength());
  861. for (var _i20 = 0; _i20 < this.getLength(); _i20++) {
  862. num[_i20] = this.get(_i20);
  863. }
  864. for (var _i21 = 0; _i21 < e.getLength(); _i21++) {
  865. num[_i21] ^= QRMath.gexp(QRMath.glog(e.get(_i21)) + ratio);
  866. }
  867. return new QRPolynomial(num, 0).mod(e);
  868. }
  869. }]);
  870. return QRPolynomial;
  871. }();
  872. /*
  873. * class QRRSBlock
  874. * */
  875. var QRRSBlock = /*#__PURE__*/(0, _createClass2.default)(function QRRSBlock(totalCount, dataCount) {
  876. (0, _classCallCheck2.default)(this, QRRSBlock);
  877. this.totalCount = totalCount;
  878. this.dataCount = dataCount;
  879. });
  880. QRRSBlock.RS_BLOCK_TABLE = [[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9], [1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16], [1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13], [1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9], [1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12], [2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15], [2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14], [2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15], [2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13], [2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16], [4, 101, 81], [1, 80, 50, 4, 81, 51], [4, 50, 22, 4, 51, 23], [3, 36, 12, 8, 37, 13], [2, 116, 92, 2, 117, 93], [6, 58, 36, 2, 59, 37], [4, 46, 20, 6, 47, 21], [7, 42, 14, 4, 43, 15], [4, 133, 107], [8, 59, 37, 1, 60, 38], [8, 44, 20, 4, 45, 21], [12, 33, 11, 4, 34, 12], [3, 145, 115, 1, 146, 116], [4, 64, 40, 5, 65, 41], [11, 36, 16, 5, 37, 17], [11, 36, 12, 5, 37, 13], [5, 109, 87, 1, 110, 88], [5, 65, 41, 5, 66, 42], [5, 54, 24, 7, 55, 25], [11, 36, 12], [5, 122, 98, 1, 123, 99], [7, 73, 45, 3, 74, 46], [15, 43, 19, 2, 44, 20], [3, 45, 15, 13, 46, 16], [1, 135, 107, 5, 136, 108], [10, 74, 46, 1, 75, 47], [1, 50, 22, 15, 51, 23], [2, 42, 14, 17, 43, 15], [5, 150, 120, 1, 151, 121], [9, 69, 43, 4, 70, 44], [17, 50, 22, 1, 51, 23], [2, 42, 14, 19, 43, 15], [3, 141, 113, 4, 142, 114], [3, 70, 44, 11, 71, 45], [17, 47, 21, 4, 48, 22], [9, 39, 13, 16, 40, 14], [3, 135, 107, 5, 136, 108], [3, 67, 41, 13, 68, 42], [15, 54, 24, 5, 55, 25], [15, 43, 15, 10, 44, 16], [4, 144, 116, 4, 145, 117], [17, 68, 42], [17, 50, 22, 6, 51, 23], [19, 46, 16, 6, 47, 17], [2, 139, 111, 7, 140, 112], [17, 74, 46], [7, 54, 24, 16, 55, 25], [34, 37, 13], [4, 151, 121, 5, 152, 122], [4, 75, 47, 14, 76, 48], [11, 54, 24, 14, 55, 25], [16, 45, 15, 14, 46, 16], [6, 147, 117, 4, 148, 118], [6, 73, 45, 14, 74, 46], [11, 54, 24, 16, 55, 25], [30, 46, 16, 2, 47, 17], [8, 132, 106, 4, 133, 107], [8, 75, 47, 13, 76, 48], [7, 54, 24, 22, 55, 25], [22, 45, 15, 13, 46, 16], [10, 142, 114, 2, 143, 115], [19, 74, 46, 4, 75, 47], [28, 50, 22, 6, 51, 23], [33, 46, 16, 4, 47, 17], [8, 152, 122, 4, 153, 123], [22, 73, 45, 3, 74, 46], [8, 53, 23, 26, 54, 24], [12, 45, 15, 28, 46, 16], [3, 147, 117, 10, 148, 118], [3, 73, 45, 23, 74, 46], [4, 54, 24, 31, 55, 25], [11, 45, 15, 31, 46, 16], [7, 146, 116, 7, 147, 117], [21, 73, 45, 7, 74, 46], [1, 53, 23, 37, 54, 24], [19, 45, 15, 26, 46, 16], [5, 145, 115, 10, 146, 116], [19, 75, 47, 10, 76, 48], [15, 54, 24, 25, 55, 25], [23, 45, 15, 25, 46, 16], [13, 145, 115, 3, 146, 116], [2, 74, 46, 29, 75, 47], [42, 54, 24, 1, 55, 25], [23, 45, 15, 28, 46, 16], [17, 145, 115], [10, 74, 46, 23, 75, 47], [10, 54, 24, 35, 55, 25], [19, 45, 15, 35, 46, 16], [17, 145, 115, 1, 146, 116], [14, 74, 46, 21, 75, 47], [29, 54, 24, 19, 55, 25], [11, 45, 15, 46, 46, 16], [13, 145, 115, 6, 146, 116], [14, 74, 46, 23, 75, 47], [44, 54, 24, 7, 55, 25], [59, 46, 16, 1, 47, 17], [12, 151, 121, 7, 152, 122], [12, 75, 47, 26, 76, 48], [39, 54, 24, 14, 55, 25], [22, 45, 15, 41, 46, 16], [6, 151, 121, 14, 152, 122], [6, 75, 47, 34, 76, 48], [46, 54, 24, 10, 55, 25], [2, 45, 15, 64, 46, 16], [17, 152, 122, 4, 153, 123], [29, 74, 46, 14, 75, 47], [49, 54, 24, 10, 55, 25], [24, 45, 15, 46, 46, 16], [4, 152, 122, 18, 153, 123], [13, 74, 46, 32, 75, 47], [48, 54, 24, 14, 55, 25], [42, 45, 15, 32, 46, 16], [20, 147, 117, 4, 148, 118], [40, 75, 47, 7, 76, 48], [43, 54, 24, 22, 55, 25], [10, 45, 15, 67, 46, 16], [19, 148, 118, 6, 149, 119], [18, 75, 47, 31, 76, 48], [34, 54, 24, 34, 55, 25], [20, 45, 15, 61, 46, 16]];
  881. QRRSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
  882. var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
  883. if (!rsBlock) {
  884. //throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
  885. throwError("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
  886. }
  887. var length = rsBlock.length / 3,
  888. list = [];
  889. for (var _i22 = 0; _i22 < length; _i22++) {
  890. var count = rsBlock[_i22 * 3],
  891. totalCount = rsBlock[_i22 * 3 + 1],
  892. dataCount = rsBlock[_i22 * 3 + 2];
  893. for (var j = 0; j < count; j++) {
  894. list.push(new QRRSBlock(totalCount, dataCount));
  895. }
  896. }
  897. return list;
  898. };
  899. QRRSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) {
  900. switch (errorCorrectLevel) {
  901. case QRErrorCorrectLevel.L:
  902. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4];
  903. case QRErrorCorrectLevel.M:
  904. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
  905. case QRErrorCorrectLevel.Q:
  906. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
  907. case QRErrorCorrectLevel.H:
  908. return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
  909. default:
  910. return undefined;
  911. }
  912. };
  913. /*
  914. * class QRBitBuffer
  915. * */
  916. var QRBitBuffer = /*#__PURE__*/function () {
  917. function QRBitBuffer() {
  918. (0, _classCallCheck2.default)(this, QRBitBuffer);
  919. this.buffer = [];
  920. this.length = 0;
  921. }
  922. (0, _createClass2.default)(QRBitBuffer, [{
  923. key: "get",
  924. value: function get(index) {
  925. var bufIndex = Math.floor(index / 8);
  926. return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
  927. }
  928. }, {
  929. key: "put",
  930. value: function put(num, length) {
  931. for (var _i23 = 0; _i23 < length; _i23++) {
  932. this.putBit((num >>> length - _i23 - 1 & 1) == 1);
  933. }
  934. }
  935. }, {
  936. key: "getLengthInBits",
  937. value: function getLengthInBits() {
  938. return this.length;
  939. }
  940. }, {
  941. key: "putBit",
  942. value: function putBit(bit) {
  943. var bufIndex = Math.floor(this.length / 8);
  944. if (this.buffer.length <= bufIndex) {
  945. this.buffer.push(0);
  946. }
  947. if (bit) {
  948. this.buffer[bufIndex] |= 0x80 >>> this.length % 8;
  949. }
  950. this.length++;
  951. }
  952. }]);
  953. return QRBitBuffer;
  954. }();
  955. /*
  956. * Class Drawing
  957. * */
  958. var Drawing = /*#__PURE__*/function () {
  959. function Drawing(el, opts) {
  960. (0, _classCallCheck2.default)(this, Drawing);
  961. this._opts = opts;
  962. this._el = el;
  963. this._ctx = uni.createCanvasContext(el);
  964. }
  965. (0, _createClass2.default)(Drawing, [{
  966. key: "draw",
  967. value: function draw(QRCode) {
  968. var ctx = this._ctx,
  969. opts = this._opts;
  970. var ctxPosFix = opts.width / 20;
  971. //console.log(opts.width)
  972. var count = QRCode.getModuleCount(),
  973. width = (opts.width - 2 * ctxPosFix) / count,
  974. height = (opts.height - 2 * ctxPosFix) / count,
  975. roundedWidth = Math.round(width),
  976. roundedHeight = Math.round(height);
  977. this.clear();
  978. ctx.setFillStyle('#fff');
  979. ctx.fillRect(0, 0, this._opts.width + 4 * ctxPosFix, this._opts.width + 4 * ctxPosFix);
  980. for (var row = 0; row < count; row++) {
  981. for (var col = 0; col < count; col++) {
  982. var isDark = QRCode.isDark(row, col),
  983. left = col * width + ctxPosFix,
  984. top = row * height + ctxPosFix;
  985. ctx.setStrokeStyle(isDark ? opts.colorDark : opts.colorLight);
  986. ctx.setLineWidth(1);
  987. ctx.setFillStyle(isDark ? opts.colorDark : opts.colorLight);
  988. ctx.fillRect(left, top, width, height);
  989. ctx.strokeRect(Math.floor(left) + 0.5, Math.floor(top) + 0.5, roundedWidth, roundedHeight);
  990. ctx.strokeRect(Math.ceil(left) - 0.5, Math.ceil(top) - 0.5, roundedWidth, roundedHeight);
  991. }
  992. }
  993. this._opts.logo && this.drawImg(this._opts.logo, this._opts.width, ctx);
  994. ctx.draw();
  995. this._bIsPainted = true;
  996. if (this._opts.successTips && drawingOptsSuccessTips) {
  997. uni.hideLoading();
  998. uni.showToast({
  999. title: '生成成功',
  1000. icon: 'success',
  1001. duration: 1000
  1002. });
  1003. }
  1004. drawingOptsSuccessTips = true;
  1005. }
  1006. }, {
  1007. key: "clear",
  1008. value: function clear() {
  1009. this._ctx.clearRect(0, 0, this._opts.width, this._opts.height);
  1010. }
  1011. /** anlib **/
  1012. /**
  1013. * 二维码上添加图片
  1014. */
  1015. }, {
  1016. key: "drawImg",
  1017. value: function drawImg(src, width, ctx) {
  1018. // logo相对二维码的比例
  1019. var scale = 5;
  1020. // logo相对二维码的大小
  1021. var imgSize = width / scale;
  1022. // 偏移位置起始点
  1023. var imgPos = width / scale * 2;
  1024. // 二维码边框尺寸,这里设置为原宽度的80分之一
  1025. var imgPosFix = width / 80;
  1026. //console.log('width', width);
  1027. //console.log('imgSize', imgSize);
  1028. //console.log('imgPos', imgPos);
  1029. //console.log('imgPosFix', imgPosFix);
  1030. //console.log('src', src);
  1031. ctx.setFillStyle('#fff');
  1032. ctx.fillRect(imgPos - imgPosFix, imgPos - imgPosFix, imgSize + imgPosFix * 2, imgSize + imgPosFix * 2);
  1033. ctx.beginPath();
  1034. ctx.moveTo(imgPos - imgPosFix, imgPos - imgPosFix);
  1035. ctx.stroke();
  1036. ctx.closePath();
  1037. ctx.drawImage(src, imgPos, imgPos, imgSize, imgSize);
  1038. ctx.beginPath();
  1039. }
  1040. }]);
  1041. return Drawing;
  1042. }();
  1043. /*
  1044. * Class QRCode
  1045. * */
  1046. var QRCode = function () {
  1047. /**
  1048. * Get the type by string length
  1049. * @author anlib
  1050. * @private
  1051. * @param {String} text
  1052. * @param {Number} correctLevel
  1053. * @return {Number} type
  1054. */
  1055. function getTypeNumber(text, correctLevel) {
  1056. var type = 1,
  1057. length = getUTF8Length(text),
  1058. QRCodeLimitLength = [[17, 14, 11, 7], [32, 26, 20, 14], [53, 42, 32, 24], [78, 62, 46, 34], [106, 84, 60, 44], [134, 106, 74, 58], [154, 122, 86, 64], [192, 152, 108, 84], [230, 180, 130, 98], [271, 213, 151, 119], [321, 251, 177, 137], [367, 287, 203, 155], [425, 331, 241, 177], [458, 362, 258, 194], [520, 412, 292, 220], [586, 450, 322, 250], [644, 504, 364, 280], [718, 560, 394, 310], [792, 624, 442, 338], [858, 666, 482, 382], [929, 711, 509, 403], [1003, 779, 565, 439], [1091, 857, 611, 461], [1171, 911, 661, 511], [1273, 997, 715, 535], [1367, 1059, 751, 593], [1465, 1125, 805, 625], [1528, 1190, 868, 658], [1628, 1264, 908, 698], [1732, 1370, 982, 742], [1840, 1452, 1030, 790], [1952, 1538, 1112, 842], [2068, 1628, 1168, 898], [2188, 1722, 1228, 958], [2303, 1809, 1283, 983], [2431, 1911, 1351, 1051], [2563, 1989, 1423, 1093], [2699, 2099, 1499, 1139], [2809, 2213, 1579, 1219], [2953, 2331, 1663, 1273]];
  1059. for (var _i24 = 0, len = QRCodeLimitLength.length; _i24 <= len; _i24++) {
  1060. var limit = 0;
  1061. switch (correctLevel) {
  1062. case QRErrorCorrectLevel.L:
  1063. limit = QRCodeLimitLength[_i24][0];
  1064. break;
  1065. case QRErrorCorrectLevel.M:
  1066. limit = QRCodeLimitLength[_i24][1];
  1067. break;
  1068. case QRErrorCorrectLevel.Q:
  1069. limit = QRCodeLimitLength[_i24][2];
  1070. break;
  1071. case QRErrorCorrectLevel.H:
  1072. limit = QRCodeLimitLength[_i24][3];
  1073. break;
  1074. }
  1075. if (length <= limit) {
  1076. break;
  1077. } else {
  1078. type++;
  1079. }
  1080. }
  1081. if (type > QRCodeLimitLength.length) {
  1082. // throw new Error('Too long data'); //supfire
  1083. throwError('Too long data');
  1084. }
  1085. return type;
  1086. }
  1087. function getUTF8Length(text) {
  1088. var replacedText = encodeURI(text).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
  1089. return replacedText.length + (replacedText.length != text ? 3 : 0);
  1090. }
  1091. var Fn = /*#__PURE__*/function () {
  1092. function Fn(el, opts) {
  1093. (0, _classCallCheck2.default)(this, Fn);
  1094. this._opts = {
  1095. width: 300,
  1096. height: 300,
  1097. typeNumber: 4,
  1098. colorDark: '#000000',
  1099. colorLight: '#ffffff',
  1100. correctLevel: Fn.correctLevel.H,
  1101. logo: false,
  1102. successTips: false
  1103. };
  1104. if (typeof opts === 'string') {
  1105. opts = {
  1106. text: opts
  1107. };
  1108. }
  1109. // Overwrites options 简单拷贝
  1110. if (opts) {
  1111. for (var _i25 in opts) {
  1112. if (opts.hasOwnProperty(_i25)) {
  1113. this._opts[_i25] = opts[_i25];
  1114. }
  1115. }
  1116. }
  1117. this._el = el;
  1118. this._QRCode = null;
  1119. this._drawing = new Drawing(this._el, this._opts);
  1120. if (this._opts.text) {
  1121. this.makeCode(this._opts.text);
  1122. }
  1123. }
  1124. (0, _createClass2.default)(Fn, [{
  1125. key: "makeCode",
  1126. value: function makeCode(text) {
  1127. this._QRCode = new QRCodeModel(getTypeNumber(text, this._opts.correctLevel), this._opts.correctLevel);
  1128. this._QRCode.addData(text);
  1129. this._QRCode.make();
  1130. this._drawing.draw(this._QRCode);
  1131. }
  1132. }, {
  1133. key: "clear",
  1134. value: function clear() {
  1135. this._drawing.clear();
  1136. }
  1137. }]);
  1138. return Fn;
  1139. }();
  1140. Fn.correctLevel = QRErrorCorrectLevel;
  1141. return Fn;
  1142. }();
  1143. /** anlib **/
  1144. var drawingOptsSuccessTips = true;
  1145. /**
  1146. * 抛出错误
  1147. */
  1148. function throwError(str) {
  1149. uni.hideLoading();
  1150. uni.showToast({
  1151. title: '有字符暂不支持',
  1152. icon: 'none',
  1153. duration: 2000
  1154. });
  1155. drawingOptsSuccessTips = false;
  1156. //throw new Error(str);
  1157. }
  1158. var _default = QRCode;
  1159. exports.default = _default;
  1160. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  1161. /***/ }),
  1162. /***/ 18:
  1163. /*!******************************************************************!*\
  1164. !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!
  1165. \******************************************************************/
  1166. /*! no static exports found */
  1167. /***/ (function(module, exports, __webpack_require__) {
  1168. var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ 19);
  1169. var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ 20);
  1170. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  1171. var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ 21);
  1172. function _toConsumableArray(arr) {
  1173. return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
  1174. }
  1175. module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  1176. /***/ }),
  1177. /***/ 19:
  1178. /*!******************************************************************!*\
  1179. !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!
  1180. \******************************************************************/
  1181. /*! no static exports found */
  1182. /***/ (function(module, exports, __webpack_require__) {
  1183. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  1184. function _arrayWithoutHoles(arr) {
  1185. if (Array.isArray(arr)) return arrayLikeToArray(arr);
  1186. }
  1187. module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  1188. /***/ }),
  1189. /***/ 2:
  1190. /*!************************************************************!*\
  1191. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  1192. \************************************************************/
  1193. /*! no static exports found */
  1194. /***/ (function(module, exports, __webpack_require__) {
  1195. "use strict";
  1196. /* WEBPACK VAR INJECTION */(function(wx, global) {
  1197. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  1198. Object.defineProperty(exports, "__esModule", {
  1199. value: true
  1200. });
  1201. exports.createApp = createApp;
  1202. exports.createComponent = createComponent;
  1203. exports.createPage = createPage;
  1204. exports.createPlugin = createPlugin;
  1205. exports.createSubpackageApp = createSubpackageApp;
  1206. exports.default = void 0;
  1207. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  1208. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  1209. var _construct2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/construct */ 15));
  1210. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  1211. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  1212. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  1213. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
  1214. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  1215. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  1216. var realAtob;
  1217. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  1218. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  1219. if (typeof atob !== 'function') {
  1220. realAtob = function realAtob(str) {
  1221. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  1222. if (!b64re.test(str)) {
  1223. throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  1224. }
  1225. // Adding the padding if missing, for semplicity
  1226. str += '=='.slice(2 - (str.length & 3));
  1227. var bitmap;
  1228. var result = '';
  1229. var r1;
  1230. var r2;
  1231. var i = 0;
  1232. for (; i < str.length;) {
  1233. 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++)));
  1234. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) : r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) : String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  1235. }
  1236. return result;
  1237. };
  1238. } else {
  1239. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  1240. realAtob = atob;
  1241. }
  1242. function b64DecodeUnicode(str) {
  1243. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  1244. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  1245. }).join(''));
  1246. }
  1247. function getCurrentUserInfo() {
  1248. var token = wx.getStorageSync('uni_id_token') || '';
  1249. var tokenArr = token.split('.');
  1250. if (!token || tokenArr.length !== 3) {
  1251. return {
  1252. uid: null,
  1253. role: [],
  1254. permission: [],
  1255. tokenExpired: 0
  1256. };
  1257. }
  1258. var userInfo;
  1259. try {
  1260. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  1261. } catch (error) {
  1262. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  1263. }
  1264. userInfo.tokenExpired = userInfo.exp * 1000;
  1265. delete userInfo.exp;
  1266. delete userInfo.iat;
  1267. return userInfo;
  1268. }
  1269. function uniIdMixin(Vue) {
  1270. Vue.prototype.uniIDHasRole = function (roleId) {
  1271. var _getCurrentUserInfo = getCurrentUserInfo(),
  1272. role = _getCurrentUserInfo.role;
  1273. return role.indexOf(roleId) > -1;
  1274. };
  1275. Vue.prototype.uniIDHasPermission = function (permissionId) {
  1276. var _getCurrentUserInfo2 = getCurrentUserInfo(),
  1277. permission = _getCurrentUserInfo2.permission;
  1278. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  1279. };
  1280. Vue.prototype.uniIDTokenValid = function () {
  1281. var _getCurrentUserInfo3 = getCurrentUserInfo(),
  1282. tokenExpired = _getCurrentUserInfo3.tokenExpired;
  1283. return tokenExpired > Date.now();
  1284. };
  1285. }
  1286. var _toString = Object.prototype.toString;
  1287. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1288. function isFn(fn) {
  1289. return typeof fn === 'function';
  1290. }
  1291. function isStr(str) {
  1292. return typeof str === 'string';
  1293. }
  1294. function isObject(obj) {
  1295. return obj !== null && (0, _typeof2.default)(obj) === 'object';
  1296. }
  1297. function isPlainObject(obj) {
  1298. return _toString.call(obj) === '[object Object]';
  1299. }
  1300. function hasOwn(obj, key) {
  1301. return hasOwnProperty.call(obj, key);
  1302. }
  1303. function noop() {}
  1304. /**
  1305. * Create a cached version of a pure function.
  1306. */
  1307. function cached(fn) {
  1308. var cache = Object.create(null);
  1309. return function cachedFn(str) {
  1310. var hit = cache[str];
  1311. return hit || (cache[str] = fn(str));
  1312. };
  1313. }
  1314. /**
  1315. * Camelize a hyphen-delimited string.
  1316. */
  1317. var camelizeRE = /-(\w)/g;
  1318. var camelize = cached(function (str) {
  1319. return str.replace(camelizeRE, function (_, c) {
  1320. return c ? c.toUpperCase() : '';
  1321. });
  1322. });
  1323. function sortObject(obj) {
  1324. var sortObj = {};
  1325. if (isPlainObject(obj)) {
  1326. Object.keys(obj).sort().forEach(function (key) {
  1327. sortObj[key] = obj[key];
  1328. });
  1329. }
  1330. return !Object.keys(sortObj) ? obj : sortObj;
  1331. }
  1332. var HOOKS = ['invoke', 'success', 'fail', 'complete', 'returnValue'];
  1333. var globalInterceptors = {};
  1334. var scopedInterceptors = {};
  1335. function mergeHook(parentVal, childVal) {
  1336. var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;
  1337. return res ? dedupeHooks(res) : res;
  1338. }
  1339. function dedupeHooks(hooks) {
  1340. var res = [];
  1341. for (var i = 0; i < hooks.length; i++) {
  1342. if (res.indexOf(hooks[i]) === -1) {
  1343. res.push(hooks[i]);
  1344. }
  1345. }
  1346. return res;
  1347. }
  1348. function removeHook(hooks, hook) {
  1349. var index = hooks.indexOf(hook);
  1350. if (index !== -1) {
  1351. hooks.splice(index, 1);
  1352. }
  1353. }
  1354. function mergeInterceptorHook(interceptor, option) {
  1355. Object.keys(option).forEach(function (hook) {
  1356. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  1357. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  1358. }
  1359. });
  1360. }
  1361. function removeInterceptorHook(interceptor, option) {
  1362. if (!interceptor || !option) {
  1363. return;
  1364. }
  1365. Object.keys(option).forEach(function (hook) {
  1366. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  1367. removeHook(interceptor[hook], option[hook]);
  1368. }
  1369. });
  1370. }
  1371. function addInterceptor(method, option) {
  1372. if (typeof method === 'string' && isPlainObject(option)) {
  1373. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  1374. } else if (isPlainObject(method)) {
  1375. mergeInterceptorHook(globalInterceptors, method);
  1376. }
  1377. }
  1378. function removeInterceptor(method, option) {
  1379. if (typeof method === 'string') {
  1380. if (isPlainObject(option)) {
  1381. removeInterceptorHook(scopedInterceptors[method], option);
  1382. } else {
  1383. delete scopedInterceptors[method];
  1384. }
  1385. } else if (isPlainObject(method)) {
  1386. removeInterceptorHook(globalInterceptors, method);
  1387. }
  1388. }
  1389. function wrapperHook(hook, params) {
  1390. return function (data) {
  1391. return hook(data, params) || data;
  1392. };
  1393. }
  1394. function isPromise(obj) {
  1395. return !!obj && ((0, _typeof2.default)(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  1396. }
  1397. function queue(hooks, data, params) {
  1398. var promise = false;
  1399. for (var i = 0; i < hooks.length; i++) {
  1400. var hook = hooks[i];
  1401. if (promise) {
  1402. promise = Promise.resolve(wrapperHook(hook, params));
  1403. } else {
  1404. var res = hook(data, params);
  1405. if (isPromise(res)) {
  1406. promise = Promise.resolve(res);
  1407. }
  1408. if (res === false) {
  1409. return {
  1410. then: function then() {}
  1411. };
  1412. }
  1413. }
  1414. }
  1415. return promise || {
  1416. then: function then(callback) {
  1417. return callback(data);
  1418. }
  1419. };
  1420. }
  1421. function wrapperOptions(interceptor) {
  1422. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1423. ['success', 'fail', 'complete'].forEach(function (name) {
  1424. if (Array.isArray(interceptor[name])) {
  1425. var oldCallback = options[name];
  1426. options[name] = function callbackInterceptor(res) {
  1427. queue(interceptor[name], res, options).then(function (res) {
  1428. /* eslint-disable no-mixed-operators */
  1429. return isFn(oldCallback) && oldCallback(res) || res;
  1430. });
  1431. };
  1432. }
  1433. });
  1434. return options;
  1435. }
  1436. function wrapperReturnValue(method, returnValue) {
  1437. var returnValueHooks = [];
  1438. if (Array.isArray(globalInterceptors.returnValue)) {
  1439. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(globalInterceptors.returnValue));
  1440. }
  1441. var interceptor = scopedInterceptors[method];
  1442. if (interceptor && Array.isArray(interceptor.returnValue)) {
  1443. returnValueHooks.push.apply(returnValueHooks, (0, _toConsumableArray2.default)(interceptor.returnValue));
  1444. }
  1445. returnValueHooks.forEach(function (hook) {
  1446. returnValue = hook(returnValue) || returnValue;
  1447. });
  1448. return returnValue;
  1449. }
  1450. function getApiInterceptorHooks(method) {
  1451. var interceptor = Object.create(null);
  1452. Object.keys(globalInterceptors).forEach(function (hook) {
  1453. if (hook !== 'returnValue') {
  1454. interceptor[hook] = globalInterceptors[hook].slice();
  1455. }
  1456. });
  1457. var scopedInterceptor = scopedInterceptors[method];
  1458. if (scopedInterceptor) {
  1459. Object.keys(scopedInterceptor).forEach(function (hook) {
  1460. if (hook !== 'returnValue') {
  1461. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  1462. }
  1463. });
  1464. }
  1465. return interceptor;
  1466. }
  1467. function invokeApi(method, api, options) {
  1468. for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  1469. params[_key - 3] = arguments[_key];
  1470. }
  1471. var interceptor = getApiInterceptorHooks(method);
  1472. if (interceptor && Object.keys(interceptor).length) {
  1473. if (Array.isArray(interceptor.invoke)) {
  1474. var res = queue(interceptor.invoke, options);
  1475. return res.then(function (options) {
  1476. // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
  1477. return api.apply(void 0, [wrapperOptions(getApiInterceptorHooks(method), options)].concat(params));
  1478. });
  1479. } else {
  1480. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  1481. }
  1482. }
  1483. return api.apply(void 0, [options].concat(params));
  1484. }
  1485. var promiseInterceptor = {
  1486. returnValue: function returnValue(res) {
  1487. if (!isPromise(res)) {
  1488. return res;
  1489. }
  1490. return new Promise(function (resolve, reject) {
  1491. res.then(function (res) {
  1492. if (res[0]) {
  1493. reject(res[0]);
  1494. } else {
  1495. resolve(res[1]);
  1496. }
  1497. });
  1498. });
  1499. }
  1500. };
  1501. var SYNC_API_RE = /^\$|Window$|WindowStyle$|sendHostEvent|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getLocale|setLocale|invokePushCallback|getWindowInfo|getDeviceInfo|getAppBaseInfo|getSystemSetting|getAppAuthorizeSetting|initUTS|requireUTS|registerUTS/;
  1502. var CONTEXT_API_RE = /^create|Manager$/;
  1503. // Context例外情况
  1504. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  1505. // 同步例外情况
  1506. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  1507. var CALLBACK_API_RE = /^on|^off/;
  1508. function isContextApi(name) {
  1509. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  1510. }
  1511. function isSyncApi(name) {
  1512. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  1513. }
  1514. function isCallbackApi(name) {
  1515. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  1516. }
  1517. function handlePromise(promise) {
  1518. return promise.then(function (data) {
  1519. return [null, data];
  1520. }).catch(function (err) {
  1521. return [err];
  1522. });
  1523. }
  1524. function shouldPromise(name) {
  1525. if (isContextApi(name) || isSyncApi(name) || isCallbackApi(name)) {
  1526. return false;
  1527. }
  1528. return true;
  1529. }
  1530. /* eslint-disable no-extend-native */
  1531. if (!Promise.prototype.finally) {
  1532. Promise.prototype.finally = function (callback) {
  1533. var promise = this.constructor;
  1534. return this.then(function (value) {
  1535. return promise.resolve(callback()).then(function () {
  1536. return value;
  1537. });
  1538. }, function (reason) {
  1539. return promise.resolve(callback()).then(function () {
  1540. throw reason;
  1541. });
  1542. });
  1543. };
  1544. }
  1545. function promisify(name, api) {
  1546. if (!shouldPromise(name) || !isFn(api)) {
  1547. return api;
  1548. }
  1549. return function promiseApi() {
  1550. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1551. for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1552. params[_key2 - 1] = arguments[_key2];
  1553. }
  1554. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  1555. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  1556. }
  1557. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  1558. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  1559. success: resolve,
  1560. fail: reject
  1561. })].concat(params));
  1562. })));
  1563. };
  1564. }
  1565. var EPS = 1e-4;
  1566. var BASE_DEVICE_WIDTH = 750;
  1567. var isIOS = false;
  1568. var deviceWidth = 0;
  1569. var deviceDPR = 0;
  1570. function checkDeviceWidth() {
  1571. var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
  1572. platform = _wx$getSystemInfoSync.platform,
  1573. pixelRatio = _wx$getSystemInfoSync.pixelRatio,
  1574. windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  1575. deviceWidth = windowWidth;
  1576. deviceDPR = pixelRatio;
  1577. isIOS = platform === 'ios';
  1578. }
  1579. function upx2px(number, newDeviceWidth) {
  1580. if (deviceWidth === 0) {
  1581. checkDeviceWidth();
  1582. }
  1583. number = Number(number);
  1584. if (number === 0) {
  1585. return 0;
  1586. }
  1587. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  1588. if (result < 0) {
  1589. result = -result;
  1590. }
  1591. result = Math.floor(result + EPS);
  1592. if (result === 0) {
  1593. if (deviceDPR === 1 || !isIOS) {
  1594. result = 1;
  1595. } else {
  1596. result = 0.5;
  1597. }
  1598. }
  1599. return number < 0 ? -result : result;
  1600. }
  1601. var LOCALE_ZH_HANS = 'zh-Hans';
  1602. var LOCALE_ZH_HANT = 'zh-Hant';
  1603. var LOCALE_EN = 'en';
  1604. var LOCALE_FR = 'fr';
  1605. var LOCALE_ES = 'es';
  1606. var messages = {};
  1607. var locale;
  1608. {
  1609. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1610. }
  1611. function initI18nMessages() {
  1612. if (!isEnableLocale()) {
  1613. return;
  1614. }
  1615. var localeKeys = Object.keys(__uniConfig.locales);
  1616. if (localeKeys.length) {
  1617. localeKeys.forEach(function (locale) {
  1618. var curMessages = messages[locale];
  1619. var userMessages = __uniConfig.locales[locale];
  1620. if (curMessages) {
  1621. Object.assign(curMessages, userMessages);
  1622. } else {
  1623. messages[locale] = userMessages;
  1624. }
  1625. });
  1626. }
  1627. }
  1628. initI18nMessages();
  1629. var i18n = (0, _uniI18n.initVueI18n)(locale, {});
  1630. var t = i18n.t;
  1631. var i18nMixin = i18n.mixin = {
  1632. beforeCreate: function beforeCreate() {
  1633. var _this = this;
  1634. var unwatch = i18n.i18n.watchLocale(function () {
  1635. _this.$forceUpdate();
  1636. });
  1637. this.$once('hook:beforeDestroy', function () {
  1638. unwatch();
  1639. });
  1640. },
  1641. methods: {
  1642. $$t: function $$t(key, values) {
  1643. return t(key, values);
  1644. }
  1645. }
  1646. };
  1647. var setLocale = i18n.setLocale;
  1648. var getLocale = i18n.getLocale;
  1649. function initAppLocale(Vue, appVm, locale) {
  1650. var state = Vue.observable({
  1651. locale: locale || i18n.getLocale()
  1652. });
  1653. var localeWatchers = [];
  1654. appVm.$watchLocale = function (fn) {
  1655. localeWatchers.push(fn);
  1656. };
  1657. Object.defineProperty(appVm, '$locale', {
  1658. get: function get() {
  1659. return state.locale;
  1660. },
  1661. set: function set(v) {
  1662. state.locale = v;
  1663. localeWatchers.forEach(function (watch) {
  1664. return watch(v);
  1665. });
  1666. }
  1667. });
  1668. }
  1669. function isEnableLocale() {
  1670. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  1671. }
  1672. function include(str, parts) {
  1673. return !!parts.find(function (part) {
  1674. return str.indexOf(part) !== -1;
  1675. });
  1676. }
  1677. function startsWith(str, parts) {
  1678. return parts.find(function (part) {
  1679. return str.indexOf(part) === 0;
  1680. });
  1681. }
  1682. function normalizeLocale(locale, messages) {
  1683. if (!locale) {
  1684. return;
  1685. }
  1686. locale = locale.trim().replace(/_/g, '-');
  1687. if (messages && messages[locale]) {
  1688. return locale;
  1689. }
  1690. locale = locale.toLowerCase();
  1691. if (locale === 'chinese') {
  1692. // 支付宝
  1693. return LOCALE_ZH_HANS;
  1694. }
  1695. if (locale.indexOf('zh') === 0) {
  1696. if (locale.indexOf('-hans') > -1) {
  1697. return LOCALE_ZH_HANS;
  1698. }
  1699. if (locale.indexOf('-hant') > -1) {
  1700. return LOCALE_ZH_HANT;
  1701. }
  1702. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  1703. return LOCALE_ZH_HANT;
  1704. }
  1705. return LOCALE_ZH_HANS;
  1706. }
  1707. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  1708. if (lang) {
  1709. return lang;
  1710. }
  1711. }
  1712. // export function initI18n() {
  1713. // const localeKeys = Object.keys(__uniConfig.locales || {})
  1714. // if (localeKeys.length) {
  1715. // localeKeys.forEach((locale) =>
  1716. // i18n.add(locale, __uniConfig.locales[locale])
  1717. // )
  1718. // }
  1719. // }
  1720. function getLocale$1() {
  1721. // 优先使用 $locale
  1722. if (isFn(getApp)) {
  1723. var app = getApp({
  1724. allowDefault: true
  1725. });
  1726. if (app && app.$vm) {
  1727. return app.$vm.$locale;
  1728. }
  1729. }
  1730. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  1731. }
  1732. function setLocale$1(locale) {
  1733. var app = isFn(getApp) ? getApp() : false;
  1734. if (!app) {
  1735. return false;
  1736. }
  1737. var oldLocale = app.$vm.$locale;
  1738. if (oldLocale !== locale) {
  1739. app.$vm.$locale = locale;
  1740. onLocaleChangeCallbacks.forEach(function (fn) {
  1741. return fn({
  1742. locale: locale
  1743. });
  1744. });
  1745. return true;
  1746. }
  1747. return false;
  1748. }
  1749. var onLocaleChangeCallbacks = [];
  1750. function onLocaleChange(fn) {
  1751. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  1752. onLocaleChangeCallbacks.push(fn);
  1753. }
  1754. }
  1755. if (typeof global !== 'undefined') {
  1756. global.getLocale = getLocale$1;
  1757. }
  1758. var interceptors = {
  1759. promiseInterceptor: promiseInterceptor
  1760. };
  1761. var baseApi = /*#__PURE__*/Object.freeze({
  1762. __proto__: null,
  1763. upx2px: upx2px,
  1764. getLocale: getLocale$1,
  1765. setLocale: setLocale$1,
  1766. onLocaleChange: onLocaleChange,
  1767. addInterceptor: addInterceptor,
  1768. removeInterceptor: removeInterceptor,
  1769. interceptors: interceptors
  1770. });
  1771. function findExistsPageIndex(url) {
  1772. var pages = getCurrentPages();
  1773. var len = pages.length;
  1774. while (len--) {
  1775. var page = pages[len];
  1776. if (page.$page && page.$page.fullPath === url) {
  1777. return len;
  1778. }
  1779. }
  1780. return -1;
  1781. }
  1782. var redirectTo = {
  1783. name: function name(fromArgs) {
  1784. if (fromArgs.exists === 'back' && fromArgs.delta) {
  1785. return 'navigateBack';
  1786. }
  1787. return 'redirectTo';
  1788. },
  1789. args: function args(fromArgs) {
  1790. if (fromArgs.exists === 'back' && fromArgs.url) {
  1791. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  1792. if (existsPageIndex !== -1) {
  1793. var delta = getCurrentPages().length - 1 - existsPageIndex;
  1794. if (delta > 0) {
  1795. fromArgs.delta = delta;
  1796. }
  1797. }
  1798. }
  1799. }
  1800. };
  1801. var previewImage = {
  1802. args: function args(fromArgs) {
  1803. var currentIndex = parseInt(fromArgs.current);
  1804. if (isNaN(currentIndex)) {
  1805. return;
  1806. }
  1807. var urls = fromArgs.urls;
  1808. if (!Array.isArray(urls)) {
  1809. return;
  1810. }
  1811. var len = urls.length;
  1812. if (!len) {
  1813. return;
  1814. }
  1815. if (currentIndex < 0) {
  1816. currentIndex = 0;
  1817. } else if (currentIndex >= len) {
  1818. currentIndex = len - 1;
  1819. }
  1820. if (currentIndex > 0) {
  1821. fromArgs.current = urls[currentIndex];
  1822. fromArgs.urls = urls.filter(function (item, index) {
  1823. return index < currentIndex ? item !== urls[currentIndex] : true;
  1824. });
  1825. } else {
  1826. fromArgs.current = urls[0];
  1827. }
  1828. return {
  1829. indicator: false,
  1830. loop: false
  1831. };
  1832. }
  1833. };
  1834. var UUID_KEY = '__DC_STAT_UUID';
  1835. var deviceId;
  1836. function useDeviceId(result) {
  1837. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  1838. if (!deviceId) {
  1839. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  1840. wx.setStorage({
  1841. key: UUID_KEY,
  1842. data: deviceId
  1843. });
  1844. }
  1845. result.deviceId = deviceId;
  1846. }
  1847. function addSafeAreaInsets(result) {
  1848. if (result.safeArea) {
  1849. var safeArea = result.safeArea;
  1850. result.safeAreaInsets = {
  1851. top: safeArea.top,
  1852. left: safeArea.left,
  1853. right: result.windowWidth - safeArea.right,
  1854. bottom: result.screenHeight - safeArea.bottom
  1855. };
  1856. }
  1857. }
  1858. function populateParameters(result) {
  1859. var _result$brand = result.brand,
  1860. brand = _result$brand === void 0 ? '' : _result$brand,
  1861. _result$model = result.model,
  1862. model = _result$model === void 0 ? '' : _result$model,
  1863. _result$system = result.system,
  1864. system = _result$system === void 0 ? '' : _result$system,
  1865. _result$language = result.language,
  1866. language = _result$language === void 0 ? '' : _result$language,
  1867. theme = result.theme,
  1868. version = result.version,
  1869. platform = result.platform,
  1870. fontSizeSetting = result.fontSizeSetting,
  1871. SDKVersion = result.SDKVersion,
  1872. pixelRatio = result.pixelRatio,
  1873. deviceOrientation = result.deviceOrientation;
  1874. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  1875. var extraParam = {};
  1876. // osName osVersion
  1877. var osName = '';
  1878. var osVersion = '';
  1879. {
  1880. osName = system.split(' ')[0] || '';
  1881. osVersion = system.split(' ')[1] || '';
  1882. }
  1883. var hostVersion = version;
  1884. // deviceType
  1885. var deviceType = getGetDeviceType(result, model);
  1886. // deviceModel
  1887. var deviceBrand = getDeviceBrand(brand);
  1888. // hostName
  1889. var _hostName = getHostName(result);
  1890. // deviceOrientation
  1891. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  1892. // devicePixelRatio
  1893. var _devicePixelRatio = pixelRatio;
  1894. // SDKVersion
  1895. var _SDKVersion = SDKVersion;
  1896. // hostLanguage
  1897. var hostLanguage = language.replace(/_/g, '-');
  1898. // wx.getAccountInfoSync
  1899. var parameters = {
  1900. appId: "__UNI__1C40FB4",
  1901. appName: "房票科技",
  1902. appVersion: "1.0.0",
  1903. appVersionCode: "100",
  1904. appLanguage: getAppLanguage(hostLanguage),
  1905. uniCompileVersion: "3.8.12",
  1906. uniRuntimeVersion: "3.8.12",
  1907. uniPlatform: undefined || "mp-weixin",
  1908. deviceBrand: deviceBrand,
  1909. deviceModel: model,
  1910. deviceType: deviceType,
  1911. devicePixelRatio: _devicePixelRatio,
  1912. deviceOrientation: _deviceOrientation,
  1913. osName: osName.toLocaleLowerCase(),
  1914. osVersion: osVersion,
  1915. hostTheme: theme,
  1916. hostVersion: hostVersion,
  1917. hostLanguage: hostLanguage,
  1918. hostName: _hostName,
  1919. hostSDKVersion: _SDKVersion,
  1920. hostFontSizeSetting: fontSizeSetting,
  1921. windowTop: 0,
  1922. windowBottom: 0,
  1923. // TODO
  1924. osLanguage: undefined,
  1925. osTheme: undefined,
  1926. ua: undefined,
  1927. hostPackageName: undefined,
  1928. browserName: undefined,
  1929. browserVersion: undefined
  1930. };
  1931. Object.assign(result, parameters, extraParam);
  1932. }
  1933. function getGetDeviceType(result, model) {
  1934. var deviceType = result.deviceType || 'phone';
  1935. {
  1936. var deviceTypeMaps = {
  1937. ipad: 'pad',
  1938. windows: 'pc',
  1939. mac: 'pc'
  1940. };
  1941. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  1942. var _model = model.toLocaleLowerCase();
  1943. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  1944. var _m = deviceTypeMapsKeys[index];
  1945. if (_model.indexOf(_m) !== -1) {
  1946. deviceType = deviceTypeMaps[_m];
  1947. break;
  1948. }
  1949. }
  1950. }
  1951. return deviceType;
  1952. }
  1953. function getDeviceBrand(brand) {
  1954. var deviceBrand = brand;
  1955. if (deviceBrand) {
  1956. deviceBrand = brand.toLocaleLowerCase();
  1957. }
  1958. return deviceBrand;
  1959. }
  1960. function getAppLanguage(defaultLanguage) {
  1961. return getLocale$1 ? getLocale$1() : defaultLanguage;
  1962. }
  1963. function getHostName(result) {
  1964. var _platform = 'WeChat';
  1965. var _hostName = result.hostName || _platform; // mp-jd
  1966. {
  1967. if (result.environment) {
  1968. _hostName = result.environment;
  1969. } else if (result.host && result.host.env) {
  1970. _hostName = result.host.env;
  1971. }
  1972. }
  1973. return _hostName;
  1974. }
  1975. var getSystemInfo = {
  1976. returnValue: function returnValue(result) {
  1977. useDeviceId(result);
  1978. addSafeAreaInsets(result);
  1979. populateParameters(result);
  1980. }
  1981. };
  1982. var showActionSheet = {
  1983. args: function args(fromArgs) {
  1984. if ((0, _typeof2.default)(fromArgs) === 'object') {
  1985. fromArgs.alertText = fromArgs.title;
  1986. }
  1987. }
  1988. };
  1989. var getAppBaseInfo = {
  1990. returnValue: function returnValue(result) {
  1991. var _result = result,
  1992. version = _result.version,
  1993. language = _result.language,
  1994. SDKVersion = _result.SDKVersion,
  1995. theme = _result.theme;
  1996. var _hostName = getHostName(result);
  1997. var hostLanguage = language.replace('_', '-');
  1998. result = sortObject(Object.assign(result, {
  1999. appId: "__UNI__1C40FB4",
  2000. appName: "房票科技",
  2001. appVersion: "1.0.0",
  2002. appVersionCode: "100",
  2003. appLanguage: getAppLanguage(hostLanguage),
  2004. hostVersion: version,
  2005. hostLanguage: hostLanguage,
  2006. hostName: _hostName,
  2007. hostSDKVersion: SDKVersion,
  2008. hostTheme: theme
  2009. }));
  2010. }
  2011. };
  2012. var getDeviceInfo = {
  2013. returnValue: function returnValue(result) {
  2014. var _result2 = result,
  2015. brand = _result2.brand,
  2016. model = _result2.model;
  2017. var deviceType = getGetDeviceType(result, model);
  2018. var deviceBrand = getDeviceBrand(brand);
  2019. useDeviceId(result);
  2020. result = sortObject(Object.assign(result, {
  2021. deviceType: deviceType,
  2022. deviceBrand: deviceBrand,
  2023. deviceModel: model
  2024. }));
  2025. }
  2026. };
  2027. var getWindowInfo = {
  2028. returnValue: function returnValue(result) {
  2029. addSafeAreaInsets(result);
  2030. result = sortObject(Object.assign(result, {
  2031. windowTop: 0,
  2032. windowBottom: 0
  2033. }));
  2034. }
  2035. };
  2036. var getAppAuthorizeSetting = {
  2037. returnValue: function returnValue(result) {
  2038. var locationReducedAccuracy = result.locationReducedAccuracy;
  2039. result.locationAccuracy = 'unsupported';
  2040. if (locationReducedAccuracy === true) {
  2041. result.locationAccuracy = 'reduced';
  2042. } else if (locationReducedAccuracy === false) {
  2043. result.locationAccuracy = 'full';
  2044. }
  2045. }
  2046. };
  2047. // import navigateTo from 'uni-helpers/navigate-to'
  2048. var compressImage = {
  2049. args: function args(fromArgs) {
  2050. // https://developers.weixin.qq.com/community/develop/doc/000c08940c865011298e0a43256800?highLine=compressHeight
  2051. if (fromArgs.compressedHeight && !fromArgs.compressHeight) {
  2052. fromArgs.compressHeight = fromArgs.compressedHeight;
  2053. }
  2054. if (fromArgs.compressedWidth && !fromArgs.compressWidth) {
  2055. fromArgs.compressWidth = fromArgs.compressedWidth;
  2056. }
  2057. }
  2058. };
  2059. var protocols = {
  2060. redirectTo: redirectTo,
  2061. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  2062. previewImage: previewImage,
  2063. getSystemInfo: getSystemInfo,
  2064. getSystemInfoSync: getSystemInfo,
  2065. showActionSheet: showActionSheet,
  2066. getAppBaseInfo: getAppBaseInfo,
  2067. getDeviceInfo: getDeviceInfo,
  2068. getWindowInfo: getWindowInfo,
  2069. getAppAuthorizeSetting: getAppAuthorizeSetting,
  2070. compressImage: compressImage
  2071. };
  2072. var todos = ['vibrate', 'preloadPage', 'unPreloadPage', 'loadSubPackage'];
  2073. var canIUses = [];
  2074. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  2075. function processCallback(methodName, method, returnValue) {
  2076. return function (res) {
  2077. return method(processReturnValue(methodName, res, returnValue));
  2078. };
  2079. }
  2080. function processArgs(methodName, fromArgs) {
  2081. var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2082. var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  2083. var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2084. if (isPlainObject(fromArgs)) {
  2085. // 一般 api 的参数解析
  2086. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  2087. if (isFn(argsOption)) {
  2088. argsOption = argsOption(fromArgs, toArgs) || {};
  2089. }
  2090. for (var key in fromArgs) {
  2091. if (hasOwn(argsOption, key)) {
  2092. var keyOption = argsOption[key];
  2093. if (isFn(keyOption)) {
  2094. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  2095. }
  2096. if (!keyOption) {
  2097. // 不支持的参数
  2098. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  2099. } else if (isStr(keyOption)) {
  2100. // 重写参数 key
  2101. toArgs[keyOption] = fromArgs[key];
  2102. } else if (isPlainObject(keyOption)) {
  2103. // {name:newName,value:value}可重新指定参数 key:value
  2104. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  2105. }
  2106. } else if (CALLBACKS.indexOf(key) !== -1) {
  2107. if (isFn(fromArgs[key])) {
  2108. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  2109. }
  2110. } else {
  2111. if (!keepFromArgs) {
  2112. toArgs[key] = fromArgs[key];
  2113. }
  2114. }
  2115. }
  2116. return toArgs;
  2117. } else if (isFn(fromArgs)) {
  2118. fromArgs = processCallback(methodName, fromArgs, returnValue);
  2119. }
  2120. return fromArgs;
  2121. }
  2122. function processReturnValue(methodName, res, returnValue) {
  2123. var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  2124. if (isFn(protocols.returnValue)) {
  2125. // 处理通用 returnValue
  2126. res = protocols.returnValue(methodName, res);
  2127. }
  2128. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  2129. }
  2130. function wrapper(methodName, method) {
  2131. if (hasOwn(protocols, methodName)) {
  2132. var protocol = protocols[methodName];
  2133. if (!protocol) {
  2134. // 暂不支持的 api
  2135. return function () {
  2136. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  2137. };
  2138. }
  2139. return function (arg1, arg2) {
  2140. // 目前 api 最多两个参数
  2141. var options = protocol;
  2142. if (isFn(protocol)) {
  2143. options = protocol(arg1);
  2144. }
  2145. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  2146. var args = [arg1];
  2147. if (typeof arg2 !== 'undefined') {
  2148. args.push(arg2);
  2149. }
  2150. if (isFn(options.name)) {
  2151. methodName = options.name(arg1);
  2152. } else if (isStr(options.name)) {
  2153. methodName = options.name;
  2154. }
  2155. var returnValue = wx[methodName].apply(wx, args);
  2156. if (isSyncApi(methodName)) {
  2157. // 同步 api
  2158. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  2159. }
  2160. return returnValue;
  2161. };
  2162. }
  2163. return method;
  2164. }
  2165. var todoApis = Object.create(null);
  2166. var TODOS = ['onTabBarMidButtonTap', 'subscribePush', 'unsubscribePush', 'onPush', 'offPush', 'share'];
  2167. function createTodoApi(name) {
  2168. return function todoApi(_ref) {
  2169. var fail = _ref.fail,
  2170. complete = _ref.complete;
  2171. var res = {
  2172. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported")
  2173. };
  2174. isFn(fail) && fail(res);
  2175. isFn(complete) && complete(res);
  2176. };
  2177. }
  2178. TODOS.forEach(function (name) {
  2179. todoApis[name] = createTodoApi(name);
  2180. });
  2181. var providers = {
  2182. oauth: ['weixin'],
  2183. share: ['weixin'],
  2184. payment: ['wxpay'],
  2185. push: ['weixin']
  2186. };
  2187. function getProvider(_ref2) {
  2188. var service = _ref2.service,
  2189. success = _ref2.success,
  2190. fail = _ref2.fail,
  2191. complete = _ref2.complete;
  2192. var res = false;
  2193. if (providers[service]) {
  2194. res = {
  2195. errMsg: 'getProvider:ok',
  2196. service: service,
  2197. provider: providers[service]
  2198. };
  2199. isFn(success) && success(res);
  2200. } else {
  2201. res = {
  2202. errMsg: 'getProvider:fail service not found'
  2203. };
  2204. isFn(fail) && fail(res);
  2205. }
  2206. isFn(complete) && complete(res);
  2207. }
  2208. var extraApi = /*#__PURE__*/Object.freeze({
  2209. __proto__: null,
  2210. getProvider: getProvider
  2211. });
  2212. var getEmitter = function () {
  2213. var Emitter;
  2214. return function getUniEmitter() {
  2215. if (!Emitter) {
  2216. Emitter = new _vue.default();
  2217. }
  2218. return Emitter;
  2219. };
  2220. }();
  2221. function apply(ctx, method, args) {
  2222. return ctx[method].apply(ctx, args);
  2223. }
  2224. function $on() {
  2225. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  2226. }
  2227. function $off() {
  2228. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  2229. }
  2230. function $once() {
  2231. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  2232. }
  2233. function $emit() {
  2234. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  2235. }
  2236. var eventApi = /*#__PURE__*/Object.freeze({
  2237. __proto__: null,
  2238. $on: $on,
  2239. $off: $off,
  2240. $once: $once,
  2241. $emit: $emit
  2242. });
  2243. /**
  2244. * 框架内 try-catch
  2245. */
  2246. /**
  2247. * 开发者 try-catch
  2248. */
  2249. function tryCatch(fn) {
  2250. return function () {
  2251. try {
  2252. return fn.apply(fn, arguments);
  2253. } catch (e) {
  2254. // TODO
  2255. console.error(e);
  2256. }
  2257. };
  2258. }
  2259. function getApiCallbacks(params) {
  2260. var apiCallbacks = {};
  2261. for (var name in params) {
  2262. var param = params[name];
  2263. if (isFn(param)) {
  2264. apiCallbacks[name] = tryCatch(param);
  2265. delete params[name];
  2266. }
  2267. }
  2268. return apiCallbacks;
  2269. }
  2270. var cid;
  2271. var cidErrMsg;
  2272. var enabled;
  2273. function normalizePushMessage(message) {
  2274. try {
  2275. return JSON.parse(message);
  2276. } catch (e) {}
  2277. return message;
  2278. }
  2279. function invokePushCallback(args) {
  2280. if (args.type === 'enabled') {
  2281. enabled = true;
  2282. } else if (args.type === 'clientId') {
  2283. cid = args.cid;
  2284. cidErrMsg = args.errMsg;
  2285. invokeGetPushCidCallbacks(cid, args.errMsg);
  2286. } else if (args.type === 'pushMsg') {
  2287. var message = {
  2288. type: 'receive',
  2289. data: normalizePushMessage(args.message)
  2290. };
  2291. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  2292. var callback = onPushMessageCallbacks[i];
  2293. callback(message);
  2294. // 该消息已被阻止
  2295. if (message.stopped) {
  2296. break;
  2297. }
  2298. }
  2299. } else if (args.type === 'click') {
  2300. onPushMessageCallbacks.forEach(function (callback) {
  2301. callback({
  2302. type: 'click',
  2303. data: normalizePushMessage(args.message)
  2304. });
  2305. });
  2306. }
  2307. }
  2308. var getPushCidCallbacks = [];
  2309. function invokeGetPushCidCallbacks(cid, errMsg) {
  2310. getPushCidCallbacks.forEach(function (callback) {
  2311. callback(cid, errMsg);
  2312. });
  2313. getPushCidCallbacks.length = 0;
  2314. }
  2315. function getPushClientId(args) {
  2316. if (!isPlainObject(args)) {
  2317. args = {};
  2318. }
  2319. var _getApiCallbacks = getApiCallbacks(args),
  2320. success = _getApiCallbacks.success,
  2321. fail = _getApiCallbacks.fail,
  2322. complete = _getApiCallbacks.complete;
  2323. var hasSuccess = isFn(success);
  2324. var hasFail = isFn(fail);
  2325. var hasComplete = isFn(complete);
  2326. Promise.resolve().then(function () {
  2327. if (typeof enabled === 'undefined') {
  2328. enabled = false;
  2329. cid = '';
  2330. cidErrMsg = 'uniPush is not enabled';
  2331. }
  2332. getPushCidCallbacks.push(function (cid, errMsg) {
  2333. var res;
  2334. if (cid) {
  2335. res = {
  2336. errMsg: 'getPushClientId:ok',
  2337. cid: cid
  2338. };
  2339. hasSuccess && success(res);
  2340. } else {
  2341. res = {
  2342. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '')
  2343. };
  2344. hasFail && fail(res);
  2345. }
  2346. hasComplete && complete(res);
  2347. });
  2348. if (typeof cid !== 'undefined') {
  2349. invokeGetPushCidCallbacks(cid, cidErrMsg);
  2350. }
  2351. });
  2352. }
  2353. var onPushMessageCallbacks = [];
  2354. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  2355. var onPushMessage = function onPushMessage(fn) {
  2356. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  2357. onPushMessageCallbacks.push(fn);
  2358. }
  2359. };
  2360. var offPushMessage = function offPushMessage(fn) {
  2361. if (!fn) {
  2362. onPushMessageCallbacks.length = 0;
  2363. } else {
  2364. var index = onPushMessageCallbacks.indexOf(fn);
  2365. if (index > -1) {
  2366. onPushMessageCallbacks.splice(index, 1);
  2367. }
  2368. }
  2369. };
  2370. var baseInfo = wx.getAppBaseInfo && wx.getAppBaseInfo();
  2371. if (!baseInfo) {
  2372. baseInfo = wx.getSystemInfoSync();
  2373. }
  2374. var host = baseInfo ? baseInfo.host : null;
  2375. var shareVideoMessage = host && host.env === 'SAAASDK' ? wx.miniapp.shareVideoMessage : wx.shareVideoMessage;
  2376. var api = /*#__PURE__*/Object.freeze({
  2377. __proto__: null,
  2378. shareVideoMessage: shareVideoMessage,
  2379. getPushClientId: getPushClientId,
  2380. onPushMessage: onPushMessage,
  2381. offPushMessage: offPushMessage,
  2382. invokePushCallback: invokePushCallback
  2383. });
  2384. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  2385. function findVmByVueId(vm, vuePid) {
  2386. var $children = vm.$children;
  2387. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  2388. for (var i = $children.length - 1; i >= 0; i--) {
  2389. var childVm = $children[i];
  2390. if (childVm.$scope._$vueId === vuePid) {
  2391. return childVm;
  2392. }
  2393. }
  2394. // 反向递归查找
  2395. var parentVm;
  2396. for (var _i = $children.length - 1; _i >= 0; _i--) {
  2397. parentVm = findVmByVueId($children[_i], vuePid);
  2398. if (parentVm) {
  2399. return parentVm;
  2400. }
  2401. }
  2402. }
  2403. function initBehavior(options) {
  2404. return Behavior(options);
  2405. }
  2406. function isPage() {
  2407. return !!this.route;
  2408. }
  2409. function initRelation(detail) {
  2410. this.triggerEvent('__l', detail);
  2411. }
  2412. function selectAllComponents(mpInstance, selector, $refs) {
  2413. var components = mpInstance.selectAllComponents(selector) || [];
  2414. components.forEach(function (component) {
  2415. var ref = component.dataset.ref;
  2416. $refs[ref] = component.$vm || toSkip(component);
  2417. {
  2418. if (component.dataset.vueGeneric === 'scoped') {
  2419. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  2420. selectAllComponents(scopedComponent, selector, $refs);
  2421. });
  2422. }
  2423. }
  2424. });
  2425. }
  2426. function syncRefs(refs, newRefs) {
  2427. var oldKeys = (0, _construct2.default)(Set, (0, _toConsumableArray2.default)(Object.keys(refs)));
  2428. var newKeys = Object.keys(newRefs);
  2429. newKeys.forEach(function (key) {
  2430. var oldValue = refs[key];
  2431. var newValue = newRefs[key];
  2432. if (Array.isArray(oldValue) && Array.isArray(newValue) && oldValue.length === newValue.length && newValue.every(function (value) {
  2433. return oldValue.includes(value);
  2434. })) {
  2435. return;
  2436. }
  2437. refs[key] = newValue;
  2438. oldKeys.delete(key);
  2439. });
  2440. oldKeys.forEach(function (key) {
  2441. delete refs[key];
  2442. });
  2443. return refs;
  2444. }
  2445. function initRefs(vm) {
  2446. var mpInstance = vm.$scope;
  2447. var refs = {};
  2448. Object.defineProperty(vm, '$refs', {
  2449. get: function get() {
  2450. var $refs = {};
  2451. selectAllComponents(mpInstance, '.vue-ref', $refs);
  2452. // TODO 暂不考虑 for 中的 scoped
  2453. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for') || [];
  2454. forComponents.forEach(function (component) {
  2455. var ref = component.dataset.ref;
  2456. if (!$refs[ref]) {
  2457. $refs[ref] = [];
  2458. }
  2459. $refs[ref].push(component.$vm || toSkip(component));
  2460. });
  2461. return syncRefs(refs, $refs);
  2462. }
  2463. });
  2464. }
  2465. function handleLink(event) {
  2466. var _ref3 = event.detail || event.value,
  2467. vuePid = _ref3.vuePid,
  2468. vueOptions = _ref3.vueOptions; // detail 是微信,value 是百度(dipatch)
  2469. var parentVm;
  2470. if (vuePid) {
  2471. parentVm = findVmByVueId(this.$vm, vuePid);
  2472. }
  2473. if (!parentVm) {
  2474. parentVm = this.$vm;
  2475. }
  2476. vueOptions.parent = parentVm;
  2477. }
  2478. function markMPComponent(component) {
  2479. // 在 Vue 中标记为小程序组件
  2480. var IS_MP = '__v_isMPComponent';
  2481. Object.defineProperty(component, IS_MP, {
  2482. configurable: true,
  2483. enumerable: false,
  2484. value: true
  2485. });
  2486. return component;
  2487. }
  2488. function toSkip(obj) {
  2489. var OB = '__ob__';
  2490. var SKIP = '__v_skip';
  2491. if (isObject(obj) && Object.isExtensible(obj)) {
  2492. // 避免被 @vue/composition-api 观测
  2493. Object.defineProperty(obj, OB, {
  2494. configurable: true,
  2495. enumerable: false,
  2496. value: (0, _defineProperty2.default)({}, SKIP, true)
  2497. });
  2498. }
  2499. return obj;
  2500. }
  2501. var WORKLET_RE = /_(.*)_worklet_factory_/;
  2502. function initWorkletMethods(mpMethods, vueMethods) {
  2503. if (vueMethods) {
  2504. Object.keys(vueMethods).forEach(function (name) {
  2505. var matches = name.match(WORKLET_RE);
  2506. if (matches) {
  2507. var workletName = matches[1];
  2508. mpMethods[name] = vueMethods[name];
  2509. mpMethods[workletName] = vueMethods[workletName];
  2510. }
  2511. });
  2512. }
  2513. }
  2514. var MPPage = Page;
  2515. var MPComponent = Component;
  2516. var customizeRE = /:/g;
  2517. var customize = cached(function (str) {
  2518. return camelize(str.replace(customizeRE, '-'));
  2519. });
  2520. function initTriggerEvent(mpInstance) {
  2521. var oldTriggerEvent = mpInstance.triggerEvent;
  2522. var newTriggerEvent = function newTriggerEvent(event) {
  2523. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  2524. args[_key3 - 1] = arguments[_key3];
  2525. }
  2526. // 事件名统一转驼峰格式,仅处理:当前组件为 vue 组件、当前组件为 vue 组件子组件
  2527. if (this.$vm || this.dataset && this.dataset.comType) {
  2528. event = customize(event);
  2529. } else {
  2530. // 针对微信/QQ小程序单独补充驼峰格式事件,以兼容历史项目
  2531. var newEvent = customize(event);
  2532. if (newEvent !== event) {
  2533. oldTriggerEvent.apply(this, [newEvent].concat(args));
  2534. }
  2535. }
  2536. return oldTriggerEvent.apply(this, [event].concat(args));
  2537. };
  2538. try {
  2539. // 京东小程序 triggerEvent 为只读
  2540. mpInstance.triggerEvent = newTriggerEvent;
  2541. } catch (error) {
  2542. mpInstance._triggerEvent = newTriggerEvent;
  2543. }
  2544. }
  2545. function initHook(name, options, isComponent) {
  2546. var oldHook = options[name];
  2547. options[name] = function () {
  2548. markMPComponent(this);
  2549. initTriggerEvent(this);
  2550. if (oldHook) {
  2551. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  2552. args[_key4] = arguments[_key4];
  2553. }
  2554. return oldHook.apply(this, args);
  2555. }
  2556. };
  2557. }
  2558. if (!MPPage.__$wrappered) {
  2559. MPPage.__$wrappered = true;
  2560. Page = function Page() {
  2561. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2562. initHook('onLoad', options);
  2563. return MPPage(options);
  2564. };
  2565. Page.after = MPPage.after;
  2566. Component = function Component() {
  2567. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2568. initHook('created', options);
  2569. return MPComponent(options);
  2570. };
  2571. }
  2572. var PAGE_EVENT_HOOKS = ['onPullDownRefresh', 'onReachBottom', 'onAddToFavorites', 'onShareTimeline', 'onShareAppMessage', 'onPageScroll', 'onResize', 'onTabItemTap'];
  2573. function initMocks(vm, mocks) {
  2574. var mpInstance = vm.$mp[vm.mpType];
  2575. mocks.forEach(function (mock) {
  2576. if (hasOwn(mpInstance, mock)) {
  2577. vm[mock] = mpInstance[mock];
  2578. }
  2579. });
  2580. }
  2581. function hasHook(hook, vueOptions) {
  2582. if (!vueOptions) {
  2583. return true;
  2584. }
  2585. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  2586. return true;
  2587. }
  2588. vueOptions = vueOptions.default || vueOptions;
  2589. if (isFn(vueOptions)) {
  2590. if (isFn(vueOptions.extendOptions[hook])) {
  2591. return true;
  2592. }
  2593. if (vueOptions.super && vueOptions.super.options && Array.isArray(vueOptions.super.options[hook])) {
  2594. return true;
  2595. }
  2596. return false;
  2597. }
  2598. if (isFn(vueOptions[hook]) || Array.isArray(vueOptions[hook])) {
  2599. return true;
  2600. }
  2601. var mixins = vueOptions.mixins;
  2602. if (Array.isArray(mixins)) {
  2603. return !!mixins.find(function (mixin) {
  2604. return hasHook(hook, mixin);
  2605. });
  2606. }
  2607. }
  2608. function initHooks(mpOptions, hooks, vueOptions) {
  2609. hooks.forEach(function (hook) {
  2610. if (hasHook(hook, vueOptions)) {
  2611. mpOptions[hook] = function (args) {
  2612. return this.$vm && this.$vm.__call_hook(hook, args);
  2613. };
  2614. }
  2615. });
  2616. }
  2617. function initUnknownHooks(mpOptions, vueOptions) {
  2618. var excludes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2619. findHooks(vueOptions).forEach(function (hook) {
  2620. return initHook$1(mpOptions, hook, excludes);
  2621. });
  2622. }
  2623. function findHooks(vueOptions) {
  2624. var hooks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2625. if (vueOptions) {
  2626. Object.keys(vueOptions).forEach(function (name) {
  2627. if (name.indexOf('on') === 0 && isFn(vueOptions[name])) {
  2628. hooks.push(name);
  2629. }
  2630. });
  2631. }
  2632. return hooks;
  2633. }
  2634. function initHook$1(mpOptions, hook, excludes) {
  2635. if (excludes.indexOf(hook) === -1 && !hasOwn(mpOptions, hook)) {
  2636. mpOptions[hook] = function (args) {
  2637. return this.$vm && this.$vm.__call_hook(hook, args);
  2638. };
  2639. }
  2640. }
  2641. function initVueComponent(Vue, vueOptions) {
  2642. vueOptions = vueOptions.default || vueOptions;
  2643. var VueComponent;
  2644. if (isFn(vueOptions)) {
  2645. VueComponent = vueOptions;
  2646. } else {
  2647. VueComponent = Vue.extend(vueOptions);
  2648. }
  2649. vueOptions = VueComponent.options;
  2650. return [VueComponent, vueOptions];
  2651. }
  2652. function initSlots(vm, vueSlots) {
  2653. if (Array.isArray(vueSlots) && vueSlots.length) {
  2654. var $slots = Object.create(null);
  2655. vueSlots.forEach(function (slotName) {
  2656. $slots[slotName] = true;
  2657. });
  2658. vm.$scopedSlots = vm.$slots = $slots;
  2659. }
  2660. }
  2661. function initVueIds(vueIds, mpInstance) {
  2662. vueIds = (vueIds || '').split(',');
  2663. var len = vueIds.length;
  2664. if (len === 1) {
  2665. mpInstance._$vueId = vueIds[0];
  2666. } else if (len === 2) {
  2667. mpInstance._$vueId = vueIds[0];
  2668. mpInstance._$vuePid = vueIds[1];
  2669. }
  2670. }
  2671. function initData(vueOptions, context) {
  2672. var data = vueOptions.data || {};
  2673. var methods = vueOptions.methods || {};
  2674. if (typeof data === 'function') {
  2675. try {
  2676. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  2677. } catch (e) {
  2678. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  2679. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  2680. }
  2681. }
  2682. } else {
  2683. try {
  2684. // 对 data 格式化
  2685. data = JSON.parse(JSON.stringify(data));
  2686. } catch (e) {}
  2687. }
  2688. if (!isPlainObject(data)) {
  2689. data = {};
  2690. }
  2691. Object.keys(methods).forEach(function (methodName) {
  2692. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  2693. data[methodName] = methods[methodName];
  2694. }
  2695. });
  2696. return data;
  2697. }
  2698. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  2699. function createObserver(name) {
  2700. return function observer(newVal, oldVal) {
  2701. if (this.$vm) {
  2702. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  2703. }
  2704. };
  2705. }
  2706. function initBehaviors(vueOptions, initBehavior) {
  2707. var vueBehaviors = vueOptions.behaviors;
  2708. var vueExtends = vueOptions.extends;
  2709. var vueMixins = vueOptions.mixins;
  2710. var vueProps = vueOptions.props;
  2711. if (!vueProps) {
  2712. vueOptions.props = vueProps = [];
  2713. }
  2714. var behaviors = [];
  2715. if (Array.isArray(vueBehaviors)) {
  2716. vueBehaviors.forEach(function (behavior) {
  2717. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  2718. if (behavior === 'uni://form-field') {
  2719. if (Array.isArray(vueProps)) {
  2720. vueProps.push('name');
  2721. vueProps.push('value');
  2722. } else {
  2723. vueProps.name = {
  2724. type: String,
  2725. default: ''
  2726. };
  2727. vueProps.value = {
  2728. type: [String, Number, Boolean, Array, Object, Date],
  2729. default: ''
  2730. };
  2731. }
  2732. }
  2733. });
  2734. }
  2735. if (isPlainObject(vueExtends) && vueExtends.props) {
  2736. behaviors.push(initBehavior({
  2737. properties: initProperties(vueExtends.props, true)
  2738. }));
  2739. }
  2740. if (Array.isArray(vueMixins)) {
  2741. vueMixins.forEach(function (vueMixin) {
  2742. if (isPlainObject(vueMixin) && vueMixin.props) {
  2743. behaviors.push(initBehavior({
  2744. properties: initProperties(vueMixin.props, true)
  2745. }));
  2746. }
  2747. });
  2748. }
  2749. return behaviors;
  2750. }
  2751. function parsePropType(key, type, defaultValue, file) {
  2752. // [String]=>String
  2753. if (Array.isArray(type) && type.length === 1) {
  2754. return type[0];
  2755. }
  2756. return type;
  2757. }
  2758. function initProperties(props) {
  2759. var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2760. var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  2761. var options = arguments.length > 3 ? arguments[3] : undefined;
  2762. var properties = {};
  2763. if (!isBehavior) {
  2764. properties.vueId = {
  2765. type: String,
  2766. value: ''
  2767. };
  2768. {
  2769. if (options.virtualHost) {
  2770. properties.virtualHostStyle = {
  2771. type: null,
  2772. value: ''
  2773. };
  2774. properties.virtualHostClass = {
  2775. type: null,
  2776. value: ''
  2777. };
  2778. }
  2779. }
  2780. // scopedSlotsCompiler auto
  2781. properties.scopedSlotsCompiler = {
  2782. type: String,
  2783. value: ''
  2784. };
  2785. properties.vueSlots = {
  2786. // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  2787. type: null,
  2788. value: [],
  2789. observer: function observer(newVal, oldVal) {
  2790. var $slots = Object.create(null);
  2791. newVal.forEach(function (slotName) {
  2792. $slots[slotName] = true;
  2793. });
  2794. this.setData({
  2795. $slots: $slots
  2796. });
  2797. }
  2798. };
  2799. }
  2800. if (Array.isArray(props)) {
  2801. // ['title']
  2802. props.forEach(function (key) {
  2803. properties[key] = {
  2804. type: null,
  2805. observer: createObserver(key)
  2806. };
  2807. });
  2808. } else if (isPlainObject(props)) {
  2809. // {title:{type:String,default:''},content:String}
  2810. Object.keys(props).forEach(function (key) {
  2811. var opts = props[key];
  2812. if (isPlainObject(opts)) {
  2813. // title:{type:String,default:''}
  2814. var value = opts.default;
  2815. if (isFn(value)) {
  2816. value = value();
  2817. }
  2818. opts.type = parsePropType(key, opts.type);
  2819. properties[key] = {
  2820. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  2821. value: value,
  2822. observer: createObserver(key)
  2823. };
  2824. } else {
  2825. // content:String
  2826. var type = parsePropType(key, opts);
  2827. properties[key] = {
  2828. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  2829. observer: createObserver(key)
  2830. };
  2831. }
  2832. });
  2833. }
  2834. return properties;
  2835. }
  2836. function wrapper$1(event) {
  2837. // TODO 又得兼容 mpvue 的 mp 对象
  2838. try {
  2839. event.mp = JSON.parse(JSON.stringify(event));
  2840. } catch (e) {}
  2841. event.stopPropagation = noop;
  2842. event.preventDefault = noop;
  2843. event.target = event.target || {};
  2844. if (!hasOwn(event, 'detail')) {
  2845. event.detail = {};
  2846. }
  2847. if (hasOwn(event, 'markerId')) {
  2848. event.detail = (0, _typeof2.default)(event.detail) === 'object' ? event.detail : {};
  2849. event.detail.markerId = event.markerId;
  2850. }
  2851. if (isPlainObject(event.detail)) {
  2852. event.target = Object.assign({}, event.target, event.detail);
  2853. }
  2854. return event;
  2855. }
  2856. function getExtraValue(vm, dataPathsArray) {
  2857. var context = vm;
  2858. dataPathsArray.forEach(function (dataPathArray) {
  2859. var dataPath = dataPathArray[0];
  2860. var value = dataPathArray[2];
  2861. if (dataPath || typeof value !== 'undefined') {
  2862. // ['','',index,'disable']
  2863. var propPath = dataPathArray[1];
  2864. var valuePath = dataPathArray[3];
  2865. var vFor;
  2866. if (Number.isInteger(dataPath)) {
  2867. vFor = dataPath;
  2868. } else if (!dataPath) {
  2869. vFor = context;
  2870. } else if (typeof dataPath === 'string' && dataPath) {
  2871. if (dataPath.indexOf('#s#') === 0) {
  2872. vFor = dataPath.substr(3);
  2873. } else {
  2874. vFor = vm.__get_value(dataPath, context);
  2875. }
  2876. }
  2877. if (Number.isInteger(vFor)) {
  2878. context = value;
  2879. } else if (!propPath) {
  2880. context = vFor[value];
  2881. } else {
  2882. if (Array.isArray(vFor)) {
  2883. context = vFor.find(function (vForItem) {
  2884. return vm.__get_value(propPath, vForItem) === value;
  2885. });
  2886. } else if (isPlainObject(vFor)) {
  2887. context = Object.keys(vFor).find(function (vForKey) {
  2888. return vm.__get_value(propPath, vFor[vForKey]) === value;
  2889. });
  2890. } else {
  2891. console.error('v-for 暂不支持循环数据:', vFor);
  2892. }
  2893. }
  2894. if (valuePath) {
  2895. context = vm.__get_value(valuePath, context);
  2896. }
  2897. }
  2898. });
  2899. return context;
  2900. }
  2901. function processEventExtra(vm, extra, event, __args__) {
  2902. var extraObj = {};
  2903. if (Array.isArray(extra) && extra.length) {
  2904. /**
  2905. *[
  2906. * ['data.items', 'data.id', item.data.id],
  2907. * ['metas', 'id', meta.id]
  2908. *],
  2909. *[
  2910. * ['data.items', 'data.id', item.data.id],
  2911. * ['metas', 'id', meta.id]
  2912. *],
  2913. *'test'
  2914. */
  2915. extra.forEach(function (dataPath, index) {
  2916. if (typeof dataPath === 'string') {
  2917. if (!dataPath) {
  2918. // model,prop.sync
  2919. extraObj['$' + index] = vm;
  2920. } else {
  2921. if (dataPath === '$event') {
  2922. // $event
  2923. extraObj['$' + index] = event;
  2924. } else if (dataPath === 'arguments') {
  2925. extraObj['$' + index] = event.detail ? event.detail.__args__ || __args__ : __args__;
  2926. } else if (dataPath.indexOf('$event.') === 0) {
  2927. // $event.target.value
  2928. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  2929. } else {
  2930. extraObj['$' + index] = vm.__get_value(dataPath);
  2931. }
  2932. }
  2933. } else {
  2934. extraObj['$' + index] = getExtraValue(vm, dataPath);
  2935. }
  2936. });
  2937. }
  2938. return extraObj;
  2939. }
  2940. function getObjByArray(arr) {
  2941. var obj = {};
  2942. for (var i = 1; i < arr.length; i++) {
  2943. var element = arr[i];
  2944. obj[element[0]] = element[1];
  2945. }
  2946. return obj;
  2947. }
  2948. function processEventArgs(vm, event) {
  2949. var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
  2950. var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  2951. var isCustom = arguments.length > 4 ? arguments[4] : undefined;
  2952. var methodName = arguments.length > 5 ? arguments[5] : undefined;
  2953. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  2954. // fixed 用户直接触发 mpInstance.triggerEvent
  2955. var __args__ = isPlainObject(event.detail) ? event.detail.__args__ || [event.detail] : [event.detail];
  2956. if (isCustom) {
  2957. // 自定义事件
  2958. isCustomMPEvent = event.currentTarget && event.currentTarget.dataset && event.currentTarget.dataset.comType === 'wx';
  2959. if (!args.length) {
  2960. // 无参数,直接传入 event 或 detail 数组
  2961. if (isCustomMPEvent) {
  2962. return [event];
  2963. }
  2964. return __args__;
  2965. }
  2966. }
  2967. var extraObj = processEventExtra(vm, extra, event, __args__);
  2968. var ret = [];
  2969. args.forEach(function (arg) {
  2970. if (arg === '$event') {
  2971. if (methodName === '__set_model' && !isCustom) {
  2972. // input v-model value
  2973. ret.push(event.target.value);
  2974. } else {
  2975. if (isCustom && !isCustomMPEvent) {
  2976. ret.push(__args__[0]);
  2977. } else {
  2978. // wxcomponent 组件或内置组件
  2979. ret.push(event);
  2980. }
  2981. }
  2982. } else {
  2983. if (Array.isArray(arg) && arg[0] === 'o') {
  2984. ret.push(getObjByArray(arg));
  2985. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  2986. ret.push(extraObj[arg]);
  2987. } else {
  2988. ret.push(arg);
  2989. }
  2990. }
  2991. });
  2992. return ret;
  2993. }
  2994. var ONCE = '~';
  2995. var CUSTOM = '^';
  2996. function isMatchEventType(eventType, optType) {
  2997. return eventType === optType || optType === 'regionchange' && (eventType === 'begin' || eventType === 'end');
  2998. }
  2999. function getContextVm(vm) {
  3000. var $parent = vm.$parent;
  3001. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  3002. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  3003. $parent = $parent.$parent;
  3004. }
  3005. return $parent && $parent.$parent;
  3006. }
  3007. function handleEvent(event) {
  3008. var _this2 = this;
  3009. event = wrapper$1(event);
  3010. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  3011. var dataset = (event.currentTarget || event.target).dataset;
  3012. if (!dataset) {
  3013. return console.warn('事件信息不存在');
  3014. }
  3015. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  3016. if (!eventOpts) {
  3017. return console.warn('事件信息不存在');
  3018. }
  3019. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  3020. var eventType = event.type;
  3021. var ret = [];
  3022. eventOpts.forEach(function (eventOpt) {
  3023. var type = eventOpt[0];
  3024. var eventsArray = eventOpt[1];
  3025. var isCustom = type.charAt(0) === CUSTOM;
  3026. type = isCustom ? type.slice(1) : type;
  3027. var isOnce = type.charAt(0) === ONCE;
  3028. type = isOnce ? type.slice(1) : type;
  3029. if (eventsArray && isMatchEventType(eventType, type)) {
  3030. eventsArray.forEach(function (eventArray) {
  3031. var methodName = eventArray[0];
  3032. if (methodName) {
  3033. var handlerCtx = _this2.$vm;
  3034. if (handlerCtx.$options.generic) {
  3035. // mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  3036. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  3037. }
  3038. if (methodName === '$emit') {
  3039. handlerCtx.$emit.apply(handlerCtx, processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName));
  3040. return;
  3041. }
  3042. var handler = handlerCtx[methodName];
  3043. if (!isFn(handler)) {
  3044. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  3045. var path = _this2.route || _this2.is;
  3046. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  3047. }
  3048. if (isOnce) {
  3049. if (handler.once) {
  3050. return;
  3051. }
  3052. handler.once = true;
  3053. }
  3054. var params = processEventArgs(_this2.$vm, event, eventArray[1], eventArray[2], isCustom, methodName);
  3055. params = Array.isArray(params) ? params : [];
  3056. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  3057. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  3058. // eslint-disable-next-line no-sparse-arrays
  3059. params = params.concat([,,,,,,,,,, event]);
  3060. }
  3061. ret.push(handler.apply(handlerCtx, params));
  3062. }
  3063. });
  3064. }
  3065. });
  3066. if (eventType === 'input' && ret.length === 1 && typeof ret[0] !== 'undefined') {
  3067. return ret[0];
  3068. }
  3069. }
  3070. var eventChannels = {};
  3071. function getEventChannel(id) {
  3072. var eventChannel = eventChannels[id];
  3073. delete eventChannels[id];
  3074. return eventChannel;
  3075. }
  3076. var hooks = ['onShow', 'onHide', 'onError', 'onPageNotFound', 'onThemeChange', 'onUnhandledRejection'];
  3077. function initEventChannel() {
  3078. _vue.default.prototype.getOpenerEventChannel = function () {
  3079. // 微信小程序使用自身getOpenerEventChannel
  3080. {
  3081. return this.$scope.getOpenerEventChannel();
  3082. }
  3083. };
  3084. var callHook = _vue.default.prototype.__call_hook;
  3085. _vue.default.prototype.__call_hook = function (hook, args) {
  3086. if (hook === 'onLoad' && args && args.__id__) {
  3087. this.__eventChannel__ = getEventChannel(args.__id__);
  3088. delete args.__id__;
  3089. }
  3090. return callHook.call(this, hook, args);
  3091. };
  3092. }
  3093. function initScopedSlotsParams() {
  3094. var center = {};
  3095. var parents = {};
  3096. function currentId(fn) {
  3097. var vueIds = this.$options.propsData.vueId;
  3098. if (vueIds) {
  3099. var vueId = vueIds.split(',')[0];
  3100. fn(vueId);
  3101. }
  3102. }
  3103. _vue.default.prototype.$hasSSP = function (vueId) {
  3104. var slot = center[vueId];
  3105. if (!slot) {
  3106. parents[vueId] = this;
  3107. this.$on('hook:destroyed', function () {
  3108. delete parents[vueId];
  3109. });
  3110. }
  3111. return slot;
  3112. };
  3113. _vue.default.prototype.$getSSP = function (vueId, name, needAll) {
  3114. var slot = center[vueId];
  3115. if (slot) {
  3116. var params = slot[name] || [];
  3117. if (needAll) {
  3118. return params;
  3119. }
  3120. return params[0];
  3121. }
  3122. };
  3123. _vue.default.prototype.$setSSP = function (name, value) {
  3124. var index = 0;
  3125. currentId.call(this, function (vueId) {
  3126. var slot = center[vueId];
  3127. var params = slot[name] = slot[name] || [];
  3128. params.push(value);
  3129. index = params.length - 1;
  3130. });
  3131. return index;
  3132. };
  3133. _vue.default.prototype.$initSSP = function () {
  3134. currentId.call(this, function (vueId) {
  3135. center[vueId] = {};
  3136. });
  3137. };
  3138. _vue.default.prototype.$callSSP = function () {
  3139. currentId.call(this, function (vueId) {
  3140. if (parents[vueId]) {
  3141. parents[vueId].$forceUpdate();
  3142. }
  3143. });
  3144. };
  3145. _vue.default.mixin({
  3146. destroyed: function destroyed() {
  3147. var propsData = this.$options.propsData;
  3148. var vueId = propsData && propsData.vueId;
  3149. if (vueId) {
  3150. delete center[vueId];
  3151. delete parents[vueId];
  3152. }
  3153. }
  3154. });
  3155. }
  3156. function parseBaseApp(vm, _ref4) {
  3157. var mocks = _ref4.mocks,
  3158. initRefs = _ref4.initRefs;
  3159. initEventChannel();
  3160. {
  3161. initScopedSlotsParams();
  3162. }
  3163. if (vm.$options.store) {
  3164. _vue.default.prototype.$store = vm.$options.store;
  3165. }
  3166. uniIdMixin(_vue.default);
  3167. _vue.default.prototype.mpHost = "mp-weixin";
  3168. _vue.default.mixin({
  3169. beforeCreate: function beforeCreate() {
  3170. if (!this.$options.mpType) {
  3171. return;
  3172. }
  3173. this.mpType = this.$options.mpType;
  3174. this.$mp = (0, _defineProperty2.default)({
  3175. data: {}
  3176. }, this.mpType, this.$options.mpInstance);
  3177. this.$scope = this.$options.mpInstance;
  3178. delete this.$options.mpType;
  3179. delete this.$options.mpInstance;
  3180. if (this.mpType === 'page' && typeof getApp === 'function') {
  3181. // hack vue-i18n
  3182. var app = getApp();
  3183. if (app.$vm && app.$vm.$i18n) {
  3184. this._i18n = app.$vm.$i18n;
  3185. }
  3186. }
  3187. if (this.mpType !== 'app') {
  3188. initRefs(this);
  3189. initMocks(this, mocks);
  3190. }
  3191. }
  3192. });
  3193. var appOptions = {
  3194. onLaunch: function onLaunch(args) {
  3195. if (this.$vm) {
  3196. // 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  3197. return;
  3198. }
  3199. {
  3200. if (wx.canIUse && !wx.canIUse('nextTick')) {
  3201. // 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  3202. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  3203. }
  3204. }
  3205. this.$vm = vm;
  3206. this.$vm.$mp = {
  3207. app: this
  3208. };
  3209. this.$vm.$scope = this;
  3210. // vm 上也挂载 globalData
  3211. this.$vm.globalData = this.globalData;
  3212. this.$vm._isMounted = true;
  3213. this.$vm.__call_hook('mounted', args);
  3214. this.$vm.__call_hook('onLaunch', args);
  3215. }
  3216. };
  3217. // 兼容旧版本 globalData
  3218. appOptions.globalData = vm.$options.globalData || {};
  3219. // 将 methods 中的方法挂在 getApp() 中
  3220. var methods = vm.$options.methods;
  3221. if (methods) {
  3222. Object.keys(methods).forEach(function (name) {
  3223. appOptions[name] = methods[name];
  3224. });
  3225. }
  3226. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  3227. initHooks(appOptions, hooks);
  3228. initUnknownHooks(appOptions, vm.$options);
  3229. return appOptions;
  3230. }
  3231. function parseApp(vm) {
  3232. return parseBaseApp(vm, {
  3233. mocks: mocks,
  3234. initRefs: initRefs
  3235. });
  3236. }
  3237. function createApp(vm) {
  3238. App(parseApp(vm));
  3239. return vm;
  3240. }
  3241. var encodeReserveRE = /[!'()*]/g;
  3242. var encodeReserveReplacer = function encodeReserveReplacer(c) {
  3243. return '%' + c.charCodeAt(0).toString(16);
  3244. };
  3245. var commaRE = /%2C/g;
  3246. // fixed encodeURIComponent which is more conformant to RFC3986:
  3247. // - escapes [!'()*]
  3248. // - preserve commas
  3249. var encode = function encode(str) {
  3250. return encodeURIComponent(str).replace(encodeReserveRE, encodeReserveReplacer).replace(commaRE, ',');
  3251. };
  3252. function stringifyQuery(obj) {
  3253. var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  3254. var res = obj ? Object.keys(obj).map(function (key) {
  3255. var val = obj[key];
  3256. if (val === undefined) {
  3257. return '';
  3258. }
  3259. if (val === null) {
  3260. return encodeStr(key);
  3261. }
  3262. if (Array.isArray(val)) {
  3263. var result = [];
  3264. val.forEach(function (val2) {
  3265. if (val2 === undefined) {
  3266. return;
  3267. }
  3268. if (val2 === null) {
  3269. result.push(encodeStr(key));
  3270. } else {
  3271. result.push(encodeStr(key) + '=' + encodeStr(val2));
  3272. }
  3273. });
  3274. return result.join('&');
  3275. }
  3276. return encodeStr(key) + '=' + encodeStr(val);
  3277. }).filter(function (x) {
  3278. return x.length > 0;
  3279. }).join('&') : null;
  3280. return res ? "?".concat(res) : '';
  3281. }
  3282. function parseBaseComponent(vueComponentOptions) {
  3283. var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  3284. isPage = _ref5.isPage,
  3285. initRelation = _ref5.initRelation;
  3286. var needVueOptions = arguments.length > 2 ? arguments[2] : undefined;
  3287. var _initVueComponent = initVueComponent(_vue.default, vueComponentOptions),
  3288. _initVueComponent2 = (0, _slicedToArray2.default)(_initVueComponent, 2),
  3289. VueComponent = _initVueComponent2[0],
  3290. vueOptions = _initVueComponent2[1];
  3291. var options = _objectSpread({
  3292. multipleSlots: true,
  3293. // styleIsolation: 'apply-shared',
  3294. addGlobalClass: true
  3295. }, vueOptions.options || {});
  3296. {
  3297. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  3298. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  3299. Object.assign(options, vueOptions['mp-weixin'].options);
  3300. }
  3301. }
  3302. var componentOptions = {
  3303. options: options,
  3304. data: initData(vueOptions, _vue.default.prototype),
  3305. behaviors: initBehaviors(vueOptions, initBehavior),
  3306. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  3307. lifetimes: {
  3308. attached: function attached() {
  3309. var properties = this.properties;
  3310. var options = {
  3311. mpType: isPage.call(this) ? 'page' : 'component',
  3312. mpInstance: this,
  3313. propsData: properties
  3314. };
  3315. initVueIds(properties.vueId, this);
  3316. // 处理父子关系
  3317. initRelation.call(this, {
  3318. vuePid: this._$vuePid,
  3319. vueOptions: options
  3320. });
  3321. // 初始化 vue 实例
  3322. this.$vm = new VueComponent(options);
  3323. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  3324. initSlots(this.$vm, properties.vueSlots);
  3325. // 触发首次 setData
  3326. this.$vm.$mount();
  3327. },
  3328. ready: function ready() {
  3329. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  3330. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  3331. if (this.$vm) {
  3332. this.$vm._isMounted = true;
  3333. this.$vm.__call_hook('mounted');
  3334. this.$vm.__call_hook('onReady');
  3335. }
  3336. },
  3337. detached: function detached() {
  3338. this.$vm && this.$vm.$destroy();
  3339. }
  3340. },
  3341. pageLifetimes: {
  3342. show: function show(args) {
  3343. this.$vm && this.$vm.__call_hook('onPageShow', args);
  3344. },
  3345. hide: function hide() {
  3346. this.$vm && this.$vm.__call_hook('onPageHide');
  3347. },
  3348. resize: function resize(size) {
  3349. this.$vm && this.$vm.__call_hook('onPageResize', size);
  3350. }
  3351. },
  3352. methods: {
  3353. __l: handleLink,
  3354. __e: handleEvent
  3355. }
  3356. };
  3357. // externalClasses
  3358. if (vueOptions.externalClasses) {
  3359. componentOptions.externalClasses = vueOptions.externalClasses;
  3360. }
  3361. if (Array.isArray(vueOptions.wxsCallMethods)) {
  3362. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  3363. componentOptions.methods[callMethod] = function (args) {
  3364. return this.$vm[callMethod](args);
  3365. };
  3366. });
  3367. }
  3368. if (needVueOptions) {
  3369. return [componentOptions, vueOptions, VueComponent];
  3370. }
  3371. if (isPage) {
  3372. return componentOptions;
  3373. }
  3374. return [componentOptions, VueComponent];
  3375. }
  3376. function parseComponent(vueComponentOptions, needVueOptions) {
  3377. return parseBaseComponent(vueComponentOptions, {
  3378. isPage: isPage,
  3379. initRelation: initRelation
  3380. }, needVueOptions);
  3381. }
  3382. var hooks$1 = ['onShow', 'onHide', 'onUnload'];
  3383. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  3384. function parseBasePage(vuePageOptions) {
  3385. var _parseComponent = parseComponent(vuePageOptions, true),
  3386. _parseComponent2 = (0, _slicedToArray2.default)(_parseComponent, 2),
  3387. pageOptions = _parseComponent2[0],
  3388. vueOptions = _parseComponent2[1];
  3389. initHooks(pageOptions.methods, hooks$1, vueOptions);
  3390. pageOptions.methods.onLoad = function (query) {
  3391. this.options = query;
  3392. var copyQuery = Object.assign({}, query);
  3393. delete copyQuery.__id__;
  3394. this.$page = {
  3395. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery)
  3396. };
  3397. this.$vm.$mp.query = query; // 兼容 mpvue
  3398. this.$vm.__call_hook('onLoad', query);
  3399. };
  3400. {
  3401. initUnknownHooks(pageOptions.methods, vuePageOptions, ['onReady']);
  3402. }
  3403. {
  3404. initWorkletMethods(pageOptions.methods, vueOptions.methods);
  3405. }
  3406. return pageOptions;
  3407. }
  3408. function parsePage(vuePageOptions) {
  3409. return parseBasePage(vuePageOptions);
  3410. }
  3411. function createPage(vuePageOptions) {
  3412. {
  3413. return Component(parsePage(vuePageOptions));
  3414. }
  3415. }
  3416. function createComponent(vueOptions) {
  3417. {
  3418. return Component(parseComponent(vueOptions));
  3419. }
  3420. }
  3421. function createSubpackageApp(vm) {
  3422. var appOptions = parseApp(vm);
  3423. var app = getApp({
  3424. allowDefault: true
  3425. });
  3426. vm.$scope = app;
  3427. var globalData = app.globalData;
  3428. if (globalData) {
  3429. Object.keys(appOptions.globalData).forEach(function (name) {
  3430. if (!hasOwn(globalData, name)) {
  3431. globalData[name] = appOptions.globalData[name];
  3432. }
  3433. });
  3434. }
  3435. Object.keys(appOptions).forEach(function (name) {
  3436. if (!hasOwn(app, name)) {
  3437. app[name] = appOptions[name];
  3438. }
  3439. });
  3440. if (isFn(appOptions.onShow) && wx.onAppShow) {
  3441. wx.onAppShow(function () {
  3442. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  3443. args[_key5] = arguments[_key5];
  3444. }
  3445. vm.__call_hook('onShow', args);
  3446. });
  3447. }
  3448. if (isFn(appOptions.onHide) && wx.onAppHide) {
  3449. wx.onAppHide(function () {
  3450. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  3451. args[_key6] = arguments[_key6];
  3452. }
  3453. vm.__call_hook('onHide', args);
  3454. });
  3455. }
  3456. if (isFn(appOptions.onLaunch)) {
  3457. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  3458. vm.__call_hook('onLaunch', args);
  3459. }
  3460. return vm;
  3461. }
  3462. function createPlugin(vm) {
  3463. var appOptions = parseApp(vm);
  3464. if (isFn(appOptions.onShow) && wx.onAppShow) {
  3465. wx.onAppShow(function () {
  3466. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  3467. args[_key7] = arguments[_key7];
  3468. }
  3469. vm.__call_hook('onShow', args);
  3470. });
  3471. }
  3472. if (isFn(appOptions.onHide) && wx.onAppHide) {
  3473. wx.onAppHide(function () {
  3474. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  3475. args[_key8] = arguments[_key8];
  3476. }
  3477. vm.__call_hook('onHide', args);
  3478. });
  3479. }
  3480. if (isFn(appOptions.onLaunch)) {
  3481. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  3482. vm.__call_hook('onLaunch', args);
  3483. }
  3484. return vm;
  3485. }
  3486. todos.forEach(function (todoApi) {
  3487. protocols[todoApi] = false;
  3488. });
  3489. canIUses.forEach(function (canIUseApi) {
  3490. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name : canIUseApi;
  3491. if (!wx.canIUse(apiName)) {
  3492. protocols[canIUseApi] = false;
  3493. }
  3494. });
  3495. var uni = {};
  3496. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  3497. uni = new Proxy({}, {
  3498. get: function get(target, name) {
  3499. if (hasOwn(target, name)) {
  3500. return target[name];
  3501. }
  3502. if (baseApi[name]) {
  3503. return baseApi[name];
  3504. }
  3505. if (api[name]) {
  3506. return promisify(name, api[name]);
  3507. }
  3508. {
  3509. if (extraApi[name]) {
  3510. return promisify(name, extraApi[name]);
  3511. }
  3512. if (todoApis[name]) {
  3513. return promisify(name, todoApis[name]);
  3514. }
  3515. }
  3516. if (eventApi[name]) {
  3517. return eventApi[name];
  3518. }
  3519. return promisify(name, wrapper(name, wx[name]));
  3520. },
  3521. set: function set(target, name, value) {
  3522. target[name] = value;
  3523. return true;
  3524. }
  3525. });
  3526. } else {
  3527. Object.keys(baseApi).forEach(function (name) {
  3528. uni[name] = baseApi[name];
  3529. });
  3530. {
  3531. Object.keys(todoApis).forEach(function (name) {
  3532. uni[name] = promisify(name, todoApis[name]);
  3533. });
  3534. Object.keys(extraApi).forEach(function (name) {
  3535. uni[name] = promisify(name, extraApi[name]);
  3536. });
  3537. }
  3538. Object.keys(eventApi).forEach(function (name) {
  3539. uni[name] = eventApi[name];
  3540. });
  3541. Object.keys(api).forEach(function (name) {
  3542. uni[name] = promisify(name, api[name]);
  3543. });
  3544. Object.keys(wx).forEach(function (name) {
  3545. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  3546. uni[name] = promisify(name, wrapper(name, wx[name]));
  3547. }
  3548. });
  3549. }
  3550. wx.createApp = createApp;
  3551. wx.createPage = createPage;
  3552. wx.createComponent = createComponent;
  3553. wx.createSubpackageApp = createSubpackageApp;
  3554. wx.createPlugin = createPlugin;
  3555. var uni$1 = uni;
  3556. var _default = uni$1;
  3557. exports.default = _default;
  3558. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  3559. /***/ }),
  3560. /***/ 20:
  3561. /*!****************************************************************!*\
  3562. !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!
  3563. \****************************************************************/
  3564. /*! no static exports found */
  3565. /***/ (function(module, exports) {
  3566. function _iterableToArray(iter) {
  3567. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  3568. }
  3569. module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3570. /***/ }),
  3571. /***/ 21:
  3572. /*!******************************************************************!*\
  3573. !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!
  3574. \******************************************************************/
  3575. /*! no static exports found */
  3576. /***/ (function(module, exports) {
  3577. function _nonIterableSpread() {
  3578. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3579. }
  3580. module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports;
  3581. /***/ }),
  3582. /***/ 22:
  3583. /*!*************************************************************!*\
  3584. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  3585. \*************************************************************/
  3586. /*! no static exports found */
  3587. /***/ (function(module, exports, __webpack_require__) {
  3588. "use strict";
  3589. /* WEBPACK VAR INJECTION */(function(uni, global) {
  3590. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  3591. Object.defineProperty(exports, "__esModule", {
  3592. value: true
  3593. });
  3594. exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;
  3595. exports.compileI18nJsonStr = compileI18nJsonStr;
  3596. exports.hasI18nJson = hasI18nJson;
  3597. exports.initVueI18n = initVueI18n;
  3598. exports.isI18nStr = isI18nStr;
  3599. exports.isString = void 0;
  3600. exports.normalizeLocale = normalizeLocale;
  3601. exports.parseI18nJson = parseI18nJson;
  3602. exports.resolveLocale = resolveLocale;
  3603. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  3604. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  3605. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  3606. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  3607. var isObject = function isObject(val) {
  3608. return val !== null && (0, _typeof2.default)(val) === 'object';
  3609. };
  3610. var defaultDelimiters = ['{', '}'];
  3611. var BaseFormatter = /*#__PURE__*/function () {
  3612. function BaseFormatter() {
  3613. (0, _classCallCheck2.default)(this, BaseFormatter);
  3614. this._caches = Object.create(null);
  3615. }
  3616. (0, _createClass2.default)(BaseFormatter, [{
  3617. key: "interpolate",
  3618. value: function interpolate(message, values) {
  3619. var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  3620. if (!values) {
  3621. return [message];
  3622. }
  3623. var tokens = this._caches[message];
  3624. if (!tokens) {
  3625. tokens = parse(message, delimiters);
  3626. this._caches[message] = tokens;
  3627. }
  3628. return compile(tokens, values);
  3629. }
  3630. }]);
  3631. return BaseFormatter;
  3632. }();
  3633. exports.Formatter = BaseFormatter;
  3634. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  3635. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  3636. function parse(format, _ref) {
  3637. var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
  3638. startDelimiter = _ref2[0],
  3639. endDelimiter = _ref2[1];
  3640. var tokens = [];
  3641. var position = 0;
  3642. var text = '';
  3643. while (position < format.length) {
  3644. var char = format[position++];
  3645. if (char === startDelimiter) {
  3646. if (text) {
  3647. tokens.push({
  3648. type: 'text',
  3649. value: text
  3650. });
  3651. }
  3652. text = '';
  3653. var sub = '';
  3654. char = format[position++];
  3655. while (char !== undefined && char !== endDelimiter) {
  3656. sub += char;
  3657. char = format[position++];
  3658. }
  3659. var isClosed = char === endDelimiter;
  3660. var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';
  3661. tokens.push({
  3662. value: sub,
  3663. type: type
  3664. });
  3665. }
  3666. // else if (char === '%') {
  3667. // // when found rails i18n syntax, skip text capture
  3668. // if (format[position] !== '{') {
  3669. // text += char
  3670. // }
  3671. // }
  3672. else {
  3673. text += char;
  3674. }
  3675. }
  3676. text && tokens.push({
  3677. type: 'text',
  3678. value: text
  3679. });
  3680. return tokens;
  3681. }
  3682. function compile(tokens, values) {
  3683. var compiled = [];
  3684. var index = 0;
  3685. var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';
  3686. if (mode === 'unknown') {
  3687. return compiled;
  3688. }
  3689. while (index < tokens.length) {
  3690. var token = tokens[index];
  3691. switch (token.type) {
  3692. case 'text':
  3693. compiled.push(token.value);
  3694. break;
  3695. case 'list':
  3696. compiled.push(values[parseInt(token.value, 10)]);
  3697. break;
  3698. case 'named':
  3699. if (mode === 'named') {
  3700. compiled.push(values[token.value]);
  3701. } else {
  3702. if (true) {
  3703. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  3704. }
  3705. }
  3706. break;
  3707. case 'unknown':
  3708. if (true) {
  3709. console.warn("Detect 'unknown' type of token!");
  3710. }
  3711. break;
  3712. }
  3713. index++;
  3714. }
  3715. return compiled;
  3716. }
  3717. var LOCALE_ZH_HANS = 'zh-Hans';
  3718. exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  3719. var LOCALE_ZH_HANT = 'zh-Hant';
  3720. exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  3721. var LOCALE_EN = 'en';
  3722. exports.LOCALE_EN = LOCALE_EN;
  3723. var LOCALE_FR = 'fr';
  3724. exports.LOCALE_FR = LOCALE_FR;
  3725. var LOCALE_ES = 'es';
  3726. exports.LOCALE_ES = LOCALE_ES;
  3727. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3728. var hasOwn = function hasOwn(val, key) {
  3729. return hasOwnProperty.call(val, key);
  3730. };
  3731. var defaultFormatter = new BaseFormatter();
  3732. function include(str, parts) {
  3733. return !!parts.find(function (part) {
  3734. return str.indexOf(part) !== -1;
  3735. });
  3736. }
  3737. function startsWith(str, parts) {
  3738. return parts.find(function (part) {
  3739. return str.indexOf(part) === 0;
  3740. });
  3741. }
  3742. function normalizeLocale(locale, messages) {
  3743. if (!locale) {
  3744. return;
  3745. }
  3746. locale = locale.trim().replace(/_/g, '-');
  3747. if (messages && messages[locale]) {
  3748. return locale;
  3749. }
  3750. locale = locale.toLowerCase();
  3751. if (locale === 'chinese') {
  3752. // 支付宝
  3753. return LOCALE_ZH_HANS;
  3754. }
  3755. if (locale.indexOf('zh') === 0) {
  3756. if (locale.indexOf('-hans') > -1) {
  3757. return LOCALE_ZH_HANS;
  3758. }
  3759. if (locale.indexOf('-hant') > -1) {
  3760. return LOCALE_ZH_HANT;
  3761. }
  3762. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  3763. return LOCALE_ZH_HANT;
  3764. }
  3765. return LOCALE_ZH_HANS;
  3766. }
  3767. var locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
  3768. if (messages && Object.keys(messages).length > 0) {
  3769. locales = Object.keys(messages);
  3770. }
  3771. var lang = startsWith(locale, locales);
  3772. if (lang) {
  3773. return lang;
  3774. }
  3775. }
  3776. var I18n = /*#__PURE__*/function () {
  3777. function I18n(_ref3) {
  3778. var locale = _ref3.locale,
  3779. fallbackLocale = _ref3.fallbackLocale,
  3780. messages = _ref3.messages,
  3781. watcher = _ref3.watcher,
  3782. formater = _ref3.formater;
  3783. (0, _classCallCheck2.default)(this, I18n);
  3784. this.locale = LOCALE_EN;
  3785. this.fallbackLocale = LOCALE_EN;
  3786. this.message = {};
  3787. this.messages = {};
  3788. this.watchers = [];
  3789. if (fallbackLocale) {
  3790. this.fallbackLocale = fallbackLocale;
  3791. }
  3792. this.formater = formater || defaultFormatter;
  3793. this.messages = messages || {};
  3794. this.setLocale(locale || LOCALE_EN);
  3795. if (watcher) {
  3796. this.watchLocale(watcher);
  3797. }
  3798. }
  3799. (0, _createClass2.default)(I18n, [{
  3800. key: "setLocale",
  3801. value: function setLocale(locale) {
  3802. var _this = this;
  3803. var oldLocale = this.locale;
  3804. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  3805. if (!this.messages[this.locale]) {
  3806. // 可能初始化时不存在
  3807. this.messages[this.locale] = {};
  3808. }
  3809. this.message = this.messages[this.locale];
  3810. // 仅发生变化时,通知
  3811. if (oldLocale !== this.locale) {
  3812. this.watchers.forEach(function (watcher) {
  3813. watcher(_this.locale, oldLocale);
  3814. });
  3815. }
  3816. }
  3817. }, {
  3818. key: "getLocale",
  3819. value: function getLocale() {
  3820. return this.locale;
  3821. }
  3822. }, {
  3823. key: "watchLocale",
  3824. value: function watchLocale(fn) {
  3825. var _this2 = this;
  3826. var index = this.watchers.push(fn) - 1;
  3827. return function () {
  3828. _this2.watchers.splice(index, 1);
  3829. };
  3830. }
  3831. }, {
  3832. key: "add",
  3833. value: function add(locale, message) {
  3834. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3835. var curMessages = this.messages[locale];
  3836. if (curMessages) {
  3837. if (override) {
  3838. Object.assign(curMessages, message);
  3839. } else {
  3840. Object.keys(message).forEach(function (key) {
  3841. if (!hasOwn(curMessages, key)) {
  3842. curMessages[key] = message[key];
  3843. }
  3844. });
  3845. }
  3846. } else {
  3847. this.messages[locale] = message;
  3848. }
  3849. }
  3850. }, {
  3851. key: "f",
  3852. value: function f(message, values, delimiters) {
  3853. return this.formater.interpolate(message, values, delimiters).join('');
  3854. }
  3855. }, {
  3856. key: "t",
  3857. value: function t(key, locale, values) {
  3858. var message = this.message;
  3859. if (typeof locale === 'string') {
  3860. locale = normalizeLocale(locale, this.messages);
  3861. locale && (message = this.messages[locale]);
  3862. } else {
  3863. values = locale;
  3864. }
  3865. if (!hasOwn(message, key)) {
  3866. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  3867. return key;
  3868. }
  3869. return this.formater.interpolate(message[key], values).join('');
  3870. }
  3871. }]);
  3872. return I18n;
  3873. }();
  3874. exports.I18n = I18n;
  3875. function watchAppLocale(appVm, i18n) {
  3876. // 需要保证 watch 的触发在组件渲染之前
  3877. if (appVm.$watchLocale) {
  3878. // vue2
  3879. appVm.$watchLocale(function (newLocale) {
  3880. i18n.setLocale(newLocale);
  3881. });
  3882. } else {
  3883. appVm.$watch(function () {
  3884. return appVm.$locale;
  3885. }, function (newLocale) {
  3886. i18n.setLocale(newLocale);
  3887. });
  3888. }
  3889. }
  3890. function getDefaultLocale() {
  3891. if (typeof uni !== 'undefined' && uni.getLocale) {
  3892. return uni.getLocale();
  3893. }
  3894. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  3895. if (typeof global !== 'undefined' && global.getLocale) {
  3896. return global.getLocale();
  3897. }
  3898. return LOCALE_EN;
  3899. }
  3900. function initVueI18n(locale) {
  3901. var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3902. var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;
  3903. var watcher = arguments.length > 3 ? arguments[3] : undefined;
  3904. // 兼容旧版本入参
  3905. if (typeof locale !== 'string') {
  3906. var _ref4 = [messages, locale];
  3907. locale = _ref4[0];
  3908. messages = _ref4[1];
  3909. }
  3910. if (typeof locale !== 'string') {
  3911. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  3912. locale = getDefaultLocale();
  3913. }
  3914. if (typeof fallbackLocale !== 'string') {
  3915. fallbackLocale = typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale || LOCALE_EN;
  3916. }
  3917. var i18n = new I18n({
  3918. locale: locale,
  3919. fallbackLocale: fallbackLocale,
  3920. messages: messages,
  3921. watcher: watcher
  3922. });
  3923. var _t = function t(key, values) {
  3924. if (typeof getApp !== 'function') {
  3925. // app view
  3926. /* eslint-disable no-func-assign */
  3927. _t = function t(key, values) {
  3928. return i18n.t(key, values);
  3929. };
  3930. } else {
  3931. var isWatchedAppLocale = false;
  3932. _t = function t(key, values) {
  3933. var appVm = getApp().$vm;
  3934. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  3935. // options: {
  3936. // type: Array,
  3937. // default () {
  3938. // return [{
  3939. // icon: 'shop',
  3940. // text: t("uni-goods-nav.options.shop"),
  3941. // }, {
  3942. // icon: 'cart',
  3943. // text: t("uni-goods-nav.options.cart")
  3944. // }]
  3945. // }
  3946. // },
  3947. if (appVm) {
  3948. // 触发响应式
  3949. appVm.$locale;
  3950. if (!isWatchedAppLocale) {
  3951. isWatchedAppLocale = true;
  3952. watchAppLocale(appVm, i18n);
  3953. }
  3954. }
  3955. return i18n.t(key, values);
  3956. };
  3957. }
  3958. return _t(key, values);
  3959. };
  3960. return {
  3961. i18n: i18n,
  3962. f: function f(message, values, delimiters) {
  3963. return i18n.f(message, values, delimiters);
  3964. },
  3965. t: function t(key, values) {
  3966. return _t(key, values);
  3967. },
  3968. add: function add(locale, message) {
  3969. var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  3970. return i18n.add(locale, message, override);
  3971. },
  3972. watch: function watch(fn) {
  3973. return i18n.watchLocale(fn);
  3974. },
  3975. getLocale: function getLocale() {
  3976. return i18n.getLocale();
  3977. },
  3978. setLocale: function setLocale(newLocale) {
  3979. return i18n.setLocale(newLocale);
  3980. }
  3981. };
  3982. }
  3983. var isString = function isString(val) {
  3984. return typeof val === 'string';
  3985. };
  3986. exports.isString = isString;
  3987. var formater;
  3988. function hasI18nJson(jsonObj, delimiters) {
  3989. if (!formater) {
  3990. formater = new BaseFormatter();
  3991. }
  3992. return walkJsonObj(jsonObj, function (jsonObj, key) {
  3993. var value = jsonObj[key];
  3994. if (isString(value)) {
  3995. if (isI18nStr(value, delimiters)) {
  3996. return true;
  3997. }
  3998. } else {
  3999. return hasI18nJson(value, delimiters);
  4000. }
  4001. });
  4002. }
  4003. function parseI18nJson(jsonObj, values, delimiters) {
  4004. if (!formater) {
  4005. formater = new BaseFormatter();
  4006. }
  4007. walkJsonObj(jsonObj, function (jsonObj, key) {
  4008. var value = jsonObj[key];
  4009. if (isString(value)) {
  4010. if (isI18nStr(value, delimiters)) {
  4011. jsonObj[key] = compileStr(value, values, delimiters);
  4012. }
  4013. } else {
  4014. parseI18nJson(value, values, delimiters);
  4015. }
  4016. });
  4017. return jsonObj;
  4018. }
  4019. function compileI18nJsonStr(jsonStr, _ref5) {
  4020. var locale = _ref5.locale,
  4021. locales = _ref5.locales,
  4022. delimiters = _ref5.delimiters;
  4023. if (!isI18nStr(jsonStr, delimiters)) {
  4024. return jsonStr;
  4025. }
  4026. if (!formater) {
  4027. formater = new BaseFormatter();
  4028. }
  4029. var localeValues = [];
  4030. Object.keys(locales).forEach(function (name) {
  4031. if (name !== locale) {
  4032. localeValues.push({
  4033. locale: name,
  4034. values: locales[name]
  4035. });
  4036. }
  4037. });
  4038. localeValues.unshift({
  4039. locale: locale,
  4040. values: locales[locale]
  4041. });
  4042. try {
  4043. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  4044. } catch (e) {}
  4045. return jsonStr;
  4046. }
  4047. function isI18nStr(value, delimiters) {
  4048. return value.indexOf(delimiters[0]) > -1;
  4049. }
  4050. function compileStr(value, values, delimiters) {
  4051. return formater.interpolate(value, values, delimiters).join('');
  4052. }
  4053. function compileValue(jsonObj, key, localeValues, delimiters) {
  4054. var value = jsonObj[key];
  4055. if (isString(value)) {
  4056. // 存在国际化
  4057. if (isI18nStr(value, delimiters)) {
  4058. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  4059. if (localeValues.length > 1) {
  4060. // 格式化国际化语言
  4061. var valueLocales = jsonObj[key + 'Locales'] = {};
  4062. localeValues.forEach(function (localValue) {
  4063. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  4064. });
  4065. }
  4066. }
  4067. } else {
  4068. compileJsonObj(value, localeValues, delimiters);
  4069. }
  4070. }
  4071. function compileJsonObj(jsonObj, localeValues, delimiters) {
  4072. walkJsonObj(jsonObj, function (jsonObj, key) {
  4073. compileValue(jsonObj, key, localeValues, delimiters);
  4074. });
  4075. return jsonObj;
  4076. }
  4077. function walkJsonObj(jsonObj, walk) {
  4078. if (Array.isArray(jsonObj)) {
  4079. for (var i = 0; i < jsonObj.length; i++) {
  4080. if (walk(jsonObj, i)) {
  4081. return true;
  4082. }
  4083. }
  4084. } else if (isObject(jsonObj)) {
  4085. for (var key in jsonObj) {
  4086. if (walk(jsonObj, key)) {
  4087. return true;
  4088. }
  4089. }
  4090. }
  4091. return false;
  4092. }
  4093. function resolveLocale(locales) {
  4094. return function (locale) {
  4095. if (!locale) {
  4096. return locale;
  4097. }
  4098. locale = normalizeLocale(locale) || locale;
  4099. return resolveLocaleChain(locale).find(function (locale) {
  4100. return locales.indexOf(locale) > -1;
  4101. });
  4102. };
  4103. }
  4104. function resolveLocaleChain(locale) {
  4105. var chain = [];
  4106. var tokens = locale.split('-');
  4107. while (tokens.length) {
  4108. chain.push(tokens.join('-'));
  4109. tokens.pop();
  4110. }
  4111. return chain;
  4112. }
  4113. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 3)))
  4114. /***/ }),
  4115. /***/ 23:
  4116. /*!***************************************************************!*\
  4117. !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!
  4118. \***************************************************************/
  4119. /*! no static exports found */
  4120. /***/ (function(module, exports) {
  4121. function _classCallCheck(instance, Constructor) {
  4122. if (!(instance instanceof Constructor)) {
  4123. throw new TypeError("Cannot call a class as a function");
  4124. }
  4125. }
  4126. module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4127. /***/ }),
  4128. /***/ 24:
  4129. /*!************************************************************!*\
  4130. !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!
  4131. \************************************************************/
  4132. /*! no static exports found */
  4133. /***/ (function(module, exports, __webpack_require__) {
  4134. var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ 12);
  4135. function _defineProperties(target, props) {
  4136. for (var i = 0; i < props.length; i++) {
  4137. var descriptor = props[i];
  4138. descriptor.enumerable = descriptor.enumerable || false;
  4139. descriptor.configurable = true;
  4140. if ("value" in descriptor) descriptor.writable = true;
  4141. Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
  4142. }
  4143. }
  4144. function _createClass(Constructor, protoProps, staticProps) {
  4145. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  4146. if (staticProps) _defineProperties(Constructor, staticProps);
  4147. Object.defineProperty(Constructor, "prototype", {
  4148. writable: false
  4149. });
  4150. return Constructor;
  4151. }
  4152. module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
  4153. /***/ }),
  4154. /***/ 25:
  4155. /*!******************************************************************************************!*\
  4156. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  4157. \******************************************************************************************/
  4158. /*! exports provided: default */
  4159. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4160. "use strict";
  4161. __webpack_require__.r(__webpack_exports__);
  4162. /* WEBPACK VAR INJECTION */(function(global) {/*!
  4163. * Vue.js v2.6.11
  4164. * (c) 2014-2023 Evan You
  4165. * Released under the MIT License.
  4166. */
  4167. /* */
  4168. var emptyObject = Object.freeze({});
  4169. // These helpers produce better VM code in JS engines due to their
  4170. // explicitness and function inlining.
  4171. function isUndef (v) {
  4172. return v === undefined || v === null
  4173. }
  4174. function isDef (v) {
  4175. return v !== undefined && v !== null
  4176. }
  4177. function isTrue (v) {
  4178. return v === true
  4179. }
  4180. function isFalse (v) {
  4181. return v === false
  4182. }
  4183. /**
  4184. * Check if value is primitive.
  4185. */
  4186. function isPrimitive (value) {
  4187. return (
  4188. typeof value === 'string' ||
  4189. typeof value === 'number' ||
  4190. // $flow-disable-line
  4191. typeof value === 'symbol' ||
  4192. typeof value === 'boolean'
  4193. )
  4194. }
  4195. /**
  4196. * Quick object check - this is primarily used to tell
  4197. * Objects from primitive values when we know the value
  4198. * is a JSON-compliant type.
  4199. */
  4200. function isObject (obj) {
  4201. return obj !== null && typeof obj === 'object'
  4202. }
  4203. /**
  4204. * Get the raw type string of a value, e.g., [object Object].
  4205. */
  4206. var _toString = Object.prototype.toString;
  4207. function toRawType (value) {
  4208. return _toString.call(value).slice(8, -1)
  4209. }
  4210. /**
  4211. * Strict object type check. Only returns true
  4212. * for plain JavaScript objects.
  4213. */
  4214. function isPlainObject (obj) {
  4215. return _toString.call(obj) === '[object Object]'
  4216. }
  4217. function isRegExp (v) {
  4218. return _toString.call(v) === '[object RegExp]'
  4219. }
  4220. /**
  4221. * Check if val is a valid array index.
  4222. */
  4223. function isValidArrayIndex (val) {
  4224. var n = parseFloat(String(val));
  4225. return n >= 0 && Math.floor(n) === n && isFinite(val)
  4226. }
  4227. function isPromise (val) {
  4228. return (
  4229. isDef(val) &&
  4230. typeof val.then === 'function' &&
  4231. typeof val.catch === 'function'
  4232. )
  4233. }
  4234. /**
  4235. * Convert a value to a string that is actually rendered.
  4236. */
  4237. function toString (val) {
  4238. return val == null
  4239. ? ''
  4240. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  4241. ? JSON.stringify(val, null, 2)
  4242. : String(val)
  4243. }
  4244. /**
  4245. * Convert an input value to a number for persistence.
  4246. * If the conversion fails, return original string.
  4247. */
  4248. function toNumber (val) {
  4249. var n = parseFloat(val);
  4250. return isNaN(n) ? val : n
  4251. }
  4252. /**
  4253. * Make a map and return a function for checking if a key
  4254. * is in that map.
  4255. */
  4256. function makeMap (
  4257. str,
  4258. expectsLowerCase
  4259. ) {
  4260. var map = Object.create(null);
  4261. var list = str.split(',');
  4262. for (var i = 0; i < list.length; i++) {
  4263. map[list[i]] = true;
  4264. }
  4265. return expectsLowerCase
  4266. ? function (val) { return map[val.toLowerCase()]; }
  4267. : function (val) { return map[val]; }
  4268. }
  4269. /**
  4270. * Check if a tag is a built-in tag.
  4271. */
  4272. var isBuiltInTag = makeMap('slot,component', true);
  4273. /**
  4274. * Check if an attribute is a reserved attribute.
  4275. */
  4276. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  4277. /**
  4278. * Remove an item from an array.
  4279. */
  4280. function remove (arr, item) {
  4281. if (arr.length) {
  4282. var index = arr.indexOf(item);
  4283. if (index > -1) {
  4284. return arr.splice(index, 1)
  4285. }
  4286. }
  4287. }
  4288. /**
  4289. * Check whether an object has the property.
  4290. */
  4291. var hasOwnProperty = Object.prototype.hasOwnProperty;
  4292. function hasOwn (obj, key) {
  4293. return hasOwnProperty.call(obj, key)
  4294. }
  4295. /**
  4296. * Create a cached version of a pure function.
  4297. */
  4298. function cached (fn) {
  4299. var cache = Object.create(null);
  4300. return (function cachedFn (str) {
  4301. var hit = cache[str];
  4302. return hit || (cache[str] = fn(str))
  4303. })
  4304. }
  4305. /**
  4306. * Camelize a hyphen-delimited string.
  4307. */
  4308. var camelizeRE = /-(\w)/g;
  4309. var camelize = cached(function (str) {
  4310. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  4311. });
  4312. /**
  4313. * Capitalize a string.
  4314. */
  4315. var capitalize = cached(function (str) {
  4316. return str.charAt(0).toUpperCase() + str.slice(1)
  4317. });
  4318. /**
  4319. * Hyphenate a camelCase string.
  4320. */
  4321. var hyphenateRE = /\B([A-Z])/g;
  4322. var hyphenate = cached(function (str) {
  4323. return str.replace(hyphenateRE, '-$1').toLowerCase()
  4324. });
  4325. /**
  4326. * Simple bind polyfill for environments that do not support it,
  4327. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  4328. * since native bind is now performant enough in most browsers.
  4329. * But removing it would mean breaking code that was able to run in
  4330. * PhantomJS 1.x, so this must be kept for backward compatibility.
  4331. */
  4332. /* istanbul ignore next */
  4333. function polyfillBind (fn, ctx) {
  4334. function boundFn (a) {
  4335. var l = arguments.length;
  4336. return l
  4337. ? l > 1
  4338. ? fn.apply(ctx, arguments)
  4339. : fn.call(ctx, a)
  4340. : fn.call(ctx)
  4341. }
  4342. boundFn._length = fn.length;
  4343. return boundFn
  4344. }
  4345. function nativeBind (fn, ctx) {
  4346. return fn.bind(ctx)
  4347. }
  4348. var bind = Function.prototype.bind
  4349. ? nativeBind
  4350. : polyfillBind;
  4351. /**
  4352. * Convert an Array-like object to a real Array.
  4353. */
  4354. function toArray (list, start) {
  4355. start = start || 0;
  4356. var i = list.length - start;
  4357. var ret = new Array(i);
  4358. while (i--) {
  4359. ret[i] = list[i + start];
  4360. }
  4361. return ret
  4362. }
  4363. /**
  4364. * Mix properties into target object.
  4365. */
  4366. function extend (to, _from) {
  4367. for (var key in _from) {
  4368. to[key] = _from[key];
  4369. }
  4370. return to
  4371. }
  4372. /**
  4373. * Merge an Array of Objects into a single Object.
  4374. */
  4375. function toObject (arr) {
  4376. var res = {};
  4377. for (var i = 0; i < arr.length; i++) {
  4378. if (arr[i]) {
  4379. extend(res, arr[i]);
  4380. }
  4381. }
  4382. return res
  4383. }
  4384. /* eslint-disable no-unused-vars */
  4385. /**
  4386. * Perform no operation.
  4387. * Stubbing args to make Flow happy without leaving useless transpiled code
  4388. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  4389. */
  4390. function noop (a, b, c) {}
  4391. /**
  4392. * Always return false.
  4393. */
  4394. var no = function (a, b, c) { return false; };
  4395. /* eslint-enable no-unused-vars */
  4396. /**
  4397. * Return the same value.
  4398. */
  4399. var identity = function (_) { return _; };
  4400. /**
  4401. * Check if two values are loosely equal - that is,
  4402. * if they are plain objects, do they have the same shape?
  4403. */
  4404. function looseEqual (a, b) {
  4405. if (a === b) { return true }
  4406. var isObjectA = isObject(a);
  4407. var isObjectB = isObject(b);
  4408. if (isObjectA && isObjectB) {
  4409. try {
  4410. var isArrayA = Array.isArray(a);
  4411. var isArrayB = Array.isArray(b);
  4412. if (isArrayA && isArrayB) {
  4413. return a.length === b.length && a.every(function (e, i) {
  4414. return looseEqual(e, b[i])
  4415. })
  4416. } else if (a instanceof Date && b instanceof Date) {
  4417. return a.getTime() === b.getTime()
  4418. } else if (!isArrayA && !isArrayB) {
  4419. var keysA = Object.keys(a);
  4420. var keysB = Object.keys(b);
  4421. return keysA.length === keysB.length && keysA.every(function (key) {
  4422. return looseEqual(a[key], b[key])
  4423. })
  4424. } else {
  4425. /* istanbul ignore next */
  4426. return false
  4427. }
  4428. } catch (e) {
  4429. /* istanbul ignore next */
  4430. return false
  4431. }
  4432. } else if (!isObjectA && !isObjectB) {
  4433. return String(a) === String(b)
  4434. } else {
  4435. return false
  4436. }
  4437. }
  4438. /**
  4439. * Return the first index at which a loosely equal value can be
  4440. * found in the array (if value is a plain object, the array must
  4441. * contain an object of the same shape), or -1 if it is not present.
  4442. */
  4443. function looseIndexOf (arr, val) {
  4444. for (var i = 0; i < arr.length; i++) {
  4445. if (looseEqual(arr[i], val)) { return i }
  4446. }
  4447. return -1
  4448. }
  4449. /**
  4450. * Ensure a function is called only once.
  4451. */
  4452. function once (fn) {
  4453. var called = false;
  4454. return function () {
  4455. if (!called) {
  4456. called = true;
  4457. fn.apply(this, arguments);
  4458. }
  4459. }
  4460. }
  4461. var ASSET_TYPES = [
  4462. 'component',
  4463. 'directive',
  4464. 'filter'
  4465. ];
  4466. var LIFECYCLE_HOOKS = [
  4467. 'beforeCreate',
  4468. 'created',
  4469. 'beforeMount',
  4470. 'mounted',
  4471. 'beforeUpdate',
  4472. 'updated',
  4473. 'beforeDestroy',
  4474. 'destroyed',
  4475. 'activated',
  4476. 'deactivated',
  4477. 'errorCaptured',
  4478. 'serverPrefetch'
  4479. ];
  4480. /* */
  4481. var config = ({
  4482. /**
  4483. * Option merge strategies (used in core/util/options)
  4484. */
  4485. // $flow-disable-line
  4486. optionMergeStrategies: Object.create(null),
  4487. /**
  4488. * Whether to suppress warnings.
  4489. */
  4490. silent: false,
  4491. /**
  4492. * Show production mode tip message on boot?
  4493. */
  4494. productionTip: "development" !== 'production',
  4495. /**
  4496. * Whether to enable devtools
  4497. */
  4498. devtools: "development" !== 'production',
  4499. /**
  4500. * Whether to record perf
  4501. */
  4502. performance: false,
  4503. /**
  4504. * Error handler for watcher errors
  4505. */
  4506. errorHandler: null,
  4507. /**
  4508. * Warn handler for watcher warns
  4509. */
  4510. warnHandler: null,
  4511. /**
  4512. * Ignore certain custom elements
  4513. */
  4514. ignoredElements: [],
  4515. /**
  4516. * Custom user key aliases for v-on
  4517. */
  4518. // $flow-disable-line
  4519. keyCodes: Object.create(null),
  4520. /**
  4521. * Check if a tag is reserved so that it cannot be registered as a
  4522. * component. This is platform-dependent and may be overwritten.
  4523. */
  4524. isReservedTag: no,
  4525. /**
  4526. * Check if an attribute is reserved so that it cannot be used as a component
  4527. * prop. This is platform-dependent and may be overwritten.
  4528. */
  4529. isReservedAttr: no,
  4530. /**
  4531. * Check if a tag is an unknown element.
  4532. * Platform-dependent.
  4533. */
  4534. isUnknownElement: no,
  4535. /**
  4536. * Get the namespace of an element
  4537. */
  4538. getTagNamespace: noop,
  4539. /**
  4540. * Parse the real tag name for the specific platform.
  4541. */
  4542. parsePlatformTagName: identity,
  4543. /**
  4544. * Check if an attribute must be bound using property, e.g. value
  4545. * Platform-dependent.
  4546. */
  4547. mustUseProp: no,
  4548. /**
  4549. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  4550. * This will significantly reduce performance if set to false.
  4551. */
  4552. async: true,
  4553. /**
  4554. * Exposed for legacy reasons
  4555. */
  4556. _lifecycleHooks: LIFECYCLE_HOOKS
  4557. });
  4558. /* */
  4559. /**
  4560. * unicode letters used for parsing html tags, component names and property paths.
  4561. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  4562. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  4563. */
  4564. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  4565. /**
  4566. * Check if a string starts with $ or _
  4567. */
  4568. function isReserved (str) {
  4569. var c = (str + '').charCodeAt(0);
  4570. return c === 0x24 || c === 0x5F
  4571. }
  4572. /**
  4573. * Define a property.
  4574. */
  4575. function def (obj, key, val, enumerable) {
  4576. Object.defineProperty(obj, key, {
  4577. value: val,
  4578. enumerable: !!enumerable,
  4579. writable: true,
  4580. configurable: true
  4581. });
  4582. }
  4583. /**
  4584. * Parse simple path.
  4585. */
  4586. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  4587. function parsePath (path) {
  4588. if (bailRE.test(path)) {
  4589. return
  4590. }
  4591. var segments = path.split('.');
  4592. return function (obj) {
  4593. for (var i = 0; i < segments.length; i++) {
  4594. if (!obj) { return }
  4595. obj = obj[segments[i]];
  4596. }
  4597. return obj
  4598. }
  4599. }
  4600. /* */
  4601. // can we use __proto__?
  4602. var hasProto = '__proto__' in {};
  4603. // Browser environment sniffing
  4604. var inBrowser = typeof window !== 'undefined';
  4605. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  4606. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  4607. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  4608. var isIE = UA && /msie|trident/.test(UA);
  4609. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  4610. var isEdge = UA && UA.indexOf('edge/') > 0;
  4611. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  4612. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  4613. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  4614. var isPhantomJS = UA && /phantomjs/.test(UA);
  4615. var isFF = UA && UA.match(/firefox\/(\d+)/);
  4616. // Firefox has a "watch" function on Object.prototype...
  4617. var nativeWatch = ({}).watch;
  4618. if (inBrowser) {
  4619. try {
  4620. var opts = {};
  4621. Object.defineProperty(opts, 'passive', ({
  4622. get: function get () {
  4623. }
  4624. })); // https://github.com/facebook/flow/issues/285
  4625. window.addEventListener('test-passive', null, opts);
  4626. } catch (e) {}
  4627. }
  4628. // this needs to be lazy-evaled because vue may be required before
  4629. // vue-server-renderer can set VUE_ENV
  4630. var _isServer;
  4631. var isServerRendering = function () {
  4632. if (_isServer === undefined) {
  4633. /* istanbul ignore if */
  4634. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  4635. // detect presence of vue-server-renderer and avoid
  4636. // Webpack shimming the process
  4637. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  4638. } else {
  4639. _isServer = false;
  4640. }
  4641. }
  4642. return _isServer
  4643. };
  4644. // detect devtools
  4645. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  4646. /* istanbul ignore next */
  4647. function isNative (Ctor) {
  4648. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  4649. }
  4650. var hasSymbol =
  4651. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  4652. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  4653. var _Set;
  4654. /* istanbul ignore if */ // $flow-disable-line
  4655. if (typeof Set !== 'undefined' && isNative(Set)) {
  4656. // use native Set when available.
  4657. _Set = Set;
  4658. } else {
  4659. // a non-standard Set polyfill that only works with primitive keys.
  4660. _Set = /*@__PURE__*/(function () {
  4661. function Set () {
  4662. this.set = Object.create(null);
  4663. }
  4664. Set.prototype.has = function has (key) {
  4665. return this.set[key] === true
  4666. };
  4667. Set.prototype.add = function add (key) {
  4668. this.set[key] = true;
  4669. };
  4670. Set.prototype.clear = function clear () {
  4671. this.set = Object.create(null);
  4672. };
  4673. return Set;
  4674. }());
  4675. }
  4676. /* */
  4677. var warn = noop;
  4678. var tip = noop;
  4679. var generateComponentTrace = (noop); // work around flow check
  4680. var formatComponentName = (noop);
  4681. if (true) {
  4682. var hasConsole = typeof console !== 'undefined';
  4683. var classifyRE = /(?:^|[-_])(\w)/g;
  4684. var classify = function (str) { return str
  4685. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  4686. .replace(/[-_]/g, ''); };
  4687. warn = function (msg, vm) {
  4688. var trace = vm ? generateComponentTrace(vm) : '';
  4689. if (config.warnHandler) {
  4690. config.warnHandler.call(null, msg, vm, trace);
  4691. } else if (hasConsole && (!config.silent)) {
  4692. console.error(("[Vue warn]: " + msg + trace));
  4693. }
  4694. };
  4695. tip = function (msg, vm) {
  4696. if (hasConsole && (!config.silent)) {
  4697. console.warn("[Vue tip]: " + msg + (
  4698. vm ? generateComponentTrace(vm) : ''
  4699. ));
  4700. }
  4701. };
  4702. formatComponentName = function (vm, includeFile) {
  4703. if (vm.$root === vm) {
  4704. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  4705. return ('') + vm.$options.__file
  4706. }
  4707. return '<Root>'
  4708. }
  4709. var options = typeof vm === 'function' && vm.cid != null
  4710. ? vm.options
  4711. : vm._isVue
  4712. ? vm.$options || vm.constructor.options
  4713. : vm;
  4714. var name = options.name || options._componentTag;
  4715. var file = options.__file;
  4716. if (!name && file) {
  4717. var match = file.match(/([^/\\]+)\.vue$/);
  4718. name = match && match[1];
  4719. }
  4720. return (
  4721. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  4722. (file && includeFile !== false ? (" at " + file) : '')
  4723. )
  4724. };
  4725. var repeat = function (str, n) {
  4726. var res = '';
  4727. while (n) {
  4728. if (n % 2 === 1) { res += str; }
  4729. if (n > 1) { str += str; }
  4730. n >>= 1;
  4731. }
  4732. return res
  4733. };
  4734. generateComponentTrace = function (vm) {
  4735. if (vm._isVue && vm.$parent) {
  4736. var tree = [];
  4737. var currentRecursiveSequence = 0;
  4738. while (vm && vm.$options.name !== 'PageBody') {
  4739. if (tree.length > 0) {
  4740. var last = tree[tree.length - 1];
  4741. if (last.constructor === vm.constructor) {
  4742. currentRecursiveSequence++;
  4743. vm = vm.$parent;
  4744. continue
  4745. } else if (currentRecursiveSequence > 0) {
  4746. tree[tree.length - 1] = [last, currentRecursiveSequence];
  4747. currentRecursiveSequence = 0;
  4748. }
  4749. }
  4750. !vm.$options.isReserved && tree.push(vm);
  4751. vm = vm.$parent;
  4752. }
  4753. return '\n\nfound in\n\n' + tree
  4754. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  4755. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  4756. : formatComponentName(vm))); })
  4757. .join('\n')
  4758. } else {
  4759. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  4760. }
  4761. };
  4762. }
  4763. /* */
  4764. var uid = 0;
  4765. /**
  4766. * A dep is an observable that can have multiple
  4767. * directives subscribing to it.
  4768. */
  4769. var Dep = function Dep () {
  4770. this.id = uid++;
  4771. this.subs = [];
  4772. };
  4773. Dep.prototype.addSub = function addSub (sub) {
  4774. this.subs.push(sub);
  4775. };
  4776. Dep.prototype.removeSub = function removeSub (sub) {
  4777. remove(this.subs, sub);
  4778. };
  4779. Dep.prototype.depend = function depend () {
  4780. if (Dep.SharedObject.target) {
  4781. Dep.SharedObject.target.addDep(this);
  4782. }
  4783. };
  4784. Dep.prototype.notify = function notify () {
  4785. // stabilize the subscriber list first
  4786. var subs = this.subs.slice();
  4787. if ( true && !config.async) {
  4788. // subs aren't sorted in scheduler if not running async
  4789. // we need to sort them now to make sure they fire in correct
  4790. // order
  4791. subs.sort(function (a, b) { return a.id - b.id; });
  4792. }
  4793. for (var i = 0, l = subs.length; i < l; i++) {
  4794. subs[i].update();
  4795. }
  4796. };
  4797. // The current target watcher being evaluated.
  4798. // This is globally unique because only one watcher
  4799. // can be evaluated at a time.
  4800. // fixed by xxxxxx (nvue shared vuex)
  4801. /* eslint-disable no-undef */
  4802. Dep.SharedObject = {};
  4803. Dep.SharedObject.target = null;
  4804. Dep.SharedObject.targetStack = [];
  4805. function pushTarget (target) {
  4806. Dep.SharedObject.targetStack.push(target);
  4807. Dep.SharedObject.target = target;
  4808. Dep.target = target;
  4809. }
  4810. function popTarget () {
  4811. Dep.SharedObject.targetStack.pop();
  4812. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  4813. Dep.target = Dep.SharedObject.target;
  4814. }
  4815. /* */
  4816. var VNode = function VNode (
  4817. tag,
  4818. data,
  4819. children,
  4820. text,
  4821. elm,
  4822. context,
  4823. componentOptions,
  4824. asyncFactory
  4825. ) {
  4826. this.tag = tag;
  4827. this.data = data;
  4828. this.children = children;
  4829. this.text = text;
  4830. this.elm = elm;
  4831. this.ns = undefined;
  4832. this.context = context;
  4833. this.fnContext = undefined;
  4834. this.fnOptions = undefined;
  4835. this.fnScopeId = undefined;
  4836. this.key = data && data.key;
  4837. this.componentOptions = componentOptions;
  4838. this.componentInstance = undefined;
  4839. this.parent = undefined;
  4840. this.raw = false;
  4841. this.isStatic = false;
  4842. this.isRootInsert = true;
  4843. this.isComment = false;
  4844. this.isCloned = false;
  4845. this.isOnce = false;
  4846. this.asyncFactory = asyncFactory;
  4847. this.asyncMeta = undefined;
  4848. this.isAsyncPlaceholder = false;
  4849. };
  4850. var prototypeAccessors = { child: { configurable: true } };
  4851. // DEPRECATED: alias for componentInstance for backwards compat.
  4852. /* istanbul ignore next */
  4853. prototypeAccessors.child.get = function () {
  4854. return this.componentInstance
  4855. };
  4856. Object.defineProperties( VNode.prototype, prototypeAccessors );
  4857. var createEmptyVNode = function (text) {
  4858. if ( text === void 0 ) text = '';
  4859. var node = new VNode();
  4860. node.text = text;
  4861. node.isComment = true;
  4862. return node
  4863. };
  4864. function createTextVNode (val) {
  4865. return new VNode(undefined, undefined, undefined, String(val))
  4866. }
  4867. // optimized shallow clone
  4868. // used for static nodes and slot nodes because they may be reused across
  4869. // multiple renders, cloning them avoids errors when DOM manipulations rely
  4870. // on their elm reference.
  4871. function cloneVNode (vnode) {
  4872. var cloned = new VNode(
  4873. vnode.tag,
  4874. vnode.data,
  4875. // #7975
  4876. // clone children array to avoid mutating original in case of cloning
  4877. // a child.
  4878. vnode.children && vnode.children.slice(),
  4879. vnode.text,
  4880. vnode.elm,
  4881. vnode.context,
  4882. vnode.componentOptions,
  4883. vnode.asyncFactory
  4884. );
  4885. cloned.ns = vnode.ns;
  4886. cloned.isStatic = vnode.isStatic;
  4887. cloned.key = vnode.key;
  4888. cloned.isComment = vnode.isComment;
  4889. cloned.fnContext = vnode.fnContext;
  4890. cloned.fnOptions = vnode.fnOptions;
  4891. cloned.fnScopeId = vnode.fnScopeId;
  4892. cloned.asyncMeta = vnode.asyncMeta;
  4893. cloned.isCloned = true;
  4894. return cloned
  4895. }
  4896. /*
  4897. * not type checking this file because flow doesn't play well with
  4898. * dynamically accessing methods on Array prototype
  4899. */
  4900. var arrayProto = Array.prototype;
  4901. var arrayMethods = Object.create(arrayProto);
  4902. var methodsToPatch = [
  4903. 'push',
  4904. 'pop',
  4905. 'shift',
  4906. 'unshift',
  4907. 'splice',
  4908. 'sort',
  4909. 'reverse'
  4910. ];
  4911. /**
  4912. * Intercept mutating methods and emit events
  4913. */
  4914. methodsToPatch.forEach(function (method) {
  4915. // cache original method
  4916. var original = arrayProto[method];
  4917. def(arrayMethods, method, function mutator () {
  4918. var args = [], len = arguments.length;
  4919. while ( len-- ) args[ len ] = arguments[ len ];
  4920. var result = original.apply(this, args);
  4921. var ob = this.__ob__;
  4922. var inserted;
  4923. switch (method) {
  4924. case 'push':
  4925. case 'unshift':
  4926. inserted = args;
  4927. break
  4928. case 'splice':
  4929. inserted = args.slice(2);
  4930. break
  4931. }
  4932. if (inserted) { ob.observeArray(inserted); }
  4933. // notify change
  4934. ob.dep.notify();
  4935. return result
  4936. });
  4937. });
  4938. /* */
  4939. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  4940. /**
  4941. * In some cases we may want to disable observation inside a component's
  4942. * update computation.
  4943. */
  4944. var shouldObserve = true;
  4945. function toggleObserving (value) {
  4946. shouldObserve = value;
  4947. }
  4948. /**
  4949. * Observer class that is attached to each observed
  4950. * object. Once attached, the observer converts the target
  4951. * object's property keys into getter/setters that
  4952. * collect dependencies and dispatch updates.
  4953. */
  4954. var Observer = function Observer (value) {
  4955. this.value = value;
  4956. this.dep = new Dep();
  4957. this.vmCount = 0;
  4958. def(value, '__ob__', this);
  4959. if (Array.isArray(value)) {
  4960. if (hasProto) {
  4961. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  4962. if(value.push !== value.__proto__.push){
  4963. copyAugment(value, arrayMethods, arrayKeys);
  4964. } else {
  4965. protoAugment(value, arrayMethods);
  4966. }
  4967. }
  4968. } else {
  4969. copyAugment(value, arrayMethods, arrayKeys);
  4970. }
  4971. this.observeArray(value);
  4972. } else {
  4973. this.walk(value);
  4974. }
  4975. };
  4976. /**
  4977. * Walk through all properties and convert them into
  4978. * getter/setters. This method should only be called when
  4979. * value type is Object.
  4980. */
  4981. Observer.prototype.walk = function walk (obj) {
  4982. var keys = Object.keys(obj);
  4983. for (var i = 0; i < keys.length; i++) {
  4984. defineReactive$$1(obj, keys[i]);
  4985. }
  4986. };
  4987. /**
  4988. * Observe a list of Array items.
  4989. */
  4990. Observer.prototype.observeArray = function observeArray (items) {
  4991. for (var i = 0, l = items.length; i < l; i++) {
  4992. observe(items[i]);
  4993. }
  4994. };
  4995. // helpers
  4996. /**
  4997. * Augment a target Object or Array by intercepting
  4998. * the prototype chain using __proto__
  4999. */
  5000. function protoAugment (target, src) {
  5001. /* eslint-disable no-proto */
  5002. target.__proto__ = src;
  5003. /* eslint-enable no-proto */
  5004. }
  5005. /**
  5006. * Augment a target Object or Array by defining
  5007. * hidden properties.
  5008. */
  5009. /* istanbul ignore next */
  5010. function copyAugment (target, src, keys) {
  5011. for (var i = 0, l = keys.length; i < l; i++) {
  5012. var key = keys[i];
  5013. def(target, key, src[key]);
  5014. }
  5015. }
  5016. /**
  5017. * Attempt to create an observer instance for a value,
  5018. * returns the new observer if successfully observed,
  5019. * or the existing observer if the value already has one.
  5020. */
  5021. function observe (value, asRootData) {
  5022. if (!isObject(value) || value instanceof VNode) {
  5023. return
  5024. }
  5025. var ob;
  5026. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  5027. ob = value.__ob__;
  5028. } else if (
  5029. shouldObserve &&
  5030. !isServerRendering() &&
  5031. (Array.isArray(value) || isPlainObject(value)) &&
  5032. Object.isExtensible(value) &&
  5033. !value._isVue &&
  5034. !value.__v_isMPComponent
  5035. ) {
  5036. ob = new Observer(value);
  5037. }
  5038. if (asRootData && ob) {
  5039. ob.vmCount++;
  5040. }
  5041. return ob
  5042. }
  5043. /**
  5044. * Define a reactive property on an Object.
  5045. */
  5046. function defineReactive$$1 (
  5047. obj,
  5048. key,
  5049. val,
  5050. customSetter,
  5051. shallow
  5052. ) {
  5053. var dep = new Dep();
  5054. var property = Object.getOwnPropertyDescriptor(obj, key);
  5055. if (property && property.configurable === false) {
  5056. return
  5057. }
  5058. // cater for pre-defined getter/setters
  5059. var getter = property && property.get;
  5060. var setter = property && property.set;
  5061. if ((!getter || setter) && arguments.length === 2) {
  5062. val = obj[key];
  5063. }
  5064. var childOb = !shallow && observe(val);
  5065. Object.defineProperty(obj, key, {
  5066. enumerable: true,
  5067. configurable: true,
  5068. get: function reactiveGetter () {
  5069. var value = getter ? getter.call(obj) : val;
  5070. if (Dep.SharedObject.target) { // fixed by xxxxxx
  5071. dep.depend();
  5072. if (childOb) {
  5073. childOb.dep.depend();
  5074. if (Array.isArray(value)) {
  5075. dependArray(value);
  5076. }
  5077. }
  5078. }
  5079. return value
  5080. },
  5081. set: function reactiveSetter (newVal) {
  5082. var value = getter ? getter.call(obj) : val;
  5083. /* eslint-disable no-self-compare */
  5084. if (newVal === value || (newVal !== newVal && value !== value)) {
  5085. return
  5086. }
  5087. /* eslint-enable no-self-compare */
  5088. if ( true && customSetter) {
  5089. customSetter();
  5090. }
  5091. // #7981: for accessor properties without setter
  5092. if (getter && !setter) { return }
  5093. if (setter) {
  5094. setter.call(obj, newVal);
  5095. } else {
  5096. val = newVal;
  5097. }
  5098. childOb = !shallow && observe(newVal);
  5099. dep.notify();
  5100. }
  5101. });
  5102. }
  5103. /**
  5104. * Set a property on an object. Adds the new property and
  5105. * triggers change notification if the property doesn't
  5106. * already exist.
  5107. */
  5108. function set (target, key, val) {
  5109. if ( true &&
  5110. (isUndef(target) || isPrimitive(target))
  5111. ) {
  5112. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  5113. }
  5114. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5115. target.length = Math.max(target.length, key);
  5116. target.splice(key, 1, val);
  5117. return val
  5118. }
  5119. if (key in target && !(key in Object.prototype)) {
  5120. target[key] = val;
  5121. return val
  5122. }
  5123. var ob = (target).__ob__;
  5124. if (target._isVue || (ob && ob.vmCount)) {
  5125. true && warn(
  5126. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  5127. 'at runtime - declare it upfront in the data option.'
  5128. );
  5129. return val
  5130. }
  5131. if (!ob) {
  5132. target[key] = val;
  5133. return val
  5134. }
  5135. defineReactive$$1(ob.value, key, val);
  5136. ob.dep.notify();
  5137. return val
  5138. }
  5139. /**
  5140. * Delete a property and trigger change if necessary.
  5141. */
  5142. function del (target, key) {
  5143. if ( true &&
  5144. (isUndef(target) || isPrimitive(target))
  5145. ) {
  5146. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  5147. }
  5148. if (Array.isArray(target) && isValidArrayIndex(key)) {
  5149. target.splice(key, 1);
  5150. return
  5151. }
  5152. var ob = (target).__ob__;
  5153. if (target._isVue || (ob && ob.vmCount)) {
  5154. true && warn(
  5155. 'Avoid deleting properties on a Vue instance or its root $data ' +
  5156. '- just set it to null.'
  5157. );
  5158. return
  5159. }
  5160. if (!hasOwn(target, key)) {
  5161. return
  5162. }
  5163. delete target[key];
  5164. if (!ob) {
  5165. return
  5166. }
  5167. ob.dep.notify();
  5168. }
  5169. /**
  5170. * Collect dependencies on array elements when the array is touched, since
  5171. * we cannot intercept array element access like property getters.
  5172. */
  5173. function dependArray (value) {
  5174. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  5175. e = value[i];
  5176. e && e.__ob__ && e.__ob__.dep.depend();
  5177. if (Array.isArray(e)) {
  5178. dependArray(e);
  5179. }
  5180. }
  5181. }
  5182. /* */
  5183. /**
  5184. * Option overwriting strategies are functions that handle
  5185. * how to merge a parent option value and a child option
  5186. * value into the final value.
  5187. */
  5188. var strats = config.optionMergeStrategies;
  5189. /**
  5190. * Options with restrictions
  5191. */
  5192. if (true) {
  5193. strats.el = strats.propsData = function (parent, child, vm, key) {
  5194. if (!vm) {
  5195. warn(
  5196. "option \"" + key + "\" can only be used during instance " +
  5197. 'creation with the `new` keyword.'
  5198. );
  5199. }
  5200. return defaultStrat(parent, child)
  5201. };
  5202. }
  5203. /**
  5204. * Helper that recursively merges two data objects together.
  5205. */
  5206. function mergeData (to, from) {
  5207. if (!from) { return to }
  5208. var key, toVal, fromVal;
  5209. var keys = hasSymbol
  5210. ? Reflect.ownKeys(from)
  5211. : Object.keys(from);
  5212. for (var i = 0; i < keys.length; i++) {
  5213. key = keys[i];
  5214. // in case the object is already observed...
  5215. if (key === '__ob__') { continue }
  5216. toVal = to[key];
  5217. fromVal = from[key];
  5218. if (!hasOwn(to, key)) {
  5219. set(to, key, fromVal);
  5220. } else if (
  5221. toVal !== fromVal &&
  5222. isPlainObject(toVal) &&
  5223. isPlainObject(fromVal)
  5224. ) {
  5225. mergeData(toVal, fromVal);
  5226. }
  5227. }
  5228. return to
  5229. }
  5230. /**
  5231. * Data
  5232. */
  5233. function mergeDataOrFn (
  5234. parentVal,
  5235. childVal,
  5236. vm
  5237. ) {
  5238. if (!vm) {
  5239. // in a Vue.extend merge, both should be functions
  5240. if (!childVal) {
  5241. return parentVal
  5242. }
  5243. if (!parentVal) {
  5244. return childVal
  5245. }
  5246. // when parentVal & childVal are both present,
  5247. // we need to return a function that returns the
  5248. // merged result of both functions... no need to
  5249. // check if parentVal is a function here because
  5250. // it has to be a function to pass previous merges.
  5251. return function mergedDataFn () {
  5252. return mergeData(
  5253. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  5254. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  5255. )
  5256. }
  5257. } else {
  5258. return function mergedInstanceDataFn () {
  5259. // instance merge
  5260. var instanceData = typeof childVal === 'function'
  5261. ? childVal.call(vm, vm)
  5262. : childVal;
  5263. var defaultData = typeof parentVal === 'function'
  5264. ? parentVal.call(vm, vm)
  5265. : parentVal;
  5266. if (instanceData) {
  5267. return mergeData(instanceData, defaultData)
  5268. } else {
  5269. return defaultData
  5270. }
  5271. }
  5272. }
  5273. }
  5274. strats.data = function (
  5275. parentVal,
  5276. childVal,
  5277. vm
  5278. ) {
  5279. if (!vm) {
  5280. if (childVal && typeof childVal !== 'function') {
  5281. true && warn(
  5282. 'The "data" option should be a function ' +
  5283. 'that returns a per-instance value in component ' +
  5284. 'definitions.',
  5285. vm
  5286. );
  5287. return parentVal
  5288. }
  5289. return mergeDataOrFn(parentVal, childVal)
  5290. }
  5291. return mergeDataOrFn(parentVal, childVal, vm)
  5292. };
  5293. /**
  5294. * Hooks and props are merged as arrays.
  5295. */
  5296. function mergeHook (
  5297. parentVal,
  5298. childVal
  5299. ) {
  5300. var res = childVal
  5301. ? parentVal
  5302. ? parentVal.concat(childVal)
  5303. : Array.isArray(childVal)
  5304. ? childVal
  5305. : [childVal]
  5306. : parentVal;
  5307. return res
  5308. ? dedupeHooks(res)
  5309. : res
  5310. }
  5311. function dedupeHooks (hooks) {
  5312. var res = [];
  5313. for (var i = 0; i < hooks.length; i++) {
  5314. if (res.indexOf(hooks[i]) === -1) {
  5315. res.push(hooks[i]);
  5316. }
  5317. }
  5318. return res
  5319. }
  5320. LIFECYCLE_HOOKS.forEach(function (hook) {
  5321. strats[hook] = mergeHook;
  5322. });
  5323. /**
  5324. * Assets
  5325. *
  5326. * When a vm is present (instance creation), we need to do
  5327. * a three-way merge between constructor options, instance
  5328. * options and parent options.
  5329. */
  5330. function mergeAssets (
  5331. parentVal,
  5332. childVal,
  5333. vm,
  5334. key
  5335. ) {
  5336. var res = Object.create(parentVal || null);
  5337. if (childVal) {
  5338. true && assertObjectType(key, childVal, vm);
  5339. return extend(res, childVal)
  5340. } else {
  5341. return res
  5342. }
  5343. }
  5344. ASSET_TYPES.forEach(function (type) {
  5345. strats[type + 's'] = mergeAssets;
  5346. });
  5347. /**
  5348. * Watchers.
  5349. *
  5350. * Watchers hashes should not overwrite one
  5351. * another, so we merge them as arrays.
  5352. */
  5353. strats.watch = function (
  5354. parentVal,
  5355. childVal,
  5356. vm,
  5357. key
  5358. ) {
  5359. // work around Firefox's Object.prototype.watch...
  5360. if (parentVal === nativeWatch) { parentVal = undefined; }
  5361. if (childVal === nativeWatch) { childVal = undefined; }
  5362. /* istanbul ignore if */
  5363. if (!childVal) { return Object.create(parentVal || null) }
  5364. if (true) {
  5365. assertObjectType(key, childVal, vm);
  5366. }
  5367. if (!parentVal) { return childVal }
  5368. var ret = {};
  5369. extend(ret, parentVal);
  5370. for (var key$1 in childVal) {
  5371. var parent = ret[key$1];
  5372. var child = childVal[key$1];
  5373. if (parent && !Array.isArray(parent)) {
  5374. parent = [parent];
  5375. }
  5376. ret[key$1] = parent
  5377. ? parent.concat(child)
  5378. : Array.isArray(child) ? child : [child];
  5379. }
  5380. return ret
  5381. };
  5382. /**
  5383. * Other object hashes.
  5384. */
  5385. strats.props =
  5386. strats.methods =
  5387. strats.inject =
  5388. strats.computed = function (
  5389. parentVal,
  5390. childVal,
  5391. vm,
  5392. key
  5393. ) {
  5394. if (childVal && "development" !== 'production') {
  5395. assertObjectType(key, childVal, vm);
  5396. }
  5397. if (!parentVal) { return childVal }
  5398. var ret = Object.create(null);
  5399. extend(ret, parentVal);
  5400. if (childVal) { extend(ret, childVal); }
  5401. return ret
  5402. };
  5403. strats.provide = mergeDataOrFn;
  5404. /**
  5405. * Default strategy.
  5406. */
  5407. var defaultStrat = function (parentVal, childVal) {
  5408. return childVal === undefined
  5409. ? parentVal
  5410. : childVal
  5411. };
  5412. /**
  5413. * Validate component names
  5414. */
  5415. function checkComponents (options) {
  5416. for (var key in options.components) {
  5417. validateComponentName(key);
  5418. }
  5419. }
  5420. function validateComponentName (name) {
  5421. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  5422. warn(
  5423. 'Invalid component name: "' + name + '". Component names ' +
  5424. 'should conform to valid custom element name in html5 specification.'
  5425. );
  5426. }
  5427. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  5428. warn(
  5429. 'Do not use built-in or reserved HTML elements as component ' +
  5430. 'id: ' + name
  5431. );
  5432. }
  5433. }
  5434. /**
  5435. * Ensure all props option syntax are normalized into the
  5436. * Object-based format.
  5437. */
  5438. function normalizeProps (options, vm) {
  5439. var props = options.props;
  5440. if (!props) { return }
  5441. var res = {};
  5442. var i, val, name;
  5443. if (Array.isArray(props)) {
  5444. i = props.length;
  5445. while (i--) {
  5446. val = props[i];
  5447. if (typeof val === 'string') {
  5448. name = camelize(val);
  5449. res[name] = { type: null };
  5450. } else if (true) {
  5451. warn('props must be strings when using array syntax.');
  5452. }
  5453. }
  5454. } else if (isPlainObject(props)) {
  5455. for (var key in props) {
  5456. val = props[key];
  5457. name = camelize(key);
  5458. res[name] = isPlainObject(val)
  5459. ? val
  5460. : { type: val };
  5461. }
  5462. } else if (true) {
  5463. warn(
  5464. "Invalid value for option \"props\": expected an Array or an Object, " +
  5465. "but got " + (toRawType(props)) + ".",
  5466. vm
  5467. );
  5468. }
  5469. options.props = res;
  5470. }
  5471. /**
  5472. * Normalize all injections into Object-based format
  5473. */
  5474. function normalizeInject (options, vm) {
  5475. var inject = options.inject;
  5476. if (!inject) { return }
  5477. var normalized = options.inject = {};
  5478. if (Array.isArray(inject)) {
  5479. for (var i = 0; i < inject.length; i++) {
  5480. normalized[inject[i]] = { from: inject[i] };
  5481. }
  5482. } else if (isPlainObject(inject)) {
  5483. for (var key in inject) {
  5484. var val = inject[key];
  5485. normalized[key] = isPlainObject(val)
  5486. ? extend({ from: key }, val)
  5487. : { from: val };
  5488. }
  5489. } else if (true) {
  5490. warn(
  5491. "Invalid value for option \"inject\": expected an Array or an Object, " +
  5492. "but got " + (toRawType(inject)) + ".",
  5493. vm
  5494. );
  5495. }
  5496. }
  5497. /**
  5498. * Normalize raw function directives into object format.
  5499. */
  5500. function normalizeDirectives (options) {
  5501. var dirs = options.directives;
  5502. if (dirs) {
  5503. for (var key in dirs) {
  5504. var def$$1 = dirs[key];
  5505. if (typeof def$$1 === 'function') {
  5506. dirs[key] = { bind: def$$1, update: def$$1 };
  5507. }
  5508. }
  5509. }
  5510. }
  5511. function assertObjectType (name, value, vm) {
  5512. if (!isPlainObject(value)) {
  5513. warn(
  5514. "Invalid value for option \"" + name + "\": expected an Object, " +
  5515. "but got " + (toRawType(value)) + ".",
  5516. vm
  5517. );
  5518. }
  5519. }
  5520. /**
  5521. * Merge two option objects into a new one.
  5522. * Core utility used in both instantiation and inheritance.
  5523. */
  5524. function mergeOptions (
  5525. parent,
  5526. child,
  5527. vm
  5528. ) {
  5529. if (true) {
  5530. checkComponents(child);
  5531. }
  5532. if (typeof child === 'function') {
  5533. child = child.options;
  5534. }
  5535. normalizeProps(child, vm);
  5536. normalizeInject(child, vm);
  5537. normalizeDirectives(child);
  5538. // Apply extends and mixins on the child options,
  5539. // but only if it is a raw options object that isn't
  5540. // the result of another mergeOptions call.
  5541. // Only merged options has the _base property.
  5542. if (!child._base) {
  5543. if (child.extends) {
  5544. parent = mergeOptions(parent, child.extends, vm);
  5545. }
  5546. if (child.mixins) {
  5547. for (var i = 0, l = child.mixins.length; i < l; i++) {
  5548. parent = mergeOptions(parent, child.mixins[i], vm);
  5549. }
  5550. }
  5551. }
  5552. var options = {};
  5553. var key;
  5554. for (key in parent) {
  5555. mergeField(key);
  5556. }
  5557. for (key in child) {
  5558. if (!hasOwn(parent, key)) {
  5559. mergeField(key);
  5560. }
  5561. }
  5562. function mergeField (key) {
  5563. var strat = strats[key] || defaultStrat;
  5564. options[key] = strat(parent[key], child[key], vm, key);
  5565. }
  5566. return options
  5567. }
  5568. /**
  5569. * Resolve an asset.
  5570. * This function is used because child instances need access
  5571. * to assets defined in its ancestor chain.
  5572. */
  5573. function resolveAsset (
  5574. options,
  5575. type,
  5576. id,
  5577. warnMissing
  5578. ) {
  5579. /* istanbul ignore if */
  5580. if (typeof id !== 'string') {
  5581. return
  5582. }
  5583. var assets = options[type];
  5584. // check local registration variations first
  5585. if (hasOwn(assets, id)) { return assets[id] }
  5586. var camelizedId = camelize(id);
  5587. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  5588. var PascalCaseId = capitalize(camelizedId);
  5589. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  5590. // fallback to prototype chain
  5591. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  5592. if ( true && warnMissing && !res) {
  5593. warn(
  5594. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  5595. options
  5596. );
  5597. }
  5598. return res
  5599. }
  5600. /* */
  5601. function validateProp (
  5602. key,
  5603. propOptions,
  5604. propsData,
  5605. vm
  5606. ) {
  5607. var prop = propOptions[key];
  5608. var absent = !hasOwn(propsData, key);
  5609. var value = propsData[key];
  5610. // boolean casting
  5611. var booleanIndex = getTypeIndex(Boolean, prop.type);
  5612. if (booleanIndex > -1) {
  5613. if (absent && !hasOwn(prop, 'default')) {
  5614. value = false;
  5615. } else if (value === '' || value === hyphenate(key)) {
  5616. // only cast empty string / same name to boolean if
  5617. // boolean has higher priority
  5618. var stringIndex = getTypeIndex(String, prop.type);
  5619. if (stringIndex < 0 || booleanIndex < stringIndex) {
  5620. value = true;
  5621. }
  5622. }
  5623. }
  5624. // check default value
  5625. if (value === undefined) {
  5626. value = getPropDefaultValue(vm, prop, key);
  5627. // since the default value is a fresh copy,
  5628. // make sure to observe it.
  5629. var prevShouldObserve = shouldObserve;
  5630. toggleObserving(true);
  5631. observe(value);
  5632. toggleObserving(prevShouldObserve);
  5633. }
  5634. if (
  5635. true
  5636. ) {
  5637. assertProp(prop, key, value, vm, absent);
  5638. }
  5639. return value
  5640. }
  5641. /**
  5642. * Get the default value of a prop.
  5643. */
  5644. function getPropDefaultValue (vm, prop, key) {
  5645. // no default, return undefined
  5646. if (!hasOwn(prop, 'default')) {
  5647. return undefined
  5648. }
  5649. var def = prop.default;
  5650. // warn against non-factory defaults for Object & Array
  5651. if ( true && isObject(def)) {
  5652. warn(
  5653. 'Invalid default value for prop "' + key + '": ' +
  5654. 'Props with type Object/Array must use a factory function ' +
  5655. 'to return the default value.',
  5656. vm
  5657. );
  5658. }
  5659. // the raw prop value was also undefined from previous render,
  5660. // return previous default value to avoid unnecessary watcher trigger
  5661. if (vm && vm.$options.propsData &&
  5662. vm.$options.propsData[key] === undefined &&
  5663. vm._props[key] !== undefined
  5664. ) {
  5665. return vm._props[key]
  5666. }
  5667. // call factory function for non-Function types
  5668. // a value is Function if its prototype is function even across different execution context
  5669. return typeof def === 'function' && getType(prop.type) !== 'Function'
  5670. ? def.call(vm)
  5671. : def
  5672. }
  5673. /**
  5674. * Assert whether a prop is valid.
  5675. */
  5676. function assertProp (
  5677. prop,
  5678. name,
  5679. value,
  5680. vm,
  5681. absent
  5682. ) {
  5683. if (prop.required && absent) {
  5684. warn(
  5685. 'Missing required prop: "' + name + '"',
  5686. vm
  5687. );
  5688. return
  5689. }
  5690. if (value == null && !prop.required) {
  5691. return
  5692. }
  5693. var type = prop.type;
  5694. var valid = !type || type === true;
  5695. var expectedTypes = [];
  5696. if (type) {
  5697. if (!Array.isArray(type)) {
  5698. type = [type];
  5699. }
  5700. for (var i = 0; i < type.length && !valid; i++) {
  5701. var assertedType = assertType(value, type[i]);
  5702. expectedTypes.push(assertedType.expectedType || '');
  5703. valid = assertedType.valid;
  5704. }
  5705. }
  5706. if (!valid) {
  5707. warn(
  5708. getInvalidTypeMessage(name, value, expectedTypes),
  5709. vm
  5710. );
  5711. return
  5712. }
  5713. var validator = prop.validator;
  5714. if (validator) {
  5715. if (!validator(value)) {
  5716. warn(
  5717. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  5718. vm
  5719. );
  5720. }
  5721. }
  5722. }
  5723. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  5724. function assertType (value, type) {
  5725. var valid;
  5726. var expectedType = getType(type);
  5727. if (simpleCheckRE.test(expectedType)) {
  5728. var t = typeof value;
  5729. valid = t === expectedType.toLowerCase();
  5730. // for primitive wrapper objects
  5731. if (!valid && t === 'object') {
  5732. valid = value instanceof type;
  5733. }
  5734. } else if (expectedType === 'Object') {
  5735. valid = isPlainObject(value);
  5736. } else if (expectedType === 'Array') {
  5737. valid = Array.isArray(value);
  5738. } else {
  5739. valid = value instanceof type;
  5740. }
  5741. return {
  5742. valid: valid,
  5743. expectedType: expectedType
  5744. }
  5745. }
  5746. /**
  5747. * Use function string name to check built-in types,
  5748. * because a simple equality check will fail when running
  5749. * across different vms / iframes.
  5750. */
  5751. function getType (fn) {
  5752. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  5753. return match ? match[1] : ''
  5754. }
  5755. function isSameType (a, b) {
  5756. return getType(a) === getType(b)
  5757. }
  5758. function getTypeIndex (type, expectedTypes) {
  5759. if (!Array.isArray(expectedTypes)) {
  5760. return isSameType(expectedTypes, type) ? 0 : -1
  5761. }
  5762. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  5763. if (isSameType(expectedTypes[i], type)) {
  5764. return i
  5765. }
  5766. }
  5767. return -1
  5768. }
  5769. function getInvalidTypeMessage (name, value, expectedTypes) {
  5770. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  5771. " Expected " + (expectedTypes.map(capitalize).join(', '));
  5772. var expectedType = expectedTypes[0];
  5773. var receivedType = toRawType(value);
  5774. var expectedValue = styleValue(value, expectedType);
  5775. var receivedValue = styleValue(value, receivedType);
  5776. // check if we need to specify expected value
  5777. if (expectedTypes.length === 1 &&
  5778. isExplicable(expectedType) &&
  5779. !isBoolean(expectedType, receivedType)) {
  5780. message += " with value " + expectedValue;
  5781. }
  5782. message += ", got " + receivedType + " ";
  5783. // check if we need to specify received value
  5784. if (isExplicable(receivedType)) {
  5785. message += "with value " + receivedValue + ".";
  5786. }
  5787. return message
  5788. }
  5789. function styleValue (value, type) {
  5790. if (type === 'String') {
  5791. return ("\"" + value + "\"")
  5792. } else if (type === 'Number') {
  5793. return ("" + (Number(value)))
  5794. } else {
  5795. return ("" + value)
  5796. }
  5797. }
  5798. function isExplicable (value) {
  5799. var explicitTypes = ['string', 'number', 'boolean'];
  5800. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  5801. }
  5802. function isBoolean () {
  5803. var args = [], len = arguments.length;
  5804. while ( len-- ) args[ len ] = arguments[ len ];
  5805. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  5806. }
  5807. /* */
  5808. function handleError (err, vm, info) {
  5809. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  5810. // See: https://github.com/vuejs/vuex/issues/1505
  5811. pushTarget();
  5812. try {
  5813. if (vm) {
  5814. var cur = vm;
  5815. while ((cur = cur.$parent)) {
  5816. var hooks = cur.$options.errorCaptured;
  5817. if (hooks) {
  5818. for (var i = 0; i < hooks.length; i++) {
  5819. try {
  5820. var capture = hooks[i].call(cur, err, vm, info) === false;
  5821. if (capture) { return }
  5822. } catch (e) {
  5823. globalHandleError(e, cur, 'errorCaptured hook');
  5824. }
  5825. }
  5826. }
  5827. }
  5828. }
  5829. globalHandleError(err, vm, info);
  5830. } finally {
  5831. popTarget();
  5832. }
  5833. }
  5834. function invokeWithErrorHandling (
  5835. handler,
  5836. context,
  5837. args,
  5838. vm,
  5839. info
  5840. ) {
  5841. var res;
  5842. try {
  5843. res = args ? handler.apply(context, args) : handler.call(context);
  5844. if (res && !res._isVue && isPromise(res) && !res._handled) {
  5845. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  5846. // issue #9511
  5847. // avoid catch triggering multiple times when nested calls
  5848. res._handled = true;
  5849. }
  5850. } catch (e) {
  5851. handleError(e, vm, info);
  5852. }
  5853. return res
  5854. }
  5855. function globalHandleError (err, vm, info) {
  5856. if (config.errorHandler) {
  5857. try {
  5858. return config.errorHandler.call(null, err, vm, info)
  5859. } catch (e) {
  5860. // if the user intentionally throws the original error in the handler,
  5861. // do not log it twice
  5862. if (e !== err) {
  5863. logError(e, null, 'config.errorHandler');
  5864. }
  5865. }
  5866. }
  5867. logError(err, vm, info);
  5868. }
  5869. function logError (err, vm, info) {
  5870. if (true) {
  5871. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  5872. }
  5873. /* istanbul ignore else */
  5874. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  5875. console.error(err);
  5876. } else {
  5877. throw err
  5878. }
  5879. }
  5880. /* */
  5881. var callbacks = [];
  5882. var pending = false;
  5883. function flushCallbacks () {
  5884. pending = false;
  5885. var copies = callbacks.slice(0);
  5886. callbacks.length = 0;
  5887. for (var i = 0; i < copies.length; i++) {
  5888. copies[i]();
  5889. }
  5890. }
  5891. // Here we have async deferring wrappers using microtasks.
  5892. // In 2.5 we used (macro) tasks (in combination with microtasks).
  5893. // However, it has subtle problems when state is changed right before repaint
  5894. // (e.g. #6813, out-in transitions).
  5895. // Also, using (macro) tasks in event handler would cause some weird behaviors
  5896. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  5897. // So we now use microtasks everywhere, again.
  5898. // A major drawback of this tradeoff is that there are some scenarios
  5899. // where microtasks have too high a priority and fire in between supposedly
  5900. // sequential events (e.g. #4521, #6690, which have workarounds)
  5901. // or even between bubbling of the same event (#6566).
  5902. var timerFunc;
  5903. // The nextTick behavior leverages the microtask queue, which can be accessed
  5904. // via either native Promise.then or MutationObserver.
  5905. // MutationObserver has wider support, however it is seriously bugged in
  5906. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  5907. // completely stops working after triggering a few times... so, if native
  5908. // Promise is available, we will use it:
  5909. /* istanbul ignore next, $flow-disable-line */
  5910. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  5911. var p = Promise.resolve();
  5912. timerFunc = function () {
  5913. p.then(flushCallbacks);
  5914. // In problematic UIWebViews, Promise.then doesn't completely break, but
  5915. // it can get stuck in a weird state where callbacks are pushed into the
  5916. // microtask queue but the queue isn't being flushed, until the browser
  5917. // needs to do some other work, e.g. handle a timer. Therefore we can
  5918. // "force" the microtask queue to be flushed by adding an empty timer.
  5919. if (isIOS) { setTimeout(noop); }
  5920. };
  5921. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  5922. isNative(MutationObserver) ||
  5923. // PhantomJS and iOS 7.x
  5924. MutationObserver.toString() === '[object MutationObserverConstructor]'
  5925. )) {
  5926. // Use MutationObserver where native Promise is not available,
  5927. // e.g. PhantomJS, iOS7, Android 4.4
  5928. // (#6466 MutationObserver is unreliable in IE11)
  5929. var counter = 1;
  5930. var observer = new MutationObserver(flushCallbacks);
  5931. var textNode = document.createTextNode(String(counter));
  5932. observer.observe(textNode, {
  5933. characterData: true
  5934. });
  5935. timerFunc = function () {
  5936. counter = (counter + 1) % 2;
  5937. textNode.data = String(counter);
  5938. };
  5939. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  5940. // Fallback to setImmediate.
  5941. // Technically it leverages the (macro) task queue,
  5942. // but it is still a better choice than setTimeout.
  5943. timerFunc = function () {
  5944. setImmediate(flushCallbacks);
  5945. };
  5946. } else {
  5947. // Fallback to setTimeout.
  5948. timerFunc = function () {
  5949. setTimeout(flushCallbacks, 0);
  5950. };
  5951. }
  5952. function nextTick (cb, ctx) {
  5953. var _resolve;
  5954. callbacks.push(function () {
  5955. if (cb) {
  5956. try {
  5957. cb.call(ctx);
  5958. } catch (e) {
  5959. handleError(e, ctx, 'nextTick');
  5960. }
  5961. } else if (_resolve) {
  5962. _resolve(ctx);
  5963. }
  5964. });
  5965. if (!pending) {
  5966. pending = true;
  5967. timerFunc();
  5968. }
  5969. // $flow-disable-line
  5970. if (!cb && typeof Promise !== 'undefined') {
  5971. return new Promise(function (resolve) {
  5972. _resolve = resolve;
  5973. })
  5974. }
  5975. }
  5976. /* */
  5977. /* not type checking this file because flow doesn't play well with Proxy */
  5978. var initProxy;
  5979. if (true) {
  5980. var allowedGlobals = makeMap(
  5981. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  5982. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  5983. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  5984. 'require' // for Webpack/Browserify
  5985. );
  5986. var warnNonPresent = function (target, key) {
  5987. warn(
  5988. "Property or method \"" + key + "\" is not defined on the instance but " +
  5989. 'referenced during render. Make sure that this property is reactive, ' +
  5990. 'either in the data option, or for class-based components, by ' +
  5991. 'initializing the property. ' +
  5992. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  5993. target
  5994. );
  5995. };
  5996. var warnReservedPrefix = function (target, key) {
  5997. warn(
  5998. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  5999. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  6000. 'prevent conflicts with Vue internals. ' +
  6001. 'See: https://vuejs.org/v2/api/#data',
  6002. target
  6003. );
  6004. };
  6005. var hasProxy =
  6006. typeof Proxy !== 'undefined' && isNative(Proxy);
  6007. if (hasProxy) {
  6008. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  6009. config.keyCodes = new Proxy(config.keyCodes, {
  6010. set: function set (target, key, value) {
  6011. if (isBuiltInModifier(key)) {
  6012. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  6013. return false
  6014. } else {
  6015. target[key] = value;
  6016. return true
  6017. }
  6018. }
  6019. });
  6020. }
  6021. var hasHandler = {
  6022. has: function has (target, key) {
  6023. var has = key in target;
  6024. var isAllowed = allowedGlobals(key) ||
  6025. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  6026. if (!has && !isAllowed) {
  6027. if (key in target.$data) { warnReservedPrefix(target, key); }
  6028. else { warnNonPresent(target, key); }
  6029. }
  6030. return has || !isAllowed
  6031. }
  6032. };
  6033. var getHandler = {
  6034. get: function get (target, key) {
  6035. if (typeof key === 'string' && !(key in target)) {
  6036. if (key in target.$data) { warnReservedPrefix(target, key); }
  6037. else { warnNonPresent(target, key); }
  6038. }
  6039. return target[key]
  6040. }
  6041. };
  6042. initProxy = function initProxy (vm) {
  6043. if (hasProxy) {
  6044. // determine which proxy handler to use
  6045. var options = vm.$options;
  6046. var handlers = options.render && options.render._withStripped
  6047. ? getHandler
  6048. : hasHandler;
  6049. vm._renderProxy = new Proxy(vm, handlers);
  6050. } else {
  6051. vm._renderProxy = vm;
  6052. }
  6053. };
  6054. }
  6055. /* */
  6056. var seenObjects = new _Set();
  6057. /**
  6058. * Recursively traverse an object to evoke all converted
  6059. * getters, so that every nested property inside the object
  6060. * is collected as a "deep" dependency.
  6061. */
  6062. function traverse (val) {
  6063. _traverse(val, seenObjects);
  6064. seenObjects.clear();
  6065. }
  6066. function _traverse (val, seen) {
  6067. var i, keys;
  6068. var isA = Array.isArray(val);
  6069. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  6070. return
  6071. }
  6072. if (val.__ob__) {
  6073. var depId = val.__ob__.dep.id;
  6074. if (seen.has(depId)) {
  6075. return
  6076. }
  6077. seen.add(depId);
  6078. }
  6079. if (isA) {
  6080. i = val.length;
  6081. while (i--) { _traverse(val[i], seen); }
  6082. } else {
  6083. keys = Object.keys(val);
  6084. i = keys.length;
  6085. while (i--) { _traverse(val[keys[i]], seen); }
  6086. }
  6087. }
  6088. var mark;
  6089. var measure;
  6090. if (true) {
  6091. var perf = inBrowser && window.performance;
  6092. /* istanbul ignore if */
  6093. if (
  6094. perf &&
  6095. perf.mark &&
  6096. perf.measure &&
  6097. perf.clearMarks &&
  6098. perf.clearMeasures
  6099. ) {
  6100. mark = function (tag) { return perf.mark(tag); };
  6101. measure = function (name, startTag, endTag) {
  6102. perf.measure(name, startTag, endTag);
  6103. perf.clearMarks(startTag);
  6104. perf.clearMarks(endTag);
  6105. // perf.clearMeasures(name)
  6106. };
  6107. }
  6108. }
  6109. /* */
  6110. var normalizeEvent = cached(function (name) {
  6111. var passive = name.charAt(0) === '&';
  6112. name = passive ? name.slice(1) : name;
  6113. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  6114. name = once$$1 ? name.slice(1) : name;
  6115. var capture = name.charAt(0) === '!';
  6116. name = capture ? name.slice(1) : name;
  6117. return {
  6118. name: name,
  6119. once: once$$1,
  6120. capture: capture,
  6121. passive: passive
  6122. }
  6123. });
  6124. function createFnInvoker (fns, vm) {
  6125. function invoker () {
  6126. var arguments$1 = arguments;
  6127. var fns = invoker.fns;
  6128. if (Array.isArray(fns)) {
  6129. var cloned = fns.slice();
  6130. for (var i = 0; i < cloned.length; i++) {
  6131. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  6132. }
  6133. } else {
  6134. // return handler return value for single handlers
  6135. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  6136. }
  6137. }
  6138. invoker.fns = fns;
  6139. return invoker
  6140. }
  6141. function updateListeners (
  6142. on,
  6143. oldOn,
  6144. add,
  6145. remove$$1,
  6146. createOnceHandler,
  6147. vm
  6148. ) {
  6149. var name, def$$1, cur, old, event;
  6150. for (name in on) {
  6151. def$$1 = cur = on[name];
  6152. old = oldOn[name];
  6153. event = normalizeEvent(name);
  6154. if (isUndef(cur)) {
  6155. true && warn(
  6156. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  6157. vm
  6158. );
  6159. } else if (isUndef(old)) {
  6160. if (isUndef(cur.fns)) {
  6161. cur = on[name] = createFnInvoker(cur, vm);
  6162. }
  6163. if (isTrue(event.once)) {
  6164. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  6165. }
  6166. add(event.name, cur, event.capture, event.passive, event.params);
  6167. } else if (cur !== old) {
  6168. old.fns = cur;
  6169. on[name] = old;
  6170. }
  6171. }
  6172. for (name in oldOn) {
  6173. if (isUndef(on[name])) {
  6174. event = normalizeEvent(name);
  6175. remove$$1(event.name, oldOn[name], event.capture);
  6176. }
  6177. }
  6178. }
  6179. /* */
  6180. /* */
  6181. // fixed by xxxxxx (mp properties)
  6182. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  6183. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  6184. if (isUndef(propOptions)) {
  6185. return res
  6186. }
  6187. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  6188. var attrs = data.attrs;
  6189. var props = data.props;
  6190. if (isDef(attrs) || isDef(props)) {
  6191. for (var key in propOptions) {
  6192. var altKey = hyphenate(key);
  6193. var result = checkProp(res, props, key, altKey, true) ||
  6194. checkProp(res, attrs, key, altKey, false);
  6195. // externalClass
  6196. if (
  6197. result &&
  6198. res[key] &&
  6199. externalClasses.indexOf(altKey) !== -1 &&
  6200. context[camelize(res[key])]
  6201. ) {
  6202. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  6203. res[key] = context[camelize(res[key])];
  6204. }
  6205. }
  6206. }
  6207. return res
  6208. }
  6209. function extractPropsFromVNodeData (
  6210. data,
  6211. Ctor,
  6212. tag,
  6213. context// fixed by xxxxxx
  6214. ) {
  6215. // we are only extracting raw values here.
  6216. // validation and default values are handled in the child
  6217. // component itself.
  6218. var propOptions = Ctor.options.props;
  6219. if (isUndef(propOptions)) {
  6220. // fixed by xxxxxx
  6221. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  6222. }
  6223. var res = {};
  6224. var attrs = data.attrs;
  6225. var props = data.props;
  6226. if (isDef(attrs) || isDef(props)) {
  6227. for (var key in propOptions) {
  6228. var altKey = hyphenate(key);
  6229. if (true) {
  6230. var keyInLowerCase = key.toLowerCase();
  6231. if (
  6232. key !== keyInLowerCase &&
  6233. attrs && hasOwn(attrs, keyInLowerCase)
  6234. ) {
  6235. tip(
  6236. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  6237. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  6238. " \"" + key + "\". " +
  6239. "Note that HTML attributes are case-insensitive and camelCased " +
  6240. "props need to use their kebab-case equivalents when using in-DOM " +
  6241. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  6242. );
  6243. }
  6244. }
  6245. checkProp(res, props, key, altKey, true) ||
  6246. checkProp(res, attrs, key, altKey, false);
  6247. }
  6248. }
  6249. // fixed by xxxxxx
  6250. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  6251. }
  6252. function checkProp (
  6253. res,
  6254. hash,
  6255. key,
  6256. altKey,
  6257. preserve
  6258. ) {
  6259. if (isDef(hash)) {
  6260. if (hasOwn(hash, key)) {
  6261. res[key] = hash[key];
  6262. if (!preserve) {
  6263. delete hash[key];
  6264. }
  6265. return true
  6266. } else if (hasOwn(hash, altKey)) {
  6267. res[key] = hash[altKey];
  6268. if (!preserve) {
  6269. delete hash[altKey];
  6270. }
  6271. return true
  6272. }
  6273. }
  6274. return false
  6275. }
  6276. /* */
  6277. // The template compiler attempts to minimize the need for normalization by
  6278. // statically analyzing the template at compile time.
  6279. //
  6280. // For plain HTML markup, normalization can be completely skipped because the
  6281. // generated render function is guaranteed to return Array<VNode>. There are
  6282. // two cases where extra normalization is needed:
  6283. // 1. When the children contains components - because a functional component
  6284. // may return an Array instead of a single root. In this case, just a simple
  6285. // normalization is needed - if any child is an Array, we flatten the whole
  6286. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  6287. // because functional components already normalize their own children.
  6288. function simpleNormalizeChildren (children) {
  6289. for (var i = 0; i < children.length; i++) {
  6290. if (Array.isArray(children[i])) {
  6291. return Array.prototype.concat.apply([], children)
  6292. }
  6293. }
  6294. return children
  6295. }
  6296. // 2. When the children contains constructs that always generated nested Arrays,
  6297. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  6298. // with hand-written render functions / JSX. In such cases a full normalization
  6299. // is needed to cater to all possible types of children values.
  6300. function normalizeChildren (children) {
  6301. return isPrimitive(children)
  6302. ? [createTextVNode(children)]
  6303. : Array.isArray(children)
  6304. ? normalizeArrayChildren(children)
  6305. : undefined
  6306. }
  6307. function isTextNode (node) {
  6308. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  6309. }
  6310. function normalizeArrayChildren (children, nestedIndex) {
  6311. var res = [];
  6312. var i, c, lastIndex, last;
  6313. for (i = 0; i < children.length; i++) {
  6314. c = children[i];
  6315. if (isUndef(c) || typeof c === 'boolean') { continue }
  6316. lastIndex = res.length - 1;
  6317. last = res[lastIndex];
  6318. // nested
  6319. if (Array.isArray(c)) {
  6320. if (c.length > 0) {
  6321. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  6322. // merge adjacent text nodes
  6323. if (isTextNode(c[0]) && isTextNode(last)) {
  6324. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  6325. c.shift();
  6326. }
  6327. res.push.apply(res, c);
  6328. }
  6329. } else if (isPrimitive(c)) {
  6330. if (isTextNode(last)) {
  6331. // merge adjacent text nodes
  6332. // this is necessary for SSR hydration because text nodes are
  6333. // essentially merged when rendered to HTML strings
  6334. res[lastIndex] = createTextVNode(last.text + c);
  6335. } else if (c !== '') {
  6336. // convert primitive to vnode
  6337. res.push(createTextVNode(c));
  6338. }
  6339. } else {
  6340. if (isTextNode(c) && isTextNode(last)) {
  6341. // merge adjacent text nodes
  6342. res[lastIndex] = createTextVNode(last.text + c.text);
  6343. } else {
  6344. // default key for nested array children (likely generated by v-for)
  6345. if (isTrue(children._isVList) &&
  6346. isDef(c.tag) &&
  6347. isUndef(c.key) &&
  6348. isDef(nestedIndex)) {
  6349. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  6350. }
  6351. res.push(c);
  6352. }
  6353. }
  6354. }
  6355. return res
  6356. }
  6357. /* */
  6358. function initProvide (vm) {
  6359. var provide = vm.$options.provide;
  6360. if (provide) {
  6361. vm._provided = typeof provide === 'function'
  6362. ? provide.call(vm)
  6363. : provide;
  6364. }
  6365. }
  6366. function initInjections (vm) {
  6367. var result = resolveInject(vm.$options.inject, vm);
  6368. if (result) {
  6369. toggleObserving(false);
  6370. Object.keys(result).forEach(function (key) {
  6371. /* istanbul ignore else */
  6372. if (true) {
  6373. defineReactive$$1(vm, key, result[key], function () {
  6374. warn(
  6375. "Avoid mutating an injected value directly since the changes will be " +
  6376. "overwritten whenever the provided component re-renders. " +
  6377. "injection being mutated: \"" + key + "\"",
  6378. vm
  6379. );
  6380. });
  6381. } else {}
  6382. });
  6383. toggleObserving(true);
  6384. }
  6385. }
  6386. function resolveInject (inject, vm) {
  6387. if (inject) {
  6388. // inject is :any because flow is not smart enough to figure out cached
  6389. var result = Object.create(null);
  6390. var keys = hasSymbol
  6391. ? Reflect.ownKeys(inject)
  6392. : Object.keys(inject);
  6393. for (var i = 0; i < keys.length; i++) {
  6394. var key = keys[i];
  6395. // #6574 in case the inject object is observed...
  6396. if (key === '__ob__') { continue }
  6397. var provideKey = inject[key].from;
  6398. var source = vm;
  6399. while (source) {
  6400. if (source._provided && hasOwn(source._provided, provideKey)) {
  6401. result[key] = source._provided[provideKey];
  6402. break
  6403. }
  6404. source = source.$parent;
  6405. }
  6406. if (!source) {
  6407. if ('default' in inject[key]) {
  6408. var provideDefault = inject[key].default;
  6409. result[key] = typeof provideDefault === 'function'
  6410. ? provideDefault.call(vm)
  6411. : provideDefault;
  6412. } else if (true) {
  6413. warn(("Injection \"" + key + "\" not found"), vm);
  6414. }
  6415. }
  6416. }
  6417. return result
  6418. }
  6419. }
  6420. /* */
  6421. /**
  6422. * Runtime helper for resolving raw children VNodes into a slot object.
  6423. */
  6424. function resolveSlots (
  6425. children,
  6426. context
  6427. ) {
  6428. if (!children || !children.length) {
  6429. return {}
  6430. }
  6431. var slots = {};
  6432. for (var i = 0, l = children.length; i < l; i++) {
  6433. var child = children[i];
  6434. var data = child.data;
  6435. // remove slot attribute if the node is resolved as a Vue slot node
  6436. if (data && data.attrs && data.attrs.slot) {
  6437. delete data.attrs.slot;
  6438. }
  6439. // named slots should only be respected if the vnode was rendered in the
  6440. // same context.
  6441. if ((child.context === context || child.fnContext === context) &&
  6442. data && data.slot != null
  6443. ) {
  6444. var name = data.slot;
  6445. var slot = (slots[name] || (slots[name] = []));
  6446. if (child.tag === 'template') {
  6447. slot.push.apply(slot, child.children || []);
  6448. } else {
  6449. slot.push(child);
  6450. }
  6451. } else {
  6452. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  6453. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  6454. (slots['page'] || (slots['page'] = [])).push(child);
  6455. }else{
  6456. (slots.default || (slots.default = [])).push(child);
  6457. }
  6458. }
  6459. }
  6460. // ignore slots that contains only whitespace
  6461. for (var name$1 in slots) {
  6462. if (slots[name$1].every(isWhitespace)) {
  6463. delete slots[name$1];
  6464. }
  6465. }
  6466. return slots
  6467. }
  6468. function isWhitespace (node) {
  6469. return (node.isComment && !node.asyncFactory) || node.text === ' '
  6470. }
  6471. /* */
  6472. function normalizeScopedSlots (
  6473. slots,
  6474. normalSlots,
  6475. prevSlots
  6476. ) {
  6477. var res;
  6478. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  6479. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  6480. var key = slots && slots.$key;
  6481. if (!slots) {
  6482. res = {};
  6483. } else if (slots._normalized) {
  6484. // fast path 1: child component re-render only, parent did not change
  6485. return slots._normalized
  6486. } else if (
  6487. isStable &&
  6488. prevSlots &&
  6489. prevSlots !== emptyObject &&
  6490. key === prevSlots.$key &&
  6491. !hasNormalSlots &&
  6492. !prevSlots.$hasNormal
  6493. ) {
  6494. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  6495. // only need to normalize once
  6496. return prevSlots
  6497. } else {
  6498. res = {};
  6499. for (var key$1 in slots) {
  6500. if (slots[key$1] && key$1[0] !== '$') {
  6501. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  6502. }
  6503. }
  6504. }
  6505. // expose normal slots on scopedSlots
  6506. for (var key$2 in normalSlots) {
  6507. if (!(key$2 in res)) {
  6508. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  6509. }
  6510. }
  6511. // avoriaz seems to mock a non-extensible $scopedSlots object
  6512. // and when that is passed down this would cause an error
  6513. if (slots && Object.isExtensible(slots)) {
  6514. (slots)._normalized = res;
  6515. }
  6516. def(res, '$stable', isStable);
  6517. def(res, '$key', key);
  6518. def(res, '$hasNormal', hasNormalSlots);
  6519. return res
  6520. }
  6521. function normalizeScopedSlot(normalSlots, key, fn) {
  6522. var normalized = function () {
  6523. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  6524. res = res && typeof res === 'object' && !Array.isArray(res)
  6525. ? [res] // single vnode
  6526. : normalizeChildren(res);
  6527. return res && (
  6528. res.length === 0 ||
  6529. (res.length === 1 && res[0].isComment) // #9658
  6530. ) ? undefined
  6531. : res
  6532. };
  6533. // this is a slot using the new v-slot syntax without scope. although it is
  6534. // compiled as a scoped slot, render fn users would expect it to be present
  6535. // on this.$slots because the usage is semantically a normal slot.
  6536. if (fn.proxy) {
  6537. Object.defineProperty(normalSlots, key, {
  6538. get: normalized,
  6539. enumerable: true,
  6540. configurable: true
  6541. });
  6542. }
  6543. return normalized
  6544. }
  6545. function proxyNormalSlot(slots, key) {
  6546. return function () { return slots[key]; }
  6547. }
  6548. /* */
  6549. /**
  6550. * Runtime helper for rendering v-for lists.
  6551. */
  6552. function renderList (
  6553. val,
  6554. render
  6555. ) {
  6556. var ret, i, l, keys, key;
  6557. if (Array.isArray(val) || typeof val === 'string') {
  6558. ret = new Array(val.length);
  6559. for (i = 0, l = val.length; i < l; i++) {
  6560. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  6561. }
  6562. } else if (typeof val === 'number') {
  6563. ret = new Array(val);
  6564. for (i = 0; i < val; i++) {
  6565. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  6566. }
  6567. } else if (isObject(val)) {
  6568. if (hasSymbol && val[Symbol.iterator]) {
  6569. ret = [];
  6570. var iterator = val[Symbol.iterator]();
  6571. var result = iterator.next();
  6572. while (!result.done) {
  6573. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  6574. result = iterator.next();
  6575. }
  6576. } else {
  6577. keys = Object.keys(val);
  6578. ret = new Array(keys.length);
  6579. for (i = 0, l = keys.length; i < l; i++) {
  6580. key = keys[i];
  6581. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  6582. }
  6583. }
  6584. }
  6585. if (!isDef(ret)) {
  6586. ret = [];
  6587. }
  6588. (ret)._isVList = true;
  6589. return ret
  6590. }
  6591. /* */
  6592. /**
  6593. * Runtime helper for rendering <slot>
  6594. */
  6595. function renderSlot (
  6596. name,
  6597. fallback,
  6598. props,
  6599. bindObject
  6600. ) {
  6601. var scopedSlotFn = this.$scopedSlots[name];
  6602. var nodes;
  6603. if (scopedSlotFn) { // scoped slot
  6604. props = props || {};
  6605. if (bindObject) {
  6606. if ( true && !isObject(bindObject)) {
  6607. warn(
  6608. 'slot v-bind without argument expects an Object',
  6609. this
  6610. );
  6611. }
  6612. props = extend(extend({}, bindObject), props);
  6613. }
  6614. // fixed by xxxxxx app-plus scopedSlot
  6615. nodes = scopedSlotFn(props, this, props._i) || fallback;
  6616. } else {
  6617. nodes = this.$slots[name] || fallback;
  6618. }
  6619. var target = props && props.slot;
  6620. if (target) {
  6621. return this.$createElement('template', { slot: target }, nodes)
  6622. } else {
  6623. return nodes
  6624. }
  6625. }
  6626. /* */
  6627. /**
  6628. * Runtime helper for resolving filters
  6629. */
  6630. function resolveFilter (id) {
  6631. return resolveAsset(this.$options, 'filters', id, true) || identity
  6632. }
  6633. /* */
  6634. function isKeyNotMatch (expect, actual) {
  6635. if (Array.isArray(expect)) {
  6636. return expect.indexOf(actual) === -1
  6637. } else {
  6638. return expect !== actual
  6639. }
  6640. }
  6641. /**
  6642. * Runtime helper for checking keyCodes from config.
  6643. * exposed as Vue.prototype._k
  6644. * passing in eventKeyName as last argument separately for backwards compat
  6645. */
  6646. function checkKeyCodes (
  6647. eventKeyCode,
  6648. key,
  6649. builtInKeyCode,
  6650. eventKeyName,
  6651. builtInKeyName
  6652. ) {
  6653. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  6654. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  6655. return isKeyNotMatch(builtInKeyName, eventKeyName)
  6656. } else if (mappedKeyCode) {
  6657. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  6658. } else if (eventKeyName) {
  6659. return hyphenate(eventKeyName) !== key
  6660. }
  6661. }
  6662. /* */
  6663. /**
  6664. * Runtime helper for merging v-bind="object" into a VNode's data.
  6665. */
  6666. function bindObjectProps (
  6667. data,
  6668. tag,
  6669. value,
  6670. asProp,
  6671. isSync
  6672. ) {
  6673. if (value) {
  6674. if (!isObject(value)) {
  6675. true && warn(
  6676. 'v-bind without argument expects an Object or Array value',
  6677. this
  6678. );
  6679. } else {
  6680. if (Array.isArray(value)) {
  6681. value = toObject(value);
  6682. }
  6683. var hash;
  6684. var loop = function ( key ) {
  6685. if (
  6686. key === 'class' ||
  6687. key === 'style' ||
  6688. isReservedAttribute(key)
  6689. ) {
  6690. hash = data;
  6691. } else {
  6692. var type = data.attrs && data.attrs.type;
  6693. hash = asProp || config.mustUseProp(tag, type, key)
  6694. ? data.domProps || (data.domProps = {})
  6695. : data.attrs || (data.attrs = {});
  6696. }
  6697. var camelizedKey = camelize(key);
  6698. var hyphenatedKey = hyphenate(key);
  6699. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  6700. hash[key] = value[key];
  6701. if (isSync) {
  6702. var on = data.on || (data.on = {});
  6703. on[("update:" + key)] = function ($event) {
  6704. value[key] = $event;
  6705. };
  6706. }
  6707. }
  6708. };
  6709. for (var key in value) loop( key );
  6710. }
  6711. }
  6712. return data
  6713. }
  6714. /* */
  6715. /**
  6716. * Runtime helper for rendering static trees.
  6717. */
  6718. function renderStatic (
  6719. index,
  6720. isInFor
  6721. ) {
  6722. var cached = this._staticTrees || (this._staticTrees = []);
  6723. var tree = cached[index];
  6724. // if has already-rendered static tree and not inside v-for,
  6725. // we can reuse the same tree.
  6726. if (tree && !isInFor) {
  6727. return tree
  6728. }
  6729. // otherwise, render a fresh tree.
  6730. tree = cached[index] = this.$options.staticRenderFns[index].call(
  6731. this._renderProxy,
  6732. null,
  6733. this // for render fns generated for functional component templates
  6734. );
  6735. markStatic(tree, ("__static__" + index), false);
  6736. return tree
  6737. }
  6738. /**
  6739. * Runtime helper for v-once.
  6740. * Effectively it means marking the node as static with a unique key.
  6741. */
  6742. function markOnce (
  6743. tree,
  6744. index,
  6745. key
  6746. ) {
  6747. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  6748. return tree
  6749. }
  6750. function markStatic (
  6751. tree,
  6752. key,
  6753. isOnce
  6754. ) {
  6755. if (Array.isArray(tree)) {
  6756. for (var i = 0; i < tree.length; i++) {
  6757. if (tree[i] && typeof tree[i] !== 'string') {
  6758. markStaticNode(tree[i], (key + "_" + i), isOnce);
  6759. }
  6760. }
  6761. } else {
  6762. markStaticNode(tree, key, isOnce);
  6763. }
  6764. }
  6765. function markStaticNode (node, key, isOnce) {
  6766. node.isStatic = true;
  6767. node.key = key;
  6768. node.isOnce = isOnce;
  6769. }
  6770. /* */
  6771. function bindObjectListeners (data, value) {
  6772. if (value) {
  6773. if (!isPlainObject(value)) {
  6774. true && warn(
  6775. 'v-on without argument expects an Object value',
  6776. this
  6777. );
  6778. } else {
  6779. var on = data.on = data.on ? extend({}, data.on) : {};
  6780. for (var key in value) {
  6781. var existing = on[key];
  6782. var ours = value[key];
  6783. on[key] = existing ? [].concat(existing, ours) : ours;
  6784. }
  6785. }
  6786. }
  6787. return data
  6788. }
  6789. /* */
  6790. function resolveScopedSlots (
  6791. fns, // see flow/vnode
  6792. res,
  6793. // the following are added in 2.6
  6794. hasDynamicKeys,
  6795. contentHashKey
  6796. ) {
  6797. res = res || { $stable: !hasDynamicKeys };
  6798. for (var i = 0; i < fns.length; i++) {
  6799. var slot = fns[i];
  6800. if (Array.isArray(slot)) {
  6801. resolveScopedSlots(slot, res, hasDynamicKeys);
  6802. } else if (slot) {
  6803. // marker for reverse proxying v-slot without scope on this.$slots
  6804. if (slot.proxy) {
  6805. slot.fn.proxy = true;
  6806. }
  6807. res[slot.key] = slot.fn;
  6808. }
  6809. }
  6810. if (contentHashKey) {
  6811. (res).$key = contentHashKey;
  6812. }
  6813. return res
  6814. }
  6815. /* */
  6816. function bindDynamicKeys (baseObj, values) {
  6817. for (var i = 0; i < values.length; i += 2) {
  6818. var key = values[i];
  6819. if (typeof key === 'string' && key) {
  6820. baseObj[values[i]] = values[i + 1];
  6821. } else if ( true && key !== '' && key !== null) {
  6822. // null is a special value for explicitly removing a binding
  6823. warn(
  6824. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  6825. this
  6826. );
  6827. }
  6828. }
  6829. return baseObj
  6830. }
  6831. // helper to dynamically append modifier runtime markers to event names.
  6832. // ensure only append when value is already string, otherwise it will be cast
  6833. // to string and cause the type check to miss.
  6834. function prependModifier (value, symbol) {
  6835. return typeof value === 'string' ? symbol + value : value
  6836. }
  6837. /* */
  6838. function installRenderHelpers (target) {
  6839. target._o = markOnce;
  6840. target._n = toNumber;
  6841. target._s = toString;
  6842. target._l = renderList;
  6843. target._t = renderSlot;
  6844. target._q = looseEqual;
  6845. target._i = looseIndexOf;
  6846. target._m = renderStatic;
  6847. target._f = resolveFilter;
  6848. target._k = checkKeyCodes;
  6849. target._b = bindObjectProps;
  6850. target._v = createTextVNode;
  6851. target._e = createEmptyVNode;
  6852. target._u = resolveScopedSlots;
  6853. target._g = bindObjectListeners;
  6854. target._d = bindDynamicKeys;
  6855. target._p = prependModifier;
  6856. }
  6857. /* */
  6858. function FunctionalRenderContext (
  6859. data,
  6860. props,
  6861. children,
  6862. parent,
  6863. Ctor
  6864. ) {
  6865. var this$1 = this;
  6866. var options = Ctor.options;
  6867. // ensure the createElement function in functional components
  6868. // gets a unique context - this is necessary for correct named slot check
  6869. var contextVm;
  6870. if (hasOwn(parent, '_uid')) {
  6871. contextVm = Object.create(parent);
  6872. // $flow-disable-line
  6873. contextVm._original = parent;
  6874. } else {
  6875. // the context vm passed in is a functional context as well.
  6876. // in this case we want to make sure we are able to get a hold to the
  6877. // real context instance.
  6878. contextVm = parent;
  6879. // $flow-disable-line
  6880. parent = parent._original;
  6881. }
  6882. var isCompiled = isTrue(options._compiled);
  6883. var needNormalization = !isCompiled;
  6884. this.data = data;
  6885. this.props = props;
  6886. this.children = children;
  6887. this.parent = parent;
  6888. this.listeners = data.on || emptyObject;
  6889. this.injections = resolveInject(options.inject, parent);
  6890. this.slots = function () {
  6891. if (!this$1.$slots) {
  6892. normalizeScopedSlots(
  6893. data.scopedSlots,
  6894. this$1.$slots = resolveSlots(children, parent)
  6895. );
  6896. }
  6897. return this$1.$slots
  6898. };
  6899. Object.defineProperty(this, 'scopedSlots', ({
  6900. enumerable: true,
  6901. get: function get () {
  6902. return normalizeScopedSlots(data.scopedSlots, this.slots())
  6903. }
  6904. }));
  6905. // support for compiled functional template
  6906. if (isCompiled) {
  6907. // exposing $options for renderStatic()
  6908. this.$options = options;
  6909. // pre-resolve slots for renderSlot()
  6910. this.$slots = this.slots();
  6911. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  6912. }
  6913. if (options._scopeId) {
  6914. this._c = function (a, b, c, d) {
  6915. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  6916. if (vnode && !Array.isArray(vnode)) {
  6917. vnode.fnScopeId = options._scopeId;
  6918. vnode.fnContext = parent;
  6919. }
  6920. return vnode
  6921. };
  6922. } else {
  6923. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  6924. }
  6925. }
  6926. installRenderHelpers(FunctionalRenderContext.prototype);
  6927. function createFunctionalComponent (
  6928. Ctor,
  6929. propsData,
  6930. data,
  6931. contextVm,
  6932. children
  6933. ) {
  6934. var options = Ctor.options;
  6935. var props = {};
  6936. var propOptions = options.props;
  6937. if (isDef(propOptions)) {
  6938. for (var key in propOptions) {
  6939. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  6940. }
  6941. } else {
  6942. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  6943. if (isDef(data.props)) { mergeProps(props, data.props); }
  6944. }
  6945. var renderContext = new FunctionalRenderContext(
  6946. data,
  6947. props,
  6948. children,
  6949. contextVm,
  6950. Ctor
  6951. );
  6952. var vnode = options.render.call(null, renderContext._c, renderContext);
  6953. if (vnode instanceof VNode) {
  6954. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  6955. } else if (Array.isArray(vnode)) {
  6956. var vnodes = normalizeChildren(vnode) || [];
  6957. var res = new Array(vnodes.length);
  6958. for (var i = 0; i < vnodes.length; i++) {
  6959. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  6960. }
  6961. return res
  6962. }
  6963. }
  6964. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  6965. // #7817 clone node before setting fnContext, otherwise if the node is reused
  6966. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  6967. // that should not be matched to match.
  6968. var clone = cloneVNode(vnode);
  6969. clone.fnContext = contextVm;
  6970. clone.fnOptions = options;
  6971. if (true) {
  6972. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  6973. }
  6974. if (data.slot) {
  6975. (clone.data || (clone.data = {})).slot = data.slot;
  6976. }
  6977. return clone
  6978. }
  6979. function mergeProps (to, from) {
  6980. for (var key in from) {
  6981. to[camelize(key)] = from[key];
  6982. }
  6983. }
  6984. /* */
  6985. /* */
  6986. /* */
  6987. /* */
  6988. // inline hooks to be invoked on component VNodes during patch
  6989. var componentVNodeHooks = {
  6990. init: function init (vnode, hydrating) {
  6991. if (
  6992. vnode.componentInstance &&
  6993. !vnode.componentInstance._isDestroyed &&
  6994. vnode.data.keepAlive
  6995. ) {
  6996. // kept-alive components, treat as a patch
  6997. var mountedNode = vnode; // work around flow
  6998. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  6999. } else {
  7000. var child = vnode.componentInstance = createComponentInstanceForVnode(
  7001. vnode,
  7002. activeInstance
  7003. );
  7004. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  7005. }
  7006. },
  7007. prepatch: function prepatch (oldVnode, vnode) {
  7008. var options = vnode.componentOptions;
  7009. var child = vnode.componentInstance = oldVnode.componentInstance;
  7010. updateChildComponent(
  7011. child,
  7012. options.propsData, // updated props
  7013. options.listeners, // updated listeners
  7014. vnode, // new parent vnode
  7015. options.children // new children
  7016. );
  7017. },
  7018. insert: function insert (vnode) {
  7019. var context = vnode.context;
  7020. var componentInstance = vnode.componentInstance;
  7021. if (!componentInstance._isMounted) {
  7022. callHook(componentInstance, 'onServiceCreated');
  7023. callHook(componentInstance, 'onServiceAttached');
  7024. componentInstance._isMounted = true;
  7025. callHook(componentInstance, 'mounted');
  7026. }
  7027. if (vnode.data.keepAlive) {
  7028. if (context._isMounted) {
  7029. // vue-router#1212
  7030. // During updates, a kept-alive component's child components may
  7031. // change, so directly walking the tree here may call activated hooks
  7032. // on incorrect children. Instead we push them into a queue which will
  7033. // be processed after the whole patch process ended.
  7034. queueActivatedComponent(componentInstance);
  7035. } else {
  7036. activateChildComponent(componentInstance, true /* direct */);
  7037. }
  7038. }
  7039. },
  7040. destroy: function destroy (vnode) {
  7041. var componentInstance = vnode.componentInstance;
  7042. if (!componentInstance._isDestroyed) {
  7043. if (!vnode.data.keepAlive) {
  7044. componentInstance.$destroy();
  7045. } else {
  7046. deactivateChildComponent(componentInstance, true /* direct */);
  7047. }
  7048. }
  7049. }
  7050. };
  7051. var hooksToMerge = Object.keys(componentVNodeHooks);
  7052. function createComponent (
  7053. Ctor,
  7054. data,
  7055. context,
  7056. children,
  7057. tag
  7058. ) {
  7059. if (isUndef(Ctor)) {
  7060. return
  7061. }
  7062. var baseCtor = context.$options._base;
  7063. // plain options object: turn it into a constructor
  7064. if (isObject(Ctor)) {
  7065. Ctor = baseCtor.extend(Ctor);
  7066. }
  7067. // if at this stage it's not a constructor or an async component factory,
  7068. // reject.
  7069. if (typeof Ctor !== 'function') {
  7070. if (true) {
  7071. warn(("Invalid Component definition: " + (String(Ctor))), context);
  7072. }
  7073. return
  7074. }
  7075. // async component
  7076. var asyncFactory;
  7077. if (isUndef(Ctor.cid)) {
  7078. asyncFactory = Ctor;
  7079. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  7080. if (Ctor === undefined) {
  7081. // return a placeholder node for async component, which is rendered
  7082. // as a comment node but preserves all the raw information for the node.
  7083. // the information will be used for async server-rendering and hydration.
  7084. return createAsyncPlaceholder(
  7085. asyncFactory,
  7086. data,
  7087. context,
  7088. children,
  7089. tag
  7090. )
  7091. }
  7092. }
  7093. data = data || {};
  7094. // resolve constructor options in case global mixins are applied after
  7095. // component constructor creation
  7096. resolveConstructorOptions(Ctor);
  7097. // transform component v-model data into props & events
  7098. if (isDef(data.model)) {
  7099. transformModel(Ctor.options, data);
  7100. }
  7101. // extract props
  7102. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  7103. // functional component
  7104. if (isTrue(Ctor.options.functional)) {
  7105. return createFunctionalComponent(Ctor, propsData, data, context, children)
  7106. }
  7107. // extract listeners, since these needs to be treated as
  7108. // child component listeners instead of DOM listeners
  7109. var listeners = data.on;
  7110. // replace with listeners with .native modifier
  7111. // so it gets processed during parent component patch.
  7112. data.on = data.nativeOn;
  7113. if (isTrue(Ctor.options.abstract)) {
  7114. // abstract components do not keep anything
  7115. // other than props & listeners & slot
  7116. // work around flow
  7117. var slot = data.slot;
  7118. data = {};
  7119. if (slot) {
  7120. data.slot = slot;
  7121. }
  7122. }
  7123. // install component management hooks onto the placeholder node
  7124. installComponentHooks(data);
  7125. // return a placeholder vnode
  7126. var name = Ctor.options.name || tag;
  7127. var vnode = new VNode(
  7128. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  7129. data, undefined, undefined, undefined, context,
  7130. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  7131. asyncFactory
  7132. );
  7133. return vnode
  7134. }
  7135. function createComponentInstanceForVnode (
  7136. vnode, // we know it's MountedComponentVNode but flow doesn't
  7137. parent // activeInstance in lifecycle state
  7138. ) {
  7139. var options = {
  7140. _isComponent: true,
  7141. _parentVnode: vnode,
  7142. parent: parent
  7143. };
  7144. // check inline-template render functions
  7145. var inlineTemplate = vnode.data.inlineTemplate;
  7146. if (isDef(inlineTemplate)) {
  7147. options.render = inlineTemplate.render;
  7148. options.staticRenderFns = inlineTemplate.staticRenderFns;
  7149. }
  7150. return new vnode.componentOptions.Ctor(options)
  7151. }
  7152. function installComponentHooks (data) {
  7153. var hooks = data.hook || (data.hook = {});
  7154. for (var i = 0; i < hooksToMerge.length; i++) {
  7155. var key = hooksToMerge[i];
  7156. var existing = hooks[key];
  7157. var toMerge = componentVNodeHooks[key];
  7158. if (existing !== toMerge && !(existing && existing._merged)) {
  7159. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  7160. }
  7161. }
  7162. }
  7163. function mergeHook$1 (f1, f2) {
  7164. var merged = function (a, b) {
  7165. // flow complains about extra args which is why we use any
  7166. f1(a, b);
  7167. f2(a, b);
  7168. };
  7169. merged._merged = true;
  7170. return merged
  7171. }
  7172. // transform component v-model info (value and callback) into
  7173. // prop and event handler respectively.
  7174. function transformModel (options, data) {
  7175. var prop = (options.model && options.model.prop) || 'value';
  7176. var event = (options.model && options.model.event) || 'input'
  7177. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  7178. var on = data.on || (data.on = {});
  7179. var existing = on[event];
  7180. var callback = data.model.callback;
  7181. if (isDef(existing)) {
  7182. if (
  7183. Array.isArray(existing)
  7184. ? existing.indexOf(callback) === -1
  7185. : existing !== callback
  7186. ) {
  7187. on[event] = [callback].concat(existing);
  7188. }
  7189. } else {
  7190. on[event] = callback;
  7191. }
  7192. }
  7193. /* */
  7194. var SIMPLE_NORMALIZE = 1;
  7195. var ALWAYS_NORMALIZE = 2;
  7196. // wrapper function for providing a more flexible interface
  7197. // without getting yelled at by flow
  7198. function createElement (
  7199. context,
  7200. tag,
  7201. data,
  7202. children,
  7203. normalizationType,
  7204. alwaysNormalize
  7205. ) {
  7206. if (Array.isArray(data) || isPrimitive(data)) {
  7207. normalizationType = children;
  7208. children = data;
  7209. data = undefined;
  7210. }
  7211. if (isTrue(alwaysNormalize)) {
  7212. normalizationType = ALWAYS_NORMALIZE;
  7213. }
  7214. return _createElement(context, tag, data, children, normalizationType)
  7215. }
  7216. function _createElement (
  7217. context,
  7218. tag,
  7219. data,
  7220. children,
  7221. normalizationType
  7222. ) {
  7223. if (isDef(data) && isDef((data).__ob__)) {
  7224. true && warn(
  7225. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  7226. 'Always create fresh vnode data objects in each render!',
  7227. context
  7228. );
  7229. return createEmptyVNode()
  7230. }
  7231. // object syntax in v-bind
  7232. if (isDef(data) && isDef(data.is)) {
  7233. tag = data.is;
  7234. }
  7235. if (!tag) {
  7236. // in case of component :is set to falsy value
  7237. return createEmptyVNode()
  7238. }
  7239. // warn against non-primitive key
  7240. if ( true &&
  7241. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  7242. ) {
  7243. {
  7244. warn(
  7245. 'Avoid using non-primitive value as key, ' +
  7246. 'use string/number value instead.',
  7247. context
  7248. );
  7249. }
  7250. }
  7251. // support single function children as default scoped slot
  7252. if (Array.isArray(children) &&
  7253. typeof children[0] === 'function'
  7254. ) {
  7255. data = data || {};
  7256. data.scopedSlots = { default: children[0] };
  7257. children.length = 0;
  7258. }
  7259. if (normalizationType === ALWAYS_NORMALIZE) {
  7260. children = normalizeChildren(children);
  7261. } else if (normalizationType === SIMPLE_NORMALIZE) {
  7262. children = simpleNormalizeChildren(children);
  7263. }
  7264. var vnode, ns;
  7265. if (typeof tag === 'string') {
  7266. var Ctor;
  7267. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  7268. if (config.isReservedTag(tag)) {
  7269. // platform built-in elements
  7270. if ( true && isDef(data) && isDef(data.nativeOn)) {
  7271. warn(
  7272. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  7273. context
  7274. );
  7275. }
  7276. vnode = new VNode(
  7277. config.parsePlatformTagName(tag), data, children,
  7278. undefined, undefined, context
  7279. );
  7280. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  7281. // component
  7282. vnode = createComponent(Ctor, data, context, children, tag);
  7283. } else {
  7284. // unknown or unlisted namespaced elements
  7285. // check at runtime because it may get assigned a namespace when its
  7286. // parent normalizes children
  7287. vnode = new VNode(
  7288. tag, data, children,
  7289. undefined, undefined, context
  7290. );
  7291. }
  7292. } else {
  7293. // direct component options / constructor
  7294. vnode = createComponent(tag, data, context, children);
  7295. }
  7296. if (Array.isArray(vnode)) {
  7297. return vnode
  7298. } else if (isDef(vnode)) {
  7299. if (isDef(ns)) { applyNS(vnode, ns); }
  7300. if (isDef(data)) { registerDeepBindings(data); }
  7301. return vnode
  7302. } else {
  7303. return createEmptyVNode()
  7304. }
  7305. }
  7306. function applyNS (vnode, ns, force) {
  7307. vnode.ns = ns;
  7308. if (vnode.tag === 'foreignObject') {
  7309. // use default namespace inside foreignObject
  7310. ns = undefined;
  7311. force = true;
  7312. }
  7313. if (isDef(vnode.children)) {
  7314. for (var i = 0, l = vnode.children.length; i < l; i++) {
  7315. var child = vnode.children[i];
  7316. if (isDef(child.tag) && (
  7317. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  7318. applyNS(child, ns, force);
  7319. }
  7320. }
  7321. }
  7322. }
  7323. // ref #5318
  7324. // necessary to ensure parent re-render when deep bindings like :style and
  7325. // :class are used on slot nodes
  7326. function registerDeepBindings (data) {
  7327. if (isObject(data.style)) {
  7328. traverse(data.style);
  7329. }
  7330. if (isObject(data.class)) {
  7331. traverse(data.class);
  7332. }
  7333. }
  7334. /* */
  7335. function initRender (vm) {
  7336. vm._vnode = null; // the root of the child tree
  7337. vm._staticTrees = null; // v-once cached trees
  7338. var options = vm.$options;
  7339. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  7340. var renderContext = parentVnode && parentVnode.context;
  7341. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  7342. vm.$scopedSlots = emptyObject;
  7343. // bind the createElement fn to this instance
  7344. // so that we get proper render context inside it.
  7345. // args order: tag, data, children, normalizationType, alwaysNormalize
  7346. // internal version is used by render functions compiled from templates
  7347. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  7348. // normalization is always applied for the public version, used in
  7349. // user-written render functions.
  7350. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  7351. // $attrs & $listeners are exposed for easier HOC creation.
  7352. // they need to be reactive so that HOCs using them are always updated
  7353. var parentData = parentVnode && parentVnode.data;
  7354. /* istanbul ignore else */
  7355. if (true) {
  7356. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  7357. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  7358. }, true);
  7359. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  7360. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  7361. }, true);
  7362. } else {}
  7363. }
  7364. var currentRenderingInstance = null;
  7365. function renderMixin (Vue) {
  7366. // install runtime convenience helpers
  7367. installRenderHelpers(Vue.prototype);
  7368. Vue.prototype.$nextTick = function (fn) {
  7369. return nextTick(fn, this)
  7370. };
  7371. Vue.prototype._render = function () {
  7372. var vm = this;
  7373. var ref = vm.$options;
  7374. var render = ref.render;
  7375. var _parentVnode = ref._parentVnode;
  7376. if (_parentVnode) {
  7377. vm.$scopedSlots = normalizeScopedSlots(
  7378. _parentVnode.data.scopedSlots,
  7379. vm.$slots,
  7380. vm.$scopedSlots
  7381. );
  7382. }
  7383. // set parent vnode. this allows render functions to have access
  7384. // to the data on the placeholder node.
  7385. vm.$vnode = _parentVnode;
  7386. // render self
  7387. var vnode;
  7388. try {
  7389. // There's no need to maintain a stack because all render fns are called
  7390. // separately from one another. Nested component's render fns are called
  7391. // when parent component is patched.
  7392. currentRenderingInstance = vm;
  7393. vnode = render.call(vm._renderProxy, vm.$createElement);
  7394. } catch (e) {
  7395. handleError(e, vm, "render");
  7396. // return error render result,
  7397. // or previous vnode to prevent render error causing blank component
  7398. /* istanbul ignore else */
  7399. if ( true && vm.$options.renderError) {
  7400. try {
  7401. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  7402. } catch (e) {
  7403. handleError(e, vm, "renderError");
  7404. vnode = vm._vnode;
  7405. }
  7406. } else {
  7407. vnode = vm._vnode;
  7408. }
  7409. } finally {
  7410. currentRenderingInstance = null;
  7411. }
  7412. // if the returned array contains only a single node, allow it
  7413. if (Array.isArray(vnode) && vnode.length === 1) {
  7414. vnode = vnode[0];
  7415. }
  7416. // return empty vnode in case the render function errored out
  7417. if (!(vnode instanceof VNode)) {
  7418. if ( true && Array.isArray(vnode)) {
  7419. warn(
  7420. 'Multiple root nodes returned from render function. Render function ' +
  7421. 'should return a single root node.',
  7422. vm
  7423. );
  7424. }
  7425. vnode = createEmptyVNode();
  7426. }
  7427. // set parent
  7428. vnode.parent = _parentVnode;
  7429. return vnode
  7430. };
  7431. }
  7432. /* */
  7433. function ensureCtor (comp, base) {
  7434. if (
  7435. comp.__esModule ||
  7436. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  7437. ) {
  7438. comp = comp.default;
  7439. }
  7440. return isObject(comp)
  7441. ? base.extend(comp)
  7442. : comp
  7443. }
  7444. function createAsyncPlaceholder (
  7445. factory,
  7446. data,
  7447. context,
  7448. children,
  7449. tag
  7450. ) {
  7451. var node = createEmptyVNode();
  7452. node.asyncFactory = factory;
  7453. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  7454. return node
  7455. }
  7456. function resolveAsyncComponent (
  7457. factory,
  7458. baseCtor
  7459. ) {
  7460. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  7461. return factory.errorComp
  7462. }
  7463. if (isDef(factory.resolved)) {
  7464. return factory.resolved
  7465. }
  7466. var owner = currentRenderingInstance;
  7467. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  7468. // already pending
  7469. factory.owners.push(owner);
  7470. }
  7471. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  7472. return factory.loadingComp
  7473. }
  7474. if (owner && !isDef(factory.owners)) {
  7475. var owners = factory.owners = [owner];
  7476. var sync = true;
  7477. var timerLoading = null;
  7478. var timerTimeout = null
  7479. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  7480. var forceRender = function (renderCompleted) {
  7481. for (var i = 0, l = owners.length; i < l; i++) {
  7482. (owners[i]).$forceUpdate();
  7483. }
  7484. if (renderCompleted) {
  7485. owners.length = 0;
  7486. if (timerLoading !== null) {
  7487. clearTimeout(timerLoading);
  7488. timerLoading = null;
  7489. }
  7490. if (timerTimeout !== null) {
  7491. clearTimeout(timerTimeout);
  7492. timerTimeout = null;
  7493. }
  7494. }
  7495. };
  7496. var resolve = once(function (res) {
  7497. // cache resolved
  7498. factory.resolved = ensureCtor(res, baseCtor);
  7499. // invoke callbacks only if this is not a synchronous resolve
  7500. // (async resolves are shimmed as synchronous during SSR)
  7501. if (!sync) {
  7502. forceRender(true);
  7503. } else {
  7504. owners.length = 0;
  7505. }
  7506. });
  7507. var reject = once(function (reason) {
  7508. true && warn(
  7509. "Failed to resolve async component: " + (String(factory)) +
  7510. (reason ? ("\nReason: " + reason) : '')
  7511. );
  7512. if (isDef(factory.errorComp)) {
  7513. factory.error = true;
  7514. forceRender(true);
  7515. }
  7516. });
  7517. var res = factory(resolve, reject);
  7518. if (isObject(res)) {
  7519. if (isPromise(res)) {
  7520. // () => Promise
  7521. if (isUndef(factory.resolved)) {
  7522. res.then(resolve, reject);
  7523. }
  7524. } else if (isPromise(res.component)) {
  7525. res.component.then(resolve, reject);
  7526. if (isDef(res.error)) {
  7527. factory.errorComp = ensureCtor(res.error, baseCtor);
  7528. }
  7529. if (isDef(res.loading)) {
  7530. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  7531. if (res.delay === 0) {
  7532. factory.loading = true;
  7533. } else {
  7534. timerLoading = setTimeout(function () {
  7535. timerLoading = null;
  7536. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  7537. factory.loading = true;
  7538. forceRender(false);
  7539. }
  7540. }, res.delay || 200);
  7541. }
  7542. }
  7543. if (isDef(res.timeout)) {
  7544. timerTimeout = setTimeout(function () {
  7545. timerTimeout = null;
  7546. if (isUndef(factory.resolved)) {
  7547. reject(
  7548. true
  7549. ? ("timeout (" + (res.timeout) + "ms)")
  7550. : undefined
  7551. );
  7552. }
  7553. }, res.timeout);
  7554. }
  7555. }
  7556. }
  7557. sync = false;
  7558. // return in case resolved synchronously
  7559. return factory.loading
  7560. ? factory.loadingComp
  7561. : factory.resolved
  7562. }
  7563. }
  7564. /* */
  7565. function isAsyncPlaceholder (node) {
  7566. return node.isComment && node.asyncFactory
  7567. }
  7568. /* */
  7569. function getFirstComponentChild (children) {
  7570. if (Array.isArray(children)) {
  7571. for (var i = 0; i < children.length; i++) {
  7572. var c = children[i];
  7573. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  7574. return c
  7575. }
  7576. }
  7577. }
  7578. }
  7579. /* */
  7580. /* */
  7581. function initEvents (vm) {
  7582. vm._events = Object.create(null);
  7583. vm._hasHookEvent = false;
  7584. // init parent attached events
  7585. var listeners = vm.$options._parentListeners;
  7586. if (listeners) {
  7587. updateComponentListeners(vm, listeners);
  7588. }
  7589. }
  7590. var target;
  7591. function add (event, fn) {
  7592. target.$on(event, fn);
  7593. }
  7594. function remove$1 (event, fn) {
  7595. target.$off(event, fn);
  7596. }
  7597. function createOnceHandler (event, fn) {
  7598. var _target = target;
  7599. return function onceHandler () {
  7600. var res = fn.apply(null, arguments);
  7601. if (res !== null) {
  7602. _target.$off(event, onceHandler);
  7603. }
  7604. }
  7605. }
  7606. function updateComponentListeners (
  7607. vm,
  7608. listeners,
  7609. oldListeners
  7610. ) {
  7611. target = vm;
  7612. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  7613. target = undefined;
  7614. }
  7615. function eventsMixin (Vue) {
  7616. var hookRE = /^hook:/;
  7617. Vue.prototype.$on = function (event, fn) {
  7618. var vm = this;
  7619. if (Array.isArray(event)) {
  7620. for (var i = 0, l = event.length; i < l; i++) {
  7621. vm.$on(event[i], fn);
  7622. }
  7623. } else {
  7624. (vm._events[event] || (vm._events[event] = [])).push(fn);
  7625. // optimize hook:event cost by using a boolean flag marked at registration
  7626. // instead of a hash lookup
  7627. if (hookRE.test(event)) {
  7628. vm._hasHookEvent = true;
  7629. }
  7630. }
  7631. return vm
  7632. };
  7633. Vue.prototype.$once = function (event, fn) {
  7634. var vm = this;
  7635. function on () {
  7636. vm.$off(event, on);
  7637. fn.apply(vm, arguments);
  7638. }
  7639. on.fn = fn;
  7640. vm.$on(event, on);
  7641. return vm
  7642. };
  7643. Vue.prototype.$off = function (event, fn) {
  7644. var vm = this;
  7645. // all
  7646. if (!arguments.length) {
  7647. vm._events = Object.create(null);
  7648. return vm
  7649. }
  7650. // array of events
  7651. if (Array.isArray(event)) {
  7652. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  7653. vm.$off(event[i$1], fn);
  7654. }
  7655. return vm
  7656. }
  7657. // specific event
  7658. var cbs = vm._events[event];
  7659. if (!cbs) {
  7660. return vm
  7661. }
  7662. if (!fn) {
  7663. vm._events[event] = null;
  7664. return vm
  7665. }
  7666. // specific handler
  7667. var cb;
  7668. var i = cbs.length;
  7669. while (i--) {
  7670. cb = cbs[i];
  7671. if (cb === fn || cb.fn === fn) {
  7672. cbs.splice(i, 1);
  7673. break
  7674. }
  7675. }
  7676. return vm
  7677. };
  7678. Vue.prototype.$emit = function (event) {
  7679. var vm = this;
  7680. if (true) {
  7681. var lowerCaseEvent = event.toLowerCase();
  7682. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  7683. tip(
  7684. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  7685. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  7686. "Note that HTML attributes are case-insensitive and you cannot use " +
  7687. "v-on to listen to camelCase events when using in-DOM templates. " +
  7688. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  7689. );
  7690. }
  7691. }
  7692. var cbs = vm._events[event];
  7693. if (cbs) {
  7694. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  7695. var args = toArray(arguments, 1);
  7696. var info = "event handler for \"" + event + "\"";
  7697. for (var i = 0, l = cbs.length; i < l; i++) {
  7698. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  7699. }
  7700. }
  7701. return vm
  7702. };
  7703. }
  7704. /* */
  7705. var activeInstance = null;
  7706. var isUpdatingChildComponent = false;
  7707. function setActiveInstance(vm) {
  7708. var prevActiveInstance = activeInstance;
  7709. activeInstance = vm;
  7710. return function () {
  7711. activeInstance = prevActiveInstance;
  7712. }
  7713. }
  7714. function initLifecycle (vm) {
  7715. var options = vm.$options;
  7716. // locate first non-abstract parent
  7717. var parent = options.parent;
  7718. if (parent && !options.abstract) {
  7719. while (parent.$options.abstract && parent.$parent) {
  7720. parent = parent.$parent;
  7721. }
  7722. parent.$children.push(vm);
  7723. }
  7724. vm.$parent = parent;
  7725. vm.$root = parent ? parent.$root : vm;
  7726. vm.$children = [];
  7727. vm.$refs = {};
  7728. vm._watcher = null;
  7729. vm._inactive = null;
  7730. vm._directInactive = false;
  7731. vm._isMounted = false;
  7732. vm._isDestroyed = false;
  7733. vm._isBeingDestroyed = false;
  7734. }
  7735. function lifecycleMixin (Vue) {
  7736. Vue.prototype._update = function (vnode, hydrating) {
  7737. var vm = this;
  7738. var prevEl = vm.$el;
  7739. var prevVnode = vm._vnode;
  7740. var restoreActiveInstance = setActiveInstance(vm);
  7741. vm._vnode = vnode;
  7742. // Vue.prototype.__patch__ is injected in entry points
  7743. // based on the rendering backend used.
  7744. if (!prevVnode) {
  7745. // initial render
  7746. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  7747. } else {
  7748. // updates
  7749. vm.$el = vm.__patch__(prevVnode, vnode);
  7750. }
  7751. restoreActiveInstance();
  7752. // update __vue__ reference
  7753. if (prevEl) {
  7754. prevEl.__vue__ = null;
  7755. }
  7756. if (vm.$el) {
  7757. vm.$el.__vue__ = vm;
  7758. }
  7759. // if parent is an HOC, update its $el as well
  7760. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  7761. vm.$parent.$el = vm.$el;
  7762. }
  7763. // updated hook is called by the scheduler to ensure that children are
  7764. // updated in a parent's updated hook.
  7765. };
  7766. Vue.prototype.$forceUpdate = function () {
  7767. var vm = this;
  7768. if (vm._watcher) {
  7769. vm._watcher.update();
  7770. }
  7771. };
  7772. Vue.prototype.$destroy = function () {
  7773. var vm = this;
  7774. if (vm._isBeingDestroyed) {
  7775. return
  7776. }
  7777. callHook(vm, 'beforeDestroy');
  7778. vm._isBeingDestroyed = true;
  7779. // remove self from parent
  7780. var parent = vm.$parent;
  7781. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  7782. remove(parent.$children, vm);
  7783. }
  7784. // teardown watchers
  7785. if (vm._watcher) {
  7786. vm._watcher.teardown();
  7787. }
  7788. var i = vm._watchers.length;
  7789. while (i--) {
  7790. vm._watchers[i].teardown();
  7791. }
  7792. // remove reference from data ob
  7793. // frozen object may not have observer.
  7794. if (vm._data.__ob__) {
  7795. vm._data.__ob__.vmCount--;
  7796. }
  7797. // call the last hook...
  7798. vm._isDestroyed = true;
  7799. // invoke destroy hooks on current rendered tree
  7800. vm.__patch__(vm._vnode, null);
  7801. // fire destroyed hook
  7802. callHook(vm, 'destroyed');
  7803. // turn off all instance listeners.
  7804. vm.$off();
  7805. // remove __vue__ reference
  7806. if (vm.$el) {
  7807. vm.$el.__vue__ = null;
  7808. }
  7809. // release circular reference (#6759)
  7810. if (vm.$vnode) {
  7811. vm.$vnode.parent = null;
  7812. }
  7813. };
  7814. }
  7815. function updateChildComponent (
  7816. vm,
  7817. propsData,
  7818. listeners,
  7819. parentVnode,
  7820. renderChildren
  7821. ) {
  7822. if (true) {
  7823. isUpdatingChildComponent = true;
  7824. }
  7825. // determine whether component has slot children
  7826. // we need to do this before overwriting $options._renderChildren.
  7827. // check if there are dynamic scopedSlots (hand-written or compiled but with
  7828. // dynamic slot names). Static scoped slots compiled from template has the
  7829. // "$stable" marker.
  7830. var newScopedSlots = parentVnode.data.scopedSlots;
  7831. var oldScopedSlots = vm.$scopedSlots;
  7832. var hasDynamicScopedSlot = !!(
  7833. (newScopedSlots && !newScopedSlots.$stable) ||
  7834. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  7835. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  7836. );
  7837. // Any static slot children from the parent may have changed during parent's
  7838. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  7839. // update is necessary to ensure correctness.
  7840. var needsForceUpdate = !!(
  7841. renderChildren || // has new static slots
  7842. vm.$options._renderChildren || // has old static slots
  7843. hasDynamicScopedSlot
  7844. );
  7845. vm.$options._parentVnode = parentVnode;
  7846. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  7847. if (vm._vnode) { // update child tree's parent
  7848. vm._vnode.parent = parentVnode;
  7849. }
  7850. vm.$options._renderChildren = renderChildren;
  7851. // update $attrs and $listeners hash
  7852. // these are also reactive so they may trigger child update if the child
  7853. // used them during render
  7854. vm.$attrs = parentVnode.data.attrs || emptyObject;
  7855. vm.$listeners = listeners || emptyObject;
  7856. // update props
  7857. if (propsData && vm.$options.props) {
  7858. toggleObserving(false);
  7859. var props = vm._props;
  7860. var propKeys = vm.$options._propKeys || [];
  7861. for (var i = 0; i < propKeys.length; i++) {
  7862. var key = propKeys[i];
  7863. var propOptions = vm.$options.props; // wtf flow?
  7864. props[key] = validateProp(key, propOptions, propsData, vm);
  7865. }
  7866. toggleObserving(true);
  7867. // keep a copy of raw propsData
  7868. vm.$options.propsData = propsData;
  7869. }
  7870. // fixed by xxxxxx update properties(mp runtime)
  7871. vm._$updateProperties && vm._$updateProperties(vm);
  7872. // update listeners
  7873. listeners = listeners || emptyObject;
  7874. var oldListeners = vm.$options._parentListeners;
  7875. vm.$options._parentListeners = listeners;
  7876. updateComponentListeners(vm, listeners, oldListeners);
  7877. // resolve slots + force update if has children
  7878. if (needsForceUpdate) {
  7879. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  7880. vm.$forceUpdate();
  7881. }
  7882. if (true) {
  7883. isUpdatingChildComponent = false;
  7884. }
  7885. }
  7886. function isInInactiveTree (vm) {
  7887. while (vm && (vm = vm.$parent)) {
  7888. if (vm._inactive) { return true }
  7889. }
  7890. return false
  7891. }
  7892. function activateChildComponent (vm, direct) {
  7893. if (direct) {
  7894. vm._directInactive = false;
  7895. if (isInInactiveTree(vm)) {
  7896. return
  7897. }
  7898. } else if (vm._directInactive) {
  7899. return
  7900. }
  7901. if (vm._inactive || vm._inactive === null) {
  7902. vm._inactive = false;
  7903. for (var i = 0; i < vm.$children.length; i++) {
  7904. activateChildComponent(vm.$children[i]);
  7905. }
  7906. callHook(vm, 'activated');
  7907. }
  7908. }
  7909. function deactivateChildComponent (vm, direct) {
  7910. if (direct) {
  7911. vm._directInactive = true;
  7912. if (isInInactiveTree(vm)) {
  7913. return
  7914. }
  7915. }
  7916. if (!vm._inactive) {
  7917. vm._inactive = true;
  7918. for (var i = 0; i < vm.$children.length; i++) {
  7919. deactivateChildComponent(vm.$children[i]);
  7920. }
  7921. callHook(vm, 'deactivated');
  7922. }
  7923. }
  7924. function callHook (vm, hook) {
  7925. // #7573 disable dep collection when invoking lifecycle hooks
  7926. pushTarget();
  7927. var handlers = vm.$options[hook];
  7928. var info = hook + " hook";
  7929. if (handlers) {
  7930. for (var i = 0, j = handlers.length; i < j; i++) {
  7931. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  7932. }
  7933. }
  7934. if (vm._hasHookEvent) {
  7935. vm.$emit('hook:' + hook);
  7936. }
  7937. popTarget();
  7938. }
  7939. /* */
  7940. var MAX_UPDATE_COUNT = 100;
  7941. var queue = [];
  7942. var activatedChildren = [];
  7943. var has = {};
  7944. var circular = {};
  7945. var waiting = false;
  7946. var flushing = false;
  7947. var index = 0;
  7948. /**
  7949. * Reset the scheduler's state.
  7950. */
  7951. function resetSchedulerState () {
  7952. index = queue.length = activatedChildren.length = 0;
  7953. has = {};
  7954. if (true) {
  7955. circular = {};
  7956. }
  7957. waiting = flushing = false;
  7958. }
  7959. // Async edge case #6566 requires saving the timestamp when event listeners are
  7960. // attached. However, calling performance.now() has a perf overhead especially
  7961. // if the page has thousands of event listeners. Instead, we take a timestamp
  7962. // every time the scheduler flushes and use that for all event listeners
  7963. // attached during that flush.
  7964. var currentFlushTimestamp = 0;
  7965. // Async edge case fix requires storing an event listener's attach timestamp.
  7966. var getNow = Date.now;
  7967. // Determine what event timestamp the browser is using. Annoyingly, the
  7968. // timestamp can either be hi-res (relative to page load) or low-res
  7969. // (relative to UNIX epoch), so in order to compare time we have to use the
  7970. // same timestamp type when saving the flush timestamp.
  7971. // All IE versions use low-res event timestamps, and have problematic clock
  7972. // implementations (#9632)
  7973. if (inBrowser && !isIE) {
  7974. var performance = window.performance;
  7975. if (
  7976. performance &&
  7977. typeof performance.now === 'function' &&
  7978. getNow() > document.createEvent('Event').timeStamp
  7979. ) {
  7980. // if the event timestamp, although evaluated AFTER the Date.now(), is
  7981. // smaller than it, it means the event is using a hi-res timestamp,
  7982. // and we need to use the hi-res version for event listener timestamps as
  7983. // well.
  7984. getNow = function () { return performance.now(); };
  7985. }
  7986. }
  7987. /**
  7988. * Flush both queues and run the watchers.
  7989. */
  7990. function flushSchedulerQueue () {
  7991. currentFlushTimestamp = getNow();
  7992. flushing = true;
  7993. var watcher, id;
  7994. // Sort queue before flush.
  7995. // This ensures that:
  7996. // 1. Components are updated from parent to child. (because parent is always
  7997. // created before the child)
  7998. // 2. A component's user watchers are run before its render watcher (because
  7999. // user watchers are created before the render watcher)
  8000. // 3. If a component is destroyed during a parent component's watcher run,
  8001. // its watchers can be skipped.
  8002. queue.sort(function (a, b) { return a.id - b.id; });
  8003. // do not cache length because more watchers might be pushed
  8004. // as we run existing watchers
  8005. for (index = 0; index < queue.length; index++) {
  8006. watcher = queue[index];
  8007. if (watcher.before) {
  8008. watcher.before();
  8009. }
  8010. id = watcher.id;
  8011. has[id] = null;
  8012. watcher.run();
  8013. // in dev build, check and stop circular updates.
  8014. if ( true && has[id] != null) {
  8015. circular[id] = (circular[id] || 0) + 1;
  8016. if (circular[id] > MAX_UPDATE_COUNT) {
  8017. warn(
  8018. 'You may have an infinite update loop ' + (
  8019. watcher.user
  8020. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  8021. : "in a component render function."
  8022. ),
  8023. watcher.vm
  8024. );
  8025. break
  8026. }
  8027. }
  8028. }
  8029. // keep copies of post queues before resetting state
  8030. var activatedQueue = activatedChildren.slice();
  8031. var updatedQueue = queue.slice();
  8032. resetSchedulerState();
  8033. // call component updated and activated hooks
  8034. callActivatedHooks(activatedQueue);
  8035. callUpdatedHooks(updatedQueue);
  8036. // devtool hook
  8037. /* istanbul ignore if */
  8038. if (devtools && config.devtools) {
  8039. devtools.emit('flush');
  8040. }
  8041. }
  8042. function callUpdatedHooks (queue) {
  8043. var i = queue.length;
  8044. while (i--) {
  8045. var watcher = queue[i];
  8046. var vm = watcher.vm;
  8047. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  8048. callHook(vm, 'updated');
  8049. }
  8050. }
  8051. }
  8052. /**
  8053. * Queue a kept-alive component that was activated during patch.
  8054. * The queue will be processed after the entire tree has been patched.
  8055. */
  8056. function queueActivatedComponent (vm) {
  8057. // setting _inactive to false here so that a render function can
  8058. // rely on checking whether it's in an inactive tree (e.g. router-view)
  8059. vm._inactive = false;
  8060. activatedChildren.push(vm);
  8061. }
  8062. function callActivatedHooks (queue) {
  8063. for (var i = 0; i < queue.length; i++) {
  8064. queue[i]._inactive = true;
  8065. activateChildComponent(queue[i], true /* true */);
  8066. }
  8067. }
  8068. /**
  8069. * Push a watcher into the watcher queue.
  8070. * Jobs with duplicate IDs will be skipped unless it's
  8071. * pushed when the queue is being flushed.
  8072. */
  8073. function queueWatcher (watcher) {
  8074. var id = watcher.id;
  8075. if (has[id] == null) {
  8076. has[id] = true;
  8077. if (!flushing) {
  8078. queue.push(watcher);
  8079. } else {
  8080. // if already flushing, splice the watcher based on its id
  8081. // if already past its id, it will be run next immediately.
  8082. var i = queue.length - 1;
  8083. while (i > index && queue[i].id > watcher.id) {
  8084. i--;
  8085. }
  8086. queue.splice(i + 1, 0, watcher);
  8087. }
  8088. // queue the flush
  8089. if (!waiting) {
  8090. waiting = true;
  8091. if ( true && !config.async) {
  8092. flushSchedulerQueue();
  8093. return
  8094. }
  8095. nextTick(flushSchedulerQueue);
  8096. }
  8097. }
  8098. }
  8099. /* */
  8100. var uid$2 = 0;
  8101. /**
  8102. * A watcher parses an expression, collects dependencies,
  8103. * and fires callback when the expression value changes.
  8104. * This is used for both the $watch() api and directives.
  8105. */
  8106. var Watcher = function Watcher (
  8107. vm,
  8108. expOrFn,
  8109. cb,
  8110. options,
  8111. isRenderWatcher
  8112. ) {
  8113. this.vm = vm;
  8114. if (isRenderWatcher) {
  8115. vm._watcher = this;
  8116. }
  8117. vm._watchers.push(this);
  8118. // options
  8119. if (options) {
  8120. this.deep = !!options.deep;
  8121. this.user = !!options.user;
  8122. this.lazy = !!options.lazy;
  8123. this.sync = !!options.sync;
  8124. this.before = options.before;
  8125. } else {
  8126. this.deep = this.user = this.lazy = this.sync = false;
  8127. }
  8128. this.cb = cb;
  8129. this.id = ++uid$2; // uid for batching
  8130. this.active = true;
  8131. this.dirty = this.lazy; // for lazy watchers
  8132. this.deps = [];
  8133. this.newDeps = [];
  8134. this.depIds = new _Set();
  8135. this.newDepIds = new _Set();
  8136. this.expression = true
  8137. ? expOrFn.toString()
  8138. : undefined;
  8139. // parse expression for getter
  8140. if (typeof expOrFn === 'function') {
  8141. this.getter = expOrFn;
  8142. } else {
  8143. this.getter = parsePath(expOrFn);
  8144. if (!this.getter) {
  8145. this.getter = noop;
  8146. true && warn(
  8147. "Failed watching path: \"" + expOrFn + "\" " +
  8148. 'Watcher only accepts simple dot-delimited paths. ' +
  8149. 'For full control, use a function instead.',
  8150. vm
  8151. );
  8152. }
  8153. }
  8154. this.value = this.lazy
  8155. ? undefined
  8156. : this.get();
  8157. };
  8158. /**
  8159. * Evaluate the getter, and re-collect dependencies.
  8160. */
  8161. Watcher.prototype.get = function get () {
  8162. pushTarget(this);
  8163. var value;
  8164. var vm = this.vm;
  8165. try {
  8166. value = this.getter.call(vm, vm);
  8167. } catch (e) {
  8168. if (this.user) {
  8169. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  8170. } else {
  8171. throw e
  8172. }
  8173. } finally {
  8174. // "touch" every property so they are all tracked as
  8175. // dependencies for deep watching
  8176. if (this.deep) {
  8177. traverse(value);
  8178. }
  8179. popTarget();
  8180. this.cleanupDeps();
  8181. }
  8182. return value
  8183. };
  8184. /**
  8185. * Add a dependency to this directive.
  8186. */
  8187. Watcher.prototype.addDep = function addDep (dep) {
  8188. var id = dep.id;
  8189. if (!this.newDepIds.has(id)) {
  8190. this.newDepIds.add(id);
  8191. this.newDeps.push(dep);
  8192. if (!this.depIds.has(id)) {
  8193. dep.addSub(this);
  8194. }
  8195. }
  8196. };
  8197. /**
  8198. * Clean up for dependency collection.
  8199. */
  8200. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8201. var i = this.deps.length;
  8202. while (i--) {
  8203. var dep = this.deps[i];
  8204. if (!this.newDepIds.has(dep.id)) {
  8205. dep.removeSub(this);
  8206. }
  8207. }
  8208. var tmp = this.depIds;
  8209. this.depIds = this.newDepIds;
  8210. this.newDepIds = tmp;
  8211. this.newDepIds.clear();
  8212. tmp = this.deps;
  8213. this.deps = this.newDeps;
  8214. this.newDeps = tmp;
  8215. this.newDeps.length = 0;
  8216. };
  8217. /**
  8218. * Subscriber interface.
  8219. * Will be called when a dependency changes.
  8220. */
  8221. Watcher.prototype.update = function update () {
  8222. /* istanbul ignore else */
  8223. if (this.lazy) {
  8224. this.dirty = true;
  8225. } else if (this.sync) {
  8226. this.run();
  8227. } else {
  8228. queueWatcher(this);
  8229. }
  8230. };
  8231. /**
  8232. * Scheduler job interface.
  8233. * Will be called by the scheduler.
  8234. */
  8235. Watcher.prototype.run = function run () {
  8236. if (this.active) {
  8237. var value = this.get();
  8238. if (
  8239. value !== this.value ||
  8240. // Deep watchers and watchers on Object/Arrays should fire even
  8241. // when the value is the same, because the value may
  8242. // have mutated.
  8243. isObject(value) ||
  8244. this.deep
  8245. ) {
  8246. // set new value
  8247. var oldValue = this.value;
  8248. this.value = value;
  8249. if (this.user) {
  8250. try {
  8251. this.cb.call(this.vm, value, oldValue);
  8252. } catch (e) {
  8253. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  8254. }
  8255. } else {
  8256. this.cb.call(this.vm, value, oldValue);
  8257. }
  8258. }
  8259. }
  8260. };
  8261. /**
  8262. * Evaluate the value of the watcher.
  8263. * This only gets called for lazy watchers.
  8264. */
  8265. Watcher.prototype.evaluate = function evaluate () {
  8266. this.value = this.get();
  8267. this.dirty = false;
  8268. };
  8269. /**
  8270. * Depend on all deps collected by this watcher.
  8271. */
  8272. Watcher.prototype.depend = function depend () {
  8273. var i = this.deps.length;
  8274. while (i--) {
  8275. this.deps[i].depend();
  8276. }
  8277. };
  8278. /**
  8279. * Remove self from all dependencies' subscriber list.
  8280. */
  8281. Watcher.prototype.teardown = function teardown () {
  8282. if (this.active) {
  8283. // remove self from vm's watcher list
  8284. // this is a somewhat expensive operation so we skip it
  8285. // if the vm is being destroyed.
  8286. if (!this.vm._isBeingDestroyed) {
  8287. remove(this.vm._watchers, this);
  8288. }
  8289. var i = this.deps.length;
  8290. while (i--) {
  8291. this.deps[i].removeSub(this);
  8292. }
  8293. this.active = false;
  8294. }
  8295. };
  8296. /* */
  8297. var sharedPropertyDefinition = {
  8298. enumerable: true,
  8299. configurable: true,
  8300. get: noop,
  8301. set: noop
  8302. };
  8303. function proxy (target, sourceKey, key) {
  8304. sharedPropertyDefinition.get = function proxyGetter () {
  8305. return this[sourceKey][key]
  8306. };
  8307. sharedPropertyDefinition.set = function proxySetter (val) {
  8308. this[sourceKey][key] = val;
  8309. };
  8310. Object.defineProperty(target, key, sharedPropertyDefinition);
  8311. }
  8312. function initState (vm) {
  8313. vm._watchers = [];
  8314. var opts = vm.$options;
  8315. if (opts.props) { initProps(vm, opts.props); }
  8316. if (opts.methods) { initMethods(vm, opts.methods); }
  8317. if (opts.data) {
  8318. initData(vm);
  8319. } else {
  8320. observe(vm._data = {}, true /* asRootData */);
  8321. }
  8322. if (opts.computed) { initComputed(vm, opts.computed); }
  8323. if (opts.watch && opts.watch !== nativeWatch) {
  8324. initWatch(vm, opts.watch);
  8325. }
  8326. }
  8327. function initProps (vm, propsOptions) {
  8328. var propsData = vm.$options.propsData || {};
  8329. var props = vm._props = {};
  8330. // cache prop keys so that future props updates can iterate using Array
  8331. // instead of dynamic object key enumeration.
  8332. var keys = vm.$options._propKeys = [];
  8333. var isRoot = !vm.$parent;
  8334. // root instance props should be converted
  8335. if (!isRoot) {
  8336. toggleObserving(false);
  8337. }
  8338. var loop = function ( key ) {
  8339. keys.push(key);
  8340. var value = validateProp(key, propsOptions, propsData, vm);
  8341. /* istanbul ignore else */
  8342. if (true) {
  8343. var hyphenatedKey = hyphenate(key);
  8344. if (isReservedAttribute(hyphenatedKey) ||
  8345. config.isReservedAttr(hyphenatedKey)) {
  8346. warn(
  8347. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  8348. vm
  8349. );
  8350. }
  8351. defineReactive$$1(props, key, value, function () {
  8352. if (!isRoot && !isUpdatingChildComponent) {
  8353. {
  8354. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  8355. return
  8356. }
  8357. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  8358. if(
  8359. key === 'value' &&
  8360. Array.isArray(vm.$options.behaviors) &&
  8361. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  8362. ){
  8363. return
  8364. }
  8365. if(vm._getFormData){
  8366. return
  8367. }
  8368. var $parent = vm.$parent;
  8369. while($parent){
  8370. if($parent.__next_tick_pending){
  8371. return
  8372. }
  8373. $parent = $parent.$parent;
  8374. }
  8375. }
  8376. warn(
  8377. "Avoid mutating a prop directly since the value will be " +
  8378. "overwritten whenever the parent component re-renders. " +
  8379. "Instead, use a data or computed property based on the prop's " +
  8380. "value. Prop being mutated: \"" + key + "\"",
  8381. vm
  8382. );
  8383. }
  8384. });
  8385. } else {}
  8386. // static props are already proxied on the component's prototype
  8387. // during Vue.extend(). We only need to proxy props defined at
  8388. // instantiation here.
  8389. if (!(key in vm)) {
  8390. proxy(vm, "_props", key);
  8391. }
  8392. };
  8393. for (var key in propsOptions) loop( key );
  8394. toggleObserving(true);
  8395. }
  8396. function initData (vm) {
  8397. var data = vm.$options.data;
  8398. data = vm._data = typeof data === 'function'
  8399. ? getData(data, vm)
  8400. : data || {};
  8401. if (!isPlainObject(data)) {
  8402. data = {};
  8403. true && warn(
  8404. 'data functions should return an object:\n' +
  8405. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  8406. vm
  8407. );
  8408. }
  8409. // proxy data on instance
  8410. var keys = Object.keys(data);
  8411. var props = vm.$options.props;
  8412. var methods = vm.$options.methods;
  8413. var i = keys.length;
  8414. while (i--) {
  8415. var key = keys[i];
  8416. if (true) {
  8417. if (methods && hasOwn(methods, key)) {
  8418. warn(
  8419. ("Method \"" + key + "\" has already been defined as a data property."),
  8420. vm
  8421. );
  8422. }
  8423. }
  8424. if (props && hasOwn(props, key)) {
  8425. true && warn(
  8426. "The data property \"" + key + "\" is already declared as a prop. " +
  8427. "Use prop default value instead.",
  8428. vm
  8429. );
  8430. } else if (!isReserved(key)) {
  8431. proxy(vm, "_data", key);
  8432. }
  8433. }
  8434. // observe data
  8435. observe(data, true /* asRootData */);
  8436. }
  8437. function getData (data, vm) {
  8438. // #7573 disable dep collection when invoking data getters
  8439. pushTarget();
  8440. try {
  8441. return data.call(vm, vm)
  8442. } catch (e) {
  8443. handleError(e, vm, "data()");
  8444. return {}
  8445. } finally {
  8446. popTarget();
  8447. }
  8448. }
  8449. var computedWatcherOptions = { lazy: true };
  8450. function initComputed (vm, computed) {
  8451. // $flow-disable-line
  8452. var watchers = vm._computedWatchers = Object.create(null);
  8453. // computed properties are just getters during SSR
  8454. var isSSR = isServerRendering();
  8455. for (var key in computed) {
  8456. var userDef = computed[key];
  8457. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  8458. if ( true && getter == null) {
  8459. warn(
  8460. ("Getter is missing for computed property \"" + key + "\"."),
  8461. vm
  8462. );
  8463. }
  8464. if (!isSSR) {
  8465. // create internal watcher for the computed property.
  8466. watchers[key] = new Watcher(
  8467. vm,
  8468. getter || noop,
  8469. noop,
  8470. computedWatcherOptions
  8471. );
  8472. }
  8473. // component-defined computed properties are already defined on the
  8474. // component prototype. We only need to define computed properties defined
  8475. // at instantiation here.
  8476. if (!(key in vm)) {
  8477. defineComputed(vm, key, userDef);
  8478. } else if (true) {
  8479. if (key in vm.$data) {
  8480. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  8481. } else if (vm.$options.props && key in vm.$options.props) {
  8482. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  8483. }
  8484. }
  8485. }
  8486. }
  8487. function defineComputed (
  8488. target,
  8489. key,
  8490. userDef
  8491. ) {
  8492. var shouldCache = !isServerRendering();
  8493. if (typeof userDef === 'function') {
  8494. sharedPropertyDefinition.get = shouldCache
  8495. ? createComputedGetter(key)
  8496. : createGetterInvoker(userDef);
  8497. sharedPropertyDefinition.set = noop;
  8498. } else {
  8499. sharedPropertyDefinition.get = userDef.get
  8500. ? shouldCache && userDef.cache !== false
  8501. ? createComputedGetter(key)
  8502. : createGetterInvoker(userDef.get)
  8503. : noop;
  8504. sharedPropertyDefinition.set = userDef.set || noop;
  8505. }
  8506. if ( true &&
  8507. sharedPropertyDefinition.set === noop) {
  8508. sharedPropertyDefinition.set = function () {
  8509. warn(
  8510. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  8511. this
  8512. );
  8513. };
  8514. }
  8515. Object.defineProperty(target, key, sharedPropertyDefinition);
  8516. }
  8517. function createComputedGetter (key) {
  8518. return function computedGetter () {
  8519. var watcher = this._computedWatchers && this._computedWatchers[key];
  8520. if (watcher) {
  8521. if (watcher.dirty) {
  8522. watcher.evaluate();
  8523. }
  8524. if (Dep.SharedObject.target) {// fixed by xxxxxx
  8525. watcher.depend();
  8526. }
  8527. return watcher.value
  8528. }
  8529. }
  8530. }
  8531. function createGetterInvoker(fn) {
  8532. return function computedGetter () {
  8533. return fn.call(this, this)
  8534. }
  8535. }
  8536. function initMethods (vm, methods) {
  8537. var props = vm.$options.props;
  8538. for (var key in methods) {
  8539. if (true) {
  8540. if (typeof methods[key] !== 'function') {
  8541. warn(
  8542. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  8543. "Did you reference the function correctly?",
  8544. vm
  8545. );
  8546. }
  8547. if (props && hasOwn(props, key)) {
  8548. warn(
  8549. ("Method \"" + key + "\" has already been defined as a prop."),
  8550. vm
  8551. );
  8552. }
  8553. if ((key in vm) && isReserved(key)) {
  8554. warn(
  8555. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  8556. "Avoid defining component methods that start with _ or $."
  8557. );
  8558. }
  8559. }
  8560. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  8561. }
  8562. }
  8563. function initWatch (vm, watch) {
  8564. for (var key in watch) {
  8565. var handler = watch[key];
  8566. if (Array.isArray(handler)) {
  8567. for (var i = 0; i < handler.length; i++) {
  8568. createWatcher(vm, key, handler[i]);
  8569. }
  8570. } else {
  8571. createWatcher(vm, key, handler);
  8572. }
  8573. }
  8574. }
  8575. function createWatcher (
  8576. vm,
  8577. expOrFn,
  8578. handler,
  8579. options
  8580. ) {
  8581. if (isPlainObject(handler)) {
  8582. options = handler;
  8583. handler = handler.handler;
  8584. }
  8585. if (typeof handler === 'string') {
  8586. handler = vm[handler];
  8587. }
  8588. return vm.$watch(expOrFn, handler, options)
  8589. }
  8590. function stateMixin (Vue) {
  8591. // flow somehow has problems with directly declared definition object
  8592. // when using Object.defineProperty, so we have to procedurally build up
  8593. // the object here.
  8594. var dataDef = {};
  8595. dataDef.get = function () { return this._data };
  8596. var propsDef = {};
  8597. propsDef.get = function () { return this._props };
  8598. if (true) {
  8599. dataDef.set = function () {
  8600. warn(
  8601. 'Avoid replacing instance root $data. ' +
  8602. 'Use nested data properties instead.',
  8603. this
  8604. );
  8605. };
  8606. propsDef.set = function () {
  8607. warn("$props is readonly.", this);
  8608. };
  8609. }
  8610. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8611. Object.defineProperty(Vue.prototype, '$props', propsDef);
  8612. Vue.prototype.$set = set;
  8613. Vue.prototype.$delete = del;
  8614. Vue.prototype.$watch = function (
  8615. expOrFn,
  8616. cb,
  8617. options
  8618. ) {
  8619. var vm = this;
  8620. if (isPlainObject(cb)) {
  8621. return createWatcher(vm, expOrFn, cb, options)
  8622. }
  8623. options = options || {};
  8624. options.user = true;
  8625. var watcher = new Watcher(vm, expOrFn, cb, options);
  8626. if (options.immediate) {
  8627. try {
  8628. cb.call(vm, watcher.value);
  8629. } catch (error) {
  8630. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  8631. }
  8632. }
  8633. return function unwatchFn () {
  8634. watcher.teardown();
  8635. }
  8636. };
  8637. }
  8638. /* */
  8639. var uid$3 = 0;
  8640. function initMixin (Vue) {
  8641. Vue.prototype._init = function (options) {
  8642. var vm = this;
  8643. // a uid
  8644. vm._uid = uid$3++;
  8645. var startTag, endTag;
  8646. /* istanbul ignore if */
  8647. if ( true && config.performance && mark) {
  8648. startTag = "vue-perf-start:" + (vm._uid);
  8649. endTag = "vue-perf-end:" + (vm._uid);
  8650. mark(startTag);
  8651. }
  8652. // a flag to avoid this being observed
  8653. vm._isVue = true;
  8654. // merge options
  8655. if (options && options._isComponent) {
  8656. // optimize internal component instantiation
  8657. // since dynamic options merging is pretty slow, and none of the
  8658. // internal component options needs special treatment.
  8659. initInternalComponent(vm, options);
  8660. } else {
  8661. vm.$options = mergeOptions(
  8662. resolveConstructorOptions(vm.constructor),
  8663. options || {},
  8664. vm
  8665. );
  8666. }
  8667. /* istanbul ignore else */
  8668. if (true) {
  8669. initProxy(vm);
  8670. } else {}
  8671. // expose real self
  8672. vm._self = vm;
  8673. initLifecycle(vm);
  8674. initEvents(vm);
  8675. initRender(vm);
  8676. callHook(vm, 'beforeCreate');
  8677. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  8678. initState(vm);
  8679. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  8680. !vm._$fallback && callHook(vm, 'created');
  8681. /* istanbul ignore if */
  8682. if ( true && config.performance && mark) {
  8683. vm._name = formatComponentName(vm, false);
  8684. mark(endTag);
  8685. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  8686. }
  8687. if (vm.$options.el) {
  8688. vm.$mount(vm.$options.el);
  8689. }
  8690. };
  8691. }
  8692. function initInternalComponent (vm, options) {
  8693. var opts = vm.$options = Object.create(vm.constructor.options);
  8694. // doing this because it's faster than dynamic enumeration.
  8695. var parentVnode = options._parentVnode;
  8696. opts.parent = options.parent;
  8697. opts._parentVnode = parentVnode;
  8698. var vnodeComponentOptions = parentVnode.componentOptions;
  8699. opts.propsData = vnodeComponentOptions.propsData;
  8700. opts._parentListeners = vnodeComponentOptions.listeners;
  8701. opts._renderChildren = vnodeComponentOptions.children;
  8702. opts._componentTag = vnodeComponentOptions.tag;
  8703. if (options.render) {
  8704. opts.render = options.render;
  8705. opts.staticRenderFns = options.staticRenderFns;
  8706. }
  8707. }
  8708. function resolveConstructorOptions (Ctor) {
  8709. var options = Ctor.options;
  8710. if (Ctor.super) {
  8711. var superOptions = resolveConstructorOptions(Ctor.super);
  8712. var cachedSuperOptions = Ctor.superOptions;
  8713. if (superOptions !== cachedSuperOptions) {
  8714. // super option changed,
  8715. // need to resolve new options.
  8716. Ctor.superOptions = superOptions;
  8717. // check if there are any late-modified/attached options (#4976)
  8718. var modifiedOptions = resolveModifiedOptions(Ctor);
  8719. // update base extend options
  8720. if (modifiedOptions) {
  8721. extend(Ctor.extendOptions, modifiedOptions);
  8722. }
  8723. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  8724. if (options.name) {
  8725. options.components[options.name] = Ctor;
  8726. }
  8727. }
  8728. }
  8729. return options
  8730. }
  8731. function resolveModifiedOptions (Ctor) {
  8732. var modified;
  8733. var latest = Ctor.options;
  8734. var sealed = Ctor.sealedOptions;
  8735. for (var key in latest) {
  8736. if (latest[key] !== sealed[key]) {
  8737. if (!modified) { modified = {}; }
  8738. modified[key] = latest[key];
  8739. }
  8740. }
  8741. return modified
  8742. }
  8743. function Vue (options) {
  8744. if ( true &&
  8745. !(this instanceof Vue)
  8746. ) {
  8747. warn('Vue is a constructor and should be called with the `new` keyword');
  8748. }
  8749. this._init(options);
  8750. }
  8751. initMixin(Vue);
  8752. stateMixin(Vue);
  8753. eventsMixin(Vue);
  8754. lifecycleMixin(Vue);
  8755. renderMixin(Vue);
  8756. /* */
  8757. function initUse (Vue) {
  8758. Vue.use = function (plugin) {
  8759. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  8760. if (installedPlugins.indexOf(plugin) > -1) {
  8761. return this
  8762. }
  8763. // additional parameters
  8764. var args = toArray(arguments, 1);
  8765. args.unshift(this);
  8766. if (typeof plugin.install === 'function') {
  8767. plugin.install.apply(plugin, args);
  8768. } else if (typeof plugin === 'function') {
  8769. plugin.apply(null, args);
  8770. }
  8771. installedPlugins.push(plugin);
  8772. return this
  8773. };
  8774. }
  8775. /* */
  8776. function initMixin$1 (Vue) {
  8777. Vue.mixin = function (mixin) {
  8778. this.options = mergeOptions(this.options, mixin);
  8779. return this
  8780. };
  8781. }
  8782. /* */
  8783. function initExtend (Vue) {
  8784. /**
  8785. * Each instance constructor, including Vue, has a unique
  8786. * cid. This enables us to create wrapped "child
  8787. * constructors" for prototypal inheritance and cache them.
  8788. */
  8789. Vue.cid = 0;
  8790. var cid = 1;
  8791. /**
  8792. * Class inheritance
  8793. */
  8794. Vue.extend = function (extendOptions) {
  8795. extendOptions = extendOptions || {};
  8796. var Super = this;
  8797. var SuperId = Super.cid;
  8798. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  8799. if (cachedCtors[SuperId]) {
  8800. return cachedCtors[SuperId]
  8801. }
  8802. var name = extendOptions.name || Super.options.name;
  8803. if ( true && name) {
  8804. validateComponentName(name);
  8805. }
  8806. var Sub = function VueComponent (options) {
  8807. this._init(options);
  8808. };
  8809. Sub.prototype = Object.create(Super.prototype);
  8810. Sub.prototype.constructor = Sub;
  8811. Sub.cid = cid++;
  8812. Sub.options = mergeOptions(
  8813. Super.options,
  8814. extendOptions
  8815. );
  8816. Sub['super'] = Super;
  8817. // For props and computed properties, we define the proxy getters on
  8818. // the Vue instances at extension time, on the extended prototype. This
  8819. // avoids Object.defineProperty calls for each instance created.
  8820. if (Sub.options.props) {
  8821. initProps$1(Sub);
  8822. }
  8823. if (Sub.options.computed) {
  8824. initComputed$1(Sub);
  8825. }
  8826. // allow further extension/mixin/plugin usage
  8827. Sub.extend = Super.extend;
  8828. Sub.mixin = Super.mixin;
  8829. Sub.use = Super.use;
  8830. // create asset registers, so extended classes
  8831. // can have their private assets too.
  8832. ASSET_TYPES.forEach(function (type) {
  8833. Sub[type] = Super[type];
  8834. });
  8835. // enable recursive self-lookup
  8836. if (name) {
  8837. Sub.options.components[name] = Sub;
  8838. }
  8839. // keep a reference to the super options at extension time.
  8840. // later at instantiation we can check if Super's options have
  8841. // been updated.
  8842. Sub.superOptions = Super.options;
  8843. Sub.extendOptions = extendOptions;
  8844. Sub.sealedOptions = extend({}, Sub.options);
  8845. // cache constructor
  8846. cachedCtors[SuperId] = Sub;
  8847. return Sub
  8848. };
  8849. }
  8850. function initProps$1 (Comp) {
  8851. var props = Comp.options.props;
  8852. for (var key in props) {
  8853. proxy(Comp.prototype, "_props", key);
  8854. }
  8855. }
  8856. function initComputed$1 (Comp) {
  8857. var computed = Comp.options.computed;
  8858. for (var key in computed) {
  8859. defineComputed(Comp.prototype, key, computed[key]);
  8860. }
  8861. }
  8862. /* */
  8863. function initAssetRegisters (Vue) {
  8864. /**
  8865. * Create asset registration methods.
  8866. */
  8867. ASSET_TYPES.forEach(function (type) {
  8868. Vue[type] = function (
  8869. id,
  8870. definition
  8871. ) {
  8872. if (!definition) {
  8873. return this.options[type + 's'][id]
  8874. } else {
  8875. /* istanbul ignore if */
  8876. if ( true && type === 'component') {
  8877. validateComponentName(id);
  8878. }
  8879. if (type === 'component' && isPlainObject(definition)) {
  8880. definition.name = definition.name || id;
  8881. definition = this.options._base.extend(definition);
  8882. }
  8883. if (type === 'directive' && typeof definition === 'function') {
  8884. definition = { bind: definition, update: definition };
  8885. }
  8886. this.options[type + 's'][id] = definition;
  8887. return definition
  8888. }
  8889. };
  8890. });
  8891. }
  8892. /* */
  8893. function getComponentName (opts) {
  8894. return opts && (opts.Ctor.options.name || opts.tag)
  8895. }
  8896. function matches (pattern, name) {
  8897. if (Array.isArray(pattern)) {
  8898. return pattern.indexOf(name) > -1
  8899. } else if (typeof pattern === 'string') {
  8900. return pattern.split(',').indexOf(name) > -1
  8901. } else if (isRegExp(pattern)) {
  8902. return pattern.test(name)
  8903. }
  8904. /* istanbul ignore next */
  8905. return false
  8906. }
  8907. function pruneCache (keepAliveInstance, filter) {
  8908. var cache = keepAliveInstance.cache;
  8909. var keys = keepAliveInstance.keys;
  8910. var _vnode = keepAliveInstance._vnode;
  8911. for (var key in cache) {
  8912. var cachedNode = cache[key];
  8913. if (cachedNode) {
  8914. var name = getComponentName(cachedNode.componentOptions);
  8915. if (name && !filter(name)) {
  8916. pruneCacheEntry(cache, key, keys, _vnode);
  8917. }
  8918. }
  8919. }
  8920. }
  8921. function pruneCacheEntry (
  8922. cache,
  8923. key,
  8924. keys,
  8925. current
  8926. ) {
  8927. var cached$$1 = cache[key];
  8928. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  8929. cached$$1.componentInstance.$destroy();
  8930. }
  8931. cache[key] = null;
  8932. remove(keys, key);
  8933. }
  8934. var patternTypes = [String, RegExp, Array];
  8935. var KeepAlive = {
  8936. name: 'keep-alive',
  8937. abstract: true,
  8938. props: {
  8939. include: patternTypes,
  8940. exclude: patternTypes,
  8941. max: [String, Number]
  8942. },
  8943. created: function created () {
  8944. this.cache = Object.create(null);
  8945. this.keys = [];
  8946. },
  8947. destroyed: function destroyed () {
  8948. for (var key in this.cache) {
  8949. pruneCacheEntry(this.cache, key, this.keys);
  8950. }
  8951. },
  8952. mounted: function mounted () {
  8953. var this$1 = this;
  8954. this.$watch('include', function (val) {
  8955. pruneCache(this$1, function (name) { return matches(val, name); });
  8956. });
  8957. this.$watch('exclude', function (val) {
  8958. pruneCache(this$1, function (name) { return !matches(val, name); });
  8959. });
  8960. },
  8961. render: function render () {
  8962. var slot = this.$slots.default;
  8963. var vnode = getFirstComponentChild(slot);
  8964. var componentOptions = vnode && vnode.componentOptions;
  8965. if (componentOptions) {
  8966. // check pattern
  8967. var name = getComponentName(componentOptions);
  8968. var ref = this;
  8969. var include = ref.include;
  8970. var exclude = ref.exclude;
  8971. if (
  8972. // not included
  8973. (include && (!name || !matches(include, name))) ||
  8974. // excluded
  8975. (exclude && name && matches(exclude, name))
  8976. ) {
  8977. return vnode
  8978. }
  8979. var ref$1 = this;
  8980. var cache = ref$1.cache;
  8981. var keys = ref$1.keys;
  8982. var key = vnode.key == null
  8983. // same constructor may get registered as different local components
  8984. // so cid alone is not enough (#3269)
  8985. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  8986. : vnode.key;
  8987. if (cache[key]) {
  8988. vnode.componentInstance = cache[key].componentInstance;
  8989. // make current key freshest
  8990. remove(keys, key);
  8991. keys.push(key);
  8992. } else {
  8993. cache[key] = vnode;
  8994. keys.push(key);
  8995. // prune oldest entry
  8996. if (this.max && keys.length > parseInt(this.max)) {
  8997. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  8998. }
  8999. }
  9000. vnode.data.keepAlive = true;
  9001. }
  9002. return vnode || (slot && slot[0])
  9003. }
  9004. };
  9005. var builtInComponents = {
  9006. KeepAlive: KeepAlive
  9007. };
  9008. /* */
  9009. function initGlobalAPI (Vue) {
  9010. // config
  9011. var configDef = {};
  9012. configDef.get = function () { return config; };
  9013. if (true) {
  9014. configDef.set = function () {
  9015. warn(
  9016. 'Do not replace the Vue.config object, set individual fields instead.'
  9017. );
  9018. };
  9019. }
  9020. Object.defineProperty(Vue, 'config', configDef);
  9021. // exposed util methods.
  9022. // NOTE: these are not considered part of the public API - avoid relying on
  9023. // them unless you are aware of the risk.
  9024. Vue.util = {
  9025. warn: warn,
  9026. extend: extend,
  9027. mergeOptions: mergeOptions,
  9028. defineReactive: defineReactive$$1
  9029. };
  9030. Vue.set = set;
  9031. Vue.delete = del;
  9032. Vue.nextTick = nextTick;
  9033. // 2.6 explicit observable API
  9034. Vue.observable = function (obj) {
  9035. observe(obj);
  9036. return obj
  9037. };
  9038. Vue.options = Object.create(null);
  9039. ASSET_TYPES.forEach(function (type) {
  9040. Vue.options[type + 's'] = Object.create(null);
  9041. });
  9042. // this is used to identify the "base" constructor to extend all plain-object
  9043. // components with in Weex's multi-instance scenarios.
  9044. Vue.options._base = Vue;
  9045. extend(Vue.options.components, builtInComponents);
  9046. initUse(Vue);
  9047. initMixin$1(Vue);
  9048. initExtend(Vue);
  9049. initAssetRegisters(Vue);
  9050. }
  9051. initGlobalAPI(Vue);
  9052. Object.defineProperty(Vue.prototype, '$isServer', {
  9053. get: isServerRendering
  9054. });
  9055. Object.defineProperty(Vue.prototype, '$ssrContext', {
  9056. get: function get () {
  9057. /* istanbul ignore next */
  9058. return this.$vnode && this.$vnode.ssrContext
  9059. }
  9060. });
  9061. // expose FunctionalRenderContext for ssr runtime helper installation
  9062. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  9063. value: FunctionalRenderContext
  9064. });
  9065. Vue.version = '2.6.11';
  9066. /**
  9067. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  9068. */
  9069. var ARRAYTYPE = '[object Array]';
  9070. var OBJECTTYPE = '[object Object]';
  9071. var NULLTYPE = '[object Null]';
  9072. var UNDEFINEDTYPE = '[object Undefined]';
  9073. // const FUNCTIONTYPE = '[object Function]'
  9074. function diff(current, pre) {
  9075. var result = {};
  9076. syncKeys(current, pre);
  9077. _diff(current, pre, '', result);
  9078. return result
  9079. }
  9080. function syncKeys(current, pre) {
  9081. if (current === pre) { return }
  9082. var rootCurrentType = type(current);
  9083. var rootPreType = type(pre);
  9084. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  9085. if(Object.keys(current).length >= Object.keys(pre).length){
  9086. for (var key in pre) {
  9087. var currentValue = current[key];
  9088. if (currentValue === undefined) {
  9089. current[key] = null;
  9090. } else {
  9091. syncKeys(currentValue, pre[key]);
  9092. }
  9093. }
  9094. }
  9095. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  9096. if (current.length >= pre.length) {
  9097. pre.forEach(function (item, index) {
  9098. syncKeys(current[index], item);
  9099. });
  9100. }
  9101. }
  9102. }
  9103. function nullOrUndefined(currentType, preType) {
  9104. if(
  9105. (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
  9106. (preType === NULLTYPE || preType === UNDEFINEDTYPE)
  9107. ) {
  9108. return false
  9109. }
  9110. return true
  9111. }
  9112. function _diff(current, pre, path, result) {
  9113. if (current === pre) { return }
  9114. var rootCurrentType = type(current);
  9115. var rootPreType = type(pre);
  9116. if (rootCurrentType == OBJECTTYPE) {
  9117. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  9118. setResult(result, path, current);
  9119. } else {
  9120. var loop = function ( key ) {
  9121. var currentValue = current[key];
  9122. var preValue = pre[key];
  9123. var currentType = type(currentValue);
  9124. var preType = type(preValue);
  9125. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  9126. if (currentValue !== pre[key] && nullOrUndefined(currentType, preType)) {
  9127. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9128. }
  9129. } else if (currentType == ARRAYTYPE) {
  9130. if (preType != ARRAYTYPE) {
  9131. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9132. } else {
  9133. if (currentValue.length < preValue.length) {
  9134. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9135. } else {
  9136. currentValue.forEach(function (item, index) {
  9137. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  9138. });
  9139. }
  9140. }
  9141. } else if (currentType == OBJECTTYPE) {
  9142. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  9143. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  9144. } else {
  9145. for (var subKey in currentValue) {
  9146. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  9147. }
  9148. }
  9149. }
  9150. };
  9151. for (var key in current) loop( key );
  9152. }
  9153. } else if (rootCurrentType == ARRAYTYPE) {
  9154. if (rootPreType != ARRAYTYPE) {
  9155. setResult(result, path, current);
  9156. } else {
  9157. if (current.length < pre.length) {
  9158. setResult(result, path, current);
  9159. } else {
  9160. current.forEach(function (item, index) {
  9161. _diff(item, pre[index], path + '[' + index + ']', result);
  9162. });
  9163. }
  9164. }
  9165. } else {
  9166. setResult(result, path, current);
  9167. }
  9168. }
  9169. function setResult(result, k, v) {
  9170. // if (type(v) != FUNCTIONTYPE) {
  9171. result[k] = v;
  9172. // }
  9173. }
  9174. function type(obj) {
  9175. return Object.prototype.toString.call(obj)
  9176. }
  9177. /* */
  9178. function flushCallbacks$1(vm) {
  9179. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  9180. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9181. var mpInstance = vm.$scope;
  9182. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9183. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  9184. }
  9185. var copies = vm.__next_tick_callbacks.slice(0);
  9186. vm.__next_tick_callbacks.length = 0;
  9187. for (var i = 0; i < copies.length; i++) {
  9188. copies[i]();
  9189. }
  9190. }
  9191. }
  9192. function hasRenderWatcher(vm) {
  9193. return queue.find(function (watcher) { return vm._watcher === watcher; })
  9194. }
  9195. function nextTick$1(vm, cb) {
  9196. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  9197. //2.nextTick 之前存在 render watcher
  9198. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  9199. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  9200. var mpInstance = vm.$scope;
  9201. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  9202. ']:nextVueTick');
  9203. }
  9204. return nextTick(cb, vm)
  9205. }else{
  9206. if(Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  9207. var mpInstance$1 = vm.$scope;
  9208. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  9209. ']:nextMPTick');
  9210. }
  9211. }
  9212. var _resolve;
  9213. if (!vm.__next_tick_callbacks) {
  9214. vm.__next_tick_callbacks = [];
  9215. }
  9216. vm.__next_tick_callbacks.push(function () {
  9217. if (cb) {
  9218. try {
  9219. cb.call(vm);
  9220. } catch (e) {
  9221. handleError(e, vm, 'nextTick');
  9222. }
  9223. } else if (_resolve) {
  9224. _resolve(vm);
  9225. }
  9226. });
  9227. // $flow-disable-line
  9228. if (!cb && typeof Promise !== 'undefined') {
  9229. return new Promise(function (resolve) {
  9230. _resolve = resolve;
  9231. })
  9232. }
  9233. }
  9234. /* */
  9235. function clearInstance(key, value) {
  9236. // 简易去除 Vue 和小程序组件实例
  9237. if (value) {
  9238. if (value._isVue || value.__v_isMPComponent) {
  9239. return {}
  9240. }
  9241. }
  9242. return value
  9243. }
  9244. function cloneWithData(vm) {
  9245. // 确保当前 vm 所有数据被同步
  9246. var ret = Object.create(null);
  9247. var dataKeys = [].concat(
  9248. Object.keys(vm._data || {}),
  9249. Object.keys(vm._computedWatchers || {}));
  9250. dataKeys.reduce(function(ret, key) {
  9251. ret[key] = vm[key];
  9252. return ret
  9253. }, ret);
  9254. // vue-composition-api
  9255. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  9256. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  9257. if (rawBindings) {
  9258. Object.keys(rawBindings).forEach(function (key) {
  9259. ret[key] = vm[key];
  9260. });
  9261. }
  9262. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  9263. Object.assign(ret, vm.$mp.data || {});
  9264. if (
  9265. Array.isArray(vm.$options.behaviors) &&
  9266. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  9267. ) { //form-field
  9268. ret['name'] = vm.name;
  9269. ret['value'] = vm.value;
  9270. }
  9271. return JSON.parse(JSON.stringify(ret, clearInstance))
  9272. }
  9273. var patch = function(oldVnode, vnode) {
  9274. var this$1 = this;
  9275. if (vnode === null) { //destroy
  9276. return
  9277. }
  9278. if (this.mpType === 'page' || this.mpType === 'component') {
  9279. var mpInstance = this.$scope;
  9280. var data = Object.create(null);
  9281. try {
  9282. data = cloneWithData(this);
  9283. } catch (err) {
  9284. console.error(err);
  9285. }
  9286. data.__webviewId__ = mpInstance.data.__webviewId__;
  9287. var mpData = Object.create(null);
  9288. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  9289. mpData[key] = mpInstance.data[key];
  9290. });
  9291. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  9292. if (Object.keys(diffData).length) {
  9293. if (Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  9294. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  9295. ']差量更新',
  9296. JSON.stringify(diffData));
  9297. }
  9298. this.__next_tick_pending = true;
  9299. mpInstance.setData(diffData, function () {
  9300. this$1.__next_tick_pending = false;
  9301. flushCallbacks$1(this$1);
  9302. });
  9303. } else {
  9304. flushCallbacks$1(this);
  9305. }
  9306. }
  9307. };
  9308. /* */
  9309. function createEmptyRender() {
  9310. }
  9311. function mountComponent$1(
  9312. vm,
  9313. el,
  9314. hydrating
  9315. ) {
  9316. if (!vm.mpType) {//main.js 中的 new Vue
  9317. return vm
  9318. }
  9319. if (vm.mpType === 'app') {
  9320. vm.$options.render = createEmptyRender;
  9321. }
  9322. if (!vm.$options.render) {
  9323. vm.$options.render = createEmptyRender;
  9324. if (true) {
  9325. /* istanbul ignore if */
  9326. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  9327. vm.$options.el || el) {
  9328. warn(
  9329. 'You are using the runtime-only build of Vue where the template ' +
  9330. 'compiler is not available. Either pre-compile the templates into ' +
  9331. 'render functions, or use the compiler-included build.',
  9332. vm
  9333. );
  9334. } else {
  9335. warn(
  9336. 'Failed to mount component: template or render function not defined.',
  9337. vm
  9338. );
  9339. }
  9340. }
  9341. }
  9342. !vm._$fallback && callHook(vm, 'beforeMount');
  9343. var updateComponent = function () {
  9344. vm._update(vm._render(), hydrating);
  9345. };
  9346. // we set this to vm._watcher inside the watcher's constructor
  9347. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  9348. // component's mounted hook), which relies on vm._watcher being already defined
  9349. new Watcher(vm, updateComponent, noop, {
  9350. before: function before() {
  9351. if (vm._isMounted && !vm._isDestroyed) {
  9352. callHook(vm, 'beforeUpdate');
  9353. }
  9354. }
  9355. }, true /* isRenderWatcher */);
  9356. hydrating = false;
  9357. return vm
  9358. }
  9359. /* */
  9360. function renderClass (
  9361. staticClass,
  9362. dynamicClass
  9363. ) {
  9364. if (isDef(staticClass) || isDef(dynamicClass)) {
  9365. return concat(staticClass, stringifyClass(dynamicClass))
  9366. }
  9367. /* istanbul ignore next */
  9368. return ''
  9369. }
  9370. function concat (a, b) {
  9371. return a ? b ? (a + ' ' + b) : a : (b || '')
  9372. }
  9373. function stringifyClass (value) {
  9374. if (Array.isArray(value)) {
  9375. return stringifyArray(value)
  9376. }
  9377. if (isObject(value)) {
  9378. return stringifyObject(value)
  9379. }
  9380. if (typeof value === 'string') {
  9381. return value
  9382. }
  9383. /* istanbul ignore next */
  9384. return ''
  9385. }
  9386. function stringifyArray (value) {
  9387. var res = '';
  9388. var stringified;
  9389. for (var i = 0, l = value.length; i < l; i++) {
  9390. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  9391. if (res) { res += ' '; }
  9392. res += stringified;
  9393. }
  9394. }
  9395. return res
  9396. }
  9397. function stringifyObject (value) {
  9398. var res = '';
  9399. for (var key in value) {
  9400. if (value[key]) {
  9401. if (res) { res += ' '; }
  9402. res += key;
  9403. }
  9404. }
  9405. return res
  9406. }
  9407. /* */
  9408. var parseStyleText = cached(function (cssText) {
  9409. var res = {};
  9410. var listDelimiter = /;(?![^(]*\))/g;
  9411. var propertyDelimiter = /:(.+)/;
  9412. cssText.split(listDelimiter).forEach(function (item) {
  9413. if (item) {
  9414. var tmp = item.split(propertyDelimiter);
  9415. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  9416. }
  9417. });
  9418. return res
  9419. });
  9420. // normalize possible array / string values into Object
  9421. function normalizeStyleBinding (bindingStyle) {
  9422. if (Array.isArray(bindingStyle)) {
  9423. return toObject(bindingStyle)
  9424. }
  9425. if (typeof bindingStyle === 'string') {
  9426. return parseStyleText(bindingStyle)
  9427. }
  9428. return bindingStyle
  9429. }
  9430. /* */
  9431. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  9432. function getTarget(obj, path) {
  9433. var parts = path.split('.');
  9434. var key = parts[0];
  9435. if (key.indexOf('__$n') === 0) { //number index
  9436. key = parseInt(key.replace('__$n', ''));
  9437. }
  9438. if (parts.length === 1) {
  9439. return obj[key]
  9440. }
  9441. return getTarget(obj[key], parts.slice(1).join('.'))
  9442. }
  9443. function internalMixin(Vue) {
  9444. Vue.config.errorHandler = function(err, vm, info) {
  9445. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9446. console.error(err);
  9447. /* eslint-disable no-undef */
  9448. var app = typeof getApp === 'function' && getApp();
  9449. if (app && app.onError) {
  9450. app.onError(err);
  9451. }
  9452. };
  9453. var oldEmit = Vue.prototype.$emit;
  9454. Vue.prototype.$emit = function(event) {
  9455. if (this.$scope && event) {
  9456. var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
  9457. if (triggerEvent) {
  9458. try {
  9459. triggerEvent.call(this.$scope, event, {
  9460. __args__: toArray(arguments, 1)
  9461. });
  9462. } catch (error) {
  9463. }
  9464. }
  9465. }
  9466. return oldEmit.apply(this, arguments)
  9467. };
  9468. Vue.prototype.$nextTick = function(fn) {
  9469. return nextTick$1(this, fn)
  9470. };
  9471. MP_METHODS.forEach(function (method) {
  9472. Vue.prototype[method] = function(args) {
  9473. if (this.$scope && this.$scope[method]) {
  9474. return this.$scope[method](args)
  9475. }
  9476. // mp-alipay
  9477. if (typeof my === 'undefined') {
  9478. return
  9479. }
  9480. if (method === 'createSelectorQuery') {
  9481. /* eslint-disable no-undef */
  9482. return my.createSelectorQuery(args)
  9483. } else if (method === 'createIntersectionObserver') {
  9484. /* eslint-disable no-undef */
  9485. return my.createIntersectionObserver(args)
  9486. }
  9487. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  9488. };
  9489. });
  9490. Vue.prototype.__init_provide = initProvide;
  9491. Vue.prototype.__init_injections = initInjections;
  9492. Vue.prototype.__call_hook = function(hook, args) {
  9493. var vm = this;
  9494. // #7573 disable dep collection when invoking lifecycle hooks
  9495. pushTarget();
  9496. var handlers = vm.$options[hook];
  9497. var info = hook + " hook";
  9498. var ret;
  9499. if (handlers) {
  9500. for (var i = 0, j = handlers.length; i < j; i++) {
  9501. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  9502. }
  9503. }
  9504. if (vm._hasHookEvent) {
  9505. vm.$emit('hook:' + hook, args);
  9506. }
  9507. popTarget();
  9508. return ret
  9509. };
  9510. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  9511. if (Array.isArray(modifiers)) {
  9512. if (modifiers.indexOf('trim') !== -1) {
  9513. value = value.trim();
  9514. }
  9515. if (modifiers.indexOf('number') !== -1) {
  9516. value = this._n(value);
  9517. }
  9518. }
  9519. if (!target) {
  9520. target = this;
  9521. }
  9522. // 解决动态属性添加
  9523. Vue.set(target, key, value);
  9524. };
  9525. Vue.prototype.__set_sync = function(target, key, value) {
  9526. if (!target) {
  9527. target = this;
  9528. }
  9529. // 解决动态属性添加
  9530. Vue.set(target, key, value);
  9531. };
  9532. Vue.prototype.__get_orig = function(item) {
  9533. if (isPlainObject(item)) {
  9534. return item['$orig'] || item
  9535. }
  9536. return item
  9537. };
  9538. Vue.prototype.__get_value = function(dataPath, target) {
  9539. return getTarget(target || this, dataPath)
  9540. };
  9541. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  9542. return renderClass(staticClass, dynamicClass)
  9543. };
  9544. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  9545. if (!dynamicStyle && !staticStyle) {
  9546. return ''
  9547. }
  9548. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  9549. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  9550. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  9551. };
  9552. Vue.prototype.__map = function(val, iteratee) {
  9553. //TODO 暂不考虑 string
  9554. var ret, i, l, keys, key;
  9555. if (Array.isArray(val)) {
  9556. ret = new Array(val.length);
  9557. for (i = 0, l = val.length; i < l; i++) {
  9558. ret[i] = iteratee(val[i], i);
  9559. }
  9560. return ret
  9561. } else if (isObject(val)) {
  9562. keys = Object.keys(val);
  9563. ret = Object.create(null);
  9564. for (i = 0, l = keys.length; i < l; i++) {
  9565. key = keys[i];
  9566. ret[key] = iteratee(val[key], key, i);
  9567. }
  9568. return ret
  9569. } else if (typeof val === 'number') {
  9570. ret = new Array(val);
  9571. for (i = 0, l = val; i < l; i++) {
  9572. // 第一个参数暂时仍和小程序一致
  9573. ret[i] = iteratee(i, i);
  9574. }
  9575. return ret
  9576. }
  9577. return []
  9578. };
  9579. }
  9580. /* */
  9581. var LIFECYCLE_HOOKS$1 = [
  9582. //App
  9583. 'onLaunch',
  9584. 'onShow',
  9585. 'onHide',
  9586. 'onUniNViewMessage',
  9587. 'onPageNotFound',
  9588. 'onThemeChange',
  9589. 'onError',
  9590. 'onUnhandledRejection',
  9591. //Page
  9592. 'onInit',
  9593. 'onLoad',
  9594. // 'onShow',
  9595. 'onReady',
  9596. // 'onHide',
  9597. 'onUnload',
  9598. 'onPullDownRefresh',
  9599. 'onReachBottom',
  9600. 'onTabItemTap',
  9601. 'onAddToFavorites',
  9602. 'onShareTimeline',
  9603. 'onShareAppMessage',
  9604. 'onResize',
  9605. 'onPageScroll',
  9606. 'onNavigationBarButtonTap',
  9607. 'onBackPress',
  9608. 'onNavigationBarSearchInputChanged',
  9609. 'onNavigationBarSearchInputConfirmed',
  9610. 'onNavigationBarSearchInputClicked',
  9611. 'onUploadDouyinVideo',
  9612. 'onNFCReadMessage',
  9613. //Component
  9614. // 'onReady', // 兼容旧版本,应该移除该事件
  9615. 'onPageShow',
  9616. 'onPageHide',
  9617. 'onPageResize'
  9618. ];
  9619. function lifecycleMixin$1(Vue) {
  9620. //fixed vue-class-component
  9621. var oldExtend = Vue.extend;
  9622. Vue.extend = function(extendOptions) {
  9623. extendOptions = extendOptions || {};
  9624. var methods = extendOptions.methods;
  9625. if (methods) {
  9626. Object.keys(methods).forEach(function (methodName) {
  9627. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  9628. extendOptions[methodName] = methods[methodName];
  9629. delete methods[methodName];
  9630. }
  9631. });
  9632. }
  9633. return oldExtend.call(this, extendOptions)
  9634. };
  9635. var strategies = Vue.config.optionMergeStrategies;
  9636. var mergeHook = strategies.created;
  9637. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  9638. strategies[hook] = mergeHook;
  9639. });
  9640. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  9641. }
  9642. /* */
  9643. // install platform patch function
  9644. Vue.prototype.__patch__ = patch;
  9645. // public mount method
  9646. Vue.prototype.$mount = function(
  9647. el ,
  9648. hydrating
  9649. ) {
  9650. return mountComponent$1(this, el, hydrating)
  9651. };
  9652. lifecycleMixin$1(Vue);
  9653. internalMixin(Vue);
  9654. /* */
  9655. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  9656. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  9657. /***/ }),
  9658. /***/ 26:
  9659. /*!********************************!*\
  9660. !*** E:/work/mdapp/pages.json ***!
  9661. \********************************/
  9662. /*! no static exports found */
  9663. /***/ (function(module, exports) {
  9664. /***/ }),
  9665. /***/ 270:
  9666. /*!*******************************************************!*\
  9667. !*** E:/work/mdapp/node_modules/image-tools/index.js ***!
  9668. \*******************************************************/
  9669. /*! no static exports found */
  9670. /***/ (function(module, exports, __webpack_require__) {
  9671. "use strict";
  9672. /* WEBPACK VAR INJECTION */(function(wx) {
  9673. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  9674. Object.defineProperty(exports, "__esModule", {
  9675. value: true
  9676. });
  9677. exports.base64ToPath = base64ToPath;
  9678. exports.pathToBase64 = pathToBase64;
  9679. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  9680. function getLocalFilePath(path) {
  9681. if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
  9682. return path;
  9683. }
  9684. if (path.indexOf('file://') === 0) {
  9685. return path;
  9686. }
  9687. if (path.indexOf('/storage/emulated/0/') === 0) {
  9688. return path;
  9689. }
  9690. if (path.indexOf('/') === 0) {
  9691. var localFilePath = plus.io.convertAbsoluteFileSystem(path);
  9692. if (localFilePath !== path) {
  9693. return localFilePath;
  9694. } else {
  9695. path = path.substr(1);
  9696. }
  9697. }
  9698. return '_www/' + path;
  9699. }
  9700. function dataUrlToBase64(str) {
  9701. var array = str.split(',');
  9702. return array[array.length - 1];
  9703. }
  9704. var index = 0;
  9705. function getNewFileId() {
  9706. return Date.now() + String(index++);
  9707. }
  9708. function biggerThan(v1, v2) {
  9709. var v1Array = v1.split('.');
  9710. var v2Array = v2.split('.');
  9711. var update = false;
  9712. for (var index = 0; index < v2Array.length; index++) {
  9713. var diff = v1Array[index] - v2Array[index];
  9714. if (diff !== 0) {
  9715. update = diff > 0;
  9716. break;
  9717. }
  9718. }
  9719. return update;
  9720. }
  9721. function pathToBase64(path) {
  9722. return new Promise(function (resolve, reject) {
  9723. if ((typeof window === "undefined" ? "undefined" : (0, _typeof2.default)(window)) === 'object' && 'document' in window) {
  9724. if (typeof FileReader === 'function') {
  9725. var xhr = new XMLHttpRequest();
  9726. xhr.open('GET', path, true);
  9727. xhr.responseType = 'blob';
  9728. xhr.onload = function () {
  9729. if (this.status === 200) {
  9730. var fileReader = new FileReader();
  9731. fileReader.onload = function (e) {
  9732. resolve(e.target.result);
  9733. };
  9734. fileReader.onerror = reject;
  9735. fileReader.readAsDataURL(this.response);
  9736. }
  9737. };
  9738. xhr.onerror = reject;
  9739. xhr.send();
  9740. return;
  9741. }
  9742. var canvas = document.createElement('canvas');
  9743. var c2x = canvas.getContext('2d');
  9744. var img = new Image();
  9745. img.onload = function () {
  9746. canvas.width = img.width;
  9747. canvas.height = img.height;
  9748. c2x.drawImage(img, 0, 0);
  9749. resolve(canvas.toDataURL());
  9750. canvas.height = canvas.width = 0;
  9751. };
  9752. img.onerror = reject;
  9753. img.src = path;
  9754. return;
  9755. }
  9756. if ((typeof plus === "undefined" ? "undefined" : (0, _typeof2.default)(plus)) === 'object') {
  9757. plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function (entry) {
  9758. entry.file(function (file) {
  9759. var fileReader = new plus.io.FileReader();
  9760. fileReader.onload = function (data) {
  9761. resolve(data.target.result);
  9762. };
  9763. fileReader.onerror = function (error) {
  9764. reject(error);
  9765. };
  9766. fileReader.readAsDataURL(file);
  9767. }, function (error) {
  9768. reject(error);
  9769. });
  9770. }, function (error) {
  9771. reject(error);
  9772. });
  9773. return;
  9774. }
  9775. if ((typeof wx === "undefined" ? "undefined" : (0, _typeof2.default)(wx)) === 'object' && wx.canIUse('getFileSystemManager')) {
  9776. wx.getFileSystemManager().readFile({
  9777. filePath: path,
  9778. encoding: 'base64',
  9779. success: function success(res) {
  9780. resolve('data:image/png;base64,' + res.data);
  9781. },
  9782. fail: function fail(error) {
  9783. reject(error);
  9784. }
  9785. });
  9786. return;
  9787. }
  9788. reject(new Error('not support'));
  9789. });
  9790. }
  9791. function base64ToPath(base64) {
  9792. return new Promise(function (resolve, reject) {
  9793. if ((typeof window === "undefined" ? "undefined" : (0, _typeof2.default)(window)) === 'object' && 'document' in window) {
  9794. base64 = base64.split(',');
  9795. var type = base64[0].match(/:(.*?);/)[1];
  9796. var str = atob(base64[1]);
  9797. var n = str.length;
  9798. var array = new Uint8Array(n);
  9799. while (n--) {
  9800. array[n] = str.charCodeAt(n);
  9801. }
  9802. return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], {
  9803. type: type
  9804. })));
  9805. }
  9806. var extName = base64.split(',')[0].match(/data\:\S+\/(\S+);/);
  9807. if (extName) {
  9808. extName = extName[1];
  9809. } else {
  9810. reject(new Error('base64 error'));
  9811. }
  9812. var fileName = getNewFileId() + '.' + extName;
  9813. if ((typeof plus === "undefined" ? "undefined" : (0, _typeof2.default)(plus)) === 'object') {
  9814. var basePath = '_doc';
  9815. var dirPath = 'uniapp_temp';
  9816. var filePath = basePath + '/' + dirPath + '/' + fileName;
  9817. if (!biggerThan(plus.os.name === 'Android' ? '1.9.9.80627' : '1.9.9.80472', plus.runtime.innerVersion)) {
  9818. plus.io.resolveLocalFileSystemURL(basePath, function (entry) {
  9819. entry.getDirectory(dirPath, {
  9820. create: true,
  9821. exclusive: false
  9822. }, function (entry) {
  9823. entry.getFile(fileName, {
  9824. create: true,
  9825. exclusive: false
  9826. }, function (entry) {
  9827. entry.createWriter(function (writer) {
  9828. writer.onwrite = function () {
  9829. resolve(filePath);
  9830. };
  9831. writer.onerror = reject;
  9832. writer.seek(0);
  9833. writer.writeAsBinary(dataUrlToBase64(base64));
  9834. }, reject);
  9835. }, reject);
  9836. }, reject);
  9837. }, reject);
  9838. return;
  9839. }
  9840. var bitmap = new plus.nativeObj.Bitmap(fileName);
  9841. bitmap.loadBase64Data(base64, function () {
  9842. bitmap.save(filePath, {}, function () {
  9843. bitmap.clear();
  9844. resolve(filePath);
  9845. }, function (error) {
  9846. bitmap.clear();
  9847. reject(error);
  9848. });
  9849. }, function (error) {
  9850. bitmap.clear();
  9851. reject(error);
  9852. });
  9853. return;
  9854. }
  9855. if ((typeof wx === "undefined" ? "undefined" : (0, _typeof2.default)(wx)) === 'object' && wx.canIUse('getFileSystemManager')) {
  9856. var filePath = wx.env.USER_DATA_PATH + '/' + fileName;
  9857. wx.getFileSystemManager().writeFile({
  9858. filePath: filePath,
  9859. data: dataUrlToBase64(base64),
  9860. encoding: 'base64',
  9861. success: function success() {
  9862. resolve(filePath);
  9863. },
  9864. fail: function fail(error) {
  9865. reject(error);
  9866. }
  9867. });
  9868. return;
  9869. }
  9870. reject(new Error('not support'));
  9871. });
  9872. }
  9873. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  9874. /***/ }),
  9875. /***/ 3:
  9876. /*!***********************************!*\
  9877. !*** (webpack)/buildin/global.js ***!
  9878. \***********************************/
  9879. /*! no static exports found */
  9880. /***/ (function(module, exports) {
  9881. var g;
  9882. // This works in non-strict mode
  9883. g = (function() {
  9884. return this;
  9885. })();
  9886. try {
  9887. // This works if eval is allowed (see CSP)
  9888. g = g || new Function("return this")();
  9889. } catch (e) {
  9890. // This works if the window reference is available
  9891. if (typeof window === "object") g = window;
  9892. }
  9893. // g can still be undefined, but nothing to do about it...
  9894. // We return undefined, instead of nothing here, so it's
  9895. // easier to handle this case. if(!global) { ...}
  9896. module.exports = g;
  9897. /***/ }),
  9898. /***/ 32:
  9899. /*!**********************************************************************************************************!*\
  9900. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  9901. \**********************************************************************************************************/
  9902. /*! exports provided: default */
  9903. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9904. "use strict";
  9905. __webpack_require__.r(__webpack_exports__);
  9906. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  9907. /* globals __VUE_SSR_CONTEXT__ */
  9908. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  9909. // This module is a runtime utility for cleaner component module output and will
  9910. // be included in the final webpack user bundle.
  9911. function normalizeComponent (
  9912. scriptExports,
  9913. render,
  9914. staticRenderFns,
  9915. functionalTemplate,
  9916. injectStyles,
  9917. scopeId,
  9918. moduleIdentifier, /* server only */
  9919. shadowMode, /* vue-cli only */
  9920. components, // fixed by xxxxxx auto components
  9921. renderjs // fixed by xxxxxx renderjs
  9922. ) {
  9923. // Vue.extend constructor export interop
  9924. var options = typeof scriptExports === 'function'
  9925. ? scriptExports.options
  9926. : scriptExports
  9927. // fixed by xxxxxx auto components
  9928. if (components) {
  9929. if (!options.components) {
  9930. options.components = {}
  9931. }
  9932. var hasOwn = Object.prototype.hasOwnProperty
  9933. for (var name in components) {
  9934. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  9935. options.components[name] = components[name]
  9936. }
  9937. }
  9938. }
  9939. // fixed by xxxxxx renderjs
  9940. if (renderjs) {
  9941. if(typeof renderjs.beforeCreate === 'function'){
  9942. renderjs.beforeCreate = [renderjs.beforeCreate]
  9943. }
  9944. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  9945. this[renderjs.__module] = this
  9946. });
  9947. (options.mixins || (options.mixins = [])).push(renderjs)
  9948. }
  9949. // render functions
  9950. if (render) {
  9951. options.render = render
  9952. options.staticRenderFns = staticRenderFns
  9953. options._compiled = true
  9954. }
  9955. // functional template
  9956. if (functionalTemplate) {
  9957. options.functional = true
  9958. }
  9959. // scopedId
  9960. if (scopeId) {
  9961. options._scopeId = 'data-v-' + scopeId
  9962. }
  9963. var hook
  9964. if (moduleIdentifier) { // server build
  9965. hook = function (context) {
  9966. // 2.3 injection
  9967. context =
  9968. context || // cached call
  9969. (this.$vnode && this.$vnode.ssrContext) || // stateful
  9970. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  9971. // 2.2 with runInNewContext: true
  9972. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  9973. context = __VUE_SSR_CONTEXT__
  9974. }
  9975. // inject component styles
  9976. if (injectStyles) {
  9977. injectStyles.call(this, context)
  9978. }
  9979. // register component module identifier for async chunk inferrence
  9980. if (context && context._registeredComponents) {
  9981. context._registeredComponents.add(moduleIdentifier)
  9982. }
  9983. }
  9984. // used by ssr in case component is cached and beforeCreate
  9985. // never gets called
  9986. options._ssrRegister = hook
  9987. } else if (injectStyles) {
  9988. hook = shadowMode
  9989. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  9990. : injectStyles
  9991. }
  9992. if (hook) {
  9993. if (options.functional) {
  9994. // for template-only hot-reload because in that case the render fn doesn't
  9995. // go through the normalizer
  9996. options._injectStyles = hook
  9997. // register for functioal component in vue file
  9998. var originalRender = options.render
  9999. options.render = function renderWithStyleInjection (h, context) {
  10000. hook.call(context)
  10001. return originalRender(h, context)
  10002. }
  10003. } else {
  10004. // inject component registration as beforeCreate hook
  10005. var existing = options.beforeCreate
  10006. options.beforeCreate = existing
  10007. ? [].concat(existing, hook)
  10008. : [hook]
  10009. }
  10010. }
  10011. return {
  10012. exports: scriptExports,
  10013. options: options
  10014. }
  10015. }
  10016. /***/ }),
  10017. /***/ 321:
  10018. /*!**************************************************!*\
  10019. !*** E:/work/mdapp/pages/estate/img/i_house.png ***!
  10020. \**************************************************/
  10021. /*! no static exports found */
  10022. /***/ (function(module, exports) {
  10023. module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAADqklEQVR4Xu1b71XbMBDXWQOUDQoTNH4+8xWYoGUDmKCwQTsBMEHTCcoGha9EfqYTlE7QZID4+o7KeY5t2VaebJxE/kZ8Pt39dLp/OkDs+QN7rr/wAHgL2HME/BHYcwOwc4JPT0+TIAhOAOCgb+CIaJ5l2ePx8fFzn2t1PgKz2ewGAK76FKaONxHdxnF83de6nQBIkuSKiG76EqKNLwBcR1F020a3yftOACilUiHEZJMFHH3zjIihI15rbLoCQH0sbsMTETvJasOTaTsxVUp5AJqQBYDHLMu+5DRBEEyafAYRfRVCPOT02rl+bFpjzBawkFIehmE4LyqglGKn9blGqe+IeFH+XSn1IoR4bwJhtADw7kdRdFoWfDabnQLAz/LvvPtxHK+sJX+fJMkDEZ14AAwIjNYChBAviHhUltuUO+ycBWjFrxDxLgchTdPD5XLJ5n9Ys6Gc4p4VU9wkSS6I6FtLCJsi4qVtmGuj35ow2KaIjir3xY3o8M325AFdlNE0VpaySxawwoiIzuI4XuUZjTlMF2THkAl2kTOnMTnaOh47aQGm3KRvABYA8ExE3Cz50GHHfgHAnIg4UhgzwA58KiSDAwAAl1EUTUthkM9gnWKcOk/CMOTU9/VRSn0SQvzYRNnaXTVkp31ZwB9ErMR714mQDTiDWsBQtYAHwAKBQS1ACDGXUh45KId/G1JnC9X/kw4NAK/Jpewtt7L5DynlKRFVSt5CnGbaey3sAQBwf4AdoZPnLQBwIrgrJh6AgcOgq41zxsdbgLeA+j5lX5kg810IIaZ5FAiCgKOAscGp2+jFtjhHAWf1wOBHQOcBq9xe5/cc5iq9/jrh0jQ9WC6X/P07F45gUABMi5kKnE2bojbAjAIA1/cCowVACFF7c2vq9O6cBfDOZFkWlic5lFLcFq/cGDFgUsqzYu2gJ0+Y3snkyaBHQJsm1wDFURbuD9TdCeSWzA6v6DR59sCk/ILrjOJlqq4huHbg6FFxnG8BgM0RtaJt6vCami47BUDTnaDJ0XoAdikV9hbQMBvkj4BhCMP7AO8Dhi+HrWK7DfGbO0Fdqv61EdolbV2pnfM3VZzOfIBWnmeEK2NtLpVs4fUgpTwv3zvoMRy+TzSN8J4j4mvrvelZXY/rgoSVrStg2vhsw3u+iZ6WJ89XACilajs426CZpYxrluEByNHjIyCl5CsrYzPTEumxkb82bhFx7Z8+Oo3IjE0Tl/J4AFyiuY28vAVs4665lHnvLeAf8XaCXwWtufUAAAAASUVORK5CYII="
  10024. /***/ }),
  10025. /***/ 322:
  10026. /*!************************************************!*\
  10027. !*** E:/work/mdapp/pages/estate/img/i_pos.png ***!
  10028. \************************************************/
  10029. /*! no static exports found */
  10030. /***/ (function(module, exports) {
  10031. module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHDklEQVR4Xs1bfYhVRRQ/565uGSomWX8kFQlhmq28ObOsq0mitiFhYiSVUFFa4T+aEIaE2hdKkUYQfWBlJaWpRQlZoSmEtrt37t21WrOMRJCiDJfUlF323ROjd2Vddt+dmTvv7Q68v+45v3POb2bOfJx5CBVoR48evby9vf1GZta/cQAwPv31tn4EAL4MgmB/oVA4UQHXAMtpJI7jWUmS3AMA+jfGxhYz7waA/Yi4hYgO2+jayHonoKWlZVSxWFyUBl1n40w/skUA2MrMW6WUX3jAuwTCKwFKqXkAsBoAJvt2VOMhYlgsFlfV1tZ+5QvfCwG615MkWc3My3w5loGzkojW+rCVmwClVAEA3ilXr5cIcjszr5BS/p6HiFwExHE8PUmSDwHgujxO5NBtC4JgQaFQOOSK4UxAGIZzgiDYzMxXuhr3pJeLBCcCdLJj5u2IWOUpiLwwziRYE5Auc3sHYM5nkdQybNiw6RMnTjyTJdjzuzUBURRtqGC2t4lFy64lopU2SlYEpOv8ZzYGKi2LiNOFEN+Z2rUiIIqikJnJFHwg5BBxlxBijqltYwLCMHwQEd83BS4htw0AtgVB0NbZ2Xlcy1VXV49NkmQiANyb/vKaeZiIjHw1JkAppRPf7Tk8WwcAHxHRj6UwmpqaplRVVT2Zhwhm3imlnGviqxEBURTNZ+YdJoD9yCwgIt3zxi0MwzWIqM8VTi0IgsmFQuFglrIRAUqpnQBwVxaYr+C7ccIwnI2I3zjafZ6IVmXpZhLAzFVxHJ9w3PFZ93xvh5VS+tDzdFYgvb8j4iEhhM4rJVsmAXEcT0mS5EAWUO/vzLxBSrncVq+3fBzHY5Ik+R4A9E2SVWPmOVLKXaWUMglQSi0FgFetLAOcHjp06ISamprzWT5vU0otAYDXHXAyN0aZBERRpA88Cy2N7yOiGZY6/Yq3trZe29XV5ULmB0T0UK4REIbhAUScYhMMMz8rpVxjo5MlG0XRQWa+NUuu53dm3iOlnJWLAKWUXrdvsTS8SEqpL0m8NaXUJw57g8NEdHNeAo7ZXngg4p1CiK+9RQ8AYRiuR0S9QTJuzHxaSjkyFwFRFJ20XQKZeYaUcp+xpwaCjqfQf4io5HV8ZhIMw7DL9uKjHAQopfQpVN8627T9RDQt1whQSv0EAJkbil7Jx3sSVEr9ZrsXQMR3hRCP5iVgIwCUBOnDQBsRWSXOUk4qpXQp7Webrtey6a3xS3kJeAIA3rA1joiPCyHettXrS951OxwEwd2FQqFkNSkzBzQ3N9frYqVDIBER5b48SesOeit+ma0PzDxeSvlLrhGwd+/e4cOHDz+GiKNtHdAXH0S0wEHvoorLRqxbmYgyOzhTQIMppTYDgO12+LwfeXaFOe8EPiaiB7LINyIgiqKFzKxJcGqIuAkRXzat4Ohhz8xPIeJ9TgYvED9PSvl5lr4RAW1tbaPPnj17xHEadPtwSh+Ri8Xip3V1dT/0k+wmAYDuNb3js57zPTD/6+zsHFNfX3/OCwF5p0EfTuxj5uOIqE94IxFxbHrQuSHLYZPviPieEOIRI1kTIS2TdxqY2vEhx8z3Sym3mGAZTQEN5GkamPiUSwYR/+jo6JhUX19/0gTImAANFobhm3qDYwI8UDK2q44VAU1NTTVVVVXNupYxUAGWsqt7X1euiOhPU/+sCEiTob4f1PeEg67Z9r4OwJqA1tbWm7q6ukKdvQcTAy6970RAmgvWIeKKwUSAS+87E6CU0m+C9Ci4ejCQ4Nr7zgSkoyBX7c4nca69n4uANCHqut1sn8HYYjGzKhaLM+vq6k7Z6uYmoLGxsW7IkCF7AOAKF+OedBqIyLWAar8K9HY6juPlSZK84ikYW5jVRPScrVJPeetlsC9jURTtYOb5eRyx1WXmXVJK46cw/eF7ISCO4wlJknwLANfYBuIo387MM6WULY76F9W8EKDRoihazMxeLkENglpCRNYXtX3heiMgXRU2AUDJaqxBcFkimRXfLADvOaAbUCl1FQDot/zCxglTWWZura6ubqipqfnbVCdLzusISKfCbcysSfC9NOoSXYMQQucab807ASkJjzHzW968vAC0lIhe84yZfx/Qn0NhGG5ARF//INlIRIt9B6/xyjICeuQEPRUacjreSERWL1Rs7JWVgCiK9OuMXcx8vY1TPWTPdHR0jJs6daq3pNfbj7ISoI01NzfPD4LA6ZVpkiRza2tr9SPNsrWyE5AmxWW6KGITBSK+KIR4xkbHRbYiBKQkrGdmozc+iLhbCFGRY3bFCEhJ0H9103+jLdUy3/W49HR/OhUlQJfaR4wYoe8PaksEMYqI/vUZZCmsihKgHUmfu+gH0Jc8eGLmv4IguEMI0WfhtFyEVJyA7kB0rREAZjHzKET89dy5cy9MmzbtdLkC7Q/3fxMowF8w/lVXAAAAAElFTkSuQmCC"
  10032. /***/ }),
  10033. /***/ 33:
  10034. /*!******************************************************!*\
  10035. !*** E:/work/mdapp/uni_modules/vk-uview-ui/index.js ***!
  10036. \******************************************************/
  10037. /*! no static exports found */
  10038. /***/ (function(module, exports, __webpack_require__) {
  10039. "use strict";
  10040. /* WEBPACK VAR INJECTION */(function(uni) {
  10041. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10042. Object.defineProperty(exports, "__esModule", {
  10043. value: true
  10044. });
  10045. exports.default = void 0;
  10046. var _mixin = _interopRequireDefault(__webpack_require__(/*! ./libs/mixin/mixin.js */ 34));
  10047. var _request = _interopRequireDefault(__webpack_require__(/*! ./libs/request */ 35));
  10048. var _queryParams = _interopRequireDefault(__webpack_require__(/*! ./libs/function/queryParams.js */ 39));
  10049. var _route = _interopRequireDefault(__webpack_require__(/*! ./libs/function/route.js */ 40));
  10050. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFormat.js */ 44));
  10051. var _timeFrom = _interopRequireDefault(__webpack_require__(/*! ./libs/function/timeFrom.js */ 45));
  10052. var _colorGradient = _interopRequireDefault(__webpack_require__(/*! ./libs/function/colorGradient.js */ 46));
  10053. var _guid = _interopRequireDefault(__webpack_require__(/*! ./libs/function/guid.js */ 47));
  10054. var _color = _interopRequireDefault(__webpack_require__(/*! ./libs/function/color.js */ 48));
  10055. var _type2icon = _interopRequireDefault(__webpack_require__(/*! ./libs/function/type2icon.js */ 49));
  10056. var _randomArray = _interopRequireDefault(__webpack_require__(/*! ./libs/function/randomArray.js */ 50));
  10057. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepClone.js */ 37));
  10058. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ./libs/function/deepMerge.js */ 36));
  10059. var _addUnit = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addUnit.js */ 51));
  10060. var _test = _interopRequireDefault(__webpack_require__(/*! ./libs/function/test.js */ 38));
  10061. var _random = _interopRequireDefault(__webpack_require__(/*! ./libs/function/random.js */ 52));
  10062. var _trim = _interopRequireDefault(__webpack_require__(/*! ./libs/function/trim.js */ 53));
  10063. var _toast = _interopRequireDefault(__webpack_require__(/*! ./libs/function/toast.js */ 54));
  10064. var _getParent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/getParent.js */ 55));
  10065. var _$parent = _interopRequireDefault(__webpack_require__(/*! ./libs/function/$parent.js */ 56));
  10066. var _sys = __webpack_require__(/*! ./libs/function/sys.js */ 57);
  10067. var _debounce = _interopRequireDefault(__webpack_require__(/*! ./libs/function/debounce.js */ 58));
  10068. var _throttle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/throttle.js */ 59));
  10069. var _addStyle = _interopRequireDefault(__webpack_require__(/*! ./libs/function/addStyle.js */ 60));
  10070. var _config = _interopRequireDefault(__webpack_require__(/*! ./libs/config/config.js */ 61));
  10071. var _zIndex = _interopRequireDefault(__webpack_require__(/*! ./libs/config/zIndex.js */ 62));
  10072. // 引入全局mixin
  10073. // 引入关于是否mixin集成小程序分享的配置
  10074. // import wxshare from './libs/mixin/mpShare.js'
  10075. // 全局挂载引入http相关请求拦截插件
  10076. function wranning(str) {
  10077. // 开发环境进行信息输出,主要是一些报错信息
  10078. // 这个环境的来由是在程序编写时候,点击hx编辑器运行调试代码的时候,详见:
  10079. // https://uniapp.dcloud.io/frame?id=%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e5%92%8c%e7%94%9f%e4%ba%a7%e7%8e%af%e5%a2%83
  10080. if (true) {
  10081. console.warn(str);
  10082. }
  10083. }
  10084. // 尝试判断在根目录的/store中是否有$u.mixin.js,此文件uView默认为需要挂在到全局的vuex的state变量
  10085. // HX2.6.11版本,放到try中,控制台依然会警告,暂时不用此方式,
  10086. // let vuexStore = {};
  10087. // try {
  10088. // vuexStore = require("@/store/$u.mixin.js");
  10089. // } catch (e) {
  10090. // //TODO handle the exception
  10091. // }
  10092. // post类型对象参数转为get类型url参数
  10093. var $u = {
  10094. queryParams: _queryParams.default,
  10095. route: _route.default,
  10096. timeFormat: _timeFormat.default,
  10097. date: _timeFormat.default,
  10098. // 另名date
  10099. timeFrom: _timeFrom.default,
  10100. colorGradient: _colorGradient.default.colorGradient,
  10101. colorToRgba: _colorGradient.default.colorToRgba,
  10102. guid: _guid.default,
  10103. color: _color.default,
  10104. sys: _sys.sys,
  10105. os: _sys.os,
  10106. type2icon: _type2icon.default,
  10107. randomArray: _randomArray.default,
  10108. wranning: wranning,
  10109. get: _request.default.get,
  10110. post: _request.default.post,
  10111. put: _request.default.put,
  10112. 'delete': _request.default.delete,
  10113. hexToRgb: _colorGradient.default.hexToRgb,
  10114. rgbToHex: _colorGradient.default.rgbToHex,
  10115. test: _test.default,
  10116. random: _random.default,
  10117. deepClone: _deepClone.default,
  10118. deepMerge: _deepMerge.default,
  10119. getParent: _getParent.default,
  10120. $parent: _$parent.default,
  10121. addUnit: _addUnit.default,
  10122. trim: _trim.default,
  10123. type: ['primary', 'success', 'error', 'warning', 'info'],
  10124. http: _request.default,
  10125. toast: _toast.default,
  10126. config: _config.default,
  10127. // uView配置信息相关,比如版本号
  10128. zIndex: _zIndex.default,
  10129. debounce: _debounce.default,
  10130. throttle: _throttle.default,
  10131. addStyle: _addStyle.default
  10132. };
  10133. // $u挂载到uni对象上
  10134. uni.$u = $u;
  10135. var install = function install(Vue) {
  10136. Vue.mixin(_mixin.default);
  10137. if (Vue.prototype.openShare) {
  10138. Vue.mixin(mpShare);
  10139. }
  10140. // Vue.mixin(vuexStore);
  10141. // 时间格式化,同时两个名称,date和timeFormat
  10142. Vue.filter('timeFormat', function (timestamp, format) {
  10143. return (0, _timeFormat.default)(timestamp, format);
  10144. });
  10145. Vue.filter('date', function (timestamp, format) {
  10146. return (0, _timeFormat.default)(timestamp, format);
  10147. });
  10148. // 将多久以前的方法,注入到全局过滤器
  10149. Vue.filter('timeFrom', function (timestamp, format) {
  10150. return (0, _timeFrom.default)(timestamp, format);
  10151. });
  10152. Vue.prototype.$u = $u;
  10153. };
  10154. var _default = {
  10155. install: install
  10156. };
  10157. exports.default = _default;
  10158. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10159. /***/ }),
  10160. /***/ 34:
  10161. /*!*****************************************************************!*\
  10162. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/mixin/mixin.js ***!
  10163. \*****************************************************************/
  10164. /*! no static exports found */
  10165. /***/ (function(module, exports, __webpack_require__) {
  10166. "use strict";
  10167. /* WEBPACK VAR INJECTION */(function(uni) {
  10168. Object.defineProperty(exports, "__esModule", {
  10169. value: true
  10170. });
  10171. exports.default = void 0;
  10172. var _default = {
  10173. data: function data() {
  10174. return {};
  10175. },
  10176. onLoad: function onLoad() {
  10177. // getRect挂载到$u上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
  10178. this.$u.getRect = this.$uGetRect;
  10179. },
  10180. methods: {
  10181. // 查询节点信息
  10182. // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
  10183. // 解决办法为在组件根部再套一个没有任何作用的view元素
  10184. $uGetRect: function $uGetRect(selector, all) {
  10185. var _this = this;
  10186. return new Promise(function (resolve) {
  10187. uni.createSelectorQuery().in(_this)[all ? 'selectAll' : 'select'](selector).boundingClientRect(function (rect) {
  10188. if (all && Array.isArray(rect) && rect.length) {
  10189. resolve(rect);
  10190. }
  10191. if (!all && rect) {
  10192. resolve(rect);
  10193. }
  10194. }).exec();
  10195. });
  10196. },
  10197. getParentData: function getParentData() {
  10198. var _this2 = this;
  10199. var parentName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  10200. // 避免在created中去定义parent变量
  10201. if (!this.parent) this.parent = false;
  10202. // 这里的本质原理是,通过获取父组件实例(也即u-radio-group的this)
  10203. // 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
  10204. // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
  10205. this.parent = this.$u.$parent.call(this, parentName);
  10206. if (this.parent) {
  10207. // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
  10208. Object.keys(this.parentData).map(function (key) {
  10209. _this2.parentData[key] = _this2.parent[key];
  10210. });
  10211. }
  10212. },
  10213. // 阻止事件冒泡
  10214. preventEvent: function preventEvent(e) {
  10215. e && e.stopPropagation && e.stopPropagation();
  10216. }
  10217. },
  10218. onReachBottom: function onReachBottom() {
  10219. uni.$emit('uOnReachBottom');
  10220. },
  10221. beforeDestroy: function beforeDestroy() {
  10222. var _this3 = this;
  10223. // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
  10224. // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
  10225. if (this.parent && uni.$u.test.array(this.parent.children)) {
  10226. // 组件销毁时,移除父组件中的children数组中对应的实例
  10227. var childrenList = this.parent.children;
  10228. childrenList.map(function (child, index) {
  10229. // 如果相等,则移除
  10230. if (child === _this3) {
  10231. childrenList.splice(index, 1);
  10232. }
  10233. });
  10234. }
  10235. }
  10236. };
  10237. exports.default = _default;
  10238. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10239. /***/ }),
  10240. /***/ 35:
  10241. /*!*******************************************************************!*\
  10242. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/request/index.js ***!
  10243. \*******************************************************************/
  10244. /*! no static exports found */
  10245. /***/ (function(module, exports, __webpack_require__) {
  10246. "use strict";
  10247. /* WEBPACK VAR INJECTION */(function(uni) {
  10248. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10249. Object.defineProperty(exports, "__esModule", {
  10250. value: true
  10251. });
  10252. exports.default = void 0;
  10253. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  10254. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  10255. var _deepMerge = _interopRequireDefault(__webpack_require__(/*! ../function/deepMerge */ 36));
  10256. var _test = _interopRequireDefault(__webpack_require__(/*! ../function/test */ 38));
  10257. var Request = /*#__PURE__*/function () {
  10258. function Request() {
  10259. var _this = this;
  10260. (0, _classCallCheck2.default)(this, Request);
  10261. this.config = {
  10262. baseUrl: '',
  10263. // 请求的根域名
  10264. // 默认的请求头
  10265. header: {},
  10266. method: 'POST',
  10267. // 设置为json,返回后uni.request会对数据进行一次JSON.parse
  10268. dataType: 'json',
  10269. // 此参数无需处理,因为5+和支付宝小程序不支持,默认为text即可
  10270. responseType: 'text',
  10271. showLoading: true,
  10272. // 是否显示请求中的loading
  10273. loadingText: '请求中...',
  10274. loadingTime: 800,
  10275. // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
  10276. timer: null,
  10277. // 定时器
  10278. originalData: false,
  10279. // 是否在拦截器中返回服务端的原始数据,见文档说明
  10280. loadingMask: true // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
  10281. };
  10282. // 拦截器
  10283. this.interceptor = {
  10284. // 请求前的拦截
  10285. request: null,
  10286. // 请求后的拦截
  10287. response: null
  10288. };
  10289. // get请求
  10290. this.get = function (url) {
  10291. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10292. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10293. return _this.request({
  10294. method: 'GET',
  10295. url: url,
  10296. header: header,
  10297. data: data
  10298. });
  10299. };
  10300. // post请求
  10301. this.post = function (url) {
  10302. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10303. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10304. return _this.request({
  10305. url: url,
  10306. method: 'POST',
  10307. header: header,
  10308. data: data
  10309. });
  10310. };
  10311. // put请求,不支持支付宝小程序(HX2.6.15)
  10312. this.put = function (url) {
  10313. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10314. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10315. return _this.request({
  10316. url: url,
  10317. method: 'PUT',
  10318. header: header,
  10319. data: data
  10320. });
  10321. };
  10322. // delete请求,不支持支付宝和头条小程序(HX2.6.15)
  10323. this.delete = function (url) {
  10324. var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10325. var header = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10326. return _this.request({
  10327. url: url,
  10328. method: 'DELETE',
  10329. header: header,
  10330. data: data
  10331. });
  10332. };
  10333. }
  10334. (0, _createClass2.default)(Request, [{
  10335. key: "setConfig",
  10336. value:
  10337. // 设置全局默认配置
  10338. function setConfig(customConfig) {
  10339. // 深度合并对象,否则会造成对象深层属性丢失
  10340. this.config = (0, _deepMerge.default)(this.config, customConfig);
  10341. }
  10342. // 主要请求部分
  10343. }, {
  10344. key: "request",
  10345. value: function request() {
  10346. var _this2 = this;
  10347. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10348. // 检查请求拦截
  10349. if (this.interceptor.request && typeof this.interceptor.request === 'function') {
  10350. var tmpConfig = {};
  10351. var interceptorRequest = this.interceptor.request(options);
  10352. if (interceptorRequest === false) {
  10353. // 返回一个处于pending状态中的Promise,来取消原promise,避免进入then()回调
  10354. return new Promise(function () {});
  10355. }
  10356. this.options = interceptorRequest;
  10357. }
  10358. options.dataType = options.dataType || this.config.dataType;
  10359. options.responseType = options.responseType || this.config.responseType;
  10360. options.url = options.url || '';
  10361. options.params = options.params || {};
  10362. options.header = Object.assign({}, this.config.header, options.header);
  10363. options.method = options.method || this.config.method;
  10364. return new Promise(function (resolve, reject) {
  10365. options.complete = function (response) {
  10366. // 请求返回后,隐藏loading(如果请求返回快的话,可能会没有loading)
  10367. uni.hideLoading();
  10368. // 清除定时器,如果请求回来了,就无需loading
  10369. clearTimeout(_this2.config.timer);
  10370. _this2.config.timer = null;
  10371. // 判断用户对拦截返回数据的要求,如果originalData为true,返回所有的数据(response)到拦截器,否则只返回response.data
  10372. if (_this2.config.originalData) {
  10373. // 判断是否存在拦截器
  10374. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  10375. var resInterceptors = _this2.interceptor.response(response);
  10376. // 如果拦截器不返回false,就将拦截器返回的内容给this.$u.post的then回调
  10377. if (resInterceptors !== false) {
  10378. resolve(resInterceptors);
  10379. } else {
  10380. // 如果拦截器返回false,意味着拦截器定义者认为返回有问题,直接接入catch回调
  10381. reject(response);
  10382. }
  10383. } else {
  10384. // 如果要求返回原始数据,就算没有拦截器,也返回最原始的数据
  10385. resolve(response);
  10386. }
  10387. } else {
  10388. if (response.statusCode == 200) {
  10389. if (_this2.interceptor.response && typeof _this2.interceptor.response === 'function') {
  10390. var _resInterceptors = _this2.interceptor.response(response.data);
  10391. if (_resInterceptors !== false) {
  10392. resolve(_resInterceptors);
  10393. } else {
  10394. reject(response.data);
  10395. }
  10396. } else {
  10397. // 如果不是返回原始数据(originalData=false),且没有拦截器的情况下,返回纯数据给then回调
  10398. resolve(response.data);
  10399. }
  10400. } else {
  10401. // 不返回原始数据的情况下,服务器状态码不为200,modal弹框提示
  10402. // if(response.errMsg) {
  10403. // uni.showModal({
  10404. // title: response.errMsg
  10405. // });
  10406. // }
  10407. reject(response);
  10408. }
  10409. }
  10410. };
  10411. // 判断用户传递的URL是否/开头,如果不是,加上/,这里使用了uView的test.js验证库的url()方法
  10412. options.url = _test.default.url(options.url) ? options.url : _this2.config.baseUrl + (options.url.indexOf('/') == 0 ? options.url : '/' + options.url);
  10413. // 是否显示loading
  10414. // 加一个是否已有timer定时器的判断,否则有两个同时请求的时候,后者会清除前者的定时器id
  10415. // 而没有清除前者的定时器,导致前者超时,一直显示loading
  10416. if (_this2.config.showLoading && !_this2.config.timer) {
  10417. _this2.config.timer = setTimeout(function () {
  10418. uni.showLoading({
  10419. title: _this2.config.loadingText,
  10420. mask: _this2.config.loadingMask
  10421. });
  10422. _this2.config.timer = null;
  10423. }, _this2.config.loadingTime);
  10424. }
  10425. uni.request(options);
  10426. });
  10427. // .catch(res => {
  10428. // // 如果返回reject(),不让其进入this.$u.post().then().catch()后面的catct()
  10429. // // 因为很多人都会忘了写后面的catch(),导致报错捕获不到catch
  10430. // return new Promise(()=>{});
  10431. // })
  10432. }
  10433. }]);
  10434. return Request;
  10435. }();
  10436. var _default = new Request();
  10437. exports.default = _default;
  10438. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  10439. /***/ }),
  10440. /***/ 36:
  10441. /*!************************************************************************!*\
  10442. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/deepMerge.js ***!
  10443. \************************************************************************/
  10444. /*! no static exports found */
  10445. /***/ (function(module, exports, __webpack_require__) {
  10446. "use strict";
  10447. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10448. Object.defineProperty(exports, "__esModule", {
  10449. value: true
  10450. });
  10451. exports.default = void 0;
  10452. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10453. var _deepClone = _interopRequireDefault(__webpack_require__(/*! ./deepClone */ 37));
  10454. // JS对象深度合并
  10455. function deepMerge() {
  10456. var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10457. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10458. target = (0, _deepClone.default)(target);
  10459. if ((0, _typeof2.default)(target) !== 'object' || (0, _typeof2.default)(source) !== 'object') return false;
  10460. for (var prop in source) {
  10461. if (!source.hasOwnProperty(prop)) continue;
  10462. if (prop in target) {
  10463. if ((0, _typeof2.default)(target[prop]) !== 'object') {
  10464. target[prop] = source[prop];
  10465. } else {
  10466. if ((0, _typeof2.default)(source[prop]) !== 'object') {
  10467. target[prop] = source[prop];
  10468. } else {
  10469. if (target[prop].concat && source[prop].concat) {
  10470. target[prop] = target[prop].concat(source[prop]);
  10471. } else {
  10472. target[prop] = deepMerge(target[prop], source[prop]);
  10473. }
  10474. }
  10475. }
  10476. } else {
  10477. target[prop] = source[prop];
  10478. }
  10479. }
  10480. return target;
  10481. }
  10482. var _default = deepMerge;
  10483. exports.default = _default;
  10484. /***/ }),
  10485. /***/ 37:
  10486. /*!************************************************************************!*\
  10487. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/deepClone.js ***!
  10488. \************************************************************************/
  10489. /*! no static exports found */
  10490. /***/ (function(module, exports, __webpack_require__) {
  10491. "use strict";
  10492. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10493. Object.defineProperty(exports, "__esModule", {
  10494. value: true
  10495. });
  10496. exports.default = void 0;
  10497. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10498. // 判断arr是否为一个数组,返回一个bool值
  10499. function isArray(arr) {
  10500. return Object.prototype.toString.call(arr) === '[object Array]';
  10501. }
  10502. // 深度克隆
  10503. function deepClone(obj) {
  10504. // 对常见的“非”值,直接返回原来值
  10505. if ([null, undefined, NaN, false].includes(obj)) return obj;
  10506. if ((0, _typeof2.default)(obj) !== "object" && typeof obj !== 'function') {
  10507. //原始类型直接返回
  10508. return obj;
  10509. }
  10510. var o = isArray(obj) ? [] : {};
  10511. for (var i in obj) {
  10512. if (obj.hasOwnProperty(i)) {
  10513. o[i] = (0, _typeof2.default)(obj[i]) === "object" ? deepClone(obj[i]) : obj[i];
  10514. }
  10515. }
  10516. return o;
  10517. }
  10518. var _default = deepClone;
  10519. exports.default = _default;
  10520. /***/ }),
  10521. /***/ 38:
  10522. /*!*******************************************************************!*\
  10523. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/test.js ***!
  10524. \*******************************************************************/
  10525. /*! no static exports found */
  10526. /***/ (function(module, exports, __webpack_require__) {
  10527. "use strict";
  10528. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10529. Object.defineProperty(exports, "__esModule", {
  10530. value: true
  10531. });
  10532. exports.default = void 0;
  10533. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  10534. /**
  10535. * 验证电子邮箱格式
  10536. */
  10537. function email(value) {
  10538. return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value);
  10539. }
  10540. /**
  10541. * 验证手机格式
  10542. */
  10543. function mobile(value) {
  10544. return /^1[23456789]\d{9}$/.test(value);
  10545. }
  10546. /**
  10547. * 验证URL格式
  10548. */
  10549. function url(value) {
  10550. return /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=]*)?/.test(value);
  10551. }
  10552. /**
  10553. * 验证日期格式
  10554. */
  10555. function date(value) {
  10556. return !/Invalid|NaN/.test(new Date(value).toString());
  10557. }
  10558. /**
  10559. * 验证ISO类型的日期格式
  10560. */
  10561. function dateISO(value) {
  10562. return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value);
  10563. }
  10564. /**
  10565. * 验证十进制数字
  10566. */
  10567. function number(value) {
  10568. return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
  10569. }
  10570. /**
  10571. * 验证整数
  10572. */
  10573. function digits(value) {
  10574. return /^\d+$/.test(value);
  10575. }
  10576. /**
  10577. * 验证身份证号码
  10578. */
  10579. function idCard(value) {
  10580. return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value);
  10581. }
  10582. /**
  10583. * 是否车牌号
  10584. */
  10585. function carNo(value) {
  10586. // 新能源车牌
  10587. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  10588. // 旧车牌
  10589. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  10590. if (value.length === 7) {
  10591. return creg.test(value);
  10592. } else if (value.length === 8) {
  10593. return xreg.test(value);
  10594. } else {
  10595. return false;
  10596. }
  10597. }
  10598. /**
  10599. * 金额,只允许2位小数
  10600. */
  10601. function amount(value) {
  10602. //金额,只允许保留两位小数
  10603. return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value);
  10604. }
  10605. /**
  10606. * 中文
  10607. */
  10608. function chinese(value) {
  10609. var reg = /^[\u4e00-\u9fa5]+$/gi;
  10610. return reg.test(value);
  10611. }
  10612. /**
  10613. * 只能输入字母
  10614. */
  10615. function letter(value) {
  10616. return /^[a-zA-Z]*$/.test(value);
  10617. }
  10618. /**
  10619. * 只能是字母或者数字
  10620. */
  10621. function enOrNum(value) {
  10622. //英文或者数字
  10623. var reg = /^[0-9a-zA-Z]*$/g;
  10624. return reg.test(value);
  10625. }
  10626. /**
  10627. * 验证是否包含某个值
  10628. */
  10629. function contains(value, param) {
  10630. return value.indexOf(param) >= 0;
  10631. }
  10632. /**
  10633. * 验证一个值范围[min, max]
  10634. */
  10635. function range(value, param) {
  10636. return value >= param[0] && value <= param[1];
  10637. }
  10638. /**
  10639. * 验证一个长度范围[min, max]
  10640. */
  10641. function rangeLength(value, param) {
  10642. return value.length >= param[0] && value.length <= param[1];
  10643. }
  10644. /**
  10645. * 是否固定电话
  10646. */
  10647. function landline(value) {
  10648. var reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/;
  10649. return reg.test(value);
  10650. }
  10651. /**
  10652. * 判断是否为空
  10653. */
  10654. function empty(value) {
  10655. switch ((0, _typeof2.default)(value)) {
  10656. case 'undefined':
  10657. return true;
  10658. case 'string':
  10659. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  10660. break;
  10661. case 'boolean':
  10662. if (!value) return true;
  10663. break;
  10664. case 'number':
  10665. if (0 === value || isNaN(value)) return true;
  10666. break;
  10667. case 'object':
  10668. if (null === value || value.length === 0) return true;
  10669. for (var i in value) {
  10670. return false;
  10671. }
  10672. return true;
  10673. }
  10674. return false;
  10675. }
  10676. /**
  10677. * 是否json字符串
  10678. */
  10679. function jsonString(value) {
  10680. if (typeof value == 'string') {
  10681. try {
  10682. var obj = JSON.parse(value);
  10683. if ((0, _typeof2.default)(obj) == 'object' && obj) {
  10684. return true;
  10685. } else {
  10686. return false;
  10687. }
  10688. } catch (e) {
  10689. return false;
  10690. }
  10691. }
  10692. return false;
  10693. }
  10694. /**
  10695. * 是否数组
  10696. */
  10697. function array(value) {
  10698. if (typeof Array.isArray === "function") {
  10699. return Array.isArray(value);
  10700. } else {
  10701. return Object.prototype.toString.call(value) === "[object Array]";
  10702. }
  10703. }
  10704. /**
  10705. * 是否对象
  10706. */
  10707. function object(value) {
  10708. return Object.prototype.toString.call(value) === '[object Object]';
  10709. }
  10710. /**
  10711. * 是否短信验证码
  10712. */
  10713. function code(value) {
  10714. var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
  10715. return new RegExp("^\\d{".concat(len, "}$")).test(value);
  10716. }
  10717. /**
  10718. * 是否函数方法
  10719. * @param {Object} value
  10720. */
  10721. function func(value) {
  10722. return typeof value === 'function';
  10723. }
  10724. /**
  10725. * 是否promise对象
  10726. * @param {Object} value
  10727. */
  10728. function promise(value) {
  10729. return object(value) && func(value.then) && func(value.catch);
  10730. }
  10731. /** 是否图片格式
  10732. * @param {Object} value
  10733. */
  10734. function image(value) {
  10735. var newValue = value.split('?')[0];
  10736. return new RegExp(/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)$/).test(newValue);
  10737. }
  10738. /**
  10739. * 是否视频格式
  10740. * @param {Object} value
  10741. */
  10742. function video(value) {
  10743. var newValue = value.split('?')[0];
  10744. return new RegExp(/\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8|3gp)$/).test(newValue);
  10745. }
  10746. /**
  10747. * 是否为正则对象
  10748. * @param {Object}
  10749. * @return {Boolean}
  10750. */
  10751. function regExp(o) {
  10752. return o && Object.prototype.toString.call(o) === '[object RegExp]';
  10753. }
  10754. /**
  10755. * 验证字符串
  10756. */
  10757. function string(value) {
  10758. return typeof value === 'string';
  10759. }
  10760. var _default = {
  10761. email: email,
  10762. mobile: mobile,
  10763. url: url,
  10764. date: date,
  10765. dateISO: dateISO,
  10766. number: number,
  10767. digits: digits,
  10768. idCard: idCard,
  10769. carNo: carNo,
  10770. amount: amount,
  10771. chinese: chinese,
  10772. letter: letter,
  10773. enOrNum: enOrNum,
  10774. contains: contains,
  10775. range: range,
  10776. rangeLength: rangeLength,
  10777. empty: empty,
  10778. isEmpty: empty,
  10779. jsonString: jsonString,
  10780. landline: landline,
  10781. object: object,
  10782. array: array,
  10783. code: code,
  10784. func: func,
  10785. promise: promise,
  10786. video: video,
  10787. image: image,
  10788. regExp: regExp,
  10789. string: string
  10790. };
  10791. exports.default = _default;
  10792. /***/ }),
  10793. /***/ 39:
  10794. /*!**************************************************************************!*\
  10795. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/queryParams.js ***!
  10796. \**************************************************************************/
  10797. /*! no static exports found */
  10798. /***/ (function(module, exports, __webpack_require__) {
  10799. "use strict";
  10800. Object.defineProperty(exports, "__esModule", {
  10801. value: true
  10802. });
  10803. exports.default = void 0;
  10804. /**
  10805. * 对象转url参数
  10806. * @param {*} data,对象
  10807. * @param {*} isPrefix,是否自动加上"?"
  10808. */
  10809. function queryParams() {
  10810. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  10811. var isPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  10812. var arrayFormat = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'brackets';
  10813. var prefix = isPrefix ? '?' : '';
  10814. var _result = [];
  10815. if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets';
  10816. var _loop = function _loop(key) {
  10817. var value = data[key];
  10818. // 去掉为空的参数
  10819. if (['', undefined, null].indexOf(value) >= 0) {
  10820. return "continue";
  10821. }
  10822. // 如果值为数组,另行处理
  10823. if (value.constructor === Array) {
  10824. // e.g. {ids: [1, 2, 3]}
  10825. switch (arrayFormat) {
  10826. case 'indices':
  10827. // 结果: ids[0]=1&ids[1]=2&ids[2]=3
  10828. for (var i = 0; i < value.length; i++) {
  10829. _result.push(key + '[' + i + ']=' + value[i]);
  10830. }
  10831. break;
  10832. case 'brackets':
  10833. // 结果: ids[]=1&ids[]=2&ids[]=3
  10834. value.forEach(function (_value) {
  10835. _result.push(key + '[]=' + _value);
  10836. });
  10837. break;
  10838. case 'repeat':
  10839. // 结果: ids=1&ids=2&ids=3
  10840. value.forEach(function (_value) {
  10841. _result.push(key + '=' + _value);
  10842. });
  10843. break;
  10844. case 'comma':
  10845. // 结果: ids=1,2,3
  10846. var commaStr = "";
  10847. value.forEach(function (_value) {
  10848. commaStr += (commaStr ? "," : "") + _value;
  10849. });
  10850. _result.push(key + '=' + commaStr);
  10851. break;
  10852. default:
  10853. value.forEach(function (_value) {
  10854. _result.push(key + '[]=' + _value);
  10855. });
  10856. }
  10857. } else {
  10858. _result.push(key + '=' + value);
  10859. }
  10860. };
  10861. for (var key in data) {
  10862. var _ret = _loop(key);
  10863. if (_ret === "continue") continue;
  10864. }
  10865. return _result.length ? prefix + _result.join('&') : '';
  10866. }
  10867. var _default = queryParams;
  10868. exports.default = _default;
  10869. /***/ }),
  10870. /***/ 4:
  10871. /*!**********************************************************************!*\
  10872. !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
  10873. \**********************************************************************/
  10874. /*! no static exports found */
  10875. /***/ (function(module, exports) {
  10876. function _interopRequireDefault(obj) {
  10877. return obj && obj.__esModule ? obj : {
  10878. "default": obj
  10879. };
  10880. }
  10881. module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
  10882. /***/ }),
  10883. /***/ 40:
  10884. /*!********************************************************************!*\
  10885. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/route.js ***!
  10886. \********************************************************************/
  10887. /*! no static exports found */
  10888. /***/ (function(module, exports, __webpack_require__) {
  10889. "use strict";
  10890. /* WEBPACK VAR INJECTION */(function(uni) {
  10891. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  10892. Object.defineProperty(exports, "__esModule", {
  10893. value: true
  10894. });
  10895. exports.default = void 0;
  10896. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 41));
  10897. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 43));
  10898. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  10899. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  10900. /**
  10901. * 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
  10902. * 并且带有路由拦截功能
  10903. */
  10904. var Router = /*#__PURE__*/function () {
  10905. function Router() {
  10906. (0, _classCallCheck2.default)(this, Router);
  10907. // 原始属性定义
  10908. this.config = {
  10909. type: 'navigateTo',
  10910. url: '',
  10911. delta: 1,
  10912. // navigateBack页面后退时,回退的层数
  10913. params: {},
  10914. // 传递的参数
  10915. animationType: 'pop-in',
  10916. // 窗口动画,只在APP有效
  10917. animationDuration: 300,
  10918. // 窗口动画持续时间,单位毫秒,只在APP有效
  10919. intercept: false // 是否需要拦截
  10920. };
  10921. // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
  10922. // 这里在构造函数中进行this绑定
  10923. this.route = this.route.bind(this);
  10924. }
  10925. // 判断url前面是否有"/",如果没有则加上,否则无法跳转
  10926. (0, _createClass2.default)(Router, [{
  10927. key: "addRootPath",
  10928. value: function addRootPath(url) {
  10929. return url[0] === '/' ? url : "/".concat(url);
  10930. }
  10931. // 整合路由参数
  10932. }, {
  10933. key: "mixinParam",
  10934. value: function mixinParam(url, params) {
  10935. url = url && this.addRootPath(url);
  10936. // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
  10937. // 如果有url中有get参数,转换后无需带上"?"
  10938. var query = '';
  10939. if (/.*\/.*\?.*=.*/.test(url)) {
  10940. // object对象转为get类型的参数
  10941. query = uni.$u.queryParams(params, false);
  10942. // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
  10943. return url += "&" + query;
  10944. } else {
  10945. // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
  10946. query = uni.$u.queryParams(params);
  10947. return url += query;
  10948. }
  10949. }
  10950. // 对外的方法名称
  10951. }, {
  10952. key: "route",
  10953. value: function () {
  10954. var _route = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  10955. var options,
  10956. params,
  10957. mergeConfig,
  10958. isNext,
  10959. _args = arguments;
  10960. return _regenerator.default.wrap(function _callee$(_context) {
  10961. while (1) {
  10962. switch (_context.prev = _context.next) {
  10963. case 0:
  10964. options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
  10965. params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  10966. // 合并用户的配置和内部的默认配置
  10967. mergeConfig = {};
  10968. if (typeof options === 'string') {
  10969. // 如果options为字符串,则为route(url, params)的形式
  10970. mergeConfig.url = this.mixinParam(options, params);
  10971. mergeConfig.type = 'navigateTo';
  10972. } else {
  10973. mergeConfig = uni.$u.deepClone(options, this.config);
  10974. // 否则正常使用mergeConfig中的url和params进行拼接
  10975. mergeConfig.url = this.mixinParam(options.url, options.params);
  10976. }
  10977. if (params.intercept) {
  10978. this.config.intercept = params.intercept;
  10979. }
  10980. // params参数也带给拦截器
  10981. mergeConfig.params = params;
  10982. // 合并内外部参数
  10983. mergeConfig = uni.$u.deepMerge(this.config, mergeConfig);
  10984. // 判断用户是否定义了拦截器
  10985. if (!(typeof uni.$u.routeIntercept === 'function')) {
  10986. _context.next = 14;
  10987. break;
  10988. }
  10989. _context.next = 10;
  10990. return new Promise(function (resolve, reject) {
  10991. uni.$u.routeIntercept(mergeConfig, resolve);
  10992. });
  10993. case 10:
  10994. isNext = _context.sent;
  10995. // 如果isNext为true,则执行路由跳转
  10996. isNext && this.openPage(mergeConfig);
  10997. _context.next = 15;
  10998. break;
  10999. case 14:
  11000. this.openPage(mergeConfig);
  11001. case 15:
  11002. case "end":
  11003. return _context.stop();
  11004. }
  11005. }
  11006. }, _callee, this);
  11007. }));
  11008. function route() {
  11009. return _route.apply(this, arguments);
  11010. }
  11011. return route;
  11012. }() // 执行路由跳转
  11013. }, {
  11014. key: "openPage",
  11015. value: function openPage(config) {
  11016. // 解构参数
  11017. var url = config.url,
  11018. type = config.type,
  11019. delta = config.delta,
  11020. animationType = config.animationType,
  11021. animationDuration = config.animationDuration;
  11022. if (config.type == 'navigateTo' || config.type == 'to') {
  11023. uni.navigateTo({
  11024. url: url,
  11025. animationType: animationType,
  11026. animationDuration: animationDuration
  11027. });
  11028. }
  11029. if (config.type == 'redirectTo' || config.type == 'redirect') {
  11030. uni.redirectTo({
  11031. url: url
  11032. });
  11033. }
  11034. if (config.type == 'switchTab' || config.type == 'tab') {
  11035. uni.switchTab({
  11036. url: url
  11037. });
  11038. }
  11039. if (config.type == 'reLaunch' || config.type == 'launch') {
  11040. uni.reLaunch({
  11041. url: url
  11042. });
  11043. }
  11044. if (config.type == 'navigateBack' || config.type == 'back') {
  11045. uni.navigateBack({
  11046. delta: delta
  11047. });
  11048. }
  11049. }
  11050. }]);
  11051. return Router;
  11052. }();
  11053. var _default = new Router().route;
  11054. exports.default = _default;
  11055. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  11056. /***/ }),
  11057. /***/ 41:
  11058. /*!************************************************************************************************!*\
  11059. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/@babel/runtime/regenerator/index.js ***!
  11060. \************************************************************************************************/
  11061. /*! no static exports found */
  11062. /***/ (function(module, exports, __webpack_require__) {
  11063. // TODO(Babel 8): Remove this file.
  11064. var runtime = __webpack_require__(/*! @babel/runtime/helpers/regeneratorRuntime */ 42)();
  11065. module.exports = runtime;
  11066. /***/ }),
  11067. /***/ 42:
  11068. /*!*******************************************************************!*\
  11069. !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***!
  11070. \*******************************************************************/
  11071. /*! no static exports found */
  11072. /***/ (function(module, exports, __webpack_require__) {
  11073. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  11074. function _regeneratorRuntime() {
  11075. "use strict";
  11076. /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
  11077. module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
  11078. return exports;
  11079. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11080. var exports = {},
  11081. Op = Object.prototype,
  11082. hasOwn = Op.hasOwnProperty,
  11083. defineProperty = Object.defineProperty || function (obj, key, desc) {
  11084. obj[key] = desc.value;
  11085. },
  11086. $Symbol = "function" == typeof Symbol ? Symbol : {},
  11087. iteratorSymbol = $Symbol.iterator || "@@iterator",
  11088. asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
  11089. toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  11090. function define(obj, key, value) {
  11091. return Object.defineProperty(obj, key, {
  11092. value: value,
  11093. enumerable: !0,
  11094. configurable: !0,
  11095. writable: !0
  11096. }), obj[key];
  11097. }
  11098. try {
  11099. define({}, "");
  11100. } catch (err) {
  11101. define = function define(obj, key, value) {
  11102. return obj[key] = value;
  11103. };
  11104. }
  11105. function wrap(innerFn, outerFn, self, tryLocsList) {
  11106. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
  11107. generator = Object.create(protoGenerator.prototype),
  11108. context = new Context(tryLocsList || []);
  11109. return defineProperty(generator, "_invoke", {
  11110. value: makeInvokeMethod(innerFn, self, context)
  11111. }), generator;
  11112. }
  11113. function tryCatch(fn, obj, arg) {
  11114. try {
  11115. return {
  11116. type: "normal",
  11117. arg: fn.call(obj, arg)
  11118. };
  11119. } catch (err) {
  11120. return {
  11121. type: "throw",
  11122. arg: err
  11123. };
  11124. }
  11125. }
  11126. exports.wrap = wrap;
  11127. var ContinueSentinel = {};
  11128. function Generator() {}
  11129. function GeneratorFunction() {}
  11130. function GeneratorFunctionPrototype() {}
  11131. var IteratorPrototype = {};
  11132. define(IteratorPrototype, iteratorSymbol, function () {
  11133. return this;
  11134. });
  11135. var getProto = Object.getPrototypeOf,
  11136. NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  11137. NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
  11138. var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
  11139. function defineIteratorMethods(prototype) {
  11140. ["next", "throw", "return"].forEach(function (method) {
  11141. define(prototype, method, function (arg) {
  11142. return this._invoke(method, arg);
  11143. });
  11144. });
  11145. }
  11146. function AsyncIterator(generator, PromiseImpl) {
  11147. function invoke(method, arg, resolve, reject) {
  11148. var record = tryCatch(generator[method], generator, arg);
  11149. if ("throw" !== record.type) {
  11150. var result = record.arg,
  11151. value = result.value;
  11152. return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
  11153. invoke("next", value, resolve, reject);
  11154. }, function (err) {
  11155. invoke("throw", err, resolve, reject);
  11156. }) : PromiseImpl.resolve(value).then(function (unwrapped) {
  11157. result.value = unwrapped, resolve(result);
  11158. }, function (error) {
  11159. return invoke("throw", error, resolve, reject);
  11160. });
  11161. }
  11162. reject(record.arg);
  11163. }
  11164. var previousPromise;
  11165. defineProperty(this, "_invoke", {
  11166. value: function value(method, arg) {
  11167. function callInvokeWithMethodAndArg() {
  11168. return new PromiseImpl(function (resolve, reject) {
  11169. invoke(method, arg, resolve, reject);
  11170. });
  11171. }
  11172. return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
  11173. }
  11174. });
  11175. }
  11176. function makeInvokeMethod(innerFn, self, context) {
  11177. var state = "suspendedStart";
  11178. return function (method, arg) {
  11179. if ("executing" === state) throw new Error("Generator is already running");
  11180. if ("completed" === state) {
  11181. if ("throw" === method) throw arg;
  11182. return doneResult();
  11183. }
  11184. for (context.method = method, context.arg = arg;;) {
  11185. var delegate = context.delegate;
  11186. if (delegate) {
  11187. var delegateResult = maybeInvokeDelegate(delegate, context);
  11188. if (delegateResult) {
  11189. if (delegateResult === ContinueSentinel) continue;
  11190. return delegateResult;
  11191. }
  11192. }
  11193. if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
  11194. if ("suspendedStart" === state) throw state = "completed", context.arg;
  11195. context.dispatchException(context.arg);
  11196. } else "return" === context.method && context.abrupt("return", context.arg);
  11197. state = "executing";
  11198. var record = tryCatch(innerFn, self, context);
  11199. if ("normal" === record.type) {
  11200. if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
  11201. return {
  11202. value: record.arg,
  11203. done: context.done
  11204. };
  11205. }
  11206. "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
  11207. }
  11208. };
  11209. }
  11210. function maybeInvokeDelegate(delegate, context) {
  11211. var methodName = context.method,
  11212. method = delegate.iterator[methodName];
  11213. if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
  11214. var record = tryCatch(method, delegate.iterator, context.arg);
  11215. if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
  11216. var info = record.arg;
  11217. return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
  11218. }
  11219. function pushTryEntry(locs) {
  11220. var entry = {
  11221. tryLoc: locs[0]
  11222. };
  11223. 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
  11224. }
  11225. function resetTryEntry(entry) {
  11226. var record = entry.completion || {};
  11227. record.type = "normal", delete record.arg, entry.completion = record;
  11228. }
  11229. function Context(tryLocsList) {
  11230. this.tryEntries = [{
  11231. tryLoc: "root"
  11232. }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
  11233. }
  11234. function values(iterable) {
  11235. if (iterable) {
  11236. var iteratorMethod = iterable[iteratorSymbol];
  11237. if (iteratorMethod) return iteratorMethod.call(iterable);
  11238. if ("function" == typeof iterable.next) return iterable;
  11239. if (!isNaN(iterable.length)) {
  11240. var i = -1,
  11241. next = function next() {
  11242. for (; ++i < iterable.length;) {
  11243. if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
  11244. }
  11245. return next.value = undefined, next.done = !0, next;
  11246. };
  11247. return next.next = next;
  11248. }
  11249. }
  11250. return {
  11251. next: doneResult
  11252. };
  11253. }
  11254. function doneResult() {
  11255. return {
  11256. value: undefined,
  11257. done: !0
  11258. };
  11259. }
  11260. return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
  11261. value: GeneratorFunctionPrototype,
  11262. configurable: !0
  11263. }), defineProperty(GeneratorFunctionPrototype, "constructor", {
  11264. value: GeneratorFunction,
  11265. configurable: !0
  11266. }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
  11267. var ctor = "function" == typeof genFun && genFun.constructor;
  11268. return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
  11269. }, exports.mark = function (genFun) {
  11270. return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
  11271. }, exports.awrap = function (arg) {
  11272. return {
  11273. __await: arg
  11274. };
  11275. }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  11276. return this;
  11277. }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  11278. void 0 === PromiseImpl && (PromiseImpl = Promise);
  11279. var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
  11280. return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
  11281. return result.done ? result.value : iter.next();
  11282. });
  11283. }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
  11284. return this;
  11285. }), define(Gp, "toString", function () {
  11286. return "[object Generator]";
  11287. }), exports.keys = function (val) {
  11288. var object = Object(val),
  11289. keys = [];
  11290. for (var key in object) {
  11291. keys.push(key);
  11292. }
  11293. return keys.reverse(), function next() {
  11294. for (; keys.length;) {
  11295. var key = keys.pop();
  11296. if (key in object) return next.value = key, next.done = !1, next;
  11297. }
  11298. return next.done = !0, next;
  11299. };
  11300. }, exports.values = values, Context.prototype = {
  11301. constructor: Context,
  11302. reset: function reset(skipTempReset) {
  11303. if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
  11304. "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
  11305. }
  11306. },
  11307. stop: function stop() {
  11308. this.done = !0;
  11309. var rootRecord = this.tryEntries[0].completion;
  11310. if ("throw" === rootRecord.type) throw rootRecord.arg;
  11311. return this.rval;
  11312. },
  11313. dispatchException: function dispatchException(exception) {
  11314. if (this.done) throw exception;
  11315. var context = this;
  11316. function handle(loc, caught) {
  11317. return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
  11318. }
  11319. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11320. var entry = this.tryEntries[i],
  11321. record = entry.completion;
  11322. if ("root" === entry.tryLoc) return handle("end");
  11323. if (entry.tryLoc <= this.prev) {
  11324. var hasCatch = hasOwn.call(entry, "catchLoc"),
  11325. hasFinally = hasOwn.call(entry, "finallyLoc");
  11326. if (hasCatch && hasFinally) {
  11327. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  11328. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  11329. } else if (hasCatch) {
  11330. if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
  11331. } else {
  11332. if (!hasFinally) throw new Error("try statement without catch or finally");
  11333. if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
  11334. }
  11335. }
  11336. }
  11337. },
  11338. abrupt: function abrupt(type, arg) {
  11339. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11340. var entry = this.tryEntries[i];
  11341. if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
  11342. var finallyEntry = entry;
  11343. break;
  11344. }
  11345. }
  11346. finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
  11347. var record = finallyEntry ? finallyEntry.completion : {};
  11348. return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
  11349. },
  11350. complete: function complete(record, afterLoc) {
  11351. if ("throw" === record.type) throw record.arg;
  11352. return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
  11353. },
  11354. finish: function finish(finallyLoc) {
  11355. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11356. var entry = this.tryEntries[i];
  11357. if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
  11358. }
  11359. },
  11360. "catch": function _catch(tryLoc) {
  11361. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  11362. var entry = this.tryEntries[i];
  11363. if (entry.tryLoc === tryLoc) {
  11364. var record = entry.completion;
  11365. if ("throw" === record.type) {
  11366. var thrown = record.arg;
  11367. resetTryEntry(entry);
  11368. }
  11369. return thrown;
  11370. }
  11371. }
  11372. throw new Error("illegal catch attempt");
  11373. },
  11374. delegateYield: function delegateYield(iterable, resultName, nextLoc) {
  11375. return this.delegate = {
  11376. iterator: values(iterable),
  11377. resultName: resultName,
  11378. nextLoc: nextLoc
  11379. }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
  11380. }
  11381. }, exports;
  11382. }
  11383. module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11384. /***/ }),
  11385. /***/ 43:
  11386. /*!*****************************************************************!*\
  11387. !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***!
  11388. \*****************************************************************/
  11389. /*! no static exports found */
  11390. /***/ (function(module, exports) {
  11391. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  11392. try {
  11393. var info = gen[key](arg);
  11394. var value = info.value;
  11395. } catch (error) {
  11396. reject(error);
  11397. return;
  11398. }
  11399. if (info.done) {
  11400. resolve(value);
  11401. } else {
  11402. Promise.resolve(value).then(_next, _throw);
  11403. }
  11404. }
  11405. function _asyncToGenerator(fn) {
  11406. return function () {
  11407. var self = this,
  11408. args = arguments;
  11409. return new Promise(function (resolve, reject) {
  11410. var gen = fn.apply(self, args);
  11411. function _next(value) {
  11412. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  11413. }
  11414. function _throw(err) {
  11415. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  11416. }
  11417. _next(undefined);
  11418. });
  11419. };
  11420. }
  11421. module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
  11422. /***/ }),
  11423. /***/ 44:
  11424. /*!*************************************************************************!*\
  11425. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/timeFormat.js ***!
  11426. \*************************************************************************/
  11427. /*! no static exports found */
  11428. /***/ (function(module, exports, __webpack_require__) {
  11429. "use strict";
  11430. Object.defineProperty(exports, "__esModule", {
  11431. value: true
  11432. });
  11433. exports.default = void 0;
  11434. // padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
  11435. // 所以这里做一个兼容polyfill的兼容处理
  11436. if (!String.prototype.padStart) {
  11437. // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
  11438. String.prototype.padStart = function (maxLength) {
  11439. var fillString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
  11440. if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError('fillString must be String');
  11441. var str = this;
  11442. // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
  11443. if (str.length >= maxLength) return String(str);
  11444. var fillLength = maxLength - str.length,
  11445. times = Math.ceil(fillLength / fillString.length);
  11446. while (times >>= 1) {
  11447. fillString += fillString;
  11448. if (times === 1) {
  11449. fillString += fillString;
  11450. }
  11451. }
  11452. return fillString.slice(0, fillLength) + str;
  11453. };
  11454. }
  11455. // 其他更多是格式化有如下:
  11456. // yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
  11457. function timeFormat() {
  11458. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11459. var fmt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  11460. // 如果为null,则格式化当前时间
  11461. if (!dateTime) dateTime = Number(new Date());
  11462. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  11463. if (dateTime.toString().length == 10) dateTime *= 1000;
  11464. var date = new Date(dateTime);
  11465. var ret;
  11466. var opt = {
  11467. "y+": date.getFullYear().toString(),
  11468. // 年
  11469. "m+": (date.getMonth() + 1).toString(),
  11470. // 月
  11471. "d+": date.getDate().toString(),
  11472. // 日
  11473. "h+": date.getHours().toString(),
  11474. // 时
  11475. "M+": date.getMinutes().toString(),
  11476. // 分
  11477. "s+": date.getSeconds().toString() // 秒
  11478. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  11479. };
  11480. for (var k in opt) {
  11481. ret = new RegExp("(" + k + ")").exec(fmt);
  11482. if (ret) {
  11483. fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"));
  11484. }
  11485. ;
  11486. }
  11487. ;
  11488. return fmt;
  11489. }
  11490. var _default = timeFormat;
  11491. exports.default = _default;
  11492. /***/ }),
  11493. /***/ 45:
  11494. /*!***********************************************************************!*\
  11495. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/timeFrom.js ***!
  11496. \***********************************************************************/
  11497. /*! no static exports found */
  11498. /***/ (function(module, exports, __webpack_require__) {
  11499. "use strict";
  11500. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11501. Object.defineProperty(exports, "__esModule", {
  11502. value: true
  11503. });
  11504. exports.default = void 0;
  11505. var _timeFormat = _interopRequireDefault(__webpack_require__(/*! ../../libs/function/timeFormat.js */ 44));
  11506. /**
  11507. * 时间戳转为多久之前
  11508. * @param String timestamp 时间戳
  11509. * @param String | Boolean format 如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
  11510. * 如果为布尔值false,无论什么时间,都返回多久以前的格式
  11511. */
  11512. function timeFrom() {
  11513. var dateTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  11514. var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-mm-dd';
  11515. // 如果为null,则格式化当前时间
  11516. if (!dateTime) dateTime = Number(new Date());
  11517. // 如果dateTime长度为10或者13,则为秒和毫秒的时间戳,如果超过13位,则为其他的时间格式
  11518. if (dateTime.toString().length == 10) dateTime *= 1000;
  11519. var timestamp = +new Date(Number(dateTime));
  11520. var timer = (Number(new Date()) - timestamp) / 1000;
  11521. // 如果小于5分钟,则返回"刚刚",其他以此类推
  11522. var tips = '';
  11523. switch (true) {
  11524. case timer < 300:
  11525. tips = '刚刚';
  11526. break;
  11527. case timer >= 300 && timer < 3600:
  11528. tips = parseInt(timer / 60) + '分钟前';
  11529. break;
  11530. case timer >= 3600 && timer < 86400:
  11531. tips = parseInt(timer / 3600) + '小时前';
  11532. break;
  11533. case timer >= 86400 && timer < 2592000:
  11534. tips = parseInt(timer / 86400) + '天前';
  11535. break;
  11536. default:
  11537. // 如果format为false,则无论什么时间戳,都显示xx之前
  11538. if (format === false) {
  11539. if (timer >= 2592000 && timer < 365 * 86400) {
  11540. tips = parseInt(timer / (86400 * 30)) + '个月前';
  11541. } else {
  11542. tips = parseInt(timer / (86400 * 365)) + '年前';
  11543. }
  11544. } else {
  11545. tips = (0, _timeFormat.default)(timestamp, format);
  11546. }
  11547. }
  11548. return tips;
  11549. }
  11550. var _default = timeFrom;
  11551. exports.default = _default;
  11552. /***/ }),
  11553. /***/ 46:
  11554. /*!****************************************************************************!*\
  11555. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/colorGradient.js ***!
  11556. \****************************************************************************/
  11557. /*! no static exports found */
  11558. /***/ (function(module, exports, __webpack_require__) {
  11559. "use strict";
  11560. Object.defineProperty(exports, "__esModule", {
  11561. value: true
  11562. });
  11563. exports.default = void 0;
  11564. /**
  11565. * 求两个颜色之间的渐变值
  11566. * @param {string} startColor 开始的颜色
  11567. * @param {string} endColor 结束的颜色
  11568. * @param {number} step 颜色等分的份额
  11569. * */
  11570. function colorGradient() {
  11571. var startColor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'rgb(0, 0, 0)';
  11572. var endColor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rgb(255, 255, 255)';
  11573. var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  11574. var startRGB = hexToRgb(startColor, false); //转换为rgb数组模式
  11575. var startR = startRGB[0];
  11576. var startG = startRGB[1];
  11577. var startB = startRGB[2];
  11578. var endRGB = hexToRgb(endColor, false);
  11579. var endR = endRGB[0];
  11580. var endG = endRGB[1];
  11581. var endB = endRGB[2];
  11582. var sR = (endR - startR) / step; //总差值
  11583. var sG = (endG - startG) / step;
  11584. var sB = (endB - startB) / step;
  11585. var colorArr = [];
  11586. for (var i = 0; i < step; i++) {
  11587. //计算每一步的hex值
  11588. var hex = rgbToHex('rgb(' + Math.round(sR * i + startR) + ',' + Math.round(sG * i + startG) + ',' + Math.round(sB * i + startB) + ')');
  11589. colorArr.push(hex);
  11590. }
  11591. return colorArr;
  11592. }
  11593. // 将hex表示方式转换为rgb表示方式(这里返回rgb数组模式)
  11594. function hexToRgb(sColor) {
  11595. var str = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  11596. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11597. sColor = sColor.toLowerCase();
  11598. if (sColor && reg.test(sColor)) {
  11599. if (sColor.length === 4) {
  11600. var sColorNew = "#";
  11601. for (var i = 1; i < 4; i += 1) {
  11602. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  11603. }
  11604. sColor = sColorNew;
  11605. }
  11606. //处理六位的颜色值
  11607. var sColorChange = [];
  11608. for (var _i = 1; _i < 7; _i += 2) {
  11609. sColorChange.push(parseInt("0x" + sColor.slice(_i, _i + 2)));
  11610. }
  11611. if (!str) {
  11612. return sColorChange;
  11613. } else {
  11614. return "rgb(".concat(sColorChange[0], ",").concat(sColorChange[1], ",").concat(sColorChange[2], ")");
  11615. }
  11616. } else if (/^(rgb|RGB)/.test(sColor)) {
  11617. var arr = sColor.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  11618. return arr.map(function (val) {
  11619. return Number(val);
  11620. });
  11621. } else {
  11622. return sColor;
  11623. }
  11624. }
  11625. ;
  11626. // 将rgb表示方式转换为hex表示方式
  11627. function rgbToHex(rgb) {
  11628. var _this = rgb;
  11629. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11630. if (/^(rgb|RGB)/.test(_this)) {
  11631. var aColor = _this.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
  11632. var strHex = "#";
  11633. for (var i = 0; i < aColor.length; i++) {
  11634. var hex = Number(aColor[i]).toString(16);
  11635. hex = String(hex).length == 1 ? 0 + '' + hex : hex; // 保证每个rgb的值为2位
  11636. if (hex === "0") {
  11637. hex += hex;
  11638. }
  11639. strHex += hex;
  11640. }
  11641. if (strHex.length !== 7) {
  11642. strHex = _this;
  11643. }
  11644. return strHex;
  11645. } else if (reg.test(_this)) {
  11646. var aNum = _this.replace(/#/, "").split("");
  11647. if (aNum.length === 6) {
  11648. return _this;
  11649. } else if (aNum.length === 3) {
  11650. var numHex = "#";
  11651. for (var _i2 = 0; _i2 < aNum.length; _i2 += 1) {
  11652. numHex += aNum[_i2] + aNum[_i2];
  11653. }
  11654. return numHex;
  11655. }
  11656. } else {
  11657. return _this;
  11658. }
  11659. }
  11660. /**
  11661. * JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
  11662. * sHex为传入的十六进制的色值
  11663. * alpha为rgba的透明度
  11664. */
  11665. function colorToRgba(color) {
  11666. var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.3;
  11667. color = rgbToHex(color);
  11668. // 十六进制颜色值的正则表达式
  11669. var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  11670. /* 16进制颜色转为RGB格式 */
  11671. var sColor = color.toLowerCase();
  11672. if (sColor && reg.test(sColor)) {
  11673. if (sColor.length === 4) {
  11674. var sColorNew = '#';
  11675. for (var i = 1; i < 4; i += 1) {
  11676. sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
  11677. }
  11678. sColor = sColorNew;
  11679. }
  11680. // 处理六位的颜色值
  11681. var sColorChange = [];
  11682. for (var _i3 = 1; _i3 < 7; _i3 += 2) {
  11683. sColorChange.push(parseInt('0x' + sColor.slice(_i3, _i3 + 2)));
  11684. }
  11685. // return sColorChange.join(',')
  11686. return 'rgba(' + sColorChange.join(',') + ',' + alpha + ')';
  11687. } else {
  11688. return sColor;
  11689. }
  11690. }
  11691. var _default = {
  11692. colorGradient: colorGradient,
  11693. hexToRgb: hexToRgb,
  11694. rgbToHex: rgbToHex,
  11695. colorToRgba: colorToRgba
  11696. };
  11697. exports.default = _default;
  11698. /***/ }),
  11699. /***/ 47:
  11700. /*!*******************************************************************!*\
  11701. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/guid.js ***!
  11702. \*******************************************************************/
  11703. /*! no static exports found */
  11704. /***/ (function(module, exports, __webpack_require__) {
  11705. "use strict";
  11706. Object.defineProperty(exports, "__esModule", {
  11707. value: true
  11708. });
  11709. exports.default = void 0;
  11710. /**
  11711. * 本算法来源于简书开源代码,详见:https://www.jianshu.com/p/fdbf293d0a85
  11712. * 全局唯一标识符(uuid,Globally Unique Identifier),也称作 uuid(Universally Unique IDentifier)
  11713. * 一般用于多个组件之间,给它一个唯一的标识符,或者v-for循环的时候,如果使用数组的index可能会导致更新列表出现问题
  11714. * 最可能的情况是左滑删除item或者对某条信息流"不喜欢"并去掉它的时候,会导致组件内的数据可能出现错乱
  11715. * v-for的时候,推荐使用后端返回的id而不是循环的index
  11716. * @param {Number} len uuid的长度
  11717. * @param {Boolean} firstU 将返回的首字母置为"u"
  11718. * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
  11719. */
  11720. function guid() {
  11721. var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 32;
  11722. var firstU = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  11723. var radix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  11724. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  11725. var uuid = [];
  11726. radix = radix || chars.length;
  11727. if (len) {
  11728. // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
  11729. for (var i = 0; i < len; i++) {
  11730. uuid[i] = chars[0 | Math.random() * radix];
  11731. }
  11732. } else {
  11733. var r;
  11734. // rfc4122标准要求返回的uuid中,某些位为固定的字符
  11735. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  11736. uuid[14] = '4';
  11737. for (var _i = 0; _i < 36; _i++) {
  11738. if (!uuid[_i]) {
  11739. r = 0 | Math.random() * 16;
  11740. uuid[_i] = chars[_i == 19 ? r & 0x3 | 0x8 : r];
  11741. }
  11742. }
  11743. }
  11744. // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
  11745. if (firstU) {
  11746. uuid.shift();
  11747. return 'u' + uuid.join('');
  11748. } else {
  11749. return uuid.join('');
  11750. }
  11751. }
  11752. var _default = guid;
  11753. exports.default = _default;
  11754. /***/ }),
  11755. /***/ 48:
  11756. /*!********************************************************************!*\
  11757. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/color.js ***!
  11758. \********************************************************************/
  11759. /*! no static exports found */
  11760. /***/ (function(module, exports, __webpack_require__) {
  11761. "use strict";
  11762. Object.defineProperty(exports, "__esModule", {
  11763. value: true
  11764. });
  11765. exports.default = void 0;
  11766. // 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供
  11767. // 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20)
  11768. var color = {
  11769. primary: "#2979ff",
  11770. primaryDark: "#2b85e4",
  11771. primaryDisabled: "#a0cfff",
  11772. primaryLight: "#ecf5ff",
  11773. bgColor: "#f3f4f6",
  11774. info: "#909399",
  11775. infoDark: "#82848a",
  11776. infoDisabled: "#c8c9cc",
  11777. infoLight: "#f4f4f5",
  11778. warning: "#ff9900",
  11779. warningDark: "#f29100",
  11780. warningDisabled: "#fcbd71",
  11781. warningLight: "#fdf6ec",
  11782. error: "#fa3534",
  11783. errorDark: "#dd6161",
  11784. errorDisabled: "#fab6b6",
  11785. errorLight: "#fef0f0",
  11786. success: "#19be6b",
  11787. successDark: "#18b566",
  11788. successDisabled: "#71d5a1",
  11789. successLight: "#dbf1e1",
  11790. mainColor: "#303133",
  11791. contentColor: "#606266",
  11792. tipsColor: "#909399",
  11793. lightColor: "#c0c4cc",
  11794. borderColor: "#e4e7ed"
  11795. };
  11796. var _default = color;
  11797. exports.default = _default;
  11798. /***/ }),
  11799. /***/ 49:
  11800. /*!************************************************************************!*\
  11801. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/type2icon.js ***!
  11802. \************************************************************************/
  11803. /*! no static exports found */
  11804. /***/ (function(module, exports, __webpack_require__) {
  11805. "use strict";
  11806. Object.defineProperty(exports, "__esModule", {
  11807. value: true
  11808. });
  11809. exports.default = void 0;
  11810. /**
  11811. * 根据主题type值,获取对应的图标
  11812. * @param String type 主题名称,primary|info|error|warning|success
  11813. * @param String fill 是否使用fill填充实体的图标
  11814. */
  11815. function type2icon() {
  11816. var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'success';
  11817. var fill = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11818. // 如果非预置值,默认为success
  11819. if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success';
  11820. var iconName = '';
  11821. // 目前(2019-12-12),info和primary使用同一个图标
  11822. switch (type) {
  11823. case 'primary':
  11824. iconName = 'info-circle';
  11825. break;
  11826. case 'info':
  11827. iconName = 'info-circle';
  11828. break;
  11829. case 'error':
  11830. iconName = 'close-circle';
  11831. break;
  11832. case 'warning':
  11833. iconName = 'error-circle';
  11834. break;
  11835. case 'success':
  11836. iconName = 'checkmark-circle';
  11837. break;
  11838. default:
  11839. iconName = 'checkmark-circle';
  11840. }
  11841. // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
  11842. if (fill) iconName += '-fill';
  11843. return iconName;
  11844. }
  11845. var _default = type2icon;
  11846. exports.default = _default;
  11847. /***/ }),
  11848. /***/ 498:
  11849. /*!*************************************************************************************!*\
  11850. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/MpHtmlParser.js ***!
  11851. \*************************************************************************************/
  11852. /*! no static exports found */
  11853. /***/ (function(module, exports, __webpack_require__) {
  11854. "use strict";
  11855. /* WEBPACK VAR INJECTION */(function(uni) {
  11856. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  11857. Object.defineProperty(exports, "__esModule", {
  11858. value: true
  11859. });
  11860. exports.default = void 0;
  11861. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 499));
  11862. var _CssHandler = _interopRequireDefault(__webpack_require__(/*! ./CssHandler.js */ 500));
  11863. /**
  11864. * html 解析器
  11865. * @tutorial https://github.com/jin-yufeng/Parser
  11866. * @version 20201029
  11867. * @author JinYufeng
  11868. * @listens MIT
  11869. */
  11870. var blankChar = _config.default.blankChar;
  11871. var windowWidth = uni.getSystemInfoSync().windowWidth;
  11872. var emoji;
  11873. function MpHtmlParser(data) {
  11874. var _this = this;
  11875. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  11876. this.attrs = {};
  11877. this.CssHandler = new _CssHandler.default(options.tagStyle, windowWidth);
  11878. this.data = data;
  11879. this.domain = options.domain;
  11880. this.DOM = [];
  11881. this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0;
  11882. options.prot = (this.domain || '').includes('://') ? this.domain.split('://')[0] : 'http';
  11883. this.options = options;
  11884. this.state = this.Text;
  11885. this.STACK = [];
  11886. // 工具函数
  11887. this.bubble = function () {
  11888. for (var i = _this.STACK.length, item; item = _this.STACK[--i];) {
  11889. if (_config.default.richOnlyTags[item.name]) return false;
  11890. item.c = 1;
  11891. }
  11892. return true;
  11893. };
  11894. this.decode = function (val, amp) {
  11895. var i = -1,
  11896. j,
  11897. en;
  11898. while (1) {
  11899. if ((i = val.indexOf('&', i + 1)) == -1) break;
  11900. if ((j = val.indexOf(';', i + 2)) == -1) break;
  11901. if (val[i + 1] == '#') {
  11902. en = parseInt((val[i + 2] == 'x' ? '0' : '') + val.substring(i + 2, j));
  11903. if (!isNaN(en)) val = val.substr(0, i) + String.fromCharCode(en) + val.substr(j + 1);
  11904. } else {
  11905. en = val.substring(i + 1, j);
  11906. if (_config.default.entities[en] || en == amp) val = val.substr(0, i) + (_config.default.entities[en] || '&') + val.substr(j + 1);
  11907. }
  11908. }
  11909. return val;
  11910. };
  11911. this.getUrl = function (url) {
  11912. if (url[0] == '/') {
  11913. if (url[1] == '/') url = _this.options.prot + ':' + url;else if (_this.domain) url = _this.domain + url;
  11914. } else if (_this.domain && url.indexOf('data:') != 0 && !url.includes('://')) url = _this.domain + '/' + url;
  11915. return url;
  11916. };
  11917. this.isClose = function () {
  11918. return _this.data[_this.i] == '>' || _this.data[_this.i] == '/' && _this.data[_this.i + 1] == '>';
  11919. };
  11920. this.section = function () {
  11921. return _this.data.substring(_this.start, _this.i);
  11922. };
  11923. this.parent = function () {
  11924. return _this.STACK[_this.STACK.length - 1];
  11925. };
  11926. this.siblings = function () {
  11927. return _this.STACK.length ? _this.parent().children : _this.DOM;
  11928. };
  11929. }
  11930. MpHtmlParser.prototype.parse = function () {
  11931. if (emoji) this.data = emoji.parseEmoji(this.data);
  11932. for (var c; c = this.data[this.i]; this.i++) {
  11933. this.state(c);
  11934. }
  11935. if (this.state == this.Text) this.setText();
  11936. while (this.STACK.length) {
  11937. this.popNode(this.STACK.pop());
  11938. }
  11939. return this.DOM;
  11940. };
  11941. // 设置属性
  11942. MpHtmlParser.prototype.setAttr = function () {
  11943. var name = this.attrName.toLowerCase(),
  11944. val = this.attrVal;
  11945. if (_config.default.boolAttrs[name]) this.attrs[name] = 'T';else if (val) {
  11946. if (name == 'src' || name == 'data-src' && !this.attrs.src) this.attrs.src = this.getUrl(this.decode(val, 'amp'));else if (name == 'href' || name == 'style') this.attrs[name] = this.decode(val, 'amp');else if (name.substr(0, 5) != 'data-') this.attrs[name] = val;
  11947. }
  11948. this.attrVal = '';
  11949. while (blankChar[this.data[this.i]]) {
  11950. this.i++;
  11951. }
  11952. if (this.isClose()) this.setNode();else {
  11953. this.start = this.i;
  11954. this.state = this.AttrName;
  11955. }
  11956. };
  11957. // 设置文本节点
  11958. MpHtmlParser.prototype.setText = function () {
  11959. var back,
  11960. text = this.section();
  11961. if (!text) return;
  11962. text = _config.default.onText && _config.default.onText(text, function () {
  11963. return back = true;
  11964. }) || text;
  11965. if (back) {
  11966. this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i);
  11967. var j = this.start + text.length;
  11968. for (this.i = this.start; this.i < j; this.i++) {
  11969. this.state(this.data[this.i]);
  11970. }
  11971. return;
  11972. }
  11973. if (!this.pre) {
  11974. // 合并空白符
  11975. var flag,
  11976. tmp = [];
  11977. for (var i = text.length, c; c = text[--i];) {
  11978. if (!blankChar[c]) {
  11979. tmp.unshift(c);
  11980. if (!flag) flag = 1;
  11981. } else {
  11982. if (tmp[0] != ' ') tmp.unshift(' ');
  11983. if (c == '\n' && flag == void 0) flag = 0;
  11984. }
  11985. }
  11986. if (flag == 0) return;
  11987. text = tmp.join('');
  11988. }
  11989. this.siblings().push({
  11990. type: 'text',
  11991. text: this.decode(text)
  11992. });
  11993. };
  11994. // 设置元素节点
  11995. MpHtmlParser.prototype.setNode = function () {
  11996. var node = {
  11997. name: this.tagName.toLowerCase(),
  11998. attrs: this.attrs
  11999. },
  12000. close = _config.default.selfClosingTags[node.name];
  12001. if (this.options.nodes.length) node.type = 'node';
  12002. this.attrs = {};
  12003. if (!_config.default.ignoreTags[node.name]) {
  12004. // 处理属性
  12005. var attrs = node.attrs,
  12006. style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''),
  12007. styleObj = {};
  12008. if (attrs.id) {
  12009. if (this.options.compress & 1) attrs.id = void 0;else if (this.options.useAnchor) this.bubble();
  12010. }
  12011. if (this.options.compress & 2 && attrs.class) attrs.class = void 0;
  12012. switch (node.name) {
  12013. case 'a':
  12014. case 'ad':
  12015. this.bubble();
  12016. break;
  12017. case 'font':
  12018. if (attrs.color) {
  12019. styleObj['color'] = attrs.color;
  12020. attrs.color = void 0;
  12021. }
  12022. if (attrs.face) {
  12023. styleObj['font-family'] = attrs.face;
  12024. attrs.face = void 0;
  12025. }
  12026. if (attrs.size) {
  12027. var size = parseInt(attrs.size);
  12028. if (size < 1) size = 1;else if (size > 7) size = 7;
  12029. var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
  12030. styleObj['font-size'] = map[size - 1];
  12031. attrs.size = void 0;
  12032. }
  12033. break;
  12034. case 'embed':
  12035. var src = node.attrs.src || '',
  12036. type = node.attrs.type || '';
  12037. if (type.includes('video') || src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8')) node.name = 'video';else if (type.includes('audio') || src.includes('.m4a') || src.includes('.wav') || src.includes('.mp3') || src.includes('.aac')) node.name = 'audio';else break;
  12038. if (node.attrs.autostart) node.attrs.autoplay = 'T';
  12039. node.attrs.controls = 'T';
  12040. case 'video':
  12041. case 'audio':
  12042. if (!attrs.id) attrs.id = node.name + ++this["".concat(node.name, "Num")];else this["".concat(node.name, "Num")]++;
  12043. if (node.name == 'video') {
  12044. if (this.videoNum > 3) node.lazyLoad = 1;
  12045. if (attrs.width) {
  12046. styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px');
  12047. attrs.width = void 0;
  12048. }
  12049. if (attrs.height) {
  12050. styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px');
  12051. attrs.height = void 0;
  12052. }
  12053. }
  12054. if (!attrs.controls && !attrs.autoplay) attrs.controls = 'T';
  12055. attrs.source = [];
  12056. if (attrs.src) {
  12057. attrs.source.push(attrs.src);
  12058. attrs.src = void 0;
  12059. }
  12060. this.bubble();
  12061. break;
  12062. case 'td':
  12063. case 'th':
  12064. if (attrs.colspan || attrs.rowspan) for (var k = this.STACK.length, item; item = this.STACK[--k];) {
  12065. if (item.name == 'table') {
  12066. item.flag = 1;
  12067. break;
  12068. }
  12069. }
  12070. }
  12071. if (attrs.align) {
  12072. if (node.name == 'table') {
  12073. if (attrs.align == 'center') styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto';else styleObj['float'] = attrs.align;
  12074. } else styleObj['text-align'] = attrs.align;
  12075. attrs.align = void 0;
  12076. }
  12077. // 压缩 style
  12078. var styles = style.split(';');
  12079. style = '';
  12080. for (var i = 0, len = styles.length; i < len; i++) {
  12081. var info = styles[i].split(':');
  12082. if (info.length < 2) continue;
  12083. var _key = info[0].trim().toLowerCase(),
  12084. _value = info.slice(1).join(':').trim();
  12085. if (_value[0] == '-' || _value.includes('safe')) style += ";".concat(_key, ":").concat(_value);else if (!styleObj[_key] || _value.includes('import') || !styleObj[_key].includes('import')) styleObj[_key] = _value;
  12086. }
  12087. if (node.name == 'img') {
  12088. if (attrs.src && !attrs.ignore) {
  12089. if (this.bubble()) attrs.i = (this.imgNum++).toString();else attrs.ignore = 'T';
  12090. }
  12091. if (attrs.ignore) {
  12092. style += ';-webkit-touch-callout:none';
  12093. styleObj['max-width'] = '100%';
  12094. }
  12095. var width;
  12096. if (styleObj.width) width = styleObj.width;else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : parseFloat(attrs.width) + 'px';
  12097. if (width) {
  12098. styleObj.width = width;
  12099. attrs.width = '100%';
  12100. if (parseInt(width) > windowWidth) {
  12101. styleObj.height = '';
  12102. if (attrs.height) attrs.height = void 0;
  12103. }
  12104. }
  12105. if (styleObj.height) {
  12106. attrs.height = styleObj.height;
  12107. styleObj.height = '';
  12108. } else if (attrs.height && !attrs.height.includes('%')) attrs.height = parseFloat(attrs.height) + 'px';
  12109. }
  12110. for (var key in styleObj) {
  12111. var value = styleObj[key];
  12112. if (!value) continue;
  12113. if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1;
  12114. // 填充链接
  12115. if (value.includes('url')) {
  12116. var j = value.indexOf('(');
  12117. if (j++ != -1) {
  12118. while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) {
  12119. j++;
  12120. }
  12121. value = value.substr(0, j) + this.getUrl(value.substr(j));
  12122. }
  12123. }
  12124. // 转换 rpx
  12125. else if (value.includes('rpx')) value = value.replace(/[0-9.]+\s*rpx/g, function ($) {
  12126. return parseFloat($) * windowWidth / 750 + 'px';
  12127. });else if (key == 'white-space' && value.includes('pre') && !close) this.pre = node.pre = true;
  12128. style += ";".concat(key, ":").concat(value);
  12129. }
  12130. style = style.substr(1);
  12131. if (style) attrs.style = style;
  12132. if (!close) {
  12133. node.children = [];
  12134. if (node.name == 'pre' && _config.default.highlight) {
  12135. this.remove(node);
  12136. this.pre = node.pre = true;
  12137. }
  12138. this.siblings().push(node);
  12139. this.STACK.push(node);
  12140. } else if (!_config.default.filter || _config.default.filter(node, this) != false) this.siblings().push(node);
  12141. } else {
  12142. if (!close) this.remove(node);else if (node.name == 'source') {
  12143. var parent = this.parent();
  12144. if (parent && (parent.name == 'video' || parent.name == 'audio') && node.attrs.src) parent.attrs.source.push(node.attrs.src);
  12145. } else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href;
  12146. }
  12147. if (this.data[this.i] == '/') this.i++;
  12148. this.start = this.i + 1;
  12149. this.state = this.Text;
  12150. };
  12151. // 移除标签
  12152. MpHtmlParser.prototype.remove = function (node) {
  12153. var _this2 = this;
  12154. var name = node.name,
  12155. j = this.i;
  12156. // 处理 svg
  12157. var handleSvg = function handleSvg() {
  12158. var src = _this2.data.substring(j, _this2.i + 1);
  12159. node.attrs.xmlns = 'http://www.w3.org/2000/svg';
  12160. for (var key in node.attrs) {
  12161. if (key == 'viewbox') src = " viewBox=\"".concat(node.attrs.viewbox, "\"") + src;else if (key != 'style') src = " ".concat(key, "=\"").concat(node.attrs[key], "\"") + src;
  12162. }
  12163. src = '<svg' + src;
  12164. var parent = _this2.parent();
  12165. if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline')) parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
  12166. _this2.siblings().push({
  12167. name: 'img',
  12168. attrs: {
  12169. src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
  12170. style: node.attrs.style,
  12171. ignore: 'T'
  12172. }
  12173. });
  12174. };
  12175. if (node.name == 'svg' && this.data[j] == '/') return handleSvg(this.i++);
  12176. while (1) {
  12177. if ((this.i = this.data.indexOf('</', this.i + 1)) == -1) {
  12178. if (name == 'pre' || name == 'svg') this.i = j;else this.i = this.data.length;
  12179. return;
  12180. }
  12181. this.start = this.i += 2;
  12182. while (!blankChar[this.data[this.i]] && !this.isClose()) {
  12183. this.i++;
  12184. }
  12185. if (this.section().toLowerCase() == name) {
  12186. // 代码块高亮
  12187. if (name == 'pre') {
  12188. this.data = this.data.substr(0, j + 1) + _config.default.highlight(this.data.substring(j + 1, this.i - 5), node.attrs) + this.data.substr(this.i - 5);
  12189. return this.i = j;
  12190. } else if (name == 'style') this.CssHandler.getStyle(this.data.substring(j + 1, this.i - 7));else if (name == 'title') this.DOM.title = this.data.substring(j + 1, this.i - 7);
  12191. if ((this.i = this.data.indexOf('>', this.i)) == -1) this.i = this.data.length;
  12192. if (name == 'svg') handleSvg();
  12193. return;
  12194. }
  12195. }
  12196. };
  12197. // 节点出栈处理
  12198. MpHtmlParser.prototype.popNode = function (node) {
  12199. // 空白符处理
  12200. if (node.pre) {
  12201. node.pre = this.pre = void 0;
  12202. for (var i = this.STACK.length; i--;) {
  12203. if (this.STACK[i].pre) this.pre = true;
  12204. }
  12205. }
  12206. var siblings = this.siblings(),
  12207. len = siblings.length,
  12208. childs = node.children;
  12209. if (node.name == 'head' || _config.default.filter && _config.default.filter(node, this) == false) return siblings.pop();
  12210. var attrs = node.attrs;
  12211. // 替换一些标签名
  12212. if (_config.default.blockTags[node.name]) node.name = 'div';else if (!_config.default.trustTags[node.name]) node.name = 'span';
  12213. // 处理列表
  12214. if (node.c && (node.name == 'ul' || node.name == 'ol')) {
  12215. if ((node.attrs.style || '').includes('list-style:none')) {
  12216. for (var _i = 0, child; child = childs[_i++];) {
  12217. if (child.name == 'li') child.name = 'div';
  12218. }
  12219. } else if (node.name == 'ul') {
  12220. var floor = 1;
  12221. for (var _i2 = this.STACK.length; _i2--;) {
  12222. if (this.STACK[_i2].name == 'ul') floor++;
  12223. }
  12224. if (floor != 1) for (var _i3 = childs.length; _i3--;) {
  12225. childs[_i3].floor = floor;
  12226. }
  12227. } else {
  12228. for (var _i4 = 0, num = 1, _child; _child = childs[_i4++];) {
  12229. if (_child.name == 'li') {
  12230. _child.type = 'ol';
  12231. _child.num = function (num, type) {
  12232. if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26);
  12233. if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26);
  12234. if (type == 'i' || type == 'I') {
  12235. num = (num - 1) % 99 + 1;
  12236. var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'],
  12237. ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'],
  12238. res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || '');
  12239. if (type == 'i') return res.toLowerCase();
  12240. return res;
  12241. }
  12242. return num;
  12243. }(num++, attrs.type) + '.';
  12244. }
  12245. }
  12246. }
  12247. }
  12248. // 处理表格
  12249. if (node.name == 'table') {
  12250. var padding = parseFloat(attrs.cellpadding),
  12251. spacing = parseFloat(attrs.cellspacing),
  12252. border = parseFloat(attrs.border);
  12253. if (node.c) {
  12254. if (isNaN(padding)) padding = 2;
  12255. if (isNaN(spacing)) spacing = 2;
  12256. }
  12257. if (border) attrs.style = "border:".concat(border, "px solid gray;").concat(attrs.style || '');
  12258. if (node.flag && node.c) {
  12259. // 有 colspan 或 rowspan 且含有链接的表格转为 grid 布局实现
  12260. attrs.style = "".concat(attrs.style || '', ";").concat(spacing ? ";grid-gap:".concat(spacing, "px") : ';border-left:0;border-top:0');
  12261. var row = 1,
  12262. col = 1,
  12263. colNum,
  12264. trs = [],
  12265. children = [],
  12266. map = {};
  12267. (function f(ns) {
  12268. for (var i = 0; i < ns.length; i++) {
  12269. if (ns[i].name == 'tr') trs.push(ns[i]);else f(ns[i].children || []);
  12270. }
  12271. })(node.children);
  12272. for (var _i5 = 0; _i5 < trs.length; _i5++) {
  12273. for (var j = 0, td; td = trs[_i5].children[j]; j++) {
  12274. if (td.name == 'td' || td.name == 'th') {
  12275. while (map[row + '.' + col]) {
  12276. col++;
  12277. }
  12278. var cell = {
  12279. name: 'div',
  12280. c: 1,
  12281. attrs: {
  12282. style: (td.attrs.style || '') + (border ? ";border:".concat(border, "px solid gray") + (spacing ? '' : ';border-right:0;border-bottom:0') : '') + (padding ? ";padding:".concat(padding, "px") : '')
  12283. },
  12284. children: td.children
  12285. };
  12286. if (td.attrs.colspan) {
  12287. cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + parseInt(td.attrs.colspan));
  12288. if (!td.attrs.rowspan) cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + 1);
  12289. col += parseInt(td.attrs.colspan) - 1;
  12290. }
  12291. if (td.attrs.rowspan) {
  12292. cell.attrs.style += ';grid-row-start:' + row + ';grid-row-end:' + (row + parseInt(td.attrs.rowspan));
  12293. if (!td.attrs.colspan) cell.attrs.style += ';grid-column-start:' + col + ';grid-column-end:' + (col + 1);
  12294. for (var k = 1; k < td.attrs.rowspan; k++) {
  12295. map[row + k + '.' + col] = 1;
  12296. }
  12297. }
  12298. children.push(cell);
  12299. col++;
  12300. }
  12301. }
  12302. if (!colNum) {
  12303. colNum = col - 1;
  12304. attrs.style += ";grid-template-columns:repeat(".concat(colNum, ",auto)");
  12305. }
  12306. col = 1;
  12307. row++;
  12308. }
  12309. node.children = children;
  12310. } else {
  12311. attrs.style = "border-spacing:".concat(spacing, "px;").concat(attrs.style || '');
  12312. if (border || padding) (function f(ns) {
  12313. for (var i = 0, n; n = ns[i]; i++) {
  12314. if (n.name == 'th' || n.name == 'td') {
  12315. if (border) n.attrs.style = "border:".concat(border, "px solid gray;").concat(n.attrs.style || '');
  12316. if (padding) n.attrs.style = "padding:".concat(padding, "px;").concat(n.attrs.style || '');
  12317. } else f(n.children || []);
  12318. }
  12319. })(childs);
  12320. }
  12321. if (this.options.autoscroll) {
  12322. var table = Object.assign({}, node);
  12323. node.name = 'div';
  12324. node.attrs = {
  12325. style: 'overflow:scroll'
  12326. };
  12327. node.children = [table];
  12328. }
  12329. }
  12330. this.CssHandler.pop && this.CssHandler.pop(node);
  12331. // 自动压缩
  12332. if (node.name == 'div' && !Object.keys(attrs).length && childs.length == 1 && childs[0].name == 'div') siblings[len - 1] = childs[0];
  12333. };
  12334. // 状态机
  12335. MpHtmlParser.prototype.Text = function (c) {
  12336. if (c == '<') {
  12337. var next = this.data[this.i + 1],
  12338. isLetter = function isLetter(c) {
  12339. return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
  12340. };
  12341. if (isLetter(next)) {
  12342. this.setText();
  12343. this.start = this.i + 1;
  12344. this.state = this.TagName;
  12345. } else if (next == '/') {
  12346. this.setText();
  12347. if (isLetter(this.data[++this.i + 1])) {
  12348. this.start = this.i + 1;
  12349. this.state = this.EndTag;
  12350. } else this.Comment();
  12351. } else if (next == '!' || next == '?') {
  12352. this.setText();
  12353. this.Comment();
  12354. }
  12355. }
  12356. };
  12357. MpHtmlParser.prototype.Comment = function () {
  12358. var key;
  12359. if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->';else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>';else key = '>';
  12360. if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length;else this.i += key.length - 1;
  12361. this.start = this.i + 1;
  12362. this.state = this.Text;
  12363. };
  12364. MpHtmlParser.prototype.TagName = function (c) {
  12365. if (blankChar[c]) {
  12366. this.tagName = this.section();
  12367. while (blankChar[this.data[this.i]]) {
  12368. this.i++;
  12369. }
  12370. if (this.isClose()) this.setNode();else {
  12371. this.start = this.i;
  12372. this.state = this.AttrName;
  12373. }
  12374. } else if (this.isClose()) {
  12375. this.tagName = this.section();
  12376. this.setNode();
  12377. }
  12378. };
  12379. MpHtmlParser.prototype.AttrName = function (c) {
  12380. if (c == '=' || blankChar[c] || this.isClose()) {
  12381. this.attrName = this.section();
  12382. if (blankChar[c]) while (blankChar[this.data[++this.i]]) {
  12383. ;
  12384. }
  12385. if (this.data[this.i] == '=') {
  12386. while (blankChar[this.data[++this.i]]) {
  12387. ;
  12388. }
  12389. this.start = this.i--;
  12390. this.state = this.AttrValue;
  12391. } else this.setAttr();
  12392. }
  12393. };
  12394. MpHtmlParser.prototype.AttrValue = function (c) {
  12395. if (c == '"' || c == "'") {
  12396. this.start++;
  12397. if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length;
  12398. this.attrVal = this.section();
  12399. this.i++;
  12400. } else {
  12401. for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++) {
  12402. ;
  12403. }
  12404. this.attrVal = this.section();
  12405. }
  12406. this.setAttr();
  12407. };
  12408. MpHtmlParser.prototype.EndTag = function (c) {
  12409. if (blankChar[c] || c == '>' || c == '/') {
  12410. var name = this.section().toLowerCase();
  12411. for (var i = this.STACK.length; i--;) {
  12412. if (this.STACK[i].name == name) break;
  12413. }
  12414. if (i != -1) {
  12415. var node;
  12416. while ((node = this.STACK.pop()).name != name) {
  12417. this.popNode(node);
  12418. }
  12419. this.popNode(node);
  12420. } else if (name == 'p' || name == 'br') this.siblings().push({
  12421. name: name,
  12422. attrs: {}
  12423. });
  12424. this.i = this.data.indexOf('>', this.i);
  12425. this.start = this.i + 1;
  12426. if (this.i == -1) this.i = this.data.length;else this.state = this.Text;
  12427. }
  12428. };
  12429. var _default = MpHtmlParser;
  12430. exports.default = _default;
  12431. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  12432. /***/ }),
  12433. /***/ 499:
  12434. /*!*******************************************************************************!*\
  12435. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/config.js ***!
  12436. \*******************************************************************************/
  12437. /*! no static exports found */
  12438. /***/ (function(module, exports, __webpack_require__) {
  12439. "use strict";
  12440. /* WEBPACK VAR INJECTION */(function(wx) {
  12441. Object.defineProperty(exports, "__esModule", {
  12442. value: true
  12443. });
  12444. exports.default = void 0;
  12445. /* 配置文件 */
  12446. var cfg = {
  12447. // 出错占位图
  12448. errorImg: null,
  12449. // 过滤器函数
  12450. filter: null,
  12451. // 代码高亮函数
  12452. highlight: null,
  12453. // 文本处理函数
  12454. onText: null,
  12455. // 实体编码列表
  12456. entities: {
  12457. quot: '"',
  12458. apos: "'",
  12459. semi: ';',
  12460. nbsp: '\xA0',
  12461. ensp: "\u2002",
  12462. emsp: "\u2003",
  12463. ndash: '–',
  12464. mdash: '—',
  12465. middot: '·',
  12466. lsquo: '‘',
  12467. rsquo: '’',
  12468. ldquo: '“',
  12469. rdquo: '”',
  12470. bull: '•',
  12471. hellip: '…'
  12472. },
  12473. blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
  12474. boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
  12475. // 块级标签,将被转为 div
  12476. blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
  12477. // 将被移除的标签
  12478. ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
  12479. // 只能被 rich-text 显示的标签
  12480. richOnlyTags: makeMap('a,colgroup,fieldset,legend'),
  12481. // 自闭合的标签
  12482. selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
  12483. // 信任的标签
  12484. trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
  12485. // 默认的标签样式
  12486. userAgentStyles: {
  12487. address: 'font-style:italic',
  12488. big: 'display:inline;font-size:1.2em',
  12489. blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
  12490. caption: 'display:table-caption;text-align:center',
  12491. center: 'text-align:center',
  12492. cite: 'font-style:italic',
  12493. dd: 'margin-left:40px',
  12494. mark: 'background-color:yellow',
  12495. pre: 'font-family:monospace;white-space:pre;overflow:scroll',
  12496. s: 'text-decoration:line-through',
  12497. small: 'display:inline;font-size:0.8em',
  12498. u: 'text-decoration:underline'
  12499. }
  12500. };
  12501. function makeMap(str) {
  12502. var map = Object.create(null),
  12503. list = str.split(',');
  12504. for (var i = list.length; i--;) {
  12505. map[list[i]] = true;
  12506. }
  12507. return map;
  12508. }
  12509. if (wx.canIUse('editor')) {
  12510. cfg.blockTags.pre = void 0;
  12511. cfg.ignoreTags.rp = true;
  12512. Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
  12513. Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
  12514. }
  12515. var _default = cfg;
  12516. exports.default = _default;
  12517. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  12518. /***/ }),
  12519. /***/ 5:
  12520. /*!**************************************************************!*\
  12521. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  12522. \**************************************************************/
  12523. /*! no static exports found */
  12524. /***/ (function(module, exports, __webpack_require__) {
  12525. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ 6);
  12526. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ 7);
  12527. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ 8);
  12528. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ 10);
  12529. function _slicedToArray(arr, i) {
  12530. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  12531. }
  12532. module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  12533. /***/ }),
  12534. /***/ 50:
  12535. /*!**************************************************************************!*\
  12536. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/randomArray.js ***!
  12537. \**************************************************************************/
  12538. /*! no static exports found */
  12539. /***/ (function(module, exports, __webpack_require__) {
  12540. "use strict";
  12541. Object.defineProperty(exports, "__esModule", {
  12542. value: true
  12543. });
  12544. exports.default = void 0;
  12545. // 打乱数组
  12546. function randomArray() {
  12547. var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  12548. // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
  12549. return array.sort(function () {
  12550. return Math.random() - 0.5;
  12551. });
  12552. }
  12553. var _default = randomArray;
  12554. exports.default = _default;
  12555. /***/ }),
  12556. /***/ 500:
  12557. /*!***********************************************************************************!*\
  12558. !*** E:/work/mdapp/uni_modules/vk-uview-ui/components/u-parse/libs/CssHandler.js ***!
  12559. \***********************************************************************************/
  12560. /*! no static exports found */
  12561. /***/ (function(module, exports, __webpack_require__) {
  12562. "use strict";
  12563. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12564. Object.defineProperty(exports, "__esModule", {
  12565. value: true
  12566. });
  12567. exports.default = void 0;
  12568. var _config = _interopRequireDefault(__webpack_require__(/*! ./config.js */ 499));
  12569. var isLetter = function isLetter(c) {
  12570. return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z';
  12571. };
  12572. function CssHandler(tagStyle) {
  12573. var styles = Object.assign(Object.create(null), _config.default.userAgentStyles);
  12574. for (var item in tagStyle) {
  12575. styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item];
  12576. }
  12577. this.styles = styles;
  12578. }
  12579. CssHandler.prototype.getStyle = function (data) {
  12580. this.styles = new parser(data, this.styles).parse();
  12581. };
  12582. CssHandler.prototype.match = function (name, attrs) {
  12583. var tmp,
  12584. matched = (tmp = this.styles[name]) ? tmp + ';' : '';
  12585. if (attrs.class) {
  12586. var items = attrs.class.split(' ');
  12587. for (var i = 0, item; item = items[i]; i++) {
  12588. if (tmp = this.styles['.' + item]) matched += tmp + ';';
  12589. }
  12590. }
  12591. if (tmp = this.styles['#' + attrs.id]) matched += tmp + ';';
  12592. return matched;
  12593. };
  12594. var _default = CssHandler;
  12595. exports.default = _default;
  12596. function parser(data, init) {
  12597. this.data = data;
  12598. this.floor = 0;
  12599. this.i = 0;
  12600. this.list = [];
  12601. this.res = init;
  12602. this.state = this.Space;
  12603. }
  12604. parser.prototype.parse = function () {
  12605. for (var c; c = this.data[this.i]; this.i++) {
  12606. this.state(c);
  12607. }
  12608. return this.res;
  12609. };
  12610. parser.prototype.section = function () {
  12611. return this.data.substring(this.start, this.i);
  12612. };
  12613. // 状态机
  12614. parser.prototype.Space = function (c) {
  12615. if (c == '.' || c == '#' || isLetter(c)) {
  12616. this.start = this.i;
  12617. this.state = this.Name;
  12618. } else if (c == '/' && this.data[this.i + 1] == '*') this.Comment();else if (!_config.default.blankChar[c] && c != ';') this.state = this.Ignore;
  12619. };
  12620. parser.prototype.Comment = function () {
  12621. this.i = this.data.indexOf('*/', this.i) + 1;
  12622. if (!this.i) this.i = this.data.length;
  12623. this.state = this.Space;
  12624. };
  12625. parser.prototype.Ignore = function (c) {
  12626. if (c == '{') this.floor++;else if (c == '}' && ! --this.floor) {
  12627. this.list = [];
  12628. this.state = this.Space;
  12629. }
  12630. };
  12631. parser.prototype.Name = function (c) {
  12632. if (_config.default.blankChar[c]) {
  12633. this.list.push(this.section());
  12634. this.state = this.NameSpace;
  12635. } else if (c == '{') {
  12636. this.list.push(this.section());
  12637. this.Content();
  12638. } else if (c == ',') {
  12639. this.list.push(this.section());
  12640. this.Comma();
  12641. } else if (!isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_') this.state = this.Ignore;
  12642. };
  12643. parser.prototype.NameSpace = function (c) {
  12644. if (c == '{') this.Content();else if (c == ',') this.Comma();else if (!_config.default.blankChar[c]) this.state = this.Ignore;
  12645. };
  12646. parser.prototype.Comma = function () {
  12647. while (_config.default.blankChar[this.data[++this.i]]) {
  12648. ;
  12649. }
  12650. if (this.data[this.i] == '{') this.Content();else {
  12651. this.start = this.i--;
  12652. this.state = this.Name;
  12653. }
  12654. };
  12655. parser.prototype.Content = function () {
  12656. this.start = ++this.i;
  12657. if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length;
  12658. var content = this.section();
  12659. for (var i = 0, item; item = this.list[i++];) {
  12660. if (this.res[item]) this.res[item] += ';' + content;else this.res[item] = content;
  12661. }
  12662. this.list = [];
  12663. this.state = this.Space;
  12664. };
  12665. /***/ }),
  12666. /***/ 51:
  12667. /*!**********************************************************************!*\
  12668. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/addUnit.js ***!
  12669. \**********************************************************************/
  12670. /*! no static exports found */
  12671. /***/ (function(module, exports, __webpack_require__) {
  12672. "use strict";
  12673. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12674. Object.defineProperty(exports, "__esModule", {
  12675. value: true
  12676. });
  12677. exports.default = addUnit;
  12678. var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 38));
  12679. // 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
  12680. function addUnit() {
  12681. var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'auto';
  12682. var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'rpx';
  12683. value = String(value);
  12684. // 用uView内置验证规则中的number判断是否为数值
  12685. return _test.default.number(value) ? "".concat(value).concat(unit) : value;
  12686. }
  12687. /***/ }),
  12688. /***/ 52:
  12689. /*!*********************************************************************!*\
  12690. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/random.js ***!
  12691. \*********************************************************************/
  12692. /*! no static exports found */
  12693. /***/ (function(module, exports, __webpack_require__) {
  12694. "use strict";
  12695. Object.defineProperty(exports, "__esModule", {
  12696. value: true
  12697. });
  12698. exports.default = void 0;
  12699. function random(min, max) {
  12700. if (min >= 0 && max > 0 && max >= min) {
  12701. var gab = max - min + 1;
  12702. return Math.floor(Math.random() * gab + min);
  12703. } else {
  12704. return 0;
  12705. }
  12706. }
  12707. var _default = random;
  12708. exports.default = _default;
  12709. /***/ }),
  12710. /***/ 53:
  12711. /*!*******************************************************************!*\
  12712. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/trim.js ***!
  12713. \*******************************************************************/
  12714. /*! no static exports found */
  12715. /***/ (function(module, exports, __webpack_require__) {
  12716. "use strict";
  12717. Object.defineProperty(exports, "__esModule", {
  12718. value: true
  12719. });
  12720. exports.default = void 0;
  12721. function trim(str) {
  12722. var pos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'both';
  12723. if (pos == 'both') {
  12724. return str.replace(/^\s+|\s+$/g, "");
  12725. } else if (pos == "left") {
  12726. return str.replace(/^\s*/, '');
  12727. } else if (pos == 'right') {
  12728. return str.replace(/(\s*$)/g, "");
  12729. } else if (pos == 'all') {
  12730. return str.replace(/\s+/g, "");
  12731. } else {
  12732. return str;
  12733. }
  12734. }
  12735. var _default = trim;
  12736. exports.default = _default;
  12737. /***/ }),
  12738. /***/ 536:
  12739. /*!******************************************************************!*\
  12740. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/util/emitter.js ***!
  12741. \******************************************************************/
  12742. /*! no static exports found */
  12743. /***/ (function(module, exports, __webpack_require__) {
  12744. "use strict";
  12745. Object.defineProperty(exports, "__esModule", {
  12746. value: true
  12747. });
  12748. exports.default = void 0;
  12749. /**
  12750. * 递归使用 call 方式this指向
  12751. * @param componentName // 需要找的组件的名称
  12752. * @param eventName // 事件名称
  12753. * @param params // 需要传递的参数
  12754. */
  12755. function _broadcast(componentName, eventName, params) {
  12756. // 循环子节点找到名称一样的子节点 否则 递归 当前子节点
  12757. var $children;
  12758. $children = this.$children;
  12759. $children.map(function (child) {
  12760. if (componentName === child.$options.name) {
  12761. child.$emit.apply(child, [eventName].concat(params));
  12762. } else {
  12763. _broadcast.apply(child, [componentName, eventName].concat(params));
  12764. }
  12765. });
  12766. }
  12767. var _default = {
  12768. methods: {
  12769. /**
  12770. * 派发 (向上查找) (一个)
  12771. * @param componentName // 需要找的组件的名称
  12772. * @param eventName // 事件名称
  12773. * @param params // 需要传递的参数
  12774. */
  12775. dispatch: function dispatch(componentName, eventName, params) {
  12776. var parent = this.$parent || this.$root; //$parent 找到最近的父节点 $root 根节点
  12777. var name = parent.$options.name; // 获取当前组件实例的name
  12778. // 如果当前有节点 && 当前没名称 且 当前名称等于需要传进来的名称的时候就去查找当前的节点
  12779. // 循环出当前名称的一样的组件实例
  12780. while (parent && (!name || name !== componentName)) {
  12781. parent = parent.$parent;
  12782. if (parent) {
  12783. name = parent.$options.name;
  12784. }
  12785. }
  12786. // 有节点表示当前找到了name一样的实例
  12787. if (parent) {
  12788. parent.$emit.apply(parent, [eventName].concat(params));
  12789. }
  12790. },
  12791. /**
  12792. * 广播 (向下查找) (广播多个)
  12793. * @param componentName // 需要找的组件的名称
  12794. * @param eventName // 事件名称
  12795. * @param params // 需要传递的参数
  12796. */
  12797. broadcast: function broadcast(componentName, eventName, params) {
  12798. _broadcast.call(this, componentName, eventName, params);
  12799. }
  12800. }
  12801. };
  12802. exports.default = _default;
  12803. /***/ }),
  12804. /***/ 537:
  12805. /*!**************************************************************************!*\
  12806. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/util/async-validator.js ***!
  12807. \**************************************************************************/
  12808. /*! no static exports found */
  12809. /***/ (function(module, exports, __webpack_require__) {
  12810. "use strict";
  12811. /* WEBPACK VAR INJECTION */(function(process) {
  12812. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  12813. Object.defineProperty(exports, "__esModule", {
  12814. value: true
  12815. });
  12816. exports.default = void 0;
  12817. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  12818. function _extends() {
  12819. _extends = Object.assign || function (target) {
  12820. for (var i = 1; i < arguments.length; i++) {
  12821. var source = arguments[i];
  12822. for (var key in source) {
  12823. if (Object.prototype.hasOwnProperty.call(source, key)) {
  12824. target[key] = source[key];
  12825. }
  12826. }
  12827. }
  12828. return target;
  12829. };
  12830. return _extends.apply(this, arguments);
  12831. }
  12832. /* eslint no-console:0 */
  12833. var formatRegExp = /%[sdj%]/g;
  12834. var warning = function warning() {}; // don't print warning message when in production env or node runtime
  12835. if (typeof process !== 'undefined' && Object({"NODE_ENV":"development","VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}) && "development" !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
  12836. warning = function warning(type, errors) {
  12837. if (typeof console !== 'undefined' && console.warn) {
  12838. if (errors.every(function (e) {
  12839. return typeof e === 'string';
  12840. })) {
  12841. console.warn(type, errors);
  12842. }
  12843. }
  12844. };
  12845. }
  12846. function convertFieldsError(errors) {
  12847. if (!errors || !errors.length) return null;
  12848. var fields = {};
  12849. errors.forEach(function (error) {
  12850. var field = error.field;
  12851. fields[field] = fields[field] || [];
  12852. fields[field].push(error);
  12853. });
  12854. return fields;
  12855. }
  12856. function format() {
  12857. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  12858. args[_key] = arguments[_key];
  12859. }
  12860. var i = 1;
  12861. var f = args[0];
  12862. var len = args.length;
  12863. if (typeof f === 'function') {
  12864. return f.apply(null, args.slice(1));
  12865. }
  12866. if (typeof f === 'string') {
  12867. var str = String(f).replace(formatRegExp, function (x) {
  12868. if (x === '%%') {
  12869. return '%';
  12870. }
  12871. if (i >= len) {
  12872. return x;
  12873. }
  12874. switch (x) {
  12875. case '%s':
  12876. return String(args[i++]);
  12877. case '%d':
  12878. return Number(args[i++]);
  12879. case '%j':
  12880. try {
  12881. return JSON.stringify(args[i++]);
  12882. } catch (_) {
  12883. return '[Circular]';
  12884. }
  12885. break;
  12886. default:
  12887. return x;
  12888. }
  12889. });
  12890. for (var arg = args[i]; i < len; arg = args[++i]) {
  12891. str += " " + arg;
  12892. }
  12893. return str;
  12894. }
  12895. return f;
  12896. }
  12897. function isNativeStringType(type) {
  12898. return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';
  12899. }
  12900. function isEmptyValue(value, type) {
  12901. if (value === undefined || value === null) {
  12902. return true;
  12903. }
  12904. if (type === 'array' && Array.isArray(value) && !value.length) {
  12905. return true;
  12906. }
  12907. if (isNativeStringType(type) && typeof value === 'string' && !value) {
  12908. return true;
  12909. }
  12910. return false;
  12911. }
  12912. function asyncParallelArray(arr, func, callback) {
  12913. var results = [];
  12914. var total = 0;
  12915. var arrLength = arr.length;
  12916. function count(errors) {
  12917. results.push.apply(results, errors);
  12918. total++;
  12919. if (total === arrLength) {
  12920. callback(results);
  12921. }
  12922. }
  12923. arr.forEach(function (a) {
  12924. func(a, count);
  12925. });
  12926. }
  12927. function asyncSerialArray(arr, func, callback) {
  12928. var index = 0;
  12929. var arrLength = arr.length;
  12930. function next(errors) {
  12931. if (errors && errors.length) {
  12932. callback(errors);
  12933. return;
  12934. }
  12935. var original = index;
  12936. index = index + 1;
  12937. if (original < arrLength) {
  12938. func(arr[original], next);
  12939. } else {
  12940. callback([]);
  12941. }
  12942. }
  12943. next([]);
  12944. }
  12945. function flattenObjArr(objArr) {
  12946. var ret = [];
  12947. Object.keys(objArr).forEach(function (k) {
  12948. ret.push.apply(ret, objArr[k]);
  12949. });
  12950. return ret;
  12951. }
  12952. function asyncMap(objArr, option, func, callback) {
  12953. if (option.first) {
  12954. var _pending = new Promise(function (resolve, reject) {
  12955. var next = function next(errors) {
  12956. callback(errors);
  12957. return errors.length ? reject({
  12958. errors: errors,
  12959. fields: convertFieldsError(errors)
  12960. }) : resolve();
  12961. };
  12962. var flattenArr = flattenObjArr(objArr);
  12963. asyncSerialArray(flattenArr, func, next);
  12964. });
  12965. _pending["catch"](function (e) {
  12966. return e;
  12967. });
  12968. return _pending;
  12969. }
  12970. var firstFields = option.firstFields || [];
  12971. if (firstFields === true) {
  12972. firstFields = Object.keys(objArr);
  12973. }
  12974. var objArrKeys = Object.keys(objArr);
  12975. var objArrLength = objArrKeys.length;
  12976. var total = 0;
  12977. var results = [];
  12978. var pending = new Promise(function (resolve, reject) {
  12979. var next = function next(errors) {
  12980. results.push.apply(results, errors);
  12981. total++;
  12982. if (total === objArrLength) {
  12983. callback(results);
  12984. return results.length ? reject({
  12985. errors: results,
  12986. fields: convertFieldsError(results)
  12987. }) : resolve();
  12988. }
  12989. };
  12990. if (!objArrKeys.length) {
  12991. callback(results);
  12992. resolve();
  12993. }
  12994. objArrKeys.forEach(function (key) {
  12995. var arr = objArr[key];
  12996. if (firstFields.indexOf(key) !== -1) {
  12997. asyncSerialArray(arr, func, next);
  12998. } else {
  12999. asyncParallelArray(arr, func, next);
  13000. }
  13001. });
  13002. });
  13003. pending["catch"](function (e) {
  13004. return e;
  13005. });
  13006. return pending;
  13007. }
  13008. function complementError(rule) {
  13009. return function (oe) {
  13010. if (oe && oe.message) {
  13011. oe.field = oe.field || rule.fullField;
  13012. return oe;
  13013. }
  13014. return {
  13015. message: typeof oe === 'function' ? oe() : oe,
  13016. field: oe.field || rule.fullField
  13017. };
  13018. };
  13019. }
  13020. function deepMerge(target, source) {
  13021. if (source) {
  13022. for (var s in source) {
  13023. if (source.hasOwnProperty(s)) {
  13024. var value = source[s];
  13025. if ((0, _typeof2.default)(value) === 'object' && (0, _typeof2.default)(target[s]) === 'object') {
  13026. target[s] = _extends({}, target[s], {}, value);
  13027. } else {
  13028. target[s] = value;
  13029. }
  13030. }
  13031. }
  13032. }
  13033. return target;
  13034. }
  13035. /**
  13036. * Rule for validating required fields.
  13037. *
  13038. * @param rule The validation rule.
  13039. * @param value The value of the field on the source object.
  13040. * @param source The source object being validated.
  13041. * @param errors An array of errors that this rule may add
  13042. * validation errors to.
  13043. * @param options The validation options.
  13044. * @param options.messages The validation messages.
  13045. */
  13046. function required(rule, value, source, errors, options, type) {
  13047. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) {
  13048. errors.push(format(options.messages.required, rule.fullField));
  13049. }
  13050. }
  13051. /**
  13052. * Rule for validating whitespace.
  13053. *
  13054. * @param rule The validation rule.
  13055. * @param value The value of the field on the source object.
  13056. * @param source The source object being validated.
  13057. * @param errors An array of errors that this rule may add
  13058. * validation errors to.
  13059. * @param options The validation options.
  13060. * @param options.messages The validation messages.
  13061. */
  13062. function whitespace(rule, value, source, errors, options) {
  13063. if (/^\s+$/.test(value) || value === '') {
  13064. errors.push(format(options.messages.whitespace, rule.fullField));
  13065. }
  13066. }
  13067. /* eslint max-len:0 */
  13068. var pattern = {
  13069. // http://emailregex.com/
  13070. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
  13071. url: new RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", 'i'),
  13072. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  13073. };
  13074. var types = {
  13075. integer: function integer(value) {
  13076. return types.number(value) && parseInt(value, 10) === value;
  13077. },
  13078. "float": function float(value) {
  13079. return types.number(value) && !types.integer(value);
  13080. },
  13081. array: function array(value) {
  13082. return Array.isArray(value);
  13083. },
  13084. regexp: function regexp(value) {
  13085. if (value instanceof RegExp) {
  13086. return true;
  13087. }
  13088. try {
  13089. return !!new RegExp(value);
  13090. } catch (e) {
  13091. return false;
  13092. }
  13093. },
  13094. date: function date(value) {
  13095. return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';
  13096. },
  13097. number: function number(value) {
  13098. if (isNaN(value)) {
  13099. return false;
  13100. }
  13101. // 修改源码,将字符串数值先转为数值
  13102. return typeof +value === 'number';
  13103. },
  13104. object: function object(value) {
  13105. return (0, _typeof2.default)(value) === 'object' && !types.array(value);
  13106. },
  13107. method: function method(value) {
  13108. return typeof value === 'function';
  13109. },
  13110. email: function email(value) {
  13111. return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255;
  13112. },
  13113. url: function url(value) {
  13114. return typeof value === 'string' && !!value.match(pattern.url);
  13115. },
  13116. hex: function hex(value) {
  13117. return typeof value === 'string' && !!value.match(pattern.hex);
  13118. }
  13119. };
  13120. /**
  13121. * Rule for validating the type of a value.
  13122. *
  13123. * @param rule The validation rule.
  13124. * @param value The value of the field on the source object.
  13125. * @param source The source object being validated.
  13126. * @param errors An array of errors that this rule may add
  13127. * validation errors to.
  13128. * @param options The validation options.
  13129. * @param options.messages The validation messages.
  13130. */
  13131. function type(rule, value, source, errors, options) {
  13132. if (rule.required && value === undefined) {
  13133. required(rule, value, source, errors, options);
  13134. return;
  13135. }
  13136. var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];
  13137. var ruleType = rule.type;
  13138. if (custom.indexOf(ruleType) > -1) {
  13139. if (!types[ruleType](value)) {
  13140. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  13141. } // straight typeof check
  13142. } else if (ruleType && (0, _typeof2.default)(value) !== rule.type) {
  13143. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  13144. }
  13145. }
  13146. /**
  13147. * Rule for validating minimum and maximum allowed values.
  13148. *
  13149. * @param rule The validation rule.
  13150. * @param value The value of the field on the source object.
  13151. * @param source The source object being validated.
  13152. * @param errors An array of errors that this rule may add
  13153. * validation errors to.
  13154. * @param options The validation options.
  13155. * @param options.messages The validation messages.
  13156. */
  13157. function range(rule, value, source, errors, options) {
  13158. var len = typeof rule.len === 'number';
  13159. var min = typeof rule.min === 'number';
  13160. var max = typeof rule.max === 'number'; // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)
  13161. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  13162. var val = value;
  13163. var key = null;
  13164. var num = typeof value === 'number';
  13165. var str = typeof value === 'string';
  13166. var arr = Array.isArray(value);
  13167. if (num) {
  13168. key = 'number';
  13169. } else if (str) {
  13170. key = 'string';
  13171. } else if (arr) {
  13172. key = 'array';
  13173. } // if the value is not of a supported type for range validation
  13174. // the validation rule rule should use the
  13175. // type property to also test for a particular type
  13176. if (!key) {
  13177. return false;
  13178. }
  13179. if (arr) {
  13180. val = value.length;
  13181. }
  13182. if (str) {
  13183. // 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".lenght !== 3
  13184. val = value.replace(spRegexp, '_').length;
  13185. }
  13186. if (len) {
  13187. if (val !== rule.len) {
  13188. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  13189. }
  13190. } else if (min && !max && val < rule.min) {
  13191. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  13192. } else if (max && !min && val > rule.max) {
  13193. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  13194. } else if (min && max && (val < rule.min || val > rule.max)) {
  13195. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  13196. }
  13197. }
  13198. var ENUM = 'enum';
  13199. /**
  13200. * Rule for validating a value exists in an enumerable list.
  13201. *
  13202. * @param rule The validation rule.
  13203. * @param value The value of the field on the source object.
  13204. * @param source The source object being validated.
  13205. * @param errors An array of errors that this rule may add
  13206. * validation errors to.
  13207. * @param options The validation options.
  13208. * @param options.messages The validation messages.
  13209. */
  13210. function enumerable(rule, value, source, errors, options) {
  13211. rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
  13212. if (rule[ENUM].indexOf(value) === -1) {
  13213. errors.push(format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
  13214. }
  13215. }
  13216. /**
  13217. * Rule for validating a regular expression pattern.
  13218. *
  13219. * @param rule The validation rule.
  13220. * @param value The value of the field on the source object.
  13221. * @param source The source object being validated.
  13222. * @param errors An array of errors that this rule may add
  13223. * validation errors to.
  13224. * @param options The validation options.
  13225. * @param options.messages The validation messages.
  13226. */
  13227. function pattern$1(rule, value, source, errors, options) {
  13228. if (rule.pattern) {
  13229. if (rule.pattern instanceof RegExp) {
  13230. // if a RegExp instance is passed, reset `lastIndex` in case its `global`
  13231. // flag is accidentally set to `true`, which in a validation scenario
  13232. // is not necessary and the result might be misleading
  13233. rule.pattern.lastIndex = 0;
  13234. if (!rule.pattern.test(value)) {
  13235. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  13236. }
  13237. } else if (typeof rule.pattern === 'string') {
  13238. var _pattern = new RegExp(rule.pattern);
  13239. if (!_pattern.test(value)) {
  13240. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  13241. }
  13242. }
  13243. }
  13244. }
  13245. var rules = {
  13246. required: required,
  13247. whitespace: whitespace,
  13248. type: type,
  13249. range: range,
  13250. "enum": enumerable,
  13251. pattern: pattern$1
  13252. };
  13253. /**
  13254. * Performs validation for string types.
  13255. *
  13256. * @param rule The validation rule.
  13257. * @param value The value of the field on the source object.
  13258. * @param callback The callback function.
  13259. * @param source The source object being validated.
  13260. * @param options The validation options.
  13261. * @param options.messages The validation messages.
  13262. */
  13263. function string(rule, value, callback, source, options) {
  13264. var errors = [];
  13265. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13266. if (validate) {
  13267. if (isEmptyValue(value, 'string') && !rule.required) {
  13268. return callback();
  13269. }
  13270. rules.required(rule, value, source, errors, options, 'string');
  13271. if (!isEmptyValue(value, 'string')) {
  13272. rules.type(rule, value, source, errors, options);
  13273. rules.range(rule, value, source, errors, options);
  13274. rules.pattern(rule, value, source, errors, options);
  13275. if (rule.whitespace === true) {
  13276. rules.whitespace(rule, value, source, errors, options);
  13277. }
  13278. }
  13279. }
  13280. callback(errors);
  13281. }
  13282. /**
  13283. * Validates a function.
  13284. *
  13285. * @param rule The validation rule.
  13286. * @param value The value of the field on the source object.
  13287. * @param callback The callback function.
  13288. * @param source The source object being validated.
  13289. * @param options The validation options.
  13290. * @param options.messages The validation messages.
  13291. */
  13292. function method(rule, value, callback, source, options) {
  13293. var errors = [];
  13294. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13295. if (validate) {
  13296. if (isEmptyValue(value) && !rule.required) {
  13297. return callback();
  13298. }
  13299. rules.required(rule, value, source, errors, options);
  13300. if (value !== undefined) {
  13301. rules.type(rule, value, source, errors, options);
  13302. }
  13303. }
  13304. callback(errors);
  13305. }
  13306. /**
  13307. * Validates a number.
  13308. *
  13309. * @param rule The validation rule.
  13310. * @param value The value of the field on the source object.
  13311. * @param callback The callback function.
  13312. * @param source The source object being validated.
  13313. * @param options The validation options.
  13314. * @param options.messages The validation messages.
  13315. */
  13316. function number(rule, value, callback, source, options) {
  13317. var errors = [];
  13318. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13319. if (validate) {
  13320. if (value === '') {
  13321. value = undefined;
  13322. }
  13323. if (isEmptyValue(value) && !rule.required) {
  13324. return callback();
  13325. }
  13326. rules.required(rule, value, source, errors, options);
  13327. if (value !== undefined) {
  13328. rules.type(rule, value, source, errors, options);
  13329. rules.range(rule, value, source, errors, options);
  13330. }
  13331. }
  13332. callback(errors);
  13333. }
  13334. /**
  13335. * Validates a boolean.
  13336. *
  13337. * @param rule The validation rule.
  13338. * @param value The value of the field on the source object.
  13339. * @param callback The callback function.
  13340. * @param source The source object being validated.
  13341. * @param options The validation options.
  13342. * @param options.messages The validation messages.
  13343. */
  13344. function _boolean(rule, value, callback, source, options) {
  13345. var errors = [];
  13346. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13347. if (validate) {
  13348. if (isEmptyValue(value) && !rule.required) {
  13349. return callback();
  13350. }
  13351. rules.required(rule, value, source, errors, options);
  13352. if (value !== undefined) {
  13353. rules.type(rule, value, source, errors, options);
  13354. }
  13355. }
  13356. callback(errors);
  13357. }
  13358. /**
  13359. * Validates the regular expression type.
  13360. *
  13361. * @param rule The validation rule.
  13362. * @param value The value of the field on the source object.
  13363. * @param callback The callback function.
  13364. * @param source The source object being validated.
  13365. * @param options The validation options.
  13366. * @param options.messages The validation messages.
  13367. */
  13368. function regexp(rule, value, callback, source, options) {
  13369. var errors = [];
  13370. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13371. if (validate) {
  13372. if (isEmptyValue(value) && !rule.required) {
  13373. return callback();
  13374. }
  13375. rules.required(rule, value, source, errors, options);
  13376. if (!isEmptyValue(value)) {
  13377. rules.type(rule, value, source, errors, options);
  13378. }
  13379. }
  13380. callback(errors);
  13381. }
  13382. /**
  13383. * Validates a number is an integer.
  13384. *
  13385. * @param rule The validation rule.
  13386. * @param value The value of the field on the source object.
  13387. * @param callback The callback function.
  13388. * @param source The source object being validated.
  13389. * @param options The validation options.
  13390. * @param options.messages The validation messages.
  13391. */
  13392. function integer(rule, value, callback, source, options) {
  13393. var errors = [];
  13394. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13395. if (validate) {
  13396. if (isEmptyValue(value) && !rule.required) {
  13397. return callback();
  13398. }
  13399. rules.required(rule, value, source, errors, options);
  13400. if (value !== undefined) {
  13401. rules.type(rule, value, source, errors, options);
  13402. rules.range(rule, value, source, errors, options);
  13403. }
  13404. }
  13405. callback(errors);
  13406. }
  13407. /**
  13408. * Validates a number is a floating point number.
  13409. *
  13410. * @param rule The validation rule.
  13411. * @param value The value of the field on the source object.
  13412. * @param callback The callback function.
  13413. * @param source The source object being validated.
  13414. * @param options The validation options.
  13415. * @param options.messages The validation messages.
  13416. */
  13417. function floatFn(rule, value, callback, source, options) {
  13418. var errors = [];
  13419. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13420. if (validate) {
  13421. if (isEmptyValue(value) && !rule.required) {
  13422. return callback();
  13423. }
  13424. rules.required(rule, value, source, errors, options);
  13425. if (value !== undefined) {
  13426. rules.type(rule, value, source, errors, options);
  13427. rules.range(rule, value, source, errors, options);
  13428. }
  13429. }
  13430. callback(errors);
  13431. }
  13432. /**
  13433. * Validates an array.
  13434. *
  13435. * @param rule The validation rule.
  13436. * @param value The value of the field on the source object.
  13437. * @param callback The callback function.
  13438. * @param source The source object being validated.
  13439. * @param options The validation options.
  13440. * @param options.messages The validation messages.
  13441. */
  13442. function array(rule, value, callback, source, options) {
  13443. var errors = [];
  13444. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13445. if (validate) {
  13446. if (isEmptyValue(value, 'array') && !rule.required) {
  13447. return callback();
  13448. }
  13449. rules.required(rule, value, source, errors, options, 'array');
  13450. if (!isEmptyValue(value, 'array')) {
  13451. rules.type(rule, value, source, errors, options);
  13452. rules.range(rule, value, source, errors, options);
  13453. }
  13454. }
  13455. callback(errors);
  13456. }
  13457. /**
  13458. * Validates an object.
  13459. *
  13460. * @param rule The validation rule.
  13461. * @param value The value of the field on the source object.
  13462. * @param callback The callback function.
  13463. * @param source The source object being validated.
  13464. * @param options The validation options.
  13465. * @param options.messages The validation messages.
  13466. */
  13467. function object(rule, value, callback, source, options) {
  13468. var errors = [];
  13469. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13470. if (validate) {
  13471. if (isEmptyValue(value) && !rule.required) {
  13472. return callback();
  13473. }
  13474. rules.required(rule, value, source, errors, options);
  13475. if (value !== undefined) {
  13476. rules.type(rule, value, source, errors, options);
  13477. }
  13478. }
  13479. callback(errors);
  13480. }
  13481. var ENUM$1 = 'enum';
  13482. /**
  13483. * Validates an enumerable list.
  13484. *
  13485. * @param rule The validation rule.
  13486. * @param value The value of the field on the source object.
  13487. * @param callback The callback function.
  13488. * @param source The source object being validated.
  13489. * @param options The validation options.
  13490. * @param options.messages The validation messages.
  13491. */
  13492. function enumerable$1(rule, value, callback, source, options) {
  13493. var errors = [];
  13494. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13495. if (validate) {
  13496. if (isEmptyValue(value) && !rule.required) {
  13497. return callback();
  13498. }
  13499. rules.required(rule, value, source, errors, options);
  13500. if (value !== undefined) {
  13501. rules[ENUM$1](rule, value, source, errors, options);
  13502. }
  13503. }
  13504. callback(errors);
  13505. }
  13506. /**
  13507. * Validates a regular expression pattern.
  13508. *
  13509. * Performs validation when a rule only contains
  13510. * a pattern property but is not declared as a string type.
  13511. *
  13512. * @param rule The validation rule.
  13513. * @param value The value of the field on the source object.
  13514. * @param callback The callback function.
  13515. * @param source The source object being validated.
  13516. * @param options The validation options.
  13517. * @param options.messages The validation messages.
  13518. */
  13519. function pattern$2(rule, value, callback, source, options) {
  13520. var errors = [];
  13521. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13522. if (validate) {
  13523. if (isEmptyValue(value, 'string') && !rule.required) {
  13524. return callback();
  13525. }
  13526. rules.required(rule, value, source, errors, options);
  13527. if (!isEmptyValue(value, 'string')) {
  13528. rules.pattern(rule, value, source, errors, options);
  13529. }
  13530. }
  13531. callback(errors);
  13532. }
  13533. function date(rule, value, callback, source, options) {
  13534. var errors = [];
  13535. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13536. if (validate) {
  13537. if (isEmptyValue(value) && !rule.required) {
  13538. return callback();
  13539. }
  13540. rules.required(rule, value, source, errors, options);
  13541. if (!isEmptyValue(value)) {
  13542. var dateObject;
  13543. if (typeof value === 'number') {
  13544. dateObject = new Date(value);
  13545. } else {
  13546. dateObject = value;
  13547. }
  13548. rules.type(rule, dateObject, source, errors, options);
  13549. if (dateObject) {
  13550. rules.range(rule, dateObject.getTime(), source, errors, options);
  13551. }
  13552. }
  13553. }
  13554. callback(errors);
  13555. }
  13556. function required$1(rule, value, callback, source, options) {
  13557. var errors = [];
  13558. var type = Array.isArray(value) ? 'array' : (0, _typeof2.default)(value);
  13559. rules.required(rule, value, source, errors, options, type);
  13560. callback(errors);
  13561. }
  13562. function type$1(rule, value, callback, source, options) {
  13563. var ruleType = rule.type;
  13564. var errors = [];
  13565. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13566. if (validate) {
  13567. if (isEmptyValue(value, ruleType) && !rule.required) {
  13568. return callback();
  13569. }
  13570. rules.required(rule, value, source, errors, options, ruleType);
  13571. if (!isEmptyValue(value, ruleType)) {
  13572. rules.type(rule, value, source, errors, options);
  13573. }
  13574. }
  13575. callback(errors);
  13576. }
  13577. /**
  13578. * Performs validation for any type.
  13579. *
  13580. * @param rule The validation rule.
  13581. * @param value The value of the field on the source object.
  13582. * @param callback The callback function.
  13583. * @param source The source object being validated.
  13584. * @param options The validation options.
  13585. * @param options.messages The validation messages.
  13586. */
  13587. function any(rule, value, callback, source, options) {
  13588. var errors = [];
  13589. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13590. if (validate) {
  13591. if (isEmptyValue(value) && !rule.required) {
  13592. return callback();
  13593. }
  13594. rules.required(rule, value, source, errors, options);
  13595. }
  13596. callback(errors);
  13597. }
  13598. var validators = {
  13599. string: string,
  13600. method: method,
  13601. number: number,
  13602. "boolean": _boolean,
  13603. regexp: regexp,
  13604. integer: integer,
  13605. "float": floatFn,
  13606. array: array,
  13607. object: object,
  13608. "enum": enumerable$1,
  13609. pattern: pattern$2,
  13610. date: date,
  13611. url: type$1,
  13612. hex: type$1,
  13613. email: type$1,
  13614. required: required$1,
  13615. any: any
  13616. };
  13617. function newMessages() {
  13618. return {
  13619. "default": 'Validation error on field %s',
  13620. required: '%s is required',
  13621. "enum": '%s must be one of %s',
  13622. whitespace: '%s cannot be empty',
  13623. date: {
  13624. format: '%s date %s is invalid for format %s',
  13625. parse: '%s date could not be parsed, %s is invalid ',
  13626. invalid: '%s date %s is invalid'
  13627. },
  13628. types: {
  13629. string: '%s is not a %s',
  13630. method: '%s is not a %s (function)',
  13631. array: '%s is not an %s',
  13632. object: '%s is not an %s',
  13633. number: '%s is not a %s',
  13634. date: '%s is not a %s',
  13635. "boolean": '%s is not a %s',
  13636. integer: '%s is not an %s',
  13637. "float": '%s is not a %s',
  13638. regexp: '%s is not a valid %s',
  13639. email: '%s is not a valid %s',
  13640. url: '%s is not a valid %s',
  13641. hex: '%s is not a valid %s'
  13642. },
  13643. string: {
  13644. len: '%s must be exactly %s characters',
  13645. min: '%s must be at least %s characters',
  13646. max: '%s cannot be longer than %s characters',
  13647. range: '%s must be between %s and %s characters'
  13648. },
  13649. number: {
  13650. len: '%s must equal %s',
  13651. min: '%s cannot be less than %s',
  13652. max: '%s cannot be greater than %s',
  13653. range: '%s must be between %s and %s'
  13654. },
  13655. array: {
  13656. len: '%s must be exactly %s in length',
  13657. min: '%s cannot be less than %s in length',
  13658. max: '%s cannot be greater than %s in length',
  13659. range: '%s must be between %s and %s in length'
  13660. },
  13661. pattern: {
  13662. mismatch: '%s value %s does not match pattern %s'
  13663. },
  13664. clone: function clone() {
  13665. var cloned = JSON.parse(JSON.stringify(this));
  13666. cloned.clone = this.clone;
  13667. return cloned;
  13668. }
  13669. };
  13670. }
  13671. var messages = newMessages();
  13672. /**
  13673. * Encapsulates a validation schema.
  13674. *
  13675. * @param descriptor An object declaring validation rules
  13676. * for this schema.
  13677. */
  13678. function Schema(descriptor) {
  13679. this.rules = null;
  13680. this._messages = messages;
  13681. this.define(descriptor);
  13682. }
  13683. Schema.prototype = {
  13684. messages: function messages(_messages) {
  13685. if (_messages) {
  13686. this._messages = deepMerge(newMessages(), _messages);
  13687. }
  13688. return this._messages;
  13689. },
  13690. define: function define(rules) {
  13691. if (!rules) {
  13692. throw new Error('Cannot configure a schema with no rules');
  13693. }
  13694. if ((0, _typeof2.default)(rules) !== 'object' || Array.isArray(rules)) {
  13695. throw new Error('Rules must be an object');
  13696. }
  13697. this.rules = {};
  13698. var z;
  13699. var item;
  13700. for (z in rules) {
  13701. if (rules.hasOwnProperty(z)) {
  13702. item = rules[z];
  13703. this.rules[z] = Array.isArray(item) ? item : [item];
  13704. }
  13705. }
  13706. },
  13707. validate: function validate(source_, o, oc) {
  13708. var _this = this;
  13709. if (o === void 0) {
  13710. o = {};
  13711. }
  13712. if (oc === void 0) {
  13713. oc = function oc() {};
  13714. }
  13715. var source = source_;
  13716. var options = o;
  13717. var callback = oc;
  13718. if (typeof options === 'function') {
  13719. callback = options;
  13720. options = {};
  13721. }
  13722. if (!this.rules || Object.keys(this.rules).length === 0) {
  13723. if (callback) {
  13724. callback();
  13725. }
  13726. return Promise.resolve();
  13727. }
  13728. function complete(results) {
  13729. var i;
  13730. var errors = [];
  13731. var fields = {};
  13732. function add(e) {
  13733. if (Array.isArray(e)) {
  13734. var _errors;
  13735. errors = (_errors = errors).concat.apply(_errors, e);
  13736. } else {
  13737. errors.push(e);
  13738. }
  13739. }
  13740. for (i = 0; i < results.length; i++) {
  13741. add(results[i]);
  13742. }
  13743. if (!errors.length) {
  13744. errors = null;
  13745. fields = null;
  13746. } else {
  13747. fields = convertFieldsError(errors);
  13748. }
  13749. callback(errors, fields);
  13750. }
  13751. if (options.messages) {
  13752. var messages$1 = this.messages();
  13753. if (messages$1 === messages) {
  13754. messages$1 = newMessages();
  13755. }
  13756. deepMerge(messages$1, options.messages);
  13757. options.messages = messages$1;
  13758. } else {
  13759. options.messages = this.messages();
  13760. }
  13761. var arr;
  13762. var value;
  13763. var series = {};
  13764. var keys = options.keys || Object.keys(this.rules);
  13765. keys.forEach(function (z) {
  13766. arr = _this.rules[z];
  13767. value = source[z];
  13768. arr.forEach(function (r) {
  13769. var rule = r;
  13770. if (typeof rule.transform === 'function') {
  13771. if (source === source_) {
  13772. source = _extends({}, source);
  13773. }
  13774. value = source[z] = rule.transform(value);
  13775. }
  13776. if (typeof rule === 'function') {
  13777. rule = {
  13778. validator: rule
  13779. };
  13780. } else {
  13781. rule = _extends({}, rule);
  13782. }
  13783. rule.validator = _this.getValidationMethod(rule);
  13784. rule.field = z;
  13785. rule.fullField = rule.fullField || z;
  13786. rule.type = _this.getType(rule);
  13787. if (!rule.validator) {
  13788. return;
  13789. }
  13790. series[z] = series[z] || [];
  13791. series[z].push({
  13792. rule: rule,
  13793. value: value,
  13794. source: source,
  13795. field: z
  13796. });
  13797. });
  13798. });
  13799. var errorFields = {};
  13800. return asyncMap(series, options, function (data, doIt) {
  13801. var rule = data.rule;
  13802. var deep = (rule.type === 'object' || rule.type === 'array') && ((0, _typeof2.default)(rule.fields) === 'object' || (0, _typeof2.default)(rule.defaultField) === 'object');
  13803. deep = deep && (rule.required || !rule.required && data.value);
  13804. rule.field = data.field;
  13805. function addFullfield(key, schema) {
  13806. return _extends({}, schema, {
  13807. fullField: rule.fullField + "." + key
  13808. });
  13809. }
  13810. function cb(e) {
  13811. if (e === void 0) {
  13812. e = [];
  13813. }
  13814. var errors = e;
  13815. if (!Array.isArray(errors)) {
  13816. errors = [errors];
  13817. }
  13818. if (!options.suppressWarning && errors.length) {
  13819. Schema.warning('async-validator:', errors);
  13820. }
  13821. if (errors.length && rule.message) {
  13822. errors = [].concat(rule.message);
  13823. }
  13824. errors = errors.map(complementError(rule));
  13825. if (options.first && errors.length) {
  13826. errorFields[rule.field] = 1;
  13827. return doIt(errors);
  13828. }
  13829. if (!deep) {
  13830. doIt(errors);
  13831. } else {
  13832. // if rule is required but the target object
  13833. // does not exist fail at the rule level and don't
  13834. // go deeper
  13835. if (rule.required && !data.value) {
  13836. if (rule.message) {
  13837. errors = [].concat(rule.message).map(complementError(rule));
  13838. } else if (options.error) {
  13839. errors = [options.error(rule, format(options.messages.required, rule.field))];
  13840. } else {
  13841. errors = [];
  13842. }
  13843. return doIt(errors);
  13844. }
  13845. var fieldsSchema = {};
  13846. if (rule.defaultField) {
  13847. for (var k in data.value) {
  13848. if (data.value.hasOwnProperty(k)) {
  13849. fieldsSchema[k] = rule.defaultField;
  13850. }
  13851. }
  13852. }
  13853. fieldsSchema = _extends({}, fieldsSchema, {}, data.rule.fields);
  13854. for (var f in fieldsSchema) {
  13855. if (fieldsSchema.hasOwnProperty(f)) {
  13856. var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];
  13857. fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));
  13858. }
  13859. }
  13860. var schema = new Schema(fieldsSchema);
  13861. schema.messages(options.messages);
  13862. if (data.rule.options) {
  13863. data.rule.options.messages = options.messages;
  13864. data.rule.options.error = options.error;
  13865. }
  13866. schema.validate(data.value, data.rule.options || options, function (errs) {
  13867. var finalErrors = [];
  13868. if (errors && errors.length) {
  13869. finalErrors.push.apply(finalErrors, errors);
  13870. }
  13871. if (errs && errs.length) {
  13872. finalErrors.push.apply(finalErrors, errs);
  13873. }
  13874. doIt(finalErrors.length ? finalErrors : null);
  13875. });
  13876. }
  13877. }
  13878. var res;
  13879. if (rule.asyncValidator) {
  13880. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  13881. } else if (rule.validator) {
  13882. res = rule.validator(rule, data.value, cb, data.source, options);
  13883. if (res === true) {
  13884. cb();
  13885. } else if (res === false) {
  13886. cb(rule.message || rule.field + " fails");
  13887. } else if (res instanceof Array) {
  13888. cb(res);
  13889. } else if (res instanceof Error) {
  13890. cb(res.message);
  13891. }
  13892. }
  13893. if (res && res.then) {
  13894. res.then(function () {
  13895. return cb();
  13896. }, function (e) {
  13897. return cb(e);
  13898. });
  13899. }
  13900. }, function (results) {
  13901. complete(results);
  13902. });
  13903. },
  13904. getType: function getType(rule) {
  13905. if (rule.type === undefined && rule.pattern instanceof RegExp) {
  13906. rule.type = 'pattern';
  13907. }
  13908. if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {
  13909. throw new Error(format('Unknown rule type %s', rule.type));
  13910. }
  13911. return rule.type || 'string';
  13912. },
  13913. getValidationMethod: function getValidationMethod(rule) {
  13914. if (typeof rule.validator === 'function') {
  13915. return rule.validator;
  13916. }
  13917. var keys = Object.keys(rule);
  13918. var messageIndex = keys.indexOf('message');
  13919. if (messageIndex !== -1) {
  13920. keys.splice(messageIndex, 1);
  13921. }
  13922. if (keys.length === 1 && keys[0] === 'required') {
  13923. return validators.required;
  13924. }
  13925. return validators[this.getType(rule)] || false;
  13926. }
  13927. };
  13928. Schema.register = function register(type, validator) {
  13929. if (typeof validator !== 'function') {
  13930. throw new Error('Cannot register a validator by type, validator is not a function');
  13931. }
  13932. validators[type] = validator;
  13933. };
  13934. Schema.warning = warning;
  13935. Schema.messages = messages;
  13936. var _default = Schema;
  13937. exports.default = _default;
  13938. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/node-libs-browser/mock/process.js */ 538)))
  13939. /***/ }),
  13940. /***/ 538:
  13941. /*!********************************************************!*\
  13942. !*** ./node_modules/node-libs-browser/mock/process.js ***!
  13943. \********************************************************/
  13944. /*! no static exports found */
  13945. /***/ (function(module, exports, __webpack_require__) {
  13946. exports.nextTick = function nextTick(fn) {
  13947. var args = Array.prototype.slice.call(arguments);
  13948. args.shift();
  13949. setTimeout(function () {
  13950. fn.apply(null, args);
  13951. }, 0);
  13952. };
  13953. exports.platform = exports.arch =
  13954. exports.execPath = exports.title = 'browser';
  13955. exports.pid = 1;
  13956. exports.browser = true;
  13957. exports.env = {};
  13958. exports.argv = [];
  13959. exports.binding = function (name) {
  13960. throw new Error('No such module. (Possibly not yet loaded)')
  13961. };
  13962. (function () {
  13963. var cwd = '/';
  13964. var path;
  13965. exports.cwd = function () { return cwd };
  13966. exports.chdir = function (dir) {
  13967. if (!path) path = __webpack_require__(/*! path */ 539);
  13968. cwd = path.resolve(dir, cwd);
  13969. };
  13970. })();
  13971. exports.exit = exports.kill =
  13972. exports.umask = exports.dlopen =
  13973. exports.uptime = exports.memoryUsage =
  13974. exports.uvCounters = function() {};
  13975. exports.features = {};
  13976. /***/ }),
  13977. /***/ 539:
  13978. /*!***********************************************!*\
  13979. !*** ./node_modules/path-browserify/index.js ***!
  13980. \***********************************************/
  13981. /*! no static exports found */
  13982. /***/ (function(module, exports, __webpack_require__) {
  13983. /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  13984. // backported and transplited with Babel, with backwards-compat fixes
  13985. // Copyright Joyent, Inc. and other Node contributors.
  13986. //
  13987. // Permission is hereby granted, free of charge, to any person obtaining a
  13988. // copy of this software and associated documentation files (the
  13989. // "Software"), to deal in the Software without restriction, including
  13990. // without limitation the rights to use, copy, modify, merge, publish,
  13991. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13992. // persons to whom the Software is furnished to do so, subject to the
  13993. // following conditions:
  13994. //
  13995. // The above copyright notice and this permission notice shall be included
  13996. // in all copies or substantial portions of the Software.
  13997. //
  13998. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13999. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14000. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14001. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14002. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14003. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14004. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14005. // resolves . and .. elements in a path array with directory names there
  14006. // must be no slashes, empty elements, or device names (c:\) in the array
  14007. // (so also no leading and trailing slashes - it does not distinguish
  14008. // relative and absolute paths)
  14009. function normalizeArray(parts, allowAboveRoot) {
  14010. // if the path tries to go above the root, `up` ends up > 0
  14011. var up = 0;
  14012. for (var i = parts.length - 1; i >= 0; i--) {
  14013. var last = parts[i];
  14014. if (last === '.') {
  14015. parts.splice(i, 1);
  14016. } else if (last === '..') {
  14017. parts.splice(i, 1);
  14018. up++;
  14019. } else if (up) {
  14020. parts.splice(i, 1);
  14021. up--;
  14022. }
  14023. }
  14024. // if the path is allowed to go above the root, restore leading ..s
  14025. if (allowAboveRoot) {
  14026. for (; up--; up) {
  14027. parts.unshift('..');
  14028. }
  14029. }
  14030. return parts;
  14031. }
  14032. // path.resolve([from ...], to)
  14033. // posix version
  14034. exports.resolve = function() {
  14035. var resolvedPath = '',
  14036. resolvedAbsolute = false;
  14037. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  14038. var path = (i >= 0) ? arguments[i] : process.cwd();
  14039. // Skip empty and invalid entries
  14040. if (typeof path !== 'string') {
  14041. throw new TypeError('Arguments to path.resolve must be strings');
  14042. } else if (!path) {
  14043. continue;
  14044. }
  14045. resolvedPath = path + '/' + resolvedPath;
  14046. resolvedAbsolute = path.charAt(0) === '/';
  14047. }
  14048. // At this point the path should be resolved to a full absolute path, but
  14049. // handle relative paths to be safe (might happen when process.cwd() fails)
  14050. // Normalize the path
  14051. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  14052. return !!p;
  14053. }), !resolvedAbsolute).join('/');
  14054. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  14055. };
  14056. // path.normalize(path)
  14057. // posix version
  14058. exports.normalize = function(path) {
  14059. var isAbsolute = exports.isAbsolute(path),
  14060. trailingSlash = substr(path, -1) === '/';
  14061. // Normalize the path
  14062. path = normalizeArray(filter(path.split('/'), function(p) {
  14063. return !!p;
  14064. }), !isAbsolute).join('/');
  14065. if (!path && !isAbsolute) {
  14066. path = '.';
  14067. }
  14068. if (path && trailingSlash) {
  14069. path += '/';
  14070. }
  14071. return (isAbsolute ? '/' : '') + path;
  14072. };
  14073. // posix version
  14074. exports.isAbsolute = function(path) {
  14075. return path.charAt(0) === '/';
  14076. };
  14077. // posix version
  14078. exports.join = function() {
  14079. var paths = Array.prototype.slice.call(arguments, 0);
  14080. return exports.normalize(filter(paths, function(p, index) {
  14081. if (typeof p !== 'string') {
  14082. throw new TypeError('Arguments to path.join must be strings');
  14083. }
  14084. return p;
  14085. }).join('/'));
  14086. };
  14087. // path.relative(from, to)
  14088. // posix version
  14089. exports.relative = function(from, to) {
  14090. from = exports.resolve(from).substr(1);
  14091. to = exports.resolve(to).substr(1);
  14092. function trim(arr) {
  14093. var start = 0;
  14094. for (; start < arr.length; start++) {
  14095. if (arr[start] !== '') break;
  14096. }
  14097. var end = arr.length - 1;
  14098. for (; end >= 0; end--) {
  14099. if (arr[end] !== '') break;
  14100. }
  14101. if (start > end) return [];
  14102. return arr.slice(start, end - start + 1);
  14103. }
  14104. var fromParts = trim(from.split('/'));
  14105. var toParts = trim(to.split('/'));
  14106. var length = Math.min(fromParts.length, toParts.length);
  14107. var samePartsLength = length;
  14108. for (var i = 0; i < length; i++) {
  14109. if (fromParts[i] !== toParts[i]) {
  14110. samePartsLength = i;
  14111. break;
  14112. }
  14113. }
  14114. var outputParts = [];
  14115. for (var i = samePartsLength; i < fromParts.length; i++) {
  14116. outputParts.push('..');
  14117. }
  14118. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  14119. return outputParts.join('/');
  14120. };
  14121. exports.sep = '/';
  14122. exports.delimiter = ':';
  14123. exports.dirname = function (path) {
  14124. if (typeof path !== 'string') path = path + '';
  14125. if (path.length === 0) return '.';
  14126. var code = path.charCodeAt(0);
  14127. var hasRoot = code === 47 /*/*/;
  14128. var end = -1;
  14129. var matchedSlash = true;
  14130. for (var i = path.length - 1; i >= 1; --i) {
  14131. code = path.charCodeAt(i);
  14132. if (code === 47 /*/*/) {
  14133. if (!matchedSlash) {
  14134. end = i;
  14135. break;
  14136. }
  14137. } else {
  14138. // We saw the first non-path separator
  14139. matchedSlash = false;
  14140. }
  14141. }
  14142. if (end === -1) return hasRoot ? '/' : '.';
  14143. if (hasRoot && end === 1) {
  14144. // return '//';
  14145. // Backwards-compat fix:
  14146. return '/';
  14147. }
  14148. return path.slice(0, end);
  14149. };
  14150. function basename(path) {
  14151. if (typeof path !== 'string') path = path + '';
  14152. var start = 0;
  14153. var end = -1;
  14154. var matchedSlash = true;
  14155. var i;
  14156. for (i = path.length - 1; i >= 0; --i) {
  14157. if (path.charCodeAt(i) === 47 /*/*/) {
  14158. // If we reached a path separator that was not part of a set of path
  14159. // separators at the end of the string, stop now
  14160. if (!matchedSlash) {
  14161. start = i + 1;
  14162. break;
  14163. }
  14164. } else if (end === -1) {
  14165. // We saw the first non-path separator, mark this as the end of our
  14166. // path component
  14167. matchedSlash = false;
  14168. end = i + 1;
  14169. }
  14170. }
  14171. if (end === -1) return '';
  14172. return path.slice(start, end);
  14173. }
  14174. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  14175. // in new Node.js versions, so only basename() above is backported here
  14176. exports.basename = function (path, ext) {
  14177. var f = basename(path);
  14178. if (ext && f.substr(-1 * ext.length) === ext) {
  14179. f = f.substr(0, f.length - ext.length);
  14180. }
  14181. return f;
  14182. };
  14183. exports.extname = function (path) {
  14184. if (typeof path !== 'string') path = path + '';
  14185. var startDot = -1;
  14186. var startPart = 0;
  14187. var end = -1;
  14188. var matchedSlash = true;
  14189. // Track the state of characters (if any) we see before our first dot and
  14190. // after any path separator we find
  14191. var preDotState = 0;
  14192. for (var i = path.length - 1; i >= 0; --i) {
  14193. var code = path.charCodeAt(i);
  14194. if (code === 47 /*/*/) {
  14195. // If we reached a path separator that was not part of a set of path
  14196. // separators at the end of the string, stop now
  14197. if (!matchedSlash) {
  14198. startPart = i + 1;
  14199. break;
  14200. }
  14201. continue;
  14202. }
  14203. if (end === -1) {
  14204. // We saw the first non-path separator, mark this as the end of our
  14205. // extension
  14206. matchedSlash = false;
  14207. end = i + 1;
  14208. }
  14209. if (code === 46 /*.*/) {
  14210. // If this is our first dot, mark it as the start of our extension
  14211. if (startDot === -1)
  14212. startDot = i;
  14213. else if (preDotState !== 1)
  14214. preDotState = 1;
  14215. } else if (startDot !== -1) {
  14216. // We saw a non-dot and non-path separator before our dot, so we should
  14217. // have a good chance at having a non-empty extension
  14218. preDotState = -1;
  14219. }
  14220. }
  14221. if (startDot === -1 || end === -1 ||
  14222. // We saw a non-dot character immediately before the dot
  14223. preDotState === 0 ||
  14224. // The (right-most) trimmed path component is exactly '..'
  14225. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  14226. return '';
  14227. }
  14228. return path.slice(startDot, end);
  14229. };
  14230. function filter (xs, f) {
  14231. if (xs.filter) return xs.filter(f);
  14232. var res = [];
  14233. for (var i = 0; i < xs.length; i++) {
  14234. if (f(xs[i], i, xs)) res.push(xs[i]);
  14235. }
  14236. return res;
  14237. }
  14238. // String.prototype.substr - negative index don't work in IE8
  14239. var substr = 'ab'.substr(-1) === 'b'
  14240. ? function (str, start, len) { return str.substr(start, len) }
  14241. : function (str, start, len) {
  14242. if (start < 0) start = str.length + start;
  14243. return str.substr(start, len);
  14244. }
  14245. ;
  14246. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node-libs-browser/mock/process.js */ 538)))
  14247. /***/ }),
  14248. /***/ 54:
  14249. /*!********************************************************************!*\
  14250. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/toast.js ***!
  14251. \********************************************************************/
  14252. /*! no static exports found */
  14253. /***/ (function(module, exports, __webpack_require__) {
  14254. "use strict";
  14255. /* WEBPACK VAR INJECTION */(function(uni) {
  14256. Object.defineProperty(exports, "__esModule", {
  14257. value: true
  14258. });
  14259. exports.default = void 0;
  14260. function toast(title) {
  14261. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1500;
  14262. uni.showToast({
  14263. title: title,
  14264. icon: 'none',
  14265. duration: duration
  14266. });
  14267. }
  14268. var _default = toast;
  14269. exports.default = _default;
  14270. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  14271. /***/ }),
  14272. /***/ 55:
  14273. /*!************************************************************************!*\
  14274. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/getParent.js ***!
  14275. \************************************************************************/
  14276. /*! no static exports found */
  14277. /***/ (function(module, exports, __webpack_require__) {
  14278. "use strict";
  14279. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14280. Object.defineProperty(exports, "__esModule", {
  14281. value: true
  14282. });
  14283. exports.default = getParent;
  14284. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  14285. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  14286. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  14287. function getParent(name, keys) {
  14288. var parent = this.$parent;
  14289. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  14290. while (parent) {
  14291. // 父组件
  14292. if (parent.$options.name !== name) {
  14293. // 如果组件的name不相等,继续上一级寻找
  14294. parent = parent.$parent;
  14295. } else {
  14296. var _ret = function () {
  14297. var data = {};
  14298. // 判断keys是否数组,如果传过来的是一个数组,那么直接使用数组元素值当做键值去父组件寻找
  14299. if (Array.isArray(keys)) {
  14300. keys.map(function (val) {
  14301. data[val] = parent[val] ? parent[val] : '';
  14302. });
  14303. } else {
  14304. // 历遍传过来的对象参数
  14305. for (var i in keys) {
  14306. // 如果子组件有此值则用,无此值则用父组件的值
  14307. // 判断是否空数组,如果是,则用父组件的值,否则用子组件的值
  14308. if (Array.isArray(keys[i])) {
  14309. if (keys[i].length) {
  14310. data[i] = keys[i];
  14311. } else {
  14312. data[i] = parent[i];
  14313. }
  14314. } else if (keys[i].constructor === Object) {
  14315. // 判断是否对象,如果是对象,且有属性,那么使用子组件的值,否则使用父组件的值
  14316. if (Object.keys(keys[i]).length) {
  14317. data[i] = keys[i];
  14318. } else {
  14319. data[i] = parent[i];
  14320. }
  14321. } else {
  14322. // 只要子组件有传值,即使是false值,也是“传值”了,也需要覆盖父组件的同名参数
  14323. data[i] = keys[i] || keys[i] === false ? keys[i] : parent[i];
  14324. }
  14325. }
  14326. }
  14327. return {
  14328. v: data
  14329. };
  14330. }();
  14331. if ((0, _typeof2.default)(_ret) === "object") return _ret.v;
  14332. }
  14333. }
  14334. return {};
  14335. }
  14336. /***/ }),
  14337. /***/ 56:
  14338. /*!**********************************************************************!*\
  14339. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/$parent.js ***!
  14340. \**********************************************************************/
  14341. /*! no static exports found */
  14342. /***/ (function(module, exports, __webpack_require__) {
  14343. "use strict";
  14344. Object.defineProperty(exports, "__esModule", {
  14345. value: true
  14346. });
  14347. exports.default = $parent;
  14348. // 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
  14349. // this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
  14350. // 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
  14351. // 值(默认为undefined),就是查找最顶层的$parent
  14352. function $parent() {
  14353. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
  14354. var parent = this.$parent;
  14355. // 通过while历遍,这里主要是为了H5需要多层解析的问题
  14356. while (parent) {
  14357. // 父组件
  14358. if (parent.$options && parent.$options.name !== name) {
  14359. // 如果组件的name不相等,继续上一级寻找
  14360. parent = parent.$parent;
  14361. } else {
  14362. return parent;
  14363. }
  14364. }
  14365. return false;
  14366. }
  14367. /***/ }),
  14368. /***/ 57:
  14369. /*!******************************************************************!*\
  14370. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/sys.js ***!
  14371. \******************************************************************/
  14372. /*! no static exports found */
  14373. /***/ (function(module, exports, __webpack_require__) {
  14374. "use strict";
  14375. /* WEBPACK VAR INJECTION */(function(uni) {
  14376. Object.defineProperty(exports, "__esModule", {
  14377. value: true
  14378. });
  14379. exports.os = os;
  14380. exports.sys = sys;
  14381. function os() {
  14382. return uni.getSystemInfoSync().platform;
  14383. }
  14384. ;
  14385. function sys() {
  14386. return uni.getSystemInfoSync();
  14387. }
  14388. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  14389. /***/ }),
  14390. /***/ 58:
  14391. /*!***********************************************************************!*\
  14392. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/debounce.js ***!
  14393. \***********************************************************************/
  14394. /*! no static exports found */
  14395. /***/ (function(module, exports, __webpack_require__) {
  14396. "use strict";
  14397. Object.defineProperty(exports, "__esModule", {
  14398. value: true
  14399. });
  14400. exports.default = void 0;
  14401. var timeout = null;
  14402. /**
  14403. * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
  14404. *
  14405. * @param {Function} func 要执行的回调函数
  14406. * @param {Number} wait 延时的时间
  14407. * @param {Boolean} immediate 是否立即执行
  14408. * @return null
  14409. */
  14410. function debounce(func) {
  14411. var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  14412. var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  14413. // 清除定时器
  14414. if (timeout !== null) clearTimeout(timeout);
  14415. // 立即执行,此类情况一般用不到
  14416. if (immediate) {
  14417. var callNow = !timeout;
  14418. timeout = setTimeout(function () {
  14419. timeout = null;
  14420. }, wait);
  14421. if (callNow) typeof func === 'function' && func();
  14422. } else {
  14423. // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
  14424. timeout = setTimeout(function () {
  14425. typeof func === 'function' && func();
  14426. }, wait);
  14427. }
  14428. }
  14429. var _default = debounce;
  14430. exports.default = _default;
  14431. /***/ }),
  14432. /***/ 59:
  14433. /*!***********************************************************************!*\
  14434. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/throttle.js ***!
  14435. \***********************************************************************/
  14436. /*! no static exports found */
  14437. /***/ (function(module, exports, __webpack_require__) {
  14438. "use strict";
  14439. Object.defineProperty(exports, "__esModule", {
  14440. value: true
  14441. });
  14442. exports.default = void 0;
  14443. var timeoutArr = [];
  14444. var flagArr = [];
  14445. /**
  14446. * 节流函数
  14447. * 节流原理:在一定时间内,只能触发一次
  14448. * @param {Function} fn 要执行的回调函数
  14449. * @param {Number} time 延时的时间
  14450. * @param {Boolean} isImmediate 是否立即执行
  14451. * @param {String} timeoutName 定时器ID
  14452. * @return null
  14453. */
  14454. function throttle(fn) {
  14455. var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
  14456. var isImmediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  14457. var timeoutName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "default";
  14458. if (!timeoutArr[timeoutName]) timeoutArr[timeoutName] = null;
  14459. if (isImmediate) {
  14460. if (!flagArr[timeoutName]) {
  14461. flagArr[timeoutName] = true;
  14462. // 如果是立即执行,则在time毫秒内开始时执行
  14463. if (typeof fn === 'function') fn();
  14464. timeoutArr[timeoutName] = setTimeout(function () {
  14465. flagArr[timeoutName] = false;
  14466. }, time);
  14467. }
  14468. } else {
  14469. if (!flagArr[timeoutName]) {
  14470. flagArr[timeoutName] = true;
  14471. // 如果是非立即执行,则在time毫秒内的结束处执行
  14472. timeoutArr[timeoutName] = setTimeout(function () {
  14473. flagArr[timeoutName] = false;
  14474. if (typeof fn === 'function') fn();
  14475. }, time);
  14476. }
  14477. }
  14478. }
  14479. ;
  14480. var _default = throttle;
  14481. exports.default = _default;
  14482. /***/ }),
  14483. /***/ 6:
  14484. /*!***************************************************************!*\
  14485. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  14486. \***************************************************************/
  14487. /*! no static exports found */
  14488. /***/ (function(module, exports) {
  14489. function _arrayWithHoles(arr) {
  14490. if (Array.isArray(arr)) return arr;
  14491. }
  14492. module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
  14493. /***/ }),
  14494. /***/ 60:
  14495. /*!***********************************************************************!*\
  14496. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/function/addStyle.js ***!
  14497. \***********************************************************************/
  14498. /*! no static exports found */
  14499. /***/ (function(module, exports, __webpack_require__) {
  14500. "use strict";
  14501. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14502. Object.defineProperty(exports, "__esModule", {
  14503. value: true
  14504. });
  14505. exports.default = void 0;
  14506. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  14507. var _test = _interopRequireDefault(__webpack_require__(/*! ./test.js */ 38));
  14508. /**
  14509. * @description 样式转换
  14510. * 对象转字符串,或者字符串转对象
  14511. * @param {object | string} customStyle 需要转换的目标
  14512. * @param {String} target 转换的目的,object-转为对象,string-转为字符串
  14513. * @returns {object|string}
  14514. */
  14515. function addStyle(customStyle) {
  14516. var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'object';
  14517. // 字符串转字符串,对象转对象情形,直接返回
  14518. if (_test.default.empty(customStyle) || (0, _typeof2.default)(customStyle) === 'object' && target === 'object' || target === 'string' && typeof customStyle === 'string') {
  14519. return customStyle;
  14520. }
  14521. // 字符串转对象
  14522. if (target === 'object') {
  14523. // 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的
  14524. customStyle = trim(customStyle);
  14525. // 根据";"将字符串转为数组形式
  14526. var styleArray = customStyle.split(';');
  14527. var style = {};
  14528. // 历遍数组,拼接成对象
  14529. for (var i = 0; i < styleArray.length; i++) {
  14530. // 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤
  14531. if (styleArray[i]) {
  14532. var item = styleArray[i].split(':');
  14533. style[trim(item[0])] = trim(item[1]);
  14534. }
  14535. }
  14536. return style;
  14537. }
  14538. // 这里为对象转字符串形式
  14539. var string = '';
  14540. for (var _i in customStyle) {
  14541. // 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名
  14542. var key = _i.replace(/([A-Z])/g, '-$1').toLowerCase();
  14543. string += "".concat(key, ":").concat(customStyle[_i], ";");
  14544. }
  14545. // 去除两端空格
  14546. return trim(string);
  14547. }
  14548. var _default = addStyle;
  14549. exports.default = _default;
  14550. /***/ }),
  14551. /***/ 61:
  14552. /*!*******************************************************************!*\
  14553. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/config/config.js ***!
  14554. \*******************************************************************/
  14555. /*! no static exports found */
  14556. /***/ (function(module, exports, __webpack_require__) {
  14557. "use strict";
  14558. Object.defineProperty(exports, "__esModule", {
  14559. value: true
  14560. });
  14561. exports.default = void 0;
  14562. // 第一版 1.10.1 版本发布于2021-11-18
  14563. var version = '1.10.1';
  14564. var _default = {
  14565. v: version,
  14566. version: version,
  14567. // 主题名称
  14568. type: ['primary', 'success', 'info', 'error', 'warning']
  14569. };
  14570. exports.default = _default;
  14571. /***/ }),
  14572. /***/ 62:
  14573. /*!*******************************************************************!*\
  14574. !*** E:/work/mdapp/uni_modules/vk-uview-ui/libs/config/zIndex.js ***!
  14575. \*******************************************************************/
  14576. /*! no static exports found */
  14577. /***/ (function(module, exports, __webpack_require__) {
  14578. "use strict";
  14579. Object.defineProperty(exports, "__esModule", {
  14580. value: true
  14581. });
  14582. exports.default = void 0;
  14583. // uniapp在H5中各API的z-index值如下:
  14584. /**
  14585. * actionsheet: 999
  14586. * modal: 999
  14587. * navigate: 998
  14588. * tabbar: 998
  14589. * toast: 999
  14590. */
  14591. var _default = {
  14592. toast: 10090,
  14593. noNetwork: 10080,
  14594. // popup包含popup,actionsheet,keyboard,picker的值
  14595. popup: 10075,
  14596. mask: 10070,
  14597. navbar: 980,
  14598. topTips: 975,
  14599. sticky: 970,
  14600. indexListSticky: 965
  14601. };
  14602. exports.default = _default;
  14603. /***/ }),
  14604. /***/ 63:
  14605. /*!**********************************!*\
  14606. !*** E:/work/mdapp/api/index.js ***!
  14607. \**********************************/
  14608. /*! no static exports found */
  14609. /***/ (function(module, exports, __webpack_require__) {
  14610. "use strict";
  14611. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14612. Object.defineProperty(exports, "__esModule", {
  14613. value: true
  14614. });
  14615. exports.default = void 0;
  14616. var _base = _interopRequireDefault(__webpack_require__(/*! ./base */ 64));
  14617. var _estate = _interopRequireDefault(__webpack_require__(/*! ./estate */ 67));
  14618. var _cust = _interopRequireDefault(__webpack_require__(/*! ./cust */ 68));
  14619. var _default = {
  14620. base: _base.default,
  14621. estate: _estate.default,
  14622. cust: _cust.default
  14623. };
  14624. exports.default = _default;
  14625. /***/ }),
  14626. /***/ 64:
  14627. /*!*********************************!*\
  14628. !*** E:/work/mdapp/api/base.js ***!
  14629. \*********************************/
  14630. /*! no static exports found */
  14631. /***/ (function(module, exports, __webpack_require__) {
  14632. "use strict";
  14633. Object.defineProperty(exports, "__esModule", {
  14634. value: true
  14635. });
  14636. exports.default = void 0;
  14637. var _http = __webpack_require__(/*! @/utils/http */ 65);
  14638. var _default = {
  14639. apilogin: function apilogin(params) {
  14640. // 登录
  14641. return (0, _http.request)('api/login', params, 'loading');
  14642. },
  14643. apiregister: function apiregister(params) {
  14644. // 注册
  14645. return (0, _http.request)('api/register', params, 'loading');
  14646. },
  14647. apisendsms: function apisendsms(params) {
  14648. // 发送短信
  14649. return (0, _http.request)('api/send/sms', params, 'loading');
  14650. },
  14651. apicaptcha: function apicaptcha(params) {
  14652. // 验证码图片
  14653. return (0, _http.request)('api/captcha', params, 'loading');
  14654. },
  14655. apicheckcaptcha: function apicheckcaptcha(params) {
  14656. // 检查手机号
  14657. return (0, _http.request)('api/check/captcha', params);
  14658. },
  14659. apiwxlogin: function apiwxlogin(params) {
  14660. // 微信登录
  14661. return (0, _http.request)('api/wx/login', params, 'loading');
  14662. },
  14663. apiwxautologin: function apiwxautologin(params) {
  14664. // 微信登录 自动
  14665. return (0, _http.request)('api/wx/autologin', params, 'loading');
  14666. },
  14667. apiuserinfo: function apiuserinfo(params) {
  14668. // 用户信息
  14669. return (0, _http.request)('api/user/info', params, 'loading');
  14670. },
  14671. apiuseredit: function apiuseredit(params) {
  14672. // 用户编辑
  14673. return (0, _http.request)('api/user/edit', params, 'loading');
  14674. },
  14675. apiuserbindwechat: function apiuserbindwechat(params) {
  14676. // 绑定微信
  14677. return (0, _http.request)('api/user/bind/wechat', params, 'loading');
  14678. },
  14679. apiuserauthadd: function apiuserauthadd(params) {
  14680. // 用户认证 - 提交认证
  14681. return (0, _http.request)('api/user/auth/add', params, 'loading');
  14682. },
  14683. apiuserauthinfo: function apiuserauthinfo(params) {
  14684. // 用户认证 - 认证详情
  14685. return (0, _http.request)('api/user/auth/info', params, 'loading');
  14686. },
  14687. apiuploadcloudpiv: function apiuploadcloudpiv(params) {
  14688. // 图片上传云接口
  14689. return (0, _http.request)('api/upload/cloudpiv', params, 'loading');
  14690. },
  14691. apidicttree: function apidicttree(params) {
  14692. // 字典
  14693. return (0, _http.request)('api/dict/tree', params, 'loading');
  14694. },
  14695. apiuserauthlist: function apiuserauthlist(params) {
  14696. // 认证列表
  14697. return (0, _http.request)('api/user/auth/list', params, 'loading');
  14698. },
  14699. apiuserauthedit: function apiuserauthedit(params) {
  14700. // 认证 审核 中介
  14701. return (0, _http.request)('api/user/auth/edit', params, 'loading');
  14702. },
  14703. apideptauthedit: function apideptauthedit(params) {
  14704. // 认证 审核 渠道
  14705. return (0, _http.request)('api/dept/auth/edit', params, 'loading');
  14706. },
  14707. apiuserreferreredit: function apiuserreferreredit(params) {
  14708. // 修改推荐人
  14709. return (0, _http.request)('api/user/referrer/edit', params, 'loading');
  14710. },
  14711. apiusernoticeopen: function apiusernoticeopen(params) {
  14712. // 公众号 推送 打开
  14713. return (0, _http.request)('api/user/notice/open', params, 'loading');
  14714. },
  14715. apiusernoticeclose: function apiusernoticeclose(params) {
  14716. // 公众号 推送 关闭
  14717. return (0, _http.request)('api/user/notice/close', params, 'loading');
  14718. }
  14719. };
  14720. exports.default = _default;
  14721. /***/ }),
  14722. /***/ 65:
  14723. /*!***********************************!*\
  14724. !*** E:/work/mdapp/utils/http.js ***!
  14725. \***********************************/
  14726. /*! no static exports found */
  14727. /***/ (function(module, exports, __webpack_require__) {
  14728. "use strict";
  14729. /* WEBPACK VAR INJECTION */(function(uni) {
  14730. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  14731. Object.defineProperty(exports, "__esModule", {
  14732. value: true
  14733. });
  14734. exports.request = request;
  14735. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  14736. var _utils = __webpack_require__(/*! @utils */ 66);
  14737. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  14738. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  14739. var Http = function Http() {
  14740. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  14741. data: {}
  14742. };
  14743. return new Promise(function (resolve, reject) {
  14744. if (options.loadingStr === 'loading') {
  14745. uni.showLoading({
  14746. mask: true,
  14747. title: '加载中..'
  14748. });
  14749. }
  14750. var token = uni.getStorageSync('MD_token') || '';
  14751. var header = {
  14752. 'Content-Type': 'application/json',
  14753. 'token': token
  14754. // 'Content-Type': 'application/x-www-form-urlencoded'
  14755. };
  14756. var params = _objectSpread({}, options.data);
  14757. if (uni.getStorageSync('APP_token')) params.token = uni.getStorageSync('APP_token');
  14758. for (var key in options.data) {
  14759. if (options.data[key] === undefined || options.data[key] === 'undefined') {
  14760. params[key] = '';
  14761. }
  14762. }
  14763. var url = uni.baseUrl + options.url;
  14764. // let url = options.url
  14765. if (options.queryData) {
  14766. var qStr = '';
  14767. for (var k in options.queryData) {
  14768. qStr += "".concat(k, "=").concat(options.queryData[k], "&");
  14769. }
  14770. qStr = qStr.substr(0, qStr.length - 1);
  14771. url += "?".concat(qStr);
  14772. }
  14773. uni.request({
  14774. url: url,
  14775. data: _objectSpread({}, params),
  14776. header: header,
  14777. method: options.method || 'POST',
  14778. complete: function complete(res) {
  14779. if (options.loadingStr === 'loading') {
  14780. uni.hideLoading();
  14781. }
  14782. },
  14783. success: function success(res) {
  14784. var cData = res.data;
  14785. var code = cData.errno;
  14786. switch (code) {
  14787. case 0:
  14788. return resolve((0, _utils.noEmpty)(cData.data) ? cData.data : cData);
  14789. break;
  14790. case 401:
  14791. case 404:
  14792. case 405:
  14793. uni.removeStorageSync('MD_userInfo');
  14794. var u2 = uni.getStorageSync('MD_userInfo2');
  14795. if (u2.bind_wechat === '1' && uni.getStorageSync('MD_token')) {
  14796. uni.login({
  14797. success: function success(res) {
  14798. if (res.code) {
  14799. uni.api.base.apiwxautologin({
  14800. code: res.code
  14801. }).then(function (cData) {
  14802. if (cData.token === 'error') {
  14803. uni.removeStorageSync('MD_token');
  14804. } else {
  14805. uni.setStorageSync('MD_userInfo', cData);
  14806. uni.setStorageSync('MD_token', cData.token);
  14807. uni.api.base.apidicttree().then(function (res) {
  14808. var cObj = res || {};
  14809. var newDict = {};
  14810. for (var _k in cObj) {
  14811. var cArr = cObj[_k].map(function (item) {
  14812. return _objectSpread(_objectSpread({}, item), {}, {
  14813. key: item.dict_label,
  14814. val: item.dict_value
  14815. });
  14816. });
  14817. newDict[_k] = cArr;
  14818. }
  14819. uni.setStorageSync('MD_dict', newDict);
  14820. });
  14821. uni.api.base.apiuserinfo().then(function (res2) {
  14822. uni.setStorageSync('MD_userInfo2', res2);
  14823. uni.reLaunch({
  14824. url: '/pages/index/index'
  14825. });
  14826. });
  14827. }
  14828. });
  14829. }
  14830. }
  14831. });
  14832. } else {
  14833. uni.showToast({
  14834. title: "\u8BF7\u5148\u767B\u5F55~",
  14835. icon: 'none'
  14836. });
  14837. uni.navigateTo({
  14838. url: '/pages/user/login/login'
  14839. });
  14840. }
  14841. break;
  14842. default:
  14843. uni.showModal({
  14844. title: '提示',
  14845. content: "".concat(cData.errmsg, "(").concat(code, ")")
  14846. });
  14847. return reject(cData);
  14848. }
  14849. // resolve()
  14850. },
  14851. fail: function fail(err) {
  14852. console.log(err);
  14853. reject(err);
  14854. }
  14855. });
  14856. });
  14857. };
  14858. // export default Http
  14859. function request(url, data, loadingStr, queryData) {
  14860. return Http({
  14861. url: url,
  14862. data: data,
  14863. loadingStr: loadingStr,
  14864. queryData: queryData
  14865. });
  14866. }
  14867. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  14868. /***/ }),
  14869. /***/ 66:
  14870. /*!************************************!*\
  14871. !*** E:/work/mdapp/utils/index.js ***!
  14872. \************************************/
  14873. /*! no static exports found */
  14874. /***/ (function(module, exports, __webpack_require__) {
  14875. "use strict";
  14876. Object.defineProperty(exports, "__esModule", {
  14877. value: true
  14878. });
  14879. exports.arrToObj = arrToObj;
  14880. exports.comGetTime = comGetTime;
  14881. exports.noEmpty = noEmpty;
  14882. exports.numFormat3 = numFormat3;
  14883. exports.strTrim = strTrim;
  14884. /**
  14885. * @param {string} str
  14886. * @returns {string}
  14887. */
  14888. function strTrim(str) {
  14889. return str.replace(/(^\s*)|(\s*$)/g, '');
  14890. }
  14891. /**
  14892. * @param {Number} num
  14893. * @returns {string}
  14894. */
  14895. function numFormat3(num) {
  14896. var dotNum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14897. var numArr = Number(num).toFixed(dotNum).toString().split('.');
  14898. var arr = numArr[0].split('').reverse();
  14899. var res = [];
  14900. for (var i = 0; i < arr.length; i++) {
  14901. if (i % 3 === 0 && i !== 0) {
  14902. res.push(',');
  14903. }
  14904. res.push(arr[i]);
  14905. }
  14906. res.reverse();
  14907. if (numArr[1]) {
  14908. res = res.join('').concat('.' + numArr[1]);
  14909. } else {
  14910. res = res.join('');
  14911. }
  14912. // let res = num.toString().replace(/\d+/, function(n){
  14913. // return n.replace(/(\d)(?=(\d{3})+$)/g,function($1){
  14914. // return $1 + ","
  14915. // })
  14916. // })
  14917. // toLocaleString()
  14918. return res;
  14919. }
  14920. /**
  14921. * @param {Array} arr
  14922. * @returns {Object}
  14923. */
  14924. function arrToObj(arr) {
  14925. var obj = {};
  14926. if (Object.prototype.toString.call(arr) === '[object Array]') {
  14927. if (arr.length > 0) {
  14928. arr.forEach(function (item) {
  14929. obj[item.val] = item.key;
  14930. });
  14931. }
  14932. }
  14933. return obj;
  14934. }
  14935. /**
  14936. * @param {any} val
  14937. * @returns {Boolean}
  14938. */
  14939. function noEmpty(val) {
  14940. if (val === null || val === undefined || val === '') {
  14941. return false;
  14942. } else {
  14943. return true;
  14944. }
  14945. }
  14946. /**
  14947. * @param {Number} date
  14948. * @param {Boolean} onlyDate
  14949. * @returns {String}
  14950. * function time(time = +new Date()) {
  14951. var date = new Date(time + 8 * 3600 * 1000); // 增加8小时
  14952. return date.toJSON().substr(0, 19).replace('T', ' ');
  14953. }
  14954. */
  14955. function comGetTime() {
  14956. var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  14957. var onlyDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  14958. var year = date.getFullYear();
  14959. var month = date.getMonth() + 1;
  14960. month = month > 9 ? month : '0' + month;
  14961. var day = date.getDate();
  14962. day = day > 9 ? day : '0' + day;
  14963. var hour = date.getHours();
  14964. hour = hour > 9 ? hour : '0' + hour;
  14965. var minute = date.getMinutes();
  14966. minute = minute > 9 ? minute : '0' + minute;
  14967. var second = date.getSeconds();
  14968. second = second > 9 ? second : '0' + second;
  14969. var milli = date.getMilliseconds();
  14970. milli = milli > 100 ? milli : milli > 10 ? '0' + milli : '00' + milli;
  14971. return onlyDate ? "".concat(year, "-").concat(month, "-").concat(day) : "".concat(year).concat(month).concat(day).concat(hour).concat(minute).concat(second).concat(milli);
  14972. }
  14973. /***/ }),
  14974. /***/ 67:
  14975. /*!***********************************!*\
  14976. !*** E:/work/mdapp/api/estate.js ***!
  14977. \***********************************/
  14978. /*! no static exports found */
  14979. /***/ (function(module, exports, __webpack_require__) {
  14980. "use strict";
  14981. Object.defineProperty(exports, "__esModule", {
  14982. value: true
  14983. });
  14984. exports.default = void 0;
  14985. var _http = __webpack_require__(/*! @/utils/http */ 65);
  14986. var _default = {
  14987. apiestatelist: function apiestatelist(params) {
  14988. // 楼盘列表
  14989. return (0, _http.request)('api/estate/list', params, 'loading');
  14990. },
  14991. apiestatecontentdetail: function apiestatecontentdetail(params) {
  14992. // 楼盘 介绍详情
  14993. return (0, _http.request)('api/estate/content/detail', params, 'loading');
  14994. },
  14995. apireportadd: function apireportadd(params) {
  14996. // 报备 - 添加报备
  14997. return (0, _http.request)('api/report/add', params, 'loading');
  14998. },
  14999. apireportlist: function apireportlist(params) {
  15000. // 报备 - 报备列表
  15001. return (0, _http.request)('api/report/list', params, 'loading');
  15002. },
  15003. apireportdetail: function apireportdetail(params) {
  15004. // 报备 - 报备详情
  15005. return (0, _http.request)('api/report/detail', params, 'loading');
  15006. },
  15007. apireport2detail: function apireport2detail(params) {
  15008. // 报备 - 报备详情2 普通的报备详情
  15009. return (0, _http.request)('api/report2/detail', params, 'loading');
  15010. },
  15011. apigoverndetail: function apigoverndetail(params) {
  15012. // 报备 - 报备详情 /govern/detail
  15013. return (0, _http.request)('api/govern/detail', params, 'loading');
  15014. },
  15015. apireportsite: function apireportsite(params) {
  15016. // 案场 - 报备详情
  15017. return (0, _http.request)('api/report/site', params, 'loading');
  15018. },
  15019. apireportconfirm: function apireportconfirm(params) {
  15020. // 报备 - 报备确认
  15021. return (0, _http.request)('api/report/confirm', params, 'loading');
  15022. },
  15023. apireportcount: function apireportcount(params) {
  15024. // 报备 - 报备统计
  15025. return (0, _http.request)('api/report/count', params, 'loading');
  15026. },
  15027. apireportgroupcount: function apireportgroupcount(params) {
  15028. // 报备 - 报备分组统计
  15029. return (0, _http.request)('api/report/group/count', params, 'loading');
  15030. },
  15031. apiestateinfodetail: function apiestateinfodetail(params) {
  15032. // 楼盘一页纸
  15033. return (0, _http.request)('api/estate/info/detail', params, 'loading');
  15034. },
  15035. apiestatedetail: function apiestatedetail(params) {
  15036. // 楼盘详情 copy plus
  15037. return (0, _http.request)('api/estate/detail', params, 'loading');
  15038. },
  15039. apigovernlist: function apigovernlist(params) {
  15040. // 案场缺课列表
  15041. return (0, _http.request)('api/govern/list', params, 'loading');
  15042. },
  15043. apireportedit: function apireportedit(params) {
  15044. // 报备修改 接口
  15045. return (0, _http.request)('api/report/edit', params, 'loading');
  15046. },
  15047. apireportsubscrlist: function apireportsubscrlist(params) {
  15048. // 认购审核列表
  15049. return (0, _http.request)('api/report/subscr/list', params, 'loading');
  15050. },
  15051. apireportsubscrDeal: function apireportsubscrDeal(params) {
  15052. // 已认购审核
  15053. return (0, _http.request)('api/report/subscr', params, 'loading');
  15054. },
  15055. apireportsignupDeal: function apireportsignupDeal(params) {
  15056. // 已签约审核
  15057. return (0, _http.request)('api/report/signup', params, 'loading');
  15058. },
  15059. apiestateliblist: function apiestateliblist(params) {
  15060. // 内部 各楼盘各平台佣金汇集
  15061. return (0, _http.request)('api/estate/lib/list', params, 'loading');
  15062. },
  15063. apiestatelibdetail: function apiestatelibdetail(params) {
  15064. // 内部 各楼盘各平台佣金汇集 详情
  15065. return (0, _http.request)('api/estate/lib/detail', params, 'loading');
  15066. },
  15067. apideptstorelist: function apideptstorelist(params) {
  15068. // 渠道门店所有列表
  15069. return (0, _http.request)('api/dept/store/list', params, 'loading');
  15070. },
  15071. apideptstorecount: function apideptstorecount(params) {
  15072. // 渠道门店 品牌统计
  15073. return (0, _http.request)('api/dept/store/count', params, 'loading');
  15074. },
  15075. apistorechart: function apistorechart(params) {
  15076. // 内部门店 报备统计
  15077. return (0, _http.request)('api/store/chart', params, 'loading');
  15078. }
  15079. };
  15080. exports.default = _default;
  15081. /***/ }),
  15082. /***/ 673:
  15083. /*!************************************************************************************!*\
  15084. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/uni-cloud/dist/index.js ***!
  15085. \************************************************************************************/
  15086. /*! no static exports found */
  15087. /***/ (function(module, exports, __webpack_require__) {
  15088. "use strict";
  15089. /* WEBPACK VAR INJECTION */(function(global, uni, wx) {
  15090. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  15091. Object.defineProperty(exports, "__esModule", {
  15092. value: true
  15093. });
  15094. exports.default = void 0;
  15095. var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 41));
  15096. var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ 674));
  15097. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  15098. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  15099. var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ 18));
  15100. var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 43));
  15101. var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
  15102. var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ 675));
  15103. var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ 676));
  15104. var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ 677));
  15105. var _wrapNativeSuper2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ 678));
  15106. var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ 23));
  15107. var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ 24));
  15108. var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 22);
  15109. var _pages = _interopRequireDefault(__webpack_require__(/*! @/pages.json */ 680));
  15110. function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e35) { throw _e35; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e36) { didErr = true; err = _e36; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
  15111. function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
  15112. function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  15113. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  15114. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  15115. function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
  15116. function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  15117. "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
  15118. function n(e) {
  15119. return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
  15120. }
  15121. function s(e, t, n) {
  15122. return e(n = {
  15123. path: t,
  15124. exports: {},
  15125. require: function require(e, t) {
  15126. return function () {
  15127. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  15128. }(null == t && n.path);
  15129. }
  15130. }, n.exports), n.exports;
  15131. }
  15132. var r = s(function (e, t) {
  15133. var n;
  15134. e.exports = (n = n || function (e, t) {
  15135. var n = Object.create || function () {
  15136. function e() {}
  15137. return function (t) {
  15138. var n;
  15139. return e.prototype = t, n = new e(), e.prototype = null, n;
  15140. };
  15141. }(),
  15142. s = {},
  15143. r = s.lib = {},
  15144. i = r.Base = {
  15145. extend: function extend(e) {
  15146. var t = n(this);
  15147. return e && t.mixIn(e), t.hasOwnProperty("init") && this.init !== t.init || (t.init = function () {
  15148. t.$super.init.apply(this, arguments);
  15149. }), t.init.prototype = t, t.$super = this, t;
  15150. },
  15151. create: function create() {
  15152. var e = this.extend();
  15153. return e.init.apply(e, arguments), e;
  15154. },
  15155. init: function init() {},
  15156. mixIn: function mixIn(e) {
  15157. for (var t in e) {
  15158. e.hasOwnProperty(t) && (this[t] = e[t]);
  15159. }
  15160. e.hasOwnProperty("toString") && (this.toString = e.toString);
  15161. },
  15162. clone: function clone() {
  15163. return this.init.prototype.extend(this);
  15164. }
  15165. },
  15166. o = r.WordArray = i.extend({
  15167. init: function init(e, n) {
  15168. e = this.words = e || [], this.sigBytes = n != t ? n : 4 * e.length;
  15169. },
  15170. toString: function toString(e) {
  15171. return (e || c).stringify(this);
  15172. },
  15173. concat: function concat(e) {
  15174. var t = this.words,
  15175. n = e.words,
  15176. s = this.sigBytes,
  15177. r = e.sigBytes;
  15178. if (this.clamp(), s % 4) for (var i = 0; i < r; i++) {
  15179. var o = n[i >>> 2] >>> 24 - i % 4 * 8 & 255;
  15180. t[s + i >>> 2] |= o << 24 - (s + i) % 4 * 8;
  15181. } else for (i = 0; i < r; i += 4) {
  15182. t[s + i >>> 2] = n[i >>> 2];
  15183. }
  15184. return this.sigBytes += r, this;
  15185. },
  15186. clamp: function clamp() {
  15187. var t = this.words,
  15188. n = this.sigBytes;
  15189. t[n >>> 2] &= 4294967295 << 32 - n % 4 * 8, t.length = e.ceil(n / 4);
  15190. },
  15191. clone: function clone() {
  15192. var e = i.clone.call(this);
  15193. return e.words = this.words.slice(0), e;
  15194. },
  15195. random: function random(t) {
  15196. for (var n, s = [], r = function r(t) {
  15197. t = t;
  15198. var n = 987654321,
  15199. s = 4294967295;
  15200. return function () {
  15201. var r = ((n = 36969 * (65535 & n) + (n >> 16) & s) << 16) + (t = 18e3 * (65535 & t) + (t >> 16) & s) & s;
  15202. return r /= 4294967296, (r += .5) * (e.random() > .5 ? 1 : -1);
  15203. };
  15204. }, i = 0; i < t; i += 4) {
  15205. var a = r(4294967296 * (n || e.random()));
  15206. n = 987654071 * a(), s.push(4294967296 * a() | 0);
  15207. }
  15208. return new o.init(s, t);
  15209. }
  15210. }),
  15211. a = s.enc = {},
  15212. c = a.Hex = {
  15213. stringify: function stringify(e) {
  15214. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  15215. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  15216. s.push((i >>> 4).toString(16)), s.push((15 & i).toString(16));
  15217. }
  15218. return s.join("");
  15219. },
  15220. parse: function parse(e) {
  15221. for (var t = e.length, n = [], s = 0; s < t; s += 2) {
  15222. n[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
  15223. }
  15224. return new o.init(n, t / 2);
  15225. }
  15226. },
  15227. u = a.Latin1 = {
  15228. stringify: function stringify(e) {
  15229. for (var t = e.words, n = e.sigBytes, s = [], r = 0; r < n; r++) {
  15230. var i = t[r >>> 2] >>> 24 - r % 4 * 8 & 255;
  15231. s.push(String.fromCharCode(i));
  15232. }
  15233. return s.join("");
  15234. },
  15235. parse: function parse(e) {
  15236. for (var t = e.length, n = [], s = 0; s < t; s++) {
  15237. n[s >>> 2] |= (255 & e.charCodeAt(s)) << 24 - s % 4 * 8;
  15238. }
  15239. return new o.init(n, t);
  15240. }
  15241. },
  15242. h = a.Utf8 = {
  15243. stringify: function stringify(e) {
  15244. try {
  15245. return decodeURIComponent(escape(u.stringify(e)));
  15246. } catch (e) {
  15247. throw new Error("Malformed UTF-8 data");
  15248. }
  15249. },
  15250. parse: function parse(e) {
  15251. return u.parse(unescape(encodeURIComponent(e)));
  15252. }
  15253. },
  15254. l = r.BufferedBlockAlgorithm = i.extend({
  15255. reset: function reset() {
  15256. this._data = new o.init(), this._nDataBytes = 0;
  15257. },
  15258. _append: function _append(e) {
  15259. "string" == typeof e && (e = h.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;
  15260. },
  15261. _process: function _process(t) {
  15262. var n = this._data,
  15263. s = n.words,
  15264. r = n.sigBytes,
  15265. i = this.blockSize,
  15266. a = r / (4 * i),
  15267. c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * i,
  15268. u = e.min(4 * c, r);
  15269. if (c) {
  15270. for (var h = 0; h < c; h += i) {
  15271. this._doProcessBlock(s, h);
  15272. }
  15273. var l = s.splice(0, c);
  15274. n.sigBytes -= u;
  15275. }
  15276. return new o.init(l, u);
  15277. },
  15278. clone: function clone() {
  15279. var e = i.clone.call(this);
  15280. return e._data = this._data.clone(), e;
  15281. },
  15282. _minBufferSize: 0
  15283. });
  15284. r.Hasher = l.extend({
  15285. cfg: i.extend(),
  15286. init: function init(e) {
  15287. this.cfg = this.cfg.extend(e), this.reset();
  15288. },
  15289. reset: function reset() {
  15290. l.reset.call(this), this._doReset();
  15291. },
  15292. update: function update(e) {
  15293. return this._append(e), this._process(), this;
  15294. },
  15295. finalize: function finalize(e) {
  15296. return e && this._append(e), this._doFinalize();
  15297. },
  15298. blockSize: 16,
  15299. _createHelper: function _createHelper(e) {
  15300. return function (t, n) {
  15301. return new e.init(n).finalize(t);
  15302. };
  15303. },
  15304. _createHmacHelper: function _createHmacHelper(e) {
  15305. return function (t, n) {
  15306. return new d.HMAC.init(e, n).finalize(t);
  15307. };
  15308. }
  15309. });
  15310. var d = s.algo = {};
  15311. return s;
  15312. }(Math), n);
  15313. }),
  15314. i = r,
  15315. o = (s(function (e, t) {
  15316. var n;
  15317. e.exports = (n = i, function (e) {
  15318. var t = n,
  15319. s = t.lib,
  15320. r = s.WordArray,
  15321. i = s.Hasher,
  15322. o = t.algo,
  15323. a = [];
  15324. !function () {
  15325. for (var t = 0; t < 64; t++) {
  15326. a[t] = 4294967296 * e.abs(e.sin(t + 1)) | 0;
  15327. }
  15328. }();
  15329. var c = o.MD5 = i.extend({
  15330. _doReset: function _doReset() {
  15331. this._hash = new r.init([1732584193, 4023233417, 2562383102, 271733878]);
  15332. },
  15333. _doProcessBlock: function _doProcessBlock(e, t) {
  15334. for (var n = 0; n < 16; n++) {
  15335. var s = t + n,
  15336. r = e[s];
  15337. e[s] = 16711935 & (r << 8 | r >>> 24) | 4278255360 & (r << 24 | r >>> 8);
  15338. }
  15339. var i = this._hash.words,
  15340. o = e[t + 0],
  15341. c = e[t + 1],
  15342. p = e[t + 2],
  15343. f = e[t + 3],
  15344. g = e[t + 4],
  15345. m = e[t + 5],
  15346. y = e[t + 6],
  15347. _ = e[t + 7],
  15348. w = e[t + 8],
  15349. v = e[t + 9],
  15350. I = e[t + 10],
  15351. S = e[t + 11],
  15352. b = e[t + 12],
  15353. k = e[t + 13],
  15354. C = e[t + 14],
  15355. T = e[t + 15],
  15356. P = i[0],
  15357. A = i[1],
  15358. E = i[2],
  15359. O = i[3];
  15360. P = u(P, A, E, O, o, 7, a[0]), O = u(O, P, A, E, c, 12, a[1]), E = u(E, O, P, A, p, 17, a[2]), A = u(A, E, O, P, f, 22, a[3]), P = u(P, A, E, O, g, 7, a[4]), O = u(O, P, A, E, m, 12, a[5]), E = u(E, O, P, A, y, 17, a[6]), A = u(A, E, O, P, _, 22, a[7]), P = u(P, A, E, O, w, 7, a[8]), O = u(O, P, A, E, v, 12, a[9]), E = u(E, O, P, A, I, 17, a[10]), A = u(A, E, O, P, S, 22, a[11]), P = u(P, A, E, O, b, 7, a[12]), O = u(O, P, A, E, k, 12, a[13]), E = u(E, O, P, A, C, 17, a[14]), P = h(P, A = u(A, E, O, P, T, 22, a[15]), E, O, c, 5, a[16]), O = h(O, P, A, E, y, 9, a[17]), E = h(E, O, P, A, S, 14, a[18]), A = h(A, E, O, P, o, 20, a[19]), P = h(P, A, E, O, m, 5, a[20]), O = h(O, P, A, E, I, 9, a[21]), E = h(E, O, P, A, T, 14, a[22]), A = h(A, E, O, P, g, 20, a[23]), P = h(P, A, E, O, v, 5, a[24]), O = h(O, P, A, E, C, 9, a[25]), E = h(E, O, P, A, f, 14, a[26]), A = h(A, E, O, P, w, 20, a[27]), P = h(P, A, E, O, k, 5, a[28]), O = h(O, P, A, E, p, 9, a[29]), E = h(E, O, P, A, _, 14, a[30]), P = l(P, A = h(A, E, O, P, b, 20, a[31]), E, O, m, 4, a[32]), O = l(O, P, A, E, w, 11, a[33]), E = l(E, O, P, A, S, 16, a[34]), A = l(A, E, O, P, C, 23, a[35]), P = l(P, A, E, O, c, 4, a[36]), O = l(O, P, A, E, g, 11, a[37]), E = l(E, O, P, A, _, 16, a[38]), A = l(A, E, O, P, I, 23, a[39]), P = l(P, A, E, O, k, 4, a[40]), O = l(O, P, A, E, o, 11, a[41]), E = l(E, O, P, A, f, 16, a[42]), A = l(A, E, O, P, y, 23, a[43]), P = l(P, A, E, O, v, 4, a[44]), O = l(O, P, A, E, b, 11, a[45]), E = l(E, O, P, A, T, 16, a[46]), P = d(P, A = l(A, E, O, P, p, 23, a[47]), E, O, o, 6, a[48]), O = d(O, P, A, E, _, 10, a[49]), E = d(E, O, P, A, C, 15, a[50]), A = d(A, E, O, P, m, 21, a[51]), P = d(P, A, E, O, b, 6, a[52]), O = d(O, P, A, E, f, 10, a[53]), E = d(E, O, P, A, I, 15, a[54]), A = d(A, E, O, P, c, 21, a[55]), P = d(P, A, E, O, w, 6, a[56]), O = d(O, P, A, E, T, 10, a[57]), E = d(E, O, P, A, y, 15, a[58]), A = d(A, E, O, P, k, 21, a[59]), P = d(P, A, E, O, g, 6, a[60]), O = d(O, P, A, E, S, 10, a[61]), E = d(E, O, P, A, p, 15, a[62]), A = d(A, E, O, P, v, 21, a[63]), i[0] = i[0] + P | 0, i[1] = i[1] + A | 0, i[2] = i[2] + E | 0, i[3] = i[3] + O | 0;
  15361. },
  15362. _doFinalize: function _doFinalize() {
  15363. var t = this._data,
  15364. n = t.words,
  15365. s = 8 * this._nDataBytes,
  15366. r = 8 * t.sigBytes;
  15367. n[r >>> 5] |= 128 << 24 - r % 32;
  15368. var i = e.floor(s / 4294967296),
  15369. o = s;
  15370. n[15 + (r + 64 >>> 9 << 4)] = 16711935 & (i << 8 | i >>> 24) | 4278255360 & (i << 24 | i >>> 8), n[14 + (r + 64 >>> 9 << 4)] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), t.sigBytes = 4 * (n.length + 1), this._process();
  15371. for (var a = this._hash, c = a.words, u = 0; u < 4; u++) {
  15372. var h = c[u];
  15373. c[u] = 16711935 & (h << 8 | h >>> 24) | 4278255360 & (h << 24 | h >>> 8);
  15374. }
  15375. return a;
  15376. },
  15377. clone: function clone() {
  15378. var e = i.clone.call(this);
  15379. return e._hash = this._hash.clone(), e;
  15380. }
  15381. });
  15382. function u(e, t, n, s, r, i, o) {
  15383. var a = e + (t & n | ~t & s) + r + o;
  15384. return (a << i | a >>> 32 - i) + t;
  15385. }
  15386. function h(e, t, n, s, r, i, o) {
  15387. var a = e + (t & s | n & ~s) + r + o;
  15388. return (a << i | a >>> 32 - i) + t;
  15389. }
  15390. function l(e, t, n, s, r, i, o) {
  15391. var a = e + (t ^ n ^ s) + r + o;
  15392. return (a << i | a >>> 32 - i) + t;
  15393. }
  15394. function d(e, t, n, s, r, i, o) {
  15395. var a = e + (n ^ (t | ~s)) + r + o;
  15396. return (a << i | a >>> 32 - i) + t;
  15397. }
  15398. t.MD5 = i._createHelper(c), t.HmacMD5 = i._createHmacHelper(c);
  15399. }(Math), n.MD5);
  15400. }), s(function (e, t) {
  15401. var n;
  15402. e.exports = (n = i, void function () {
  15403. var e = n,
  15404. t = e.lib.Base,
  15405. s = e.enc.Utf8;
  15406. e.algo.HMAC = t.extend({
  15407. init: function init(e, t) {
  15408. e = this._hasher = new e.init(), "string" == typeof t && (t = s.parse(t));
  15409. var n = e.blockSize,
  15410. r = 4 * n;
  15411. t.sigBytes > r && (t = e.finalize(t)), t.clamp();
  15412. for (var i = this._oKey = t.clone(), o = this._iKey = t.clone(), a = i.words, c = o.words, u = 0; u < n; u++) {
  15413. a[u] ^= 1549556828, c[u] ^= 909522486;
  15414. }
  15415. i.sigBytes = o.sigBytes = r, this.reset();
  15416. },
  15417. reset: function reset() {
  15418. var e = this._hasher;
  15419. e.reset(), e.update(this._iKey);
  15420. },
  15421. update: function update(e) {
  15422. return this._hasher.update(e), this;
  15423. },
  15424. finalize: function finalize(e) {
  15425. var t = this._hasher,
  15426. n = t.finalize(e);
  15427. return t.reset(), t.finalize(this._oKey.clone().concat(n));
  15428. }
  15429. });
  15430. }());
  15431. }), s(function (e, t) {
  15432. e.exports = i.HmacMD5;
  15433. })),
  15434. a = s(function (e, t) {
  15435. e.exports = i.enc.Utf8;
  15436. }),
  15437. c = s(function (e, t) {
  15438. var n;
  15439. e.exports = (n = i, function () {
  15440. var e = n,
  15441. t = e.lib.WordArray;
  15442. function s(e, n, s) {
  15443. for (var r = [], i = 0, o = 0; o < n; o++) {
  15444. if (o % 4) {
  15445. var a = s[e.charCodeAt(o - 1)] << o % 4 * 2,
  15446. c = s[e.charCodeAt(o)] >>> 6 - o % 4 * 2;
  15447. r[i >>> 2] |= (a | c) << 24 - i % 4 * 8, i++;
  15448. }
  15449. }
  15450. return t.create(r, i);
  15451. }
  15452. e.enc.Base64 = {
  15453. stringify: function stringify(e) {
  15454. var t = e.words,
  15455. n = e.sigBytes,
  15456. s = this._map;
  15457. e.clamp();
  15458. for (var r = [], i = 0; i < n; i += 3) {
  15459. for (var o = (t[i >>> 2] >>> 24 - i % 4 * 8 & 255) << 16 | (t[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 255) << 8 | t[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 255, a = 0; a < 4 && i + .75 * a < n; a++) {
  15460. r.push(s.charAt(o >>> 6 * (3 - a) & 63));
  15461. }
  15462. }
  15463. var c = s.charAt(64);
  15464. if (c) for (; r.length % 4;) {
  15465. r.push(c);
  15466. }
  15467. return r.join("");
  15468. },
  15469. parse: function parse(e) {
  15470. var t = e.length,
  15471. n = this._map,
  15472. r = this._reverseMap;
  15473. if (!r) {
  15474. r = this._reverseMap = [];
  15475. for (var i = 0; i < n.length; i++) {
  15476. r[n.charCodeAt(i)] = i;
  15477. }
  15478. }
  15479. var o = n.charAt(64);
  15480. if (o) {
  15481. var a = e.indexOf(o);
  15482. -1 !== a && (t = a);
  15483. }
  15484. return s(e, t, r);
  15485. },
  15486. _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
  15487. };
  15488. }(), n.enc.Base64);
  15489. });
  15490. var u = "FUNCTION",
  15491. h = "OBJECT",
  15492. l = "CLIENT_DB",
  15493. d = "pending",
  15494. p = "fullfilled",
  15495. f = "rejected";
  15496. function g(e) {
  15497. return Object.prototype.toString.call(e).slice(8, -1).toLowerCase();
  15498. }
  15499. function m(e) {
  15500. return "object" === g(e);
  15501. }
  15502. function y(e) {
  15503. return "function" == typeof e;
  15504. }
  15505. function _(e) {
  15506. return function () {
  15507. try {
  15508. return e.apply(e, arguments);
  15509. } catch (e) {
  15510. console.error(e);
  15511. }
  15512. };
  15513. }
  15514. var w = "REJECTED",
  15515. v = "NOT_PENDING";
  15516. var I = /*#__PURE__*/function () {
  15517. function I() {
  15518. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  15519. e = _ref.createPromise,
  15520. _ref$retryRule = _ref.retryRule,
  15521. t = _ref$retryRule === void 0 ? w : _ref$retryRule;
  15522. (0, _classCallCheck2.default)(this, I);
  15523. this.createPromise = e, this.status = null, this.promise = null, this.retryRule = t;
  15524. }
  15525. (0, _createClass2.default)(I, [{
  15526. key: "needRetry",
  15527. get: function get() {
  15528. if (!this.status) return !0;
  15529. switch (this.retryRule) {
  15530. case w:
  15531. return this.status === f;
  15532. case v:
  15533. return this.status !== d;
  15534. }
  15535. }
  15536. }, {
  15537. key: "exec",
  15538. value: function exec() {
  15539. var _this = this;
  15540. return this.needRetry ? (this.status = d, this.promise = this.createPromise().then(function (e) {
  15541. return _this.status = p, Promise.resolve(e);
  15542. }, function (e) {
  15543. return _this.status = f, Promise.reject(e);
  15544. }), this.promise) : this.promise;
  15545. }
  15546. }]);
  15547. return I;
  15548. }();
  15549. function S(e) {
  15550. return e && "string" == typeof e ? JSON.parse(e) : e;
  15551. }
  15552. var b = "development" === "development",
  15553. k = "mp-weixin",
  15554. C = "true" === undefined || !0 === undefined,
  15555. T = S([]),
  15556. P = "h5" === k ? "web" : "app-plus" === k ? "app" : k,
  15557. A = S(undefined),
  15558. E = S([]) || [],
  15559. O = true;
  15560. var x = "";
  15561. try {
  15562. x = (__webpack_require__(/*! uni-stat-config */ 681).default || __webpack_require__(/*! uni-stat-config */ 681)).appid;
  15563. } catch (e) {}
  15564. var R = {};
  15565. function U(e) {
  15566. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  15567. var n, s;
  15568. return n = R, s = e, Object.prototype.hasOwnProperty.call(n, s) || (R[e] = t), R[e];
  15569. }
  15570. "app" === P && (R = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {});
  15571. var L = ["invoke", "success", "fail", "complete"],
  15572. N = U("_globalUniCloudInterceptor");
  15573. function D(e, t) {
  15574. N[e] || (N[e] = {}), m(t) && Object.keys(t).forEach(function (n) {
  15575. L.indexOf(n) > -1 && function (e, t, n) {
  15576. var s = N[e][t];
  15577. s || (s = N[e][t] = []), -1 === s.indexOf(n) && y(n) && s.push(n);
  15578. }(e, n, t[n]);
  15579. });
  15580. }
  15581. function F(e, t) {
  15582. N[e] || (N[e] = {}), m(t) ? Object.keys(t).forEach(function (n) {
  15583. L.indexOf(n) > -1 && function (e, t, n) {
  15584. var s = N[e][t];
  15585. if (!s) return;
  15586. var r = s.indexOf(n);
  15587. r > -1 && s.splice(r, 1);
  15588. }(e, n, t[n]);
  15589. }) : delete N[e];
  15590. }
  15591. function q(e, t) {
  15592. return e && 0 !== e.length ? e.reduce(function (e, n) {
  15593. return e.then(function () {
  15594. return n(t);
  15595. });
  15596. }, Promise.resolve()) : Promise.resolve();
  15597. }
  15598. function M(e, t) {
  15599. return N[e] && N[e][t] || [];
  15600. }
  15601. function K(e) {
  15602. D("callObject", e);
  15603. }
  15604. var j = U("_globalUniCloudListener"),
  15605. B = "response",
  15606. $ = "needLogin",
  15607. W = "refreshToken",
  15608. z = "clientdb",
  15609. J = "cloudfunction",
  15610. H = "cloudobject";
  15611. function G(e) {
  15612. return j[e] || (j[e] = []), j[e];
  15613. }
  15614. function V(e, t) {
  15615. var n = G(e);
  15616. n.includes(t) || n.push(t);
  15617. }
  15618. function Y(e, t) {
  15619. var n = G(e),
  15620. s = n.indexOf(t);
  15621. -1 !== s && n.splice(s, 1);
  15622. }
  15623. function Q(e, t) {
  15624. var n = G(e);
  15625. for (var _e2 = 0; _e2 < n.length; _e2++) {
  15626. (0, n[_e2])(t);
  15627. }
  15628. }
  15629. var X,
  15630. Z = !1;
  15631. function ee() {
  15632. return X || (X = new Promise(function (e) {
  15633. Z && e(), function t() {
  15634. if ("function" == typeof getCurrentPages) {
  15635. var _t2 = getCurrentPages();
  15636. _t2 && _t2[0] && (Z = !0, e());
  15637. }
  15638. Z || setTimeout(function () {
  15639. t();
  15640. }, 30);
  15641. }();
  15642. }), X);
  15643. }
  15644. function te(e) {
  15645. var t = {};
  15646. for (var _n2 in e) {
  15647. var _s2 = e[_n2];
  15648. y(_s2) && (t[_n2] = _(_s2));
  15649. }
  15650. return t;
  15651. }
  15652. var ne = /*#__PURE__*/function (_Error) {
  15653. (0, _inherits2.default)(ne, _Error);
  15654. var _super = _createSuper(ne);
  15655. function ne(e) {
  15656. var _this2;
  15657. (0, _classCallCheck2.default)(this, ne);
  15658. _this2 = _super.call(this, e.message), _this2.errMsg = e.message || e.errMsg || "unknown system error", _this2.code = _this2.errCode = e.code || e.errCode || "SYSTEM_ERROR", _this2.errSubject = _this2.subject = e.subject || e.errSubject, _this2.cause = e.cause, _this2.requestId = e.requestId;
  15659. return _this2;
  15660. }
  15661. (0, _createClass2.default)(ne, [{
  15662. key: "toJson",
  15663. value: function toJson() {
  15664. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  15665. if (!(e >= 10)) return e++, {
  15666. errCode: this.errCode,
  15667. errMsg: this.errMsg,
  15668. errSubject: this.errSubject,
  15669. cause: this.cause && this.cause.toJson ? this.cause.toJson(e) : this.cause
  15670. };
  15671. }
  15672. }]);
  15673. return ne;
  15674. }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
  15675. var se = {
  15676. request: function request(e) {
  15677. return uni.request(e);
  15678. },
  15679. uploadFile: function uploadFile(e) {
  15680. return uni.uploadFile(e);
  15681. },
  15682. setStorageSync: function setStorageSync(e, t) {
  15683. return uni.setStorageSync(e, t);
  15684. },
  15685. getStorageSync: function getStorageSync(e) {
  15686. return uni.getStorageSync(e);
  15687. },
  15688. removeStorageSync: function removeStorageSync(e) {
  15689. return uni.removeStorageSync(e);
  15690. },
  15691. clearStorageSync: function clearStorageSync() {
  15692. return uni.clearStorageSync();
  15693. }
  15694. };
  15695. function re() {
  15696. return {
  15697. token: se.getStorageSync("uni_id_token") || se.getStorageSync("uniIdToken"),
  15698. tokenExpired: se.getStorageSync("uni_id_token_expired")
  15699. };
  15700. }
  15701. function ie() {
  15702. var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  15703. e = _ref2.token,
  15704. t = _ref2.tokenExpired;
  15705. e && se.setStorageSync("uni_id_token", e), t && se.setStorageSync("uni_id_token_expired", t);
  15706. }
  15707. var oe, ae;
  15708. function ce() {
  15709. return oe || (oe = uni.getSystemInfoSync()), oe;
  15710. }
  15711. function ue() {
  15712. var e, t;
  15713. try {
  15714. if (uni.getLaunchOptionsSync) {
  15715. if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1) return;
  15716. var _uni$getLaunchOptions = uni.getLaunchOptionsSync(),
  15717. _n3 = _uni$getLaunchOptions.scene,
  15718. _s3 = _uni$getLaunchOptions.channel;
  15719. e = _s3, t = _n3;
  15720. }
  15721. } catch (e) {}
  15722. return {
  15723. channel: e,
  15724. scene: t
  15725. };
  15726. }
  15727. function he() {
  15728. var e = uni.getLocale && uni.getLocale() || "en";
  15729. if (ae) return _objectSpread(_objectSpread({}, ae), {}, {
  15730. locale: e,
  15731. LOCALE: e
  15732. });
  15733. var t = ce(),
  15734. n = t.deviceId,
  15735. s = t.osName,
  15736. r = t.uniPlatform,
  15737. i = t.appId,
  15738. o = ["pixelRatio", "brand", "model", "system", "language", "version", "platform", "host", "SDKVersion", "swanNativeVersion", "app", "AppPlatform", "fontSizeSetting"];
  15739. for (var _e3 = 0; _e3 < o.length; _e3++) {
  15740. delete t[o[_e3]];
  15741. }
  15742. return ae = _objectSpread(_objectSpread({
  15743. PLATFORM: r,
  15744. OS: s,
  15745. APPID: i,
  15746. DEVICEID: n
  15747. }, ue()), t), _objectSpread(_objectSpread({}, ae), {}, {
  15748. locale: e,
  15749. LOCALE: e
  15750. });
  15751. }
  15752. var le = {
  15753. sign: function sign(e, t) {
  15754. var n = "";
  15755. return Object.keys(e).sort().forEach(function (t) {
  15756. e[t] && (n = n + "&" + t + "=" + e[t]);
  15757. }), n = n.slice(1), o(n, t).toString();
  15758. },
  15759. wrappedRequest: function wrappedRequest(e, t) {
  15760. return new Promise(function (n, s) {
  15761. t(Object.assign(e, {
  15762. complete: function complete(e) {
  15763. e || (e = {}), b && "web" === P && e.errMsg && 0 === e.errMsg.indexOf("request:fail") && console.warn("发布H5,需要在uniCloud后台操作,绑定安全域名,否则会因为跨域问题而无法访问。教程参考:https://uniapp.dcloud.io/uniCloud/quickstart?id=useinh5");
  15764. var t = e.data && e.data.header && e.data.header["x-serverless-request-id"] || e.header && e.header["request-id"];
  15765. if (!e.statusCode || e.statusCode >= 400) return s(new ne({
  15766. code: "SYS_ERR",
  15767. message: e.errMsg || "request:fail",
  15768. requestId: t
  15769. }));
  15770. var r = e.data;
  15771. if (r.error) return s(new ne({
  15772. code: r.error.code,
  15773. message: r.error.message,
  15774. requestId: t
  15775. }));
  15776. r.result = r.data, r.requestId = t, delete r.data, n(r);
  15777. }
  15778. }));
  15779. });
  15780. },
  15781. toBase64: function toBase64(e) {
  15782. return c.stringify(a.parse(e));
  15783. }
  15784. },
  15785. de = {
  15786. "uniCloud.init.paramRequired": "{param} required",
  15787. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  15788. };
  15789. var _e4 = (0, _uniI18n.initVueI18n)({
  15790. "zh-Hans": {
  15791. "uniCloud.init.paramRequired": "缺少参数:{param}",
  15792. "uniCloud.uploadFile.fileError": "filePath应为File对象"
  15793. },
  15794. "zh-Hant": {
  15795. "uniCloud.init.paramRequired": "缺少参数:{param}",
  15796. "uniCloud.uploadFile.fileError": "filePath应为File对象"
  15797. },
  15798. en: de,
  15799. fr: {
  15800. "uniCloud.init.paramRequired": "{param} required",
  15801. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  15802. },
  15803. es: {
  15804. "uniCloud.init.paramRequired": "{param} required",
  15805. "uniCloud.uploadFile.fileError": "filePath should be instance of File"
  15806. },
  15807. ja: de
  15808. }, "zh-Hans"),
  15809. pe = _e4.t;
  15810. var fe = /*#__PURE__*/function () {
  15811. function fe(e) {
  15812. var _this3 = this;
  15813. (0, _classCallCheck2.default)(this, fe);
  15814. ["spaceId", "clientSecret"].forEach(function (t) {
  15815. if (!Object.prototype.hasOwnProperty.call(e, t)) throw new Error(pe("uniCloud.init.paramRequired", {
  15816. param: t
  15817. }));
  15818. }), this.config = Object.assign({}, {
  15819. endpoint: 0 === e.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com"
  15820. }, e), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = se, this._getAccessTokenPromiseHub = new I({
  15821. createPromise: function createPromise() {
  15822. return _this3.requestAuth(_this3.setupRequest({
  15823. method: "serverless.auth.user.anonymousAuthorize",
  15824. params: "{}"
  15825. }, "auth")).then(function (e) {
  15826. if (!e.result || !e.result.accessToken) throw new ne({
  15827. code: "AUTH_FAILED",
  15828. message: "获取accessToken失败"
  15829. });
  15830. _this3.setAccessToken(e.result.accessToken);
  15831. });
  15832. },
  15833. retryRule: v
  15834. });
  15835. }
  15836. (0, _createClass2.default)(fe, [{
  15837. key: "hasAccessToken",
  15838. get: function get() {
  15839. return !!this.accessToken;
  15840. }
  15841. }, {
  15842. key: "setAccessToken",
  15843. value: function setAccessToken(e) {
  15844. this.accessToken = e;
  15845. }
  15846. }, {
  15847. key: "requestWrapped",
  15848. value: function requestWrapped(e) {
  15849. return le.wrappedRequest(e, this.adapter.request);
  15850. }
  15851. }, {
  15852. key: "requestAuth",
  15853. value: function requestAuth(e) {
  15854. return this.requestWrapped(e);
  15855. }
  15856. }, {
  15857. key: "request",
  15858. value: function request(e, t) {
  15859. var _this4 = this;
  15860. return Promise.resolve().then(function () {
  15861. return _this4.hasAccessToken ? t ? _this4.requestWrapped(e) : _this4.requestWrapped(e).catch(function (t) {
  15862. return new Promise(function (e, n) {
  15863. !t || "GATEWAY_INVALID_TOKEN" !== t.code && "InvalidParameter.InvalidToken" !== t.code ? n(t) : e();
  15864. }).then(function () {
  15865. return _this4.getAccessToken();
  15866. }).then(function () {
  15867. var t = _this4.rebuildRequest(e);
  15868. return _this4.request(t, !0);
  15869. });
  15870. }) : _this4.getAccessToken().then(function () {
  15871. var t = _this4.rebuildRequest(e);
  15872. return _this4.request(t, !0);
  15873. });
  15874. });
  15875. }
  15876. }, {
  15877. key: "rebuildRequest",
  15878. value: function rebuildRequest(e) {
  15879. var t = Object.assign({}, e);
  15880. return t.data.token = this.accessToken, t.header["x-basement-token"] = this.accessToken, t.header["x-serverless-sign"] = le.sign(t.data, this.config.clientSecret), t;
  15881. }
  15882. }, {
  15883. key: "setupRequest",
  15884. value: function setupRequest(e, t) {
  15885. var n = Object.assign({}, e, {
  15886. spaceId: this.config.spaceId,
  15887. timestamp: Date.now()
  15888. }),
  15889. s = {
  15890. "Content-Type": "application/json"
  15891. };
  15892. return "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret), {
  15893. url: this.config.requestUrl,
  15894. method: "POST",
  15895. data: n,
  15896. dataType: "json",
  15897. header: s
  15898. };
  15899. }
  15900. }, {
  15901. key: "getAccessToken",
  15902. value: function getAccessToken() {
  15903. return this._getAccessTokenPromiseHub.exec();
  15904. }
  15905. }, {
  15906. key: "authorize",
  15907. value: function () {
  15908. var _authorize = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  15909. return _regenerator.default.wrap(function _callee$(_context) {
  15910. while (1) {
  15911. switch (_context.prev = _context.next) {
  15912. case 0:
  15913. _context.next = 2;
  15914. return this.getAccessToken();
  15915. case 2:
  15916. case "end":
  15917. return _context.stop();
  15918. }
  15919. }
  15920. }, _callee, this);
  15921. }));
  15922. function authorize() {
  15923. return _authorize.apply(this, arguments);
  15924. }
  15925. return authorize;
  15926. }()
  15927. }, {
  15928. key: "callFunction",
  15929. value: function callFunction(e) {
  15930. var t = {
  15931. method: "serverless.function.runtime.invoke",
  15932. params: JSON.stringify({
  15933. functionTarget: e.name,
  15934. functionArgs: e.data || {}
  15935. })
  15936. };
  15937. return this.request(this.setupRequest(t));
  15938. }
  15939. }, {
  15940. key: "getOSSUploadOptionsFromPath",
  15941. value: function getOSSUploadOptionsFromPath(e) {
  15942. var t = {
  15943. method: "serverless.file.resource.generateProximalSign",
  15944. params: JSON.stringify(e)
  15945. };
  15946. return this.request(this.setupRequest(t));
  15947. }
  15948. }, {
  15949. key: "uploadFileToOSS",
  15950. value: function uploadFileToOSS(_ref3) {
  15951. var _this5 = this;
  15952. var e = _ref3.url,
  15953. t = _ref3.formData,
  15954. n = _ref3.name,
  15955. s = _ref3.filePath,
  15956. r = _ref3.fileType,
  15957. i = _ref3.onUploadProgress;
  15958. return new Promise(function (o, a) {
  15959. var c = _this5.adapter.uploadFile({
  15960. url: e,
  15961. formData: t,
  15962. name: n,
  15963. filePath: s,
  15964. fileType: r,
  15965. header: {
  15966. "X-OSS-server-side-encrpytion": "AES256"
  15967. },
  15968. success: function success(e) {
  15969. e && e.statusCode < 400 ? o(e) : a(new ne({
  15970. code: "UPLOAD_FAILED",
  15971. message: "文件上传失败"
  15972. }));
  15973. },
  15974. fail: function fail(e) {
  15975. a(new ne({
  15976. code: e.code || "UPLOAD_FAILED",
  15977. message: e.message || e.errMsg || "文件上传失败"
  15978. }));
  15979. }
  15980. });
  15981. "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  15982. i({
  15983. loaded: e.totalBytesSent,
  15984. total: e.totalBytesExpectedToSend
  15985. });
  15986. });
  15987. });
  15988. }
  15989. }, {
  15990. key: "reportOSSUpload",
  15991. value: function reportOSSUpload(e) {
  15992. var t = {
  15993. method: "serverless.file.resource.report",
  15994. params: JSON.stringify(e)
  15995. };
  15996. return this.request(this.setupRequest(t));
  15997. }
  15998. }, {
  15999. key: "uploadFile",
  16000. value: function () {
  16001. var _uploadFile = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref4) {
  16002. var e, t, _ref4$fileType, n, _ref4$cloudPathAsReal, s, r, i, o, a, c, u, h, l, d, p, f, m, y, _, _e5, w;
  16003. return _regenerator.default.wrap(function _callee2$(_context2) {
  16004. while (1) {
  16005. switch (_context2.prev = _context2.next) {
  16006. case 0:
  16007. e = _ref4.filePath, t = _ref4.cloudPath, _ref4$fileType = _ref4.fileType, n = _ref4$fileType === void 0 ? "image" : _ref4$fileType, _ref4$cloudPathAsReal = _ref4.cloudPathAsRealPath, s = _ref4$cloudPathAsReal === void 0 ? !1 : _ref4$cloudPathAsReal, r = _ref4.onUploadProgress, i = _ref4.config;
  16008. if (!("string" !== g(t))) {
  16009. _context2.next = 3;
  16010. break;
  16011. }
  16012. throw new ne({
  16013. code: "INVALID_PARAM",
  16014. message: "cloudPath必须为字符串类型"
  16015. });
  16016. case 3:
  16017. if (t = t.trim()) {
  16018. _context2.next = 5;
  16019. break;
  16020. }
  16021. throw new ne({
  16022. code: "INVALID_PARAM",
  16023. message: "cloudPath不可为空"
  16024. });
  16025. case 5:
  16026. if (!/:\/\//.test(t)) {
  16027. _context2.next = 7;
  16028. break;
  16029. }
  16030. throw new ne({
  16031. code: "INVALID_PARAM",
  16032. message: "cloudPath不合法"
  16033. });
  16034. case 7:
  16035. o = i && i.envType || this.config.envType;
  16036. if (!(s && ("/" !== t[0] && (t = "/" + t), t.indexOf("\\") > -1))) {
  16037. _context2.next = 10;
  16038. break;
  16039. }
  16040. throw new ne({
  16041. code: "INVALID_PARAM",
  16042. message: "使用cloudPath作为路径时,cloudPath不可包含“\\”"
  16043. });
  16044. case 10:
  16045. _context2.next = 12;
  16046. return this.getOSSUploadOptionsFromPath({
  16047. env: o,
  16048. filename: s ? t.split("/").pop() : t,
  16049. fileId: s ? t : void 0
  16050. });
  16051. case 12:
  16052. a = _context2.sent.result;
  16053. c = "https://" + a.cdnDomain + "/" + a.ossPath;
  16054. u = a.securityToken;
  16055. h = a.accessKeyId;
  16056. l = a.signature;
  16057. d = a.host;
  16058. p = a.ossPath;
  16059. f = a.id;
  16060. m = a.policy;
  16061. y = a.ossCallbackUrl;
  16062. _ = {
  16063. "Cache-Control": "max-age=2592000",
  16064. "Content-Disposition": "attachment",
  16065. OSSAccessKeyId: h,
  16066. Signature: l,
  16067. host: d,
  16068. id: f,
  16069. key: p,
  16070. policy: m,
  16071. success_action_status: 200
  16072. };
  16073. if (u && (_["x-oss-security-token"] = u), y) {
  16074. _e5 = JSON.stringify({
  16075. callbackUrl: y,
  16076. callbackBody: JSON.stringify({
  16077. fileId: f,
  16078. spaceId: this.config.spaceId
  16079. }),
  16080. callbackBodyType: "application/json"
  16081. });
  16082. _.callback = le.toBase64(_e5);
  16083. }
  16084. w = {
  16085. url: "https://" + a.host,
  16086. formData: _,
  16087. fileName: "file",
  16088. name: "file",
  16089. filePath: e,
  16090. fileType: n
  16091. };
  16092. _context2.next = 27;
  16093. return this.uploadFileToOSS(Object.assign({}, w, {
  16094. onUploadProgress: r
  16095. }));
  16096. case 27:
  16097. if (!y) {
  16098. _context2.next = 29;
  16099. break;
  16100. }
  16101. return _context2.abrupt("return", {
  16102. success: !0,
  16103. filePath: e,
  16104. fileID: c
  16105. });
  16106. case 29:
  16107. _context2.next = 31;
  16108. return this.reportOSSUpload({
  16109. id: f
  16110. });
  16111. case 31:
  16112. if (!_context2.sent.success) {
  16113. _context2.next = 33;
  16114. break;
  16115. }
  16116. return _context2.abrupt("return", {
  16117. success: !0,
  16118. filePath: e,
  16119. fileID: c
  16120. });
  16121. case 33:
  16122. throw new ne({
  16123. code: "UPLOAD_FAILED",
  16124. message: "文件上传失败"
  16125. });
  16126. case 34:
  16127. case "end":
  16128. return _context2.stop();
  16129. }
  16130. }
  16131. }, _callee2, this);
  16132. }));
  16133. function uploadFile(_x) {
  16134. return _uploadFile.apply(this, arguments);
  16135. }
  16136. return uploadFile;
  16137. }()
  16138. }, {
  16139. key: "getTempFileURL",
  16140. value: function getTempFileURL() {
  16141. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  16142. e = _ref5.fileList;
  16143. return new Promise(function (t, n) {
  16144. Array.isArray(e) && 0 !== e.length || n(new ne({
  16145. code: "INVALID_PARAM",
  16146. message: "fileList的元素必须是非空的字符串"
  16147. })), t({
  16148. fileList: e.map(function (e) {
  16149. return {
  16150. fileID: e,
  16151. tempFileURL: e
  16152. };
  16153. })
  16154. });
  16155. });
  16156. }
  16157. }, {
  16158. key: "getFileInfo",
  16159. value: function () {
  16160. var _getFileInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
  16161. var _ref6,
  16162. e,
  16163. t,
  16164. _args3 = arguments;
  16165. return _regenerator.default.wrap(function _callee3$(_context3) {
  16166. while (1) {
  16167. switch (_context3.prev = _context3.next) {
  16168. case 0:
  16169. _ref6 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, e = _ref6.fileList;
  16170. if (!(!Array.isArray(e) || 0 === e.length)) {
  16171. _context3.next = 3;
  16172. break;
  16173. }
  16174. throw new ne({
  16175. code: "INVALID_PARAM",
  16176. message: "fileList的元素必须是非空的字符串"
  16177. });
  16178. case 3:
  16179. t = {
  16180. method: "serverless.file.resource.info",
  16181. params: JSON.stringify({
  16182. id: e.map(function (e) {
  16183. return e.split("?")[0];
  16184. }).join(",")
  16185. })
  16186. };
  16187. _context3.next = 6;
  16188. return this.request(this.setupRequest(t));
  16189. case 6:
  16190. _context3.t0 = _context3.sent.result;
  16191. return _context3.abrupt("return", {
  16192. fileList: _context3.t0
  16193. });
  16194. case 8:
  16195. case "end":
  16196. return _context3.stop();
  16197. }
  16198. }
  16199. }, _callee3, this);
  16200. }));
  16201. function getFileInfo() {
  16202. return _getFileInfo.apply(this, arguments);
  16203. }
  16204. return getFileInfo;
  16205. }()
  16206. }]);
  16207. return fe;
  16208. }();
  16209. var ge = {
  16210. init: function init(e) {
  16211. var t = new fe(e),
  16212. n = {
  16213. signInAnonymously: function signInAnonymously() {
  16214. return t.authorize();
  16215. },
  16216. getLoginState: function getLoginState() {
  16217. return Promise.resolve(!1);
  16218. }
  16219. };
  16220. return t.auth = function () {
  16221. return n;
  16222. }, t.customAuth = t.auth, t;
  16223. }
  16224. };
  16225. var me = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
  16226. var ye;
  16227. !function (e) {
  16228. e.local = "local", e.none = "none", e.session = "session";
  16229. }(ye || (ye = {}));
  16230. var _e = function _e() {};
  16231. var we = function we() {
  16232. var e;
  16233. if (!Promise) {
  16234. e = function e() {}, e.promise = {};
  16235. var _t3 = function _t3() {
  16236. throw new ne({
  16237. message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.'
  16238. });
  16239. };
  16240. return Object.defineProperty(e.promise, "then", {
  16241. get: _t3
  16242. }), Object.defineProperty(e.promise, "catch", {
  16243. get: _t3
  16244. }), e;
  16245. }
  16246. var t = new Promise(function (t, n) {
  16247. e = function e(_e6, s) {
  16248. return _e6 ? n(_e6) : t(s);
  16249. };
  16250. });
  16251. return e.promise = t, e;
  16252. };
  16253. function ve(e) {
  16254. return void 0 === e;
  16255. }
  16256. function Ie(e) {
  16257. return "[object Null]" === Object.prototype.toString.call(e);
  16258. }
  16259. var Se;
  16260. function be(e) {
  16261. var t = (n = e, "[object Array]" === Object.prototype.toString.call(n) ? e : [e]);
  16262. var n;
  16263. var _iterator = _createForOfIteratorHelper(t),
  16264. _step;
  16265. try {
  16266. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  16267. var _e7 = _step.value;
  16268. var _t4 = _e7.isMatch,
  16269. _n4 = _e7.genAdapter,
  16270. _s4 = _e7.runtime;
  16271. if (_t4()) return {
  16272. adapter: _n4(),
  16273. runtime: _s4
  16274. };
  16275. }
  16276. } catch (err) {
  16277. _iterator.e(err);
  16278. } finally {
  16279. _iterator.f();
  16280. }
  16281. }
  16282. !function (e) {
  16283. e.WEB = "web", e.WX_MP = "wx_mp";
  16284. }(Se || (Se = {}));
  16285. var ke = {
  16286. adapter: null,
  16287. runtime: void 0
  16288. },
  16289. Ce = ["anonymousUuidKey"];
  16290. var Te = /*#__PURE__*/function (_e8) {
  16291. (0, _inherits2.default)(Te, _e8);
  16292. var _super2 = _createSuper(Te);
  16293. function Te() {
  16294. var _this6;
  16295. (0, _classCallCheck2.default)(this, Te);
  16296. _this6 = _super2.call(this), ke.adapter.root.tcbObject || (ke.adapter.root.tcbObject = {});
  16297. return _this6;
  16298. }
  16299. (0, _createClass2.default)(Te, [{
  16300. key: "setItem",
  16301. value: function setItem(e, t) {
  16302. ke.adapter.root.tcbObject[e] = t;
  16303. }
  16304. }, {
  16305. key: "getItem",
  16306. value: function getItem(e) {
  16307. return ke.adapter.root.tcbObject[e];
  16308. }
  16309. }, {
  16310. key: "removeItem",
  16311. value: function removeItem(e) {
  16312. delete ke.adapter.root.tcbObject[e];
  16313. }
  16314. }, {
  16315. key: "clear",
  16316. value: function clear() {
  16317. delete ke.adapter.root.tcbObject;
  16318. }
  16319. }]);
  16320. return Te;
  16321. }(_e);
  16322. function Pe(e, t) {
  16323. switch (e) {
  16324. case "local":
  16325. return t.localStorage || new Te();
  16326. case "none":
  16327. return new Te();
  16328. default:
  16329. return t.sessionStorage || new Te();
  16330. }
  16331. }
  16332. var Ae = /*#__PURE__*/function () {
  16333. function Ae(e) {
  16334. (0, _classCallCheck2.default)(this, Ae);
  16335. if (!this._storage) {
  16336. this._persistence = ke.adapter.primaryStorage || e.persistence, this._storage = Pe(this._persistence, ke.adapter);
  16337. var _t5 = "access_token_".concat(e.env),
  16338. _n5 = "access_token_expire_".concat(e.env),
  16339. _s5 = "refresh_token_".concat(e.env),
  16340. _r = "anonymous_uuid_".concat(e.env),
  16341. _i = "login_type_".concat(e.env),
  16342. _o = "user_info_".concat(e.env);
  16343. this.keys = {
  16344. accessTokenKey: _t5,
  16345. accessTokenExpireKey: _n5,
  16346. refreshTokenKey: _s5,
  16347. anonymousUuidKey: _r,
  16348. loginTypeKey: _i,
  16349. userInfoKey: _o
  16350. };
  16351. }
  16352. }
  16353. (0, _createClass2.default)(Ae, [{
  16354. key: "updatePersistence",
  16355. value: function updatePersistence(e) {
  16356. if (e === this._persistence) return;
  16357. var t = "local" === this._persistence;
  16358. this._persistence = e;
  16359. var n = Pe(e, ke.adapter);
  16360. for (var _e9 in this.keys) {
  16361. var _s6 = this.keys[_e9];
  16362. if (t && Ce.includes(_e9)) continue;
  16363. var _r2 = this._storage.getItem(_s6);
  16364. ve(_r2) || Ie(_r2) || (n.setItem(_s6, _r2), this._storage.removeItem(_s6));
  16365. }
  16366. this._storage = n;
  16367. }
  16368. }, {
  16369. key: "setStore",
  16370. value: function setStore(e, t, n) {
  16371. if (!this._storage) return;
  16372. var s = {
  16373. version: n || "localCachev1",
  16374. content: t
  16375. },
  16376. r = JSON.stringify(s);
  16377. try {
  16378. this._storage.setItem(e, r);
  16379. } catch (e) {
  16380. throw e;
  16381. }
  16382. }
  16383. }, {
  16384. key: "getStore",
  16385. value: function getStore(e, t) {
  16386. try {
  16387. if (!this._storage) return;
  16388. } catch (e) {
  16389. return "";
  16390. }
  16391. t = t || "localCachev1";
  16392. var n = this._storage.getItem(e);
  16393. if (!n) return "";
  16394. if (n.indexOf(t) >= 0) {
  16395. return JSON.parse(n).content;
  16396. }
  16397. return "";
  16398. }
  16399. }, {
  16400. key: "removeStore",
  16401. value: function removeStore(e) {
  16402. this._storage.removeItem(e);
  16403. }
  16404. }]);
  16405. return Ae;
  16406. }();
  16407. var Ee = {},
  16408. Oe = {};
  16409. function xe(e) {
  16410. return Ee[e];
  16411. }
  16412. var Re = /*#__PURE__*/(0, _createClass2.default)(function Re(e, t) {
  16413. (0, _classCallCheck2.default)(this, Re);
  16414. this.data = t || null, this.name = e;
  16415. });
  16416. var Ue = /*#__PURE__*/function (_Re) {
  16417. (0, _inherits2.default)(Ue, _Re);
  16418. var _super3 = _createSuper(Ue);
  16419. function Ue(e, t) {
  16420. var _this7;
  16421. (0, _classCallCheck2.default)(this, Ue);
  16422. _this7 = _super3.call(this, "error", {
  16423. error: e,
  16424. data: t
  16425. }), _this7.error = e;
  16426. return _this7;
  16427. }
  16428. return (0, _createClass2.default)(Ue);
  16429. }(Re);
  16430. var Le = new ( /*#__PURE__*/function () {
  16431. function _class() {
  16432. (0, _classCallCheck2.default)(this, _class);
  16433. this._listeners = {};
  16434. }
  16435. (0, _createClass2.default)(_class, [{
  16436. key: "on",
  16437. value: function on(e, t) {
  16438. return function (e, t, n) {
  16439. n[e] = n[e] || [], n[e].push(t);
  16440. }(e, t, this._listeners), this;
  16441. }
  16442. }, {
  16443. key: "off",
  16444. value: function off(e, t) {
  16445. return function (e, t, n) {
  16446. if (n && n[e]) {
  16447. var _s7 = n[e].indexOf(t);
  16448. -1 !== _s7 && n[e].splice(_s7, 1);
  16449. }
  16450. }(e, t, this._listeners), this;
  16451. }
  16452. }, {
  16453. key: "fire",
  16454. value: function fire(e, t) {
  16455. if (e instanceof Ue) return console.error(e.error), this;
  16456. var n = "string" == typeof e ? new Re(e, t || {}) : e;
  16457. var s = n.name;
  16458. if (this._listens(s)) {
  16459. n.target = this;
  16460. var _e10 = this._listeners[s] ? (0, _toConsumableArray2.default)(this._listeners[s]) : [];
  16461. var _iterator2 = _createForOfIteratorHelper(_e10),
  16462. _step2;
  16463. try {
  16464. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  16465. var _t6 = _step2.value;
  16466. _t6.call(this, n);
  16467. }
  16468. } catch (err) {
  16469. _iterator2.e(err);
  16470. } finally {
  16471. _iterator2.f();
  16472. }
  16473. }
  16474. return this;
  16475. }
  16476. }, {
  16477. key: "_listens",
  16478. value: function _listens(e) {
  16479. return this._listeners[e] && this._listeners[e].length > 0;
  16480. }
  16481. }]);
  16482. return _class;
  16483. }())();
  16484. function Ne(e, t) {
  16485. Le.on(e, t);
  16486. }
  16487. function De(e) {
  16488. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  16489. Le.fire(e, t);
  16490. }
  16491. function Fe(e, t) {
  16492. Le.off(e, t);
  16493. }
  16494. var qe = "loginStateChanged",
  16495. Me = "loginStateExpire",
  16496. Ke = "loginTypeChanged",
  16497. je = "anonymousConverted",
  16498. Be = "refreshAccessToken";
  16499. var $e;
  16500. !function (e) {
  16501. e.ANONYMOUS = "ANONYMOUS", e.WECHAT = "WECHAT", e.WECHAT_PUBLIC = "WECHAT-PUBLIC", e.WECHAT_OPEN = "WECHAT-OPEN", e.CUSTOM = "CUSTOM", e.EMAIL = "EMAIL", e.USERNAME = "USERNAME", e.NULL = "NULL";
  16502. }($e || ($e = {}));
  16503. var We = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"],
  16504. ze = {
  16505. "X-SDK-Version": "1.3.5"
  16506. };
  16507. function Je(e, t, n) {
  16508. var s = e[t];
  16509. e[t] = function (t) {
  16510. var r = {},
  16511. i = {};
  16512. n.forEach(function (n) {
  16513. var _n$call = n.call(e, t),
  16514. s = _n$call.data,
  16515. o = _n$call.headers;
  16516. Object.assign(r, s), Object.assign(i, o);
  16517. });
  16518. var o = t.data;
  16519. return o && function () {
  16520. var e;
  16521. if (e = o, "[object FormData]" !== Object.prototype.toString.call(e)) t.data = _objectSpread(_objectSpread({}, o), r);else for (var _e11 in r) {
  16522. o.append(_e11, r[_e11]);
  16523. }
  16524. }(), t.headers = _objectSpread(_objectSpread({}, t.headers || {}), i), s.call(e, t);
  16525. };
  16526. }
  16527. function He() {
  16528. var e = Math.random().toString(16).slice(2);
  16529. return {
  16530. data: {
  16531. seqId: e
  16532. },
  16533. headers: _objectSpread(_objectSpread({}, ze), {}, {
  16534. "x-seqid": e
  16535. })
  16536. };
  16537. }
  16538. var Ge = /*#__PURE__*/function () {
  16539. function Ge() {
  16540. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  16541. (0, _classCallCheck2.default)(this, Ge);
  16542. var t;
  16543. this.config = e, this._reqClass = new ke.adapter.reqClass({
  16544. timeout: this.config.timeout,
  16545. timeoutMsg: "\u8BF7\u6C42\u5728".concat(this.config.timeout / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD"),
  16546. restrictedMethods: ["post"]
  16547. }), this._cache = xe(this.config.env), this._localCache = (t = this.config.env, Oe[t]), Je(this._reqClass, "post", [He]), Je(this._reqClass, "upload", [He]), Je(this._reqClass, "download", [He]);
  16548. }
  16549. (0, _createClass2.default)(Ge, [{
  16550. key: "post",
  16551. value: function () {
  16552. var _post = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(e) {
  16553. return _regenerator.default.wrap(function _callee4$(_context4) {
  16554. while (1) {
  16555. switch (_context4.prev = _context4.next) {
  16556. case 0:
  16557. _context4.next = 2;
  16558. return this._reqClass.post(e);
  16559. case 2:
  16560. return _context4.abrupt("return", _context4.sent);
  16561. case 3:
  16562. case "end":
  16563. return _context4.stop();
  16564. }
  16565. }
  16566. }, _callee4, this);
  16567. }));
  16568. function post(_x2) {
  16569. return _post.apply(this, arguments);
  16570. }
  16571. return post;
  16572. }()
  16573. }, {
  16574. key: "upload",
  16575. value: function () {
  16576. var _upload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(e) {
  16577. return _regenerator.default.wrap(function _callee5$(_context5) {
  16578. while (1) {
  16579. switch (_context5.prev = _context5.next) {
  16580. case 0:
  16581. _context5.next = 2;
  16582. return this._reqClass.upload(e);
  16583. case 2:
  16584. return _context5.abrupt("return", _context5.sent);
  16585. case 3:
  16586. case "end":
  16587. return _context5.stop();
  16588. }
  16589. }
  16590. }, _callee5, this);
  16591. }));
  16592. function upload(_x3) {
  16593. return _upload.apply(this, arguments);
  16594. }
  16595. return upload;
  16596. }()
  16597. }, {
  16598. key: "download",
  16599. value: function () {
  16600. var _download = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(e) {
  16601. return _regenerator.default.wrap(function _callee6$(_context6) {
  16602. while (1) {
  16603. switch (_context6.prev = _context6.next) {
  16604. case 0:
  16605. _context6.next = 2;
  16606. return this._reqClass.download(e);
  16607. case 2:
  16608. return _context6.abrupt("return", _context6.sent);
  16609. case 3:
  16610. case "end":
  16611. return _context6.stop();
  16612. }
  16613. }
  16614. }, _callee6, this);
  16615. }));
  16616. function download(_x4) {
  16617. return _download.apply(this, arguments);
  16618. }
  16619. return download;
  16620. }()
  16621. }, {
  16622. key: "refreshAccessToken",
  16623. value: function () {
  16624. var _refreshAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
  16625. var e, t;
  16626. return _regenerator.default.wrap(function _callee7$(_context7) {
  16627. while (1) {
  16628. switch (_context7.prev = _context7.next) {
  16629. case 0:
  16630. this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
  16631. _context7.prev = 1;
  16632. _context7.next = 4;
  16633. return this._refreshAccessTokenPromise;
  16634. case 4:
  16635. e = _context7.sent;
  16636. _context7.next = 10;
  16637. break;
  16638. case 7:
  16639. _context7.prev = 7;
  16640. _context7.t0 = _context7["catch"](1);
  16641. t = _context7.t0;
  16642. case 10:
  16643. if (!(this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t)) {
  16644. _context7.next = 12;
  16645. break;
  16646. }
  16647. throw t;
  16648. case 12:
  16649. return _context7.abrupt("return", e);
  16650. case 13:
  16651. case "end":
  16652. return _context7.stop();
  16653. }
  16654. }
  16655. }, _callee7, this, [[1, 7]]);
  16656. }));
  16657. function refreshAccessToken() {
  16658. return _refreshAccessToken2.apply(this, arguments);
  16659. }
  16660. return refreshAccessToken;
  16661. }()
  16662. }, {
  16663. key: "_refreshAccessToken",
  16664. value: function () {
  16665. var _refreshAccessToken3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
  16666. var _this$_cache$keys, e, t, n, s, r, i, o, a, _e12, _e13, _t7, _s8;
  16667. return _regenerator.default.wrap(function _callee8$(_context8) {
  16668. while (1) {
  16669. switch (_context8.prev = _context8.next) {
  16670. case 0:
  16671. _this$_cache$keys = this._cache.keys, e = _this$_cache$keys.accessTokenKey, t = _this$_cache$keys.accessTokenExpireKey, n = _this$_cache$keys.refreshTokenKey, s = _this$_cache$keys.loginTypeKey, r = _this$_cache$keys.anonymousUuidKey;
  16672. this._cache.removeStore(e), this._cache.removeStore(t);
  16673. i = this._cache.getStore(n);
  16674. if (i) {
  16675. _context8.next = 5;
  16676. break;
  16677. }
  16678. throw new ne({
  16679. message: "未登录CloudBase"
  16680. });
  16681. case 5:
  16682. o = {
  16683. refresh_token: i
  16684. };
  16685. _context8.next = 8;
  16686. return this.request("auth.fetchAccessTokenWithRefreshToken", o);
  16687. case 8:
  16688. a = _context8.sent;
  16689. if (!a.data.code) {
  16690. _context8.next = 21;
  16691. break;
  16692. }
  16693. _e12 = a.data.code;
  16694. if (!("SIGN_PARAM_INVALID" === _e12 || "REFRESH_TOKEN_EXPIRED" === _e12 || "INVALID_REFRESH_TOKEN" === _e12)) {
  16695. _context8.next = 20;
  16696. break;
  16697. }
  16698. if (!(this._cache.getStore(s) === $e.ANONYMOUS && "INVALID_REFRESH_TOKEN" === _e12)) {
  16699. _context8.next = 19;
  16700. break;
  16701. }
  16702. _e13 = this._cache.getStore(r);
  16703. _t7 = this._cache.getStore(n);
  16704. _context8.next = 17;
  16705. return this.send("auth.signInAnonymously", {
  16706. anonymous_uuid: _e13,
  16707. refresh_token: _t7
  16708. });
  16709. case 17:
  16710. _s8 = _context8.sent;
  16711. return _context8.abrupt("return", (this.setRefreshToken(_s8.refresh_token), this._refreshAccessToken()));
  16712. case 19:
  16713. De(Me), this._cache.removeStore(n);
  16714. case 20:
  16715. throw new ne({
  16716. code: a.data.code,
  16717. message: "\u5237\u65B0access token\u5931\u8D25\uFF1A".concat(a.data.code)
  16718. });
  16719. case 21:
  16720. if (!a.data.access_token) {
  16721. _context8.next = 23;
  16722. break;
  16723. }
  16724. return _context8.abrupt("return", (De(Be), this._cache.setStore(e, a.data.access_token), this._cache.setStore(t, a.data.access_token_expire + Date.now()), {
  16725. accessToken: a.data.access_token,
  16726. accessTokenExpire: a.data.access_token_expire
  16727. }));
  16728. case 23:
  16729. a.data.refresh_token && (this._cache.removeStore(n), this._cache.setStore(n, a.data.refresh_token), this._refreshAccessToken());
  16730. case 24:
  16731. case "end":
  16732. return _context8.stop();
  16733. }
  16734. }
  16735. }, _callee8, this);
  16736. }));
  16737. function _refreshAccessToken() {
  16738. return _refreshAccessToken3.apply(this, arguments);
  16739. }
  16740. return _refreshAccessToken;
  16741. }()
  16742. }, {
  16743. key: "getAccessToken",
  16744. value: function () {
  16745. var _getAccessToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
  16746. var _this$_cache$keys2, e, t, n, s, r, i;
  16747. return _regenerator.default.wrap(function _callee9$(_context9) {
  16748. while (1) {
  16749. switch (_context9.prev = _context9.next) {
  16750. case 0:
  16751. _this$_cache$keys2 = this._cache.keys, e = _this$_cache$keys2.accessTokenKey, t = _this$_cache$keys2.accessTokenExpireKey, n = _this$_cache$keys2.refreshTokenKey;
  16752. if (this._cache.getStore(n)) {
  16753. _context9.next = 3;
  16754. break;
  16755. }
  16756. throw new ne({
  16757. message: "refresh token不存在,登录状态异常"
  16758. });
  16759. case 3:
  16760. s = this._cache.getStore(e), r = this._cache.getStore(t), i = !0;
  16761. _context9.t0 = this._shouldRefreshAccessTokenHook;
  16762. if (!_context9.t0) {
  16763. _context9.next = 9;
  16764. break;
  16765. }
  16766. _context9.next = 8;
  16767. return this._shouldRefreshAccessTokenHook(s, r);
  16768. case 8:
  16769. _context9.t0 = !_context9.sent;
  16770. case 9:
  16771. _context9.t1 = _context9.t0;
  16772. if (!_context9.t1) {
  16773. _context9.next = 12;
  16774. break;
  16775. }
  16776. i = !1;
  16777. case 12:
  16778. return _context9.abrupt("return", (!s || !r || r < Date.now()) && i ? this.refreshAccessToken() : {
  16779. accessToken: s,
  16780. accessTokenExpire: r
  16781. });
  16782. case 13:
  16783. case "end":
  16784. return _context9.stop();
  16785. }
  16786. }
  16787. }, _callee9, this);
  16788. }));
  16789. function getAccessToken() {
  16790. return _getAccessToken.apply(this, arguments);
  16791. }
  16792. return getAccessToken;
  16793. }()
  16794. }, {
  16795. key: "request",
  16796. value: function () {
  16797. var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, t, n) {
  16798. var s, r, i, _e14, o, _e15, _e16, a, c, u, h, l, d, p, f, g;
  16799. return _regenerator.default.wrap(function _callee10$(_context10) {
  16800. while (1) {
  16801. switch (_context10.prev = _context10.next) {
  16802. case 0:
  16803. s = "x-tcb-trace_".concat(this.config.env);
  16804. r = "application/x-www-form-urlencoded";
  16805. i = _objectSpread({
  16806. action: e,
  16807. env: this.config.env,
  16808. dataVersion: "2019-08-16"
  16809. }, t);
  16810. if (!(-1 === We.indexOf(e))) {
  16811. _context10.next = 10;
  16812. break;
  16813. }
  16814. _e14 = this._cache.keys.refreshTokenKey;
  16815. _context10.t0 = this._cache.getStore(_e14);
  16816. if (!_context10.t0) {
  16817. _context10.next = 10;
  16818. break;
  16819. }
  16820. _context10.next = 9;
  16821. return this.getAccessToken();
  16822. case 9:
  16823. i.access_token = _context10.sent.accessToken;
  16824. case 10:
  16825. if ("storage.uploadFile" === e) {
  16826. o = new FormData();
  16827. for (_e15 in o) {
  16828. o.hasOwnProperty(_e15) && void 0 !== o[_e15] && o.append(_e15, i[_e15]);
  16829. }
  16830. r = "multipart/form-data";
  16831. } else {
  16832. r = "application/json", o = {};
  16833. for (_e16 in i) {
  16834. void 0 !== i[_e16] && (o[_e16] = i[_e16]);
  16835. }
  16836. }
  16837. a = {
  16838. headers: {
  16839. "content-type": r
  16840. }
  16841. };
  16842. n && n.onUploadProgress && (a.onUploadProgress = n.onUploadProgress);
  16843. c = this._localCache.getStore(s);
  16844. c && (a.headers["X-TCB-Trace"] = c);
  16845. u = t.parse, h = t.inQuery, l = t.search;
  16846. d = {
  16847. env: this.config.env
  16848. };
  16849. u && (d.parse = !0), h && (d = _objectSpread(_objectSpread({}, h), d));
  16850. p = function (e, t) {
  16851. var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  16852. var s = /\?/.test(t);
  16853. var r = "";
  16854. for (var _e17 in n) {
  16855. "" === r ? !s && (t += "?") : r += "&", r += "".concat(_e17, "=").concat(encodeURIComponent(n[_e17]));
  16856. }
  16857. return /^http(s)?\:\/\//.test(t += r) ? t : "".concat(e).concat(t);
  16858. }(me, "//tcb-api.tencentcloudapi.com/web", d);
  16859. l && (p += l);
  16860. _context10.next = 22;
  16861. return this.post(_objectSpread({
  16862. url: p,
  16863. data: o
  16864. }, a));
  16865. case 22:
  16866. f = _context10.sent;
  16867. g = f.header && f.header["x-tcb-trace"];
  16868. if (!(g && this._localCache.setStore(s, g), 200 !== Number(f.status) && 200 !== Number(f.statusCode) || !f.data)) {
  16869. _context10.next = 26;
  16870. break;
  16871. }
  16872. throw new ne({
  16873. code: "NETWORK_ERROR",
  16874. message: "network request error"
  16875. });
  16876. case 26:
  16877. return _context10.abrupt("return", f);
  16878. case 27:
  16879. case "end":
  16880. return _context10.stop();
  16881. }
  16882. }
  16883. }, _callee10, this);
  16884. }));
  16885. function request(_x5, _x6, _x7) {
  16886. return _request.apply(this, arguments);
  16887. }
  16888. return request;
  16889. }()
  16890. }, {
  16891. key: "send",
  16892. value: function () {
  16893. var _send = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e) {
  16894. var t,
  16895. n,
  16896. _n6,
  16897. _args11 = arguments;
  16898. return _regenerator.default.wrap(function _callee11$(_context11) {
  16899. while (1) {
  16900. switch (_context11.prev = _context11.next) {
  16901. case 0:
  16902. t = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
  16903. _context11.next = 3;
  16904. return this.request(e, t, {
  16905. onUploadProgress: t.onUploadProgress
  16906. });
  16907. case 3:
  16908. n = _context11.sent;
  16909. if (!("ACCESS_TOKEN_EXPIRED" === n.data.code && -1 === We.indexOf(e))) {
  16910. _context11.next = 13;
  16911. break;
  16912. }
  16913. _context11.next = 7;
  16914. return this.refreshAccessToken();
  16915. case 7:
  16916. _context11.next = 9;
  16917. return this.request(e, t, {
  16918. onUploadProgress: t.onUploadProgress
  16919. });
  16920. case 9:
  16921. _n6 = _context11.sent;
  16922. if (!_n6.data.code) {
  16923. _context11.next = 12;
  16924. break;
  16925. }
  16926. throw new ne({
  16927. code: _n6.data.code,
  16928. message: _n6.data.message
  16929. });
  16930. case 12:
  16931. return _context11.abrupt("return", _n6.data);
  16932. case 13:
  16933. if (!n.data.code) {
  16934. _context11.next = 15;
  16935. break;
  16936. }
  16937. throw new ne({
  16938. code: n.data.code,
  16939. message: n.data.message
  16940. });
  16941. case 15:
  16942. return _context11.abrupt("return", n.data);
  16943. case 16:
  16944. case "end":
  16945. return _context11.stop();
  16946. }
  16947. }
  16948. }, _callee11, this);
  16949. }));
  16950. function send(_x8) {
  16951. return _send.apply(this, arguments);
  16952. }
  16953. return send;
  16954. }()
  16955. }, {
  16956. key: "setRefreshToken",
  16957. value: function setRefreshToken(e) {
  16958. var _this$_cache$keys3 = this._cache.keys,
  16959. t = _this$_cache$keys3.accessTokenKey,
  16960. n = _this$_cache$keys3.accessTokenExpireKey,
  16961. s = _this$_cache$keys3.refreshTokenKey;
  16962. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  16963. }
  16964. }]);
  16965. return Ge;
  16966. }();
  16967. var Ve = {};
  16968. function Ye(e) {
  16969. return Ve[e];
  16970. }
  16971. var Qe = /*#__PURE__*/function () {
  16972. function Qe(e) {
  16973. (0, _classCallCheck2.default)(this, Qe);
  16974. this.config = e, this._cache = xe(e.env), this._request = Ye(e.env);
  16975. }
  16976. (0, _createClass2.default)(Qe, [{
  16977. key: "setRefreshToken",
  16978. value: function setRefreshToken(e) {
  16979. var _this$_cache$keys4 = this._cache.keys,
  16980. t = _this$_cache$keys4.accessTokenKey,
  16981. n = _this$_cache$keys4.accessTokenExpireKey,
  16982. s = _this$_cache$keys4.refreshTokenKey;
  16983. this._cache.removeStore(t), this._cache.removeStore(n), this._cache.setStore(s, e);
  16984. }
  16985. }, {
  16986. key: "setAccessToken",
  16987. value: function setAccessToken(e, t) {
  16988. var _this$_cache$keys5 = this._cache.keys,
  16989. n = _this$_cache$keys5.accessTokenKey,
  16990. s = _this$_cache$keys5.accessTokenExpireKey;
  16991. this._cache.setStore(n, e), this._cache.setStore(s, t);
  16992. }
  16993. }, {
  16994. key: "refreshUserInfo",
  16995. value: function () {
  16996. var _refreshUserInfo = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
  16997. var _yield$this$_request$, e;
  16998. return _regenerator.default.wrap(function _callee12$(_context12) {
  16999. while (1) {
  17000. switch (_context12.prev = _context12.next) {
  17001. case 0:
  17002. _context12.next = 2;
  17003. return this._request.send("auth.getUserInfo", {});
  17004. case 2:
  17005. _yield$this$_request$ = _context12.sent;
  17006. e = _yield$this$_request$.data;
  17007. return _context12.abrupt("return", (this.setLocalUserInfo(e), e));
  17008. case 5:
  17009. case "end":
  17010. return _context12.stop();
  17011. }
  17012. }
  17013. }, _callee12, this);
  17014. }));
  17015. function refreshUserInfo() {
  17016. return _refreshUserInfo.apply(this, arguments);
  17017. }
  17018. return refreshUserInfo;
  17019. }()
  17020. }, {
  17021. key: "setLocalUserInfo",
  17022. value: function setLocalUserInfo(e) {
  17023. var t = this._cache.keys.userInfoKey;
  17024. this._cache.setStore(t, e);
  17025. }
  17026. }]);
  17027. return Qe;
  17028. }();
  17029. var Xe = /*#__PURE__*/function () {
  17030. function Xe(e) {
  17031. (0, _classCallCheck2.default)(this, Xe);
  17032. if (!e) throw new ne({
  17033. code: "PARAM_ERROR",
  17034. message: "envId is not defined"
  17035. });
  17036. this._envId = e, this._cache = xe(this._envId), this._request = Ye(this._envId), this.setUserInfo();
  17037. }
  17038. (0, _createClass2.default)(Xe, [{
  17039. key: "linkWithTicket",
  17040. value: function linkWithTicket(e) {
  17041. if ("string" != typeof e) throw new ne({
  17042. code: "PARAM_ERROR",
  17043. message: "ticket must be string"
  17044. });
  17045. return this._request.send("auth.linkWithTicket", {
  17046. ticket: e
  17047. });
  17048. }
  17049. }, {
  17050. key: "linkWithRedirect",
  17051. value: function linkWithRedirect(e) {
  17052. e.signInWithRedirect();
  17053. }
  17054. }, {
  17055. key: "updatePassword",
  17056. value: function updatePassword(e, t) {
  17057. return this._request.send("auth.updatePassword", {
  17058. oldPassword: t,
  17059. newPassword: e
  17060. });
  17061. }
  17062. }, {
  17063. key: "updateEmail",
  17064. value: function updateEmail(e) {
  17065. return this._request.send("auth.updateEmail", {
  17066. newEmail: e
  17067. });
  17068. }
  17069. }, {
  17070. key: "updateUsername",
  17071. value: function updateUsername(e) {
  17072. if ("string" != typeof e) throw new ne({
  17073. code: "PARAM_ERROR",
  17074. message: "username must be a string"
  17075. });
  17076. return this._request.send("auth.updateUsername", {
  17077. username: e
  17078. });
  17079. }
  17080. }, {
  17081. key: "getLinkedUidList",
  17082. value: function () {
  17083. var _getLinkedUidList = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
  17084. var _yield$this$_request$2, e, t, n;
  17085. return _regenerator.default.wrap(function _callee13$(_context13) {
  17086. while (1) {
  17087. switch (_context13.prev = _context13.next) {
  17088. case 0:
  17089. _context13.next = 2;
  17090. return this._request.send("auth.getLinkedUidList", {});
  17091. case 2:
  17092. _yield$this$_request$2 = _context13.sent;
  17093. e = _yield$this$_request$2.data;
  17094. t = !1;
  17095. n = e.users;
  17096. return _context13.abrupt("return", (n.forEach(function (e) {
  17097. e.wxOpenId && e.wxPublicId && (t = !0);
  17098. }), {
  17099. users: n,
  17100. hasPrimaryUid: t
  17101. }));
  17102. case 7:
  17103. case "end":
  17104. return _context13.stop();
  17105. }
  17106. }
  17107. }, _callee13, this);
  17108. }));
  17109. function getLinkedUidList() {
  17110. return _getLinkedUidList.apply(this, arguments);
  17111. }
  17112. return getLinkedUidList;
  17113. }()
  17114. }, {
  17115. key: "setPrimaryUid",
  17116. value: function setPrimaryUid(e) {
  17117. return this._request.send("auth.setPrimaryUid", {
  17118. uid: e
  17119. });
  17120. }
  17121. }, {
  17122. key: "unlink",
  17123. value: function unlink(e) {
  17124. return this._request.send("auth.unlink", {
  17125. platform: e
  17126. });
  17127. }
  17128. }, {
  17129. key: "update",
  17130. value: function () {
  17131. var _update = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(e) {
  17132. var t, n, s, r, i, o, _yield$this$_request$3, a;
  17133. return _regenerator.default.wrap(function _callee14$(_context14) {
  17134. while (1) {
  17135. switch (_context14.prev = _context14.next) {
  17136. case 0:
  17137. t = e.nickName;
  17138. n = e.gender;
  17139. s = e.avatarUrl;
  17140. r = e.province;
  17141. i = e.country;
  17142. o = e.city;
  17143. _context14.next = 8;
  17144. return this._request.send("auth.updateUserInfo", {
  17145. nickName: t,
  17146. gender: n,
  17147. avatarUrl: s,
  17148. province: r,
  17149. country: i,
  17150. city: o
  17151. });
  17152. case 8:
  17153. _yield$this$_request$3 = _context14.sent;
  17154. a = _yield$this$_request$3.data;
  17155. this.setLocalUserInfo(a);
  17156. case 11:
  17157. case "end":
  17158. return _context14.stop();
  17159. }
  17160. }
  17161. }, _callee14, this);
  17162. }));
  17163. function update(_x9) {
  17164. return _update.apply(this, arguments);
  17165. }
  17166. return update;
  17167. }()
  17168. }, {
  17169. key: "refresh",
  17170. value: function () {
  17171. var _refresh = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
  17172. var _yield$this$_request$4, e;
  17173. return _regenerator.default.wrap(function _callee15$(_context15) {
  17174. while (1) {
  17175. switch (_context15.prev = _context15.next) {
  17176. case 0:
  17177. _context15.next = 2;
  17178. return this._request.send("auth.getUserInfo", {});
  17179. case 2:
  17180. _yield$this$_request$4 = _context15.sent;
  17181. e = _yield$this$_request$4.data;
  17182. return _context15.abrupt("return", (this.setLocalUserInfo(e), e));
  17183. case 5:
  17184. case "end":
  17185. return _context15.stop();
  17186. }
  17187. }
  17188. }, _callee15, this);
  17189. }));
  17190. function refresh() {
  17191. return _refresh.apply(this, arguments);
  17192. }
  17193. return refresh;
  17194. }()
  17195. }, {
  17196. key: "setUserInfo",
  17197. value: function setUserInfo() {
  17198. var _this8 = this;
  17199. var e = this._cache.keys.userInfoKey,
  17200. t = this._cache.getStore(e);
  17201. ["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach(function (e) {
  17202. _this8[e] = t[e];
  17203. }), this.location = {
  17204. country: t.country,
  17205. province: t.province,
  17206. city: t.city
  17207. };
  17208. }
  17209. }, {
  17210. key: "setLocalUserInfo",
  17211. value: function setLocalUserInfo(e) {
  17212. var t = this._cache.keys.userInfoKey;
  17213. this._cache.setStore(t, e), this.setUserInfo();
  17214. }
  17215. }]);
  17216. return Xe;
  17217. }();
  17218. var Ze = /*#__PURE__*/function () {
  17219. function Ze(e) {
  17220. (0, _classCallCheck2.default)(this, Ze);
  17221. if (!e) throw new ne({
  17222. code: "PARAM_ERROR",
  17223. message: "envId is not defined"
  17224. });
  17225. this._cache = xe(e);
  17226. var _this$_cache$keys6 = this._cache.keys,
  17227. t = _this$_cache$keys6.refreshTokenKey,
  17228. n = _this$_cache$keys6.accessTokenKey,
  17229. s = _this$_cache$keys6.accessTokenExpireKey,
  17230. r = this._cache.getStore(t),
  17231. i = this._cache.getStore(n),
  17232. o = this._cache.getStore(s);
  17233. this.credential = {
  17234. refreshToken: r,
  17235. accessToken: i,
  17236. accessTokenExpire: o
  17237. }, this.user = new Xe(e);
  17238. }
  17239. (0, _createClass2.default)(Ze, [{
  17240. key: "isAnonymousAuth",
  17241. get: function get() {
  17242. return this.loginType === $e.ANONYMOUS;
  17243. }
  17244. }, {
  17245. key: "isCustomAuth",
  17246. get: function get() {
  17247. return this.loginType === $e.CUSTOM;
  17248. }
  17249. }, {
  17250. key: "isWeixinAuth",
  17251. get: function get() {
  17252. return this.loginType === $e.WECHAT || this.loginType === $e.WECHAT_OPEN || this.loginType === $e.WECHAT_PUBLIC;
  17253. }
  17254. }, {
  17255. key: "loginType",
  17256. get: function get() {
  17257. return this._cache.getStore(this._cache.keys.loginTypeKey);
  17258. }
  17259. }]);
  17260. return Ze;
  17261. }();
  17262. var et = /*#__PURE__*/function (_Qe) {
  17263. (0, _inherits2.default)(et, _Qe);
  17264. var _super4 = _createSuper(et);
  17265. function et() {
  17266. (0, _classCallCheck2.default)(this, et);
  17267. return _super4.apply(this, arguments);
  17268. }
  17269. (0, _createClass2.default)(et, [{
  17270. key: "signIn",
  17271. value: function () {
  17272. var _signIn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
  17273. var _this$_cache$keys7, e, t, n, s, r, _e18;
  17274. return _regenerator.default.wrap(function _callee16$(_context16) {
  17275. while (1) {
  17276. switch (_context16.prev = _context16.next) {
  17277. case 0:
  17278. this._cache.updatePersistence("local");
  17279. _this$_cache$keys7 = this._cache.keys;
  17280. e = _this$_cache$keys7.anonymousUuidKey;
  17281. t = _this$_cache$keys7.refreshTokenKey;
  17282. n = this._cache.getStore(e) || void 0;
  17283. s = this._cache.getStore(t) || void 0;
  17284. _context16.next = 8;
  17285. return this._request.send("auth.signInAnonymously", {
  17286. anonymous_uuid: n,
  17287. refresh_token: s
  17288. });
  17289. case 8:
  17290. r = _context16.sent;
  17291. if (!(r.uuid && r.refresh_token)) {
  17292. _context16.next = 20;
  17293. break;
  17294. }
  17295. this._setAnonymousUUID(r.uuid);
  17296. this.setRefreshToken(r.refresh_token);
  17297. _context16.next = 14;
  17298. return this._request.refreshAccessToken();
  17299. case 14:
  17300. De(qe);
  17301. De(Ke, {
  17302. env: this.config.env,
  17303. loginType: $e.ANONYMOUS,
  17304. persistence: "local"
  17305. });
  17306. _e18 = new Ze(this.config.env);
  17307. _context16.next = 19;
  17308. return _e18.user.refresh();
  17309. case 19:
  17310. return _context16.abrupt("return", _e18);
  17311. case 20:
  17312. throw new ne({
  17313. message: "匿名登录失败"
  17314. });
  17315. case 21:
  17316. case "end":
  17317. return _context16.stop();
  17318. }
  17319. }
  17320. }, _callee16, this);
  17321. }));
  17322. function signIn() {
  17323. return _signIn.apply(this, arguments);
  17324. }
  17325. return signIn;
  17326. }()
  17327. }, {
  17328. key: "linkAndRetrieveDataWithTicket",
  17329. value: function () {
  17330. var _linkAndRetrieveDataWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(e) {
  17331. var _this$_cache$keys8, t, n, s, r, i;
  17332. return _regenerator.default.wrap(function _callee17$(_context17) {
  17333. while (1) {
  17334. switch (_context17.prev = _context17.next) {
  17335. case 0:
  17336. _this$_cache$keys8 = this._cache.keys;
  17337. t = _this$_cache$keys8.anonymousUuidKey;
  17338. n = _this$_cache$keys8.refreshTokenKey;
  17339. s = this._cache.getStore(t);
  17340. r = this._cache.getStore(n);
  17341. _context17.next = 7;
  17342. return this._request.send("auth.linkAndRetrieveDataWithTicket", {
  17343. anonymous_uuid: s,
  17344. refresh_token: r,
  17345. ticket: e
  17346. });
  17347. case 7:
  17348. i = _context17.sent;
  17349. if (!i.refresh_token) {
  17350. _context17.next = 16;
  17351. break;
  17352. }
  17353. this._clearAnonymousUUID();
  17354. this.setRefreshToken(i.refresh_token);
  17355. _context17.next = 13;
  17356. return this._request.refreshAccessToken();
  17357. case 13:
  17358. De(je, {
  17359. env: this.config.env
  17360. });
  17361. De(Ke, {
  17362. loginType: $e.CUSTOM,
  17363. persistence: "local"
  17364. });
  17365. return _context17.abrupt("return", {
  17366. credential: {
  17367. refreshToken: i.refresh_token
  17368. }
  17369. });
  17370. case 16:
  17371. throw new ne({
  17372. message: "匿名转化失败"
  17373. });
  17374. case 17:
  17375. case "end":
  17376. return _context17.stop();
  17377. }
  17378. }
  17379. }, _callee17, this);
  17380. }));
  17381. function linkAndRetrieveDataWithTicket(_x10) {
  17382. return _linkAndRetrieveDataWithTicket.apply(this, arguments);
  17383. }
  17384. return linkAndRetrieveDataWithTicket;
  17385. }()
  17386. }, {
  17387. key: "_setAnonymousUUID",
  17388. value: function _setAnonymousUUID(e) {
  17389. var _this$_cache$keys9 = this._cache.keys,
  17390. t = _this$_cache$keys9.anonymousUuidKey,
  17391. n = _this$_cache$keys9.loginTypeKey;
  17392. this._cache.removeStore(t), this._cache.setStore(t, e), this._cache.setStore(n, $e.ANONYMOUS);
  17393. }
  17394. }, {
  17395. key: "_clearAnonymousUUID",
  17396. value: function _clearAnonymousUUID() {
  17397. this._cache.removeStore(this._cache.keys.anonymousUuidKey);
  17398. }
  17399. }]);
  17400. return et;
  17401. }(Qe);
  17402. var tt = /*#__PURE__*/function (_Qe2) {
  17403. (0, _inherits2.default)(tt, _Qe2);
  17404. var _super5 = _createSuper(tt);
  17405. function tt() {
  17406. (0, _classCallCheck2.default)(this, tt);
  17407. return _super5.apply(this, arguments);
  17408. }
  17409. (0, _createClass2.default)(tt, [{
  17410. key: "signIn",
  17411. value: function () {
  17412. var _signIn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(e) {
  17413. var t, n;
  17414. return _regenerator.default.wrap(function _callee18$(_context18) {
  17415. while (1) {
  17416. switch (_context18.prev = _context18.next) {
  17417. case 0:
  17418. if (!("string" != typeof e)) {
  17419. _context18.next = 2;
  17420. break;
  17421. }
  17422. throw new ne({
  17423. code: "PARAM_ERROR",
  17424. message: "ticket must be a string"
  17425. });
  17426. case 2:
  17427. t = this._cache.keys.refreshTokenKey;
  17428. _context18.next = 5;
  17429. return this._request.send("auth.signInWithTicket", {
  17430. ticket: e,
  17431. refresh_token: this._cache.getStore(t) || ""
  17432. });
  17433. case 5:
  17434. n = _context18.sent;
  17435. if (!n.refresh_token) {
  17436. _context18.next = 15;
  17437. break;
  17438. }
  17439. this.setRefreshToken(n.refresh_token);
  17440. _context18.next = 10;
  17441. return this._request.refreshAccessToken();
  17442. case 10:
  17443. De(qe);
  17444. De(Ke, {
  17445. env: this.config.env,
  17446. loginType: $e.CUSTOM,
  17447. persistence: this.config.persistence
  17448. });
  17449. _context18.next = 14;
  17450. return this.refreshUserInfo();
  17451. case 14:
  17452. return _context18.abrupt("return", new Ze(this.config.env));
  17453. case 15:
  17454. throw new ne({
  17455. message: "自定义登录失败"
  17456. });
  17457. case 16:
  17458. case "end":
  17459. return _context18.stop();
  17460. }
  17461. }
  17462. }, _callee18, this);
  17463. }));
  17464. function signIn(_x11) {
  17465. return _signIn2.apply(this, arguments);
  17466. }
  17467. return signIn;
  17468. }()
  17469. }]);
  17470. return tt;
  17471. }(Qe);
  17472. var nt = /*#__PURE__*/function (_Qe3) {
  17473. (0, _inherits2.default)(nt, _Qe3);
  17474. var _super6 = _createSuper(nt);
  17475. function nt() {
  17476. (0, _classCallCheck2.default)(this, nt);
  17477. return _super6.apply(this, arguments);
  17478. }
  17479. (0, _createClass2.default)(nt, [{
  17480. key: "signIn",
  17481. value: function () {
  17482. var _signIn3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(e, t) {
  17483. var n, s, r, i, o;
  17484. return _regenerator.default.wrap(function _callee19$(_context19) {
  17485. while (1) {
  17486. switch (_context19.prev = _context19.next) {
  17487. case 0:
  17488. if (!("string" != typeof e)) {
  17489. _context19.next = 2;
  17490. break;
  17491. }
  17492. throw new ne({
  17493. code: "PARAM_ERROR",
  17494. message: "email must be a string"
  17495. });
  17496. case 2:
  17497. n = this._cache.keys.refreshTokenKey;
  17498. _context19.next = 5;
  17499. return this._request.send("auth.signIn", {
  17500. loginType: "EMAIL",
  17501. email: e,
  17502. password: t,
  17503. refresh_token: this._cache.getStore(n) || ""
  17504. });
  17505. case 5:
  17506. s = _context19.sent;
  17507. r = s.refresh_token;
  17508. i = s.access_token;
  17509. o = s.access_token_expire;
  17510. if (!r) {
  17511. _context19.next = 22;
  17512. break;
  17513. }
  17514. this.setRefreshToken(r);
  17515. if (!(i && o)) {
  17516. _context19.next = 15;
  17517. break;
  17518. }
  17519. this.setAccessToken(i, o);
  17520. _context19.next = 17;
  17521. break;
  17522. case 15:
  17523. _context19.next = 17;
  17524. return this._request.refreshAccessToken();
  17525. case 17:
  17526. _context19.next = 19;
  17527. return this.refreshUserInfo();
  17528. case 19:
  17529. De(qe);
  17530. De(Ke, {
  17531. env: this.config.env,
  17532. loginType: $e.EMAIL,
  17533. persistence: this.config.persistence
  17534. });
  17535. return _context19.abrupt("return", new Ze(this.config.env));
  17536. case 22:
  17537. throw s.code ? new ne({
  17538. code: s.code,
  17539. message: "\u90AE\u7BB1\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  17540. }) : new ne({
  17541. message: "邮箱登录失败"
  17542. });
  17543. case 23:
  17544. case "end":
  17545. return _context19.stop();
  17546. }
  17547. }
  17548. }, _callee19, this);
  17549. }));
  17550. function signIn(_x12, _x13) {
  17551. return _signIn3.apply(this, arguments);
  17552. }
  17553. return signIn;
  17554. }()
  17555. }, {
  17556. key: "activate",
  17557. value: function () {
  17558. var _activate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(e) {
  17559. return _regenerator.default.wrap(function _callee20$(_context20) {
  17560. while (1) {
  17561. switch (_context20.prev = _context20.next) {
  17562. case 0:
  17563. return _context20.abrupt("return", this._request.send("auth.activateEndUserMail", {
  17564. token: e
  17565. }));
  17566. case 1:
  17567. case "end":
  17568. return _context20.stop();
  17569. }
  17570. }
  17571. }, _callee20, this);
  17572. }));
  17573. function activate(_x14) {
  17574. return _activate.apply(this, arguments);
  17575. }
  17576. return activate;
  17577. }()
  17578. }, {
  17579. key: "resetPasswordWithToken",
  17580. value: function () {
  17581. var _resetPasswordWithToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(e, t) {
  17582. return _regenerator.default.wrap(function _callee21$(_context21) {
  17583. while (1) {
  17584. switch (_context21.prev = _context21.next) {
  17585. case 0:
  17586. return _context21.abrupt("return", this._request.send("auth.resetPasswordWithToken", {
  17587. token: e,
  17588. newPassword: t
  17589. }));
  17590. case 1:
  17591. case "end":
  17592. return _context21.stop();
  17593. }
  17594. }
  17595. }, _callee21, this);
  17596. }));
  17597. function resetPasswordWithToken(_x15, _x16) {
  17598. return _resetPasswordWithToken.apply(this, arguments);
  17599. }
  17600. return resetPasswordWithToken;
  17601. }()
  17602. }]);
  17603. return nt;
  17604. }(Qe);
  17605. var st = /*#__PURE__*/function (_Qe4) {
  17606. (0, _inherits2.default)(st, _Qe4);
  17607. var _super7 = _createSuper(st);
  17608. function st() {
  17609. (0, _classCallCheck2.default)(this, st);
  17610. return _super7.apply(this, arguments);
  17611. }
  17612. (0, _createClass2.default)(st, [{
  17613. key: "signIn",
  17614. value: function () {
  17615. var _signIn4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(e, t) {
  17616. var n, s, r, i, o;
  17617. return _regenerator.default.wrap(function _callee22$(_context22) {
  17618. while (1) {
  17619. switch (_context22.prev = _context22.next) {
  17620. case 0:
  17621. if (!("string" != typeof e)) {
  17622. _context22.next = 2;
  17623. break;
  17624. }
  17625. throw new ne({
  17626. code: "PARAM_ERROR",
  17627. message: "username must be a string"
  17628. });
  17629. case 2:
  17630. "string" != typeof t && (t = "", console.warn("password is empty"));
  17631. n = this._cache.keys.refreshTokenKey;
  17632. _context22.next = 6;
  17633. return this._request.send("auth.signIn", {
  17634. loginType: $e.USERNAME,
  17635. username: e,
  17636. password: t,
  17637. refresh_token: this._cache.getStore(n) || ""
  17638. });
  17639. case 6:
  17640. s = _context22.sent;
  17641. r = s.refresh_token;
  17642. i = s.access_token_expire;
  17643. o = s.access_token;
  17644. if (!r) {
  17645. _context22.next = 23;
  17646. break;
  17647. }
  17648. this.setRefreshToken(r);
  17649. if (!(o && i)) {
  17650. _context22.next = 16;
  17651. break;
  17652. }
  17653. this.setAccessToken(o, i);
  17654. _context22.next = 18;
  17655. break;
  17656. case 16:
  17657. _context22.next = 18;
  17658. return this._request.refreshAccessToken();
  17659. case 18:
  17660. _context22.next = 20;
  17661. return this.refreshUserInfo();
  17662. case 20:
  17663. De(qe);
  17664. De(Ke, {
  17665. env: this.config.env,
  17666. loginType: $e.USERNAME,
  17667. persistence: this.config.persistence
  17668. });
  17669. return _context22.abrupt("return", new Ze(this.config.env));
  17670. case 23:
  17671. throw s.code ? new ne({
  17672. code: s.code,
  17673. message: "\u7528\u6237\u540D\u5BC6\u7801\u767B\u5F55\u5931\u8D25: ".concat(s.message)
  17674. }) : new ne({
  17675. message: "用户名密码登录失败"
  17676. });
  17677. case 24:
  17678. case "end":
  17679. return _context22.stop();
  17680. }
  17681. }
  17682. }, _callee22, this);
  17683. }));
  17684. function signIn(_x17, _x18) {
  17685. return _signIn4.apply(this, arguments);
  17686. }
  17687. return signIn;
  17688. }()
  17689. }]);
  17690. return st;
  17691. }(Qe);
  17692. var rt = /*#__PURE__*/function () {
  17693. function rt(e) {
  17694. (0, _classCallCheck2.default)(this, rt);
  17695. this.config = e, this._cache = xe(e.env), this._request = Ye(e.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), Ne(Ke, this._onLoginTypeChanged);
  17696. }
  17697. (0, _createClass2.default)(rt, [{
  17698. key: "currentUser",
  17699. get: function get() {
  17700. var e = this.hasLoginState();
  17701. return e && e.user || null;
  17702. }
  17703. }, {
  17704. key: "loginType",
  17705. get: function get() {
  17706. return this._cache.getStore(this._cache.keys.loginTypeKey);
  17707. }
  17708. }, {
  17709. key: "anonymousAuthProvider",
  17710. value: function anonymousAuthProvider() {
  17711. return new et(this.config);
  17712. }
  17713. }, {
  17714. key: "customAuthProvider",
  17715. value: function customAuthProvider() {
  17716. return new tt(this.config);
  17717. }
  17718. }, {
  17719. key: "emailAuthProvider",
  17720. value: function emailAuthProvider() {
  17721. return new nt(this.config);
  17722. }
  17723. }, {
  17724. key: "usernameAuthProvider",
  17725. value: function usernameAuthProvider() {
  17726. return new st(this.config);
  17727. }
  17728. }, {
  17729. key: "signInAnonymously",
  17730. value: function () {
  17731. var _signInAnonymously = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
  17732. return _regenerator.default.wrap(function _callee23$(_context23) {
  17733. while (1) {
  17734. switch (_context23.prev = _context23.next) {
  17735. case 0:
  17736. return _context23.abrupt("return", new et(this.config).signIn());
  17737. case 1:
  17738. case "end":
  17739. return _context23.stop();
  17740. }
  17741. }
  17742. }, _callee23, this);
  17743. }));
  17744. function signInAnonymously() {
  17745. return _signInAnonymously.apply(this, arguments);
  17746. }
  17747. return signInAnonymously;
  17748. }()
  17749. }, {
  17750. key: "signInWithEmailAndPassword",
  17751. value: function () {
  17752. var _signInWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(e, t) {
  17753. return _regenerator.default.wrap(function _callee24$(_context24) {
  17754. while (1) {
  17755. switch (_context24.prev = _context24.next) {
  17756. case 0:
  17757. return _context24.abrupt("return", new nt(this.config).signIn(e, t));
  17758. case 1:
  17759. case "end":
  17760. return _context24.stop();
  17761. }
  17762. }
  17763. }, _callee24, this);
  17764. }));
  17765. function signInWithEmailAndPassword(_x19, _x20) {
  17766. return _signInWithEmailAndPassword.apply(this, arguments);
  17767. }
  17768. return signInWithEmailAndPassword;
  17769. }()
  17770. }, {
  17771. key: "signInWithUsernameAndPassword",
  17772. value: function signInWithUsernameAndPassword(e, t) {
  17773. return new st(this.config).signIn(e, t);
  17774. }
  17775. }, {
  17776. key: "linkAndRetrieveDataWithTicket",
  17777. value: function () {
  17778. var _linkAndRetrieveDataWithTicket2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(e) {
  17779. return _regenerator.default.wrap(function _callee25$(_context25) {
  17780. while (1) {
  17781. switch (_context25.prev = _context25.next) {
  17782. case 0:
  17783. this._anonymousAuthProvider || (this._anonymousAuthProvider = new et(this.config)), Ne(je, this._onAnonymousConverted);
  17784. _context25.next = 3;
  17785. return this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e);
  17786. case 3:
  17787. return _context25.abrupt("return", _context25.sent);
  17788. case 4:
  17789. case "end":
  17790. return _context25.stop();
  17791. }
  17792. }
  17793. }, _callee25, this);
  17794. }));
  17795. function linkAndRetrieveDataWithTicket(_x21) {
  17796. return _linkAndRetrieveDataWithTicket2.apply(this, arguments);
  17797. }
  17798. return linkAndRetrieveDataWithTicket;
  17799. }()
  17800. }, {
  17801. key: "signOut",
  17802. value: function () {
  17803. var _signOut = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
  17804. var _this$_cache$keys10, e, t, n, s, r;
  17805. return _regenerator.default.wrap(function _callee26$(_context26) {
  17806. while (1) {
  17807. switch (_context26.prev = _context26.next) {
  17808. case 0:
  17809. if (!(this.loginType === $e.ANONYMOUS)) {
  17810. _context26.next = 2;
  17811. break;
  17812. }
  17813. throw new ne({
  17814. message: "匿名用户不支持登出操作"
  17815. });
  17816. case 2:
  17817. _this$_cache$keys10 = this._cache.keys, e = _this$_cache$keys10.refreshTokenKey, t = _this$_cache$keys10.accessTokenKey, n = _this$_cache$keys10.accessTokenExpireKey, s = this._cache.getStore(e);
  17818. if (s) {
  17819. _context26.next = 5;
  17820. break;
  17821. }
  17822. return _context26.abrupt("return");
  17823. case 5:
  17824. _context26.next = 7;
  17825. return this._request.send("auth.logout", {
  17826. refresh_token: s
  17827. });
  17828. case 7:
  17829. r = _context26.sent;
  17830. return _context26.abrupt("return", (this._cache.removeStore(e), this._cache.removeStore(t), this._cache.removeStore(n), De(qe), De(Ke, {
  17831. env: this.config.env,
  17832. loginType: $e.NULL,
  17833. persistence: this.config.persistence
  17834. }), r));
  17835. case 9:
  17836. case "end":
  17837. return _context26.stop();
  17838. }
  17839. }
  17840. }, _callee26, this);
  17841. }));
  17842. function signOut() {
  17843. return _signOut.apply(this, arguments);
  17844. }
  17845. return signOut;
  17846. }()
  17847. }, {
  17848. key: "signUpWithEmailAndPassword",
  17849. value: function () {
  17850. var _signUpWithEmailAndPassword = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27(e, t) {
  17851. return _regenerator.default.wrap(function _callee27$(_context27) {
  17852. while (1) {
  17853. switch (_context27.prev = _context27.next) {
  17854. case 0:
  17855. return _context27.abrupt("return", this._request.send("auth.signUpWithEmailAndPassword", {
  17856. email: e,
  17857. password: t
  17858. }));
  17859. case 1:
  17860. case "end":
  17861. return _context27.stop();
  17862. }
  17863. }
  17864. }, _callee27, this);
  17865. }));
  17866. function signUpWithEmailAndPassword(_x22, _x23) {
  17867. return _signUpWithEmailAndPassword.apply(this, arguments);
  17868. }
  17869. return signUpWithEmailAndPassword;
  17870. }()
  17871. }, {
  17872. key: "sendPasswordResetEmail",
  17873. value: function () {
  17874. var _sendPasswordResetEmail = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28(e) {
  17875. return _regenerator.default.wrap(function _callee28$(_context28) {
  17876. while (1) {
  17877. switch (_context28.prev = _context28.next) {
  17878. case 0:
  17879. return _context28.abrupt("return", this._request.send("auth.sendPasswordResetEmail", {
  17880. email: e
  17881. }));
  17882. case 1:
  17883. case "end":
  17884. return _context28.stop();
  17885. }
  17886. }
  17887. }, _callee28, this);
  17888. }));
  17889. function sendPasswordResetEmail(_x24) {
  17890. return _sendPasswordResetEmail.apply(this, arguments);
  17891. }
  17892. return sendPasswordResetEmail;
  17893. }()
  17894. }, {
  17895. key: "onLoginStateChanged",
  17896. value: function onLoginStateChanged(e) {
  17897. var _this9 = this;
  17898. Ne(qe, function () {
  17899. var t = _this9.hasLoginState();
  17900. e.call(_this9, t);
  17901. });
  17902. var t = this.hasLoginState();
  17903. e.call(this, t);
  17904. }
  17905. }, {
  17906. key: "onLoginStateExpired",
  17907. value: function onLoginStateExpired(e) {
  17908. Ne(Me, e.bind(this));
  17909. }
  17910. }, {
  17911. key: "onAccessTokenRefreshed",
  17912. value: function onAccessTokenRefreshed(e) {
  17913. Ne(Be, e.bind(this));
  17914. }
  17915. }, {
  17916. key: "onAnonymousConverted",
  17917. value: function onAnonymousConverted(e) {
  17918. Ne(je, e.bind(this));
  17919. }
  17920. }, {
  17921. key: "onLoginTypeChanged",
  17922. value: function onLoginTypeChanged(e) {
  17923. var _this10 = this;
  17924. Ne(Ke, function () {
  17925. var t = _this10.hasLoginState();
  17926. e.call(_this10, t);
  17927. });
  17928. }
  17929. }, {
  17930. key: "getAccessToken",
  17931. value: function () {
  17932. var _getAccessToken2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
  17933. return _regenerator.default.wrap(function _callee29$(_context29) {
  17934. while (1) {
  17935. switch (_context29.prev = _context29.next) {
  17936. case 0:
  17937. _context29.next = 2;
  17938. return this._request.getAccessToken();
  17939. case 2:
  17940. _context29.t0 = _context29.sent.accessToken;
  17941. _context29.t1 = this.config.env;
  17942. return _context29.abrupt("return", {
  17943. accessToken: _context29.t0,
  17944. env: _context29.t1
  17945. });
  17946. case 5:
  17947. case "end":
  17948. return _context29.stop();
  17949. }
  17950. }
  17951. }, _callee29, this);
  17952. }));
  17953. function getAccessToken() {
  17954. return _getAccessToken2.apply(this, arguments);
  17955. }
  17956. return getAccessToken;
  17957. }()
  17958. }, {
  17959. key: "hasLoginState",
  17960. value: function hasLoginState() {
  17961. var e = this._cache.keys.refreshTokenKey;
  17962. return this._cache.getStore(e) ? new Ze(this.config.env) : null;
  17963. }
  17964. }, {
  17965. key: "isUsernameRegistered",
  17966. value: function () {
  17967. var _isUsernameRegistered = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30(e) {
  17968. var _yield$this$_request$5, t;
  17969. return _regenerator.default.wrap(function _callee30$(_context30) {
  17970. while (1) {
  17971. switch (_context30.prev = _context30.next) {
  17972. case 0:
  17973. if (!("string" != typeof e)) {
  17974. _context30.next = 2;
  17975. break;
  17976. }
  17977. throw new ne({
  17978. code: "PARAM_ERROR",
  17979. message: "username must be a string"
  17980. });
  17981. case 2:
  17982. _context30.next = 4;
  17983. return this._request.send("auth.isUsernameRegistered", {
  17984. username: e
  17985. });
  17986. case 4:
  17987. _yield$this$_request$5 = _context30.sent;
  17988. t = _yield$this$_request$5.data;
  17989. return _context30.abrupt("return", t && t.isRegistered);
  17990. case 7:
  17991. case "end":
  17992. return _context30.stop();
  17993. }
  17994. }
  17995. }, _callee30, this);
  17996. }));
  17997. function isUsernameRegistered(_x25) {
  17998. return _isUsernameRegistered.apply(this, arguments);
  17999. }
  18000. return isUsernameRegistered;
  18001. }()
  18002. }, {
  18003. key: "getLoginState",
  18004. value: function getLoginState() {
  18005. return Promise.resolve(this.hasLoginState());
  18006. }
  18007. }, {
  18008. key: "signInWithTicket",
  18009. value: function () {
  18010. var _signInWithTicket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31(e) {
  18011. return _regenerator.default.wrap(function _callee31$(_context31) {
  18012. while (1) {
  18013. switch (_context31.prev = _context31.next) {
  18014. case 0:
  18015. return _context31.abrupt("return", new tt(this.config).signIn(e));
  18016. case 1:
  18017. case "end":
  18018. return _context31.stop();
  18019. }
  18020. }
  18021. }, _callee31, this);
  18022. }));
  18023. function signInWithTicket(_x26) {
  18024. return _signInWithTicket.apply(this, arguments);
  18025. }
  18026. return signInWithTicket;
  18027. }()
  18028. }, {
  18029. key: "shouldRefreshAccessToken",
  18030. value: function shouldRefreshAccessToken(e) {
  18031. this._request._shouldRefreshAccessTokenHook = e.bind(this);
  18032. }
  18033. }, {
  18034. key: "getUserInfo",
  18035. value: function getUserInfo() {
  18036. return this._request.send("auth.getUserInfo", {}).then(function (e) {
  18037. return e.code ? e : _objectSpread(_objectSpread({}, e.data), {}, {
  18038. requestId: e.seqId
  18039. });
  18040. });
  18041. }
  18042. }, {
  18043. key: "getAuthHeader",
  18044. value: function getAuthHeader() {
  18045. var _this$_cache$keys11 = this._cache.keys,
  18046. e = _this$_cache$keys11.refreshTokenKey,
  18047. t = _this$_cache$keys11.accessTokenKey,
  18048. n = this._cache.getStore(e);
  18049. return {
  18050. "x-cloudbase-credentials": this._cache.getStore(t) + "/@@/" + n
  18051. };
  18052. }
  18053. }, {
  18054. key: "_onAnonymousConverted",
  18055. value: function _onAnonymousConverted(e) {
  18056. var t = e.data.env;
  18057. t === this.config.env && this._cache.updatePersistence(this.config.persistence);
  18058. }
  18059. }, {
  18060. key: "_onLoginTypeChanged",
  18061. value: function _onLoginTypeChanged(e) {
  18062. var _e$data = e.data,
  18063. t = _e$data.loginType,
  18064. n = _e$data.persistence,
  18065. s = _e$data.env;
  18066. s === this.config.env && (this._cache.updatePersistence(n), this._cache.setStore(this._cache.keys.loginTypeKey, t));
  18067. }
  18068. }]);
  18069. return rt;
  18070. }();
  18071. var it = function it(e, t) {
  18072. t = t || we();
  18073. var n = Ye(this.config.env),
  18074. s = e.cloudPath,
  18075. r = e.filePath,
  18076. i = e.onUploadProgress,
  18077. _e$fileType = e.fileType,
  18078. o = _e$fileType === void 0 ? "image" : _e$fileType;
  18079. return n.send("storage.getUploadMetadata", {
  18080. path: s
  18081. }).then(function (e) {
  18082. var _e$data2 = e.data,
  18083. a = _e$data2.url,
  18084. c = _e$data2.authorization,
  18085. u = _e$data2.token,
  18086. h = _e$data2.fileId,
  18087. l = _e$data2.cosFileId,
  18088. d = e.requestId,
  18089. p = {
  18090. key: s,
  18091. signature: c,
  18092. "x-cos-meta-fileid": l,
  18093. success_action_status: "201",
  18094. "x-cos-security-token": u
  18095. };
  18096. n.upload({
  18097. url: a,
  18098. data: p,
  18099. file: r,
  18100. name: s,
  18101. fileType: o,
  18102. onUploadProgress: i
  18103. }).then(function (e) {
  18104. 201 === e.statusCode ? t(null, {
  18105. fileID: h,
  18106. requestId: d
  18107. }) : t(new ne({
  18108. code: "STORAGE_REQUEST_FAIL",
  18109. message: "STORAGE_REQUEST_FAIL: ".concat(e.data)
  18110. }));
  18111. }).catch(function (e) {
  18112. t(e);
  18113. });
  18114. }).catch(function (e) {
  18115. t(e);
  18116. }), t.promise;
  18117. },
  18118. ot = function ot(e, t) {
  18119. t = t || we();
  18120. var n = Ye(this.config.env),
  18121. s = e.cloudPath;
  18122. return n.send("storage.getUploadMetadata", {
  18123. path: s
  18124. }).then(function (e) {
  18125. t(null, e);
  18126. }).catch(function (e) {
  18127. t(e);
  18128. }), t.promise;
  18129. },
  18130. at = function at(_ref7, t) {
  18131. var e = _ref7.fileList;
  18132. if (t = t || we(), !e || !Array.isArray(e)) return {
  18133. code: "INVALID_PARAM",
  18134. message: "fileList必须是非空的数组"
  18135. };
  18136. var _iterator3 = _createForOfIteratorHelper(e),
  18137. _step3;
  18138. try {
  18139. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  18140. var _t8 = _step3.value;
  18141. if (!_t8 || "string" != typeof _t8) return {
  18142. code: "INVALID_PARAM",
  18143. message: "fileList的元素必须是非空的字符串"
  18144. };
  18145. }
  18146. } catch (err) {
  18147. _iterator3.e(err);
  18148. } finally {
  18149. _iterator3.f();
  18150. }
  18151. var n = {
  18152. fileid_list: e
  18153. };
  18154. return Ye(this.config.env).send("storage.batchDeleteFile", n).then(function (e) {
  18155. e.code ? t(null, e) : t(null, {
  18156. fileList: e.data.delete_list,
  18157. requestId: e.requestId
  18158. });
  18159. }).catch(function (e) {
  18160. t(e);
  18161. }), t.promise;
  18162. },
  18163. ct = function ct(_ref8, t) {
  18164. var e = _ref8.fileList;
  18165. t = t || we(), e && Array.isArray(e) || t(null, {
  18166. code: "INVALID_PARAM",
  18167. message: "fileList必须是非空的数组"
  18168. });
  18169. var n = [];
  18170. var _iterator4 = _createForOfIteratorHelper(e),
  18171. _step4;
  18172. try {
  18173. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  18174. var _s9 = _step4.value;
  18175. "object" == (0, _typeof2.default)(_s9) ? (_s9.hasOwnProperty("fileID") && _s9.hasOwnProperty("maxAge") || t(null, {
  18176. code: "INVALID_PARAM",
  18177. message: "fileList的元素必须是包含fileID和maxAge的对象"
  18178. }), n.push({
  18179. fileid: _s9.fileID,
  18180. max_age: _s9.maxAge
  18181. })) : "string" == typeof _s9 ? n.push({
  18182. fileid: _s9
  18183. }) : t(null, {
  18184. code: "INVALID_PARAM",
  18185. message: "fileList的元素必须是字符串"
  18186. });
  18187. }
  18188. } catch (err) {
  18189. _iterator4.e(err);
  18190. } finally {
  18191. _iterator4.f();
  18192. }
  18193. var s = {
  18194. file_list: n
  18195. };
  18196. return Ye(this.config.env).send("storage.batchGetDownloadUrl", s).then(function (e) {
  18197. e.code ? t(null, e) : t(null, {
  18198. fileList: e.data.download_list,
  18199. requestId: e.requestId
  18200. });
  18201. }).catch(function (e) {
  18202. t(e);
  18203. }), t.promise;
  18204. },
  18205. ut = /*#__PURE__*/function () {
  18206. var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32(_ref9, t) {
  18207. var e, n, s, r;
  18208. return _regenerator.default.wrap(function _callee32$(_context32) {
  18209. while (1) {
  18210. switch (_context32.prev = _context32.next) {
  18211. case 0:
  18212. e = _ref9.fileID;
  18213. _context32.next = 3;
  18214. return ct.call(this, {
  18215. fileList: [{
  18216. fileID: e,
  18217. maxAge: 600
  18218. }]
  18219. });
  18220. case 3:
  18221. n = _context32.sent.fileList[0];
  18222. if (!("SUCCESS" !== n.code)) {
  18223. _context32.next = 6;
  18224. break;
  18225. }
  18226. return _context32.abrupt("return", t ? t(n) : new Promise(function (e) {
  18227. e(n);
  18228. }));
  18229. case 6:
  18230. s = Ye(this.config.env);
  18231. r = n.download_url;
  18232. if (!(r = encodeURI(r), !t)) {
  18233. _context32.next = 10;
  18234. break;
  18235. }
  18236. return _context32.abrupt("return", s.download({
  18237. url: r
  18238. }));
  18239. case 10:
  18240. _context32.t0 = t;
  18241. _context32.next = 13;
  18242. return s.download({
  18243. url: r
  18244. });
  18245. case 13:
  18246. _context32.t1 = _context32.sent;
  18247. (0, _context32.t0)(_context32.t1);
  18248. case 15:
  18249. case "end":
  18250. return _context32.stop();
  18251. }
  18252. }
  18253. }, _callee32, this);
  18254. }));
  18255. return function ut(_x27, _x28) {
  18256. return _ref10.apply(this, arguments);
  18257. };
  18258. }(),
  18259. ht = function ht(_ref11, i) {
  18260. var e = _ref11.name,
  18261. t = _ref11.data,
  18262. n = _ref11.query,
  18263. s = _ref11.parse,
  18264. r = _ref11.search;
  18265. var o = i || we();
  18266. var a;
  18267. try {
  18268. a = t ? JSON.stringify(t) : "";
  18269. } catch (e) {
  18270. return Promise.reject(e);
  18271. }
  18272. if (!e) return Promise.reject(new ne({
  18273. code: "PARAM_ERROR",
  18274. message: "函数名不能为空"
  18275. }));
  18276. var c = {
  18277. inQuery: n,
  18278. parse: s,
  18279. search: r,
  18280. function_name: e,
  18281. request_data: a
  18282. };
  18283. return Ye(this.config.env).send("functions.invokeFunction", c).then(function (e) {
  18284. if (e.code) o(null, e);else {
  18285. var _t9 = e.data.response_data;
  18286. if (s) o(null, {
  18287. result: _t9,
  18288. requestId: e.requestId
  18289. });else try {
  18290. _t9 = JSON.parse(e.data.response_data), o(null, {
  18291. result: _t9,
  18292. requestId: e.requestId
  18293. });
  18294. } catch (e) {
  18295. o(new ne({
  18296. message: "response data must be json"
  18297. }));
  18298. }
  18299. }
  18300. return o.promise;
  18301. }).catch(function (e) {
  18302. o(e);
  18303. }), o.promise;
  18304. },
  18305. lt = {
  18306. timeout: 15e3,
  18307. persistence: "session"
  18308. },
  18309. dt = {};
  18310. var pt = /*#__PURE__*/function () {
  18311. function pt(e) {
  18312. (0, _classCallCheck2.default)(this, pt);
  18313. this.config = e || this.config, this.authObj = void 0;
  18314. }
  18315. (0, _createClass2.default)(pt, [{
  18316. key: "init",
  18317. value: function init(e) {
  18318. switch (ke.adapter || (this.requestClient = new ke.adapter.reqClass({
  18319. timeout: e.timeout || 5e3,
  18320. timeoutMsg: "\u8BF7\u6C42\u5728".concat((e.timeout || 5e3) / 1e3, "s\u5185\u672A\u5B8C\u6210\uFF0C\u5DF2\u4E2D\u65AD")
  18321. })), this.config = _objectSpread(_objectSpread({}, lt), e), !0) {
  18322. case this.config.timeout > 6e5:
  18323. console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = 6e5;
  18324. break;
  18325. case this.config.timeout < 100:
  18326. console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
  18327. }
  18328. return new pt(this.config);
  18329. }
  18330. }, {
  18331. key: "auth",
  18332. value: function auth() {
  18333. var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18334. e = _ref12.persistence;
  18335. if (this.authObj) return this.authObj;
  18336. var t = e || ke.adapter.primaryStorage || lt.persistence;
  18337. var n;
  18338. return t !== this.config.persistence && (this.config.persistence = t), function (e) {
  18339. var t = e.env;
  18340. Ee[t] = new Ae(e), Oe[t] = new Ae(_objectSpread(_objectSpread({}, e), {}, {
  18341. persistence: "local"
  18342. }));
  18343. }(this.config), n = this.config, Ve[n.env] = new Ge(n), this.authObj = new rt(this.config), this.authObj;
  18344. }
  18345. }, {
  18346. key: "on",
  18347. value: function on(e, t) {
  18348. return Ne.apply(this, [e, t]);
  18349. }
  18350. }, {
  18351. key: "off",
  18352. value: function off(e, t) {
  18353. return Fe.apply(this, [e, t]);
  18354. }
  18355. }, {
  18356. key: "callFunction",
  18357. value: function callFunction(e, t) {
  18358. return ht.apply(this, [e, t]);
  18359. }
  18360. }, {
  18361. key: "deleteFile",
  18362. value: function deleteFile(e, t) {
  18363. return at.apply(this, [e, t]);
  18364. }
  18365. }, {
  18366. key: "getTempFileURL",
  18367. value: function getTempFileURL(e, t) {
  18368. return ct.apply(this, [e, t]);
  18369. }
  18370. }, {
  18371. key: "downloadFile",
  18372. value: function downloadFile(e, t) {
  18373. return ut.apply(this, [e, t]);
  18374. }
  18375. }, {
  18376. key: "uploadFile",
  18377. value: function uploadFile(e, t) {
  18378. return it.apply(this, [e, t]);
  18379. }
  18380. }, {
  18381. key: "getUploadMetadata",
  18382. value: function getUploadMetadata(e, t) {
  18383. return ot.apply(this, [e, t]);
  18384. }
  18385. }, {
  18386. key: "registerExtension",
  18387. value: function registerExtension(e) {
  18388. dt[e.name] = e;
  18389. }
  18390. }, {
  18391. key: "invokeExtension",
  18392. value: function () {
  18393. var _invokeExtension = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33(e, t) {
  18394. var n;
  18395. return _regenerator.default.wrap(function _callee33$(_context33) {
  18396. while (1) {
  18397. switch (_context33.prev = _context33.next) {
  18398. case 0:
  18399. n = dt[e];
  18400. if (n) {
  18401. _context33.next = 3;
  18402. break;
  18403. }
  18404. throw new ne({
  18405. message: "\u6269\u5C55".concat(e, " \u5FC5\u987B\u5148\u6CE8\u518C")
  18406. });
  18407. case 3:
  18408. _context33.next = 5;
  18409. return n.invoke(t, this);
  18410. case 5:
  18411. return _context33.abrupt("return", _context33.sent);
  18412. case 6:
  18413. case "end":
  18414. return _context33.stop();
  18415. }
  18416. }
  18417. }, _callee33, this);
  18418. }));
  18419. function invokeExtension(_x29, _x30) {
  18420. return _invokeExtension.apply(this, arguments);
  18421. }
  18422. return invokeExtension;
  18423. }()
  18424. }, {
  18425. key: "useAdapters",
  18426. value: function useAdapters(e) {
  18427. var _ref13 = be(e) || {},
  18428. t = _ref13.adapter,
  18429. n = _ref13.runtime;
  18430. t && (ke.adapter = t), n && (ke.runtime = n);
  18431. }
  18432. }]);
  18433. return pt;
  18434. }();
  18435. var ft = new pt();
  18436. function gt(e, t, n) {
  18437. void 0 === n && (n = {});
  18438. var s = /\?/.test(t),
  18439. r = "";
  18440. for (var i in n) {
  18441. "" === r ? !s && (t += "?") : r += "&", r += i + "=" + encodeURIComponent(n[i]);
  18442. }
  18443. return /^http(s)?:\/\//.test(t += r) ? t : "" + e + t;
  18444. }
  18445. var mt = /*#__PURE__*/function () {
  18446. function mt() {
  18447. (0, _classCallCheck2.default)(this, mt);
  18448. }
  18449. (0, _createClass2.default)(mt, [{
  18450. key: "post",
  18451. value: function post(e) {
  18452. var t = e.url,
  18453. n = e.data,
  18454. s = e.headers;
  18455. return new Promise(function (e, r) {
  18456. se.request({
  18457. url: gt("https:", t),
  18458. data: n,
  18459. method: "POST",
  18460. header: s,
  18461. success: function success(t) {
  18462. e(t);
  18463. },
  18464. fail: function fail(e) {
  18465. r(e);
  18466. }
  18467. });
  18468. });
  18469. }
  18470. }, {
  18471. key: "upload",
  18472. value: function upload(e) {
  18473. return new Promise(function (t, n) {
  18474. var s = e.url,
  18475. r = e.file,
  18476. i = e.data,
  18477. o = e.headers,
  18478. a = e.fileType,
  18479. c = se.uploadFile({
  18480. url: gt("https:", s),
  18481. name: "file",
  18482. formData: Object.assign({}, i),
  18483. filePath: r,
  18484. fileType: a,
  18485. header: o,
  18486. success: function success(e) {
  18487. var n = {
  18488. statusCode: e.statusCode,
  18489. data: e.data || {}
  18490. };
  18491. 200 === e.statusCode && i.success_action_status && (n.statusCode = parseInt(i.success_action_status, 10)), t(n);
  18492. },
  18493. fail: function fail(e) {
  18494. n(new Error(e.errMsg || "uploadFile:fail"));
  18495. }
  18496. });
  18497. "function" == typeof e.onUploadProgress && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (t) {
  18498. e.onUploadProgress({
  18499. loaded: t.totalBytesSent,
  18500. total: t.totalBytesExpectedToSend
  18501. });
  18502. });
  18503. });
  18504. }
  18505. }]);
  18506. return mt;
  18507. }();
  18508. var yt = {
  18509. setItem: function setItem(e, t) {
  18510. se.setStorageSync(e, t);
  18511. },
  18512. getItem: function getItem(e) {
  18513. return se.getStorageSync(e);
  18514. },
  18515. removeItem: function removeItem(e) {
  18516. se.removeStorageSync(e);
  18517. },
  18518. clear: function clear() {
  18519. se.clearStorageSync();
  18520. }
  18521. };
  18522. var _t = {
  18523. genAdapter: function genAdapter() {
  18524. return {
  18525. root: {},
  18526. reqClass: mt,
  18527. localStorage: yt,
  18528. primaryStorage: "local"
  18529. };
  18530. },
  18531. isMatch: function isMatch() {
  18532. return !0;
  18533. },
  18534. runtime: "uni_app"
  18535. };
  18536. ft.useAdapters(_t);
  18537. var wt = ft,
  18538. vt = wt.init;
  18539. wt.init = function (e) {
  18540. e.env = e.spaceId;
  18541. var t = vt.call(this, e);
  18542. t.config.provider = "tencent", t.config.spaceId = e.spaceId;
  18543. var n = t.auth;
  18544. return t.auth = function (e) {
  18545. var t = n.call(this, e);
  18546. return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach(function (e) {
  18547. var n;
  18548. t[e] = (n = t[e], function (e) {
  18549. e = e || {};
  18550. var _te = te(e),
  18551. t = _te.success,
  18552. s = _te.fail,
  18553. r = _te.complete;
  18554. if (!(t || s || r)) return n.call(this, e);
  18555. n.call(this, e).then(function (e) {
  18556. t && t(e), r && r(e);
  18557. }, function (e) {
  18558. s && s(e), r && r(e);
  18559. });
  18560. }).bind(t);
  18561. }), t;
  18562. }, t.customAuth = t.auth, t;
  18563. };
  18564. var It = wt;
  18565. var St = /*#__PURE__*/function (_fe) {
  18566. (0, _inherits2.default)(St, _fe);
  18567. var _super8 = _createSuper(St);
  18568. function St() {
  18569. (0, _classCallCheck2.default)(this, St);
  18570. return _super8.apply(this, arguments);
  18571. }
  18572. (0, _createClass2.default)(St, [{
  18573. key: "getAccessToken",
  18574. value: function getAccessToken() {
  18575. var _this11 = this;
  18576. return new Promise(function (e, t) {
  18577. var n = "Anonymous_Access_token";
  18578. _this11.setAccessToken(n), e(n);
  18579. });
  18580. }
  18581. }, {
  18582. key: "setupRequest",
  18583. value: function setupRequest(e, t) {
  18584. var n = Object.assign({}, e, {
  18585. spaceId: this.config.spaceId,
  18586. timestamp: Date.now()
  18587. }),
  18588. s = {
  18589. "Content-Type": "application/json"
  18590. };
  18591. "auth" !== t && (n.token = this.accessToken, s["x-basement-token"] = this.accessToken), s["x-serverless-sign"] = le.sign(n, this.config.clientSecret);
  18592. var r = he();
  18593. s["x-client-info"] = encodeURIComponent(JSON.stringify(r));
  18594. var _re = re(),
  18595. i = _re.token;
  18596. return s["x-client-token"] = i, {
  18597. url: this.config.requestUrl,
  18598. method: "POST",
  18599. data: n,
  18600. dataType: "json",
  18601. header: JSON.parse(JSON.stringify(s))
  18602. };
  18603. }
  18604. }, {
  18605. key: "uploadFileToOSS",
  18606. value: function uploadFileToOSS(_ref14) {
  18607. var _this12 = this;
  18608. var e = _ref14.url,
  18609. t = _ref14.formData,
  18610. n = _ref14.name,
  18611. s = _ref14.filePath,
  18612. r = _ref14.fileType,
  18613. i = _ref14.onUploadProgress;
  18614. return new Promise(function (o, a) {
  18615. var c = _this12.adapter.uploadFile({
  18616. url: e,
  18617. formData: t,
  18618. name: n,
  18619. filePath: s,
  18620. fileType: r,
  18621. success: function success(e) {
  18622. e && e.statusCode < 400 ? o(e) : a(new ne({
  18623. code: "UPLOAD_FAILED",
  18624. message: "文件上传失败"
  18625. }));
  18626. },
  18627. fail: function fail(e) {
  18628. a(new ne({
  18629. code: e.code || "UPLOAD_FAILED",
  18630. message: e.message || e.errMsg || "文件上传失败"
  18631. }));
  18632. }
  18633. });
  18634. "function" == typeof i && c && "function" == typeof c.onProgressUpdate && c.onProgressUpdate(function (e) {
  18635. i({
  18636. loaded: e.totalBytesSent,
  18637. total: e.totalBytesExpectedToSend
  18638. });
  18639. });
  18640. });
  18641. }
  18642. }, {
  18643. key: "uploadFile",
  18644. value: function uploadFile(_ref15) {
  18645. var _this13 = this;
  18646. var e = _ref15.filePath,
  18647. t = _ref15.cloudPath,
  18648. _ref15$fileType = _ref15.fileType,
  18649. n = _ref15$fileType === void 0 ? "image" : _ref15$fileType,
  18650. s = _ref15.onUploadProgress;
  18651. if (!t) throw new ne({
  18652. code: "CLOUDPATH_REQUIRED",
  18653. message: "cloudPath不可为空"
  18654. });
  18655. var r;
  18656. return this.getOSSUploadOptionsFromPath({
  18657. cloudPath: t
  18658. }).then(function (t) {
  18659. var _t$result = t.result,
  18660. i = _t$result.url,
  18661. o = _t$result.formData,
  18662. a = _t$result.name;
  18663. r = t.result.fileUrl;
  18664. var c = {
  18665. url: i,
  18666. formData: o,
  18667. name: a,
  18668. filePath: e,
  18669. fileType: n
  18670. };
  18671. return _this13.uploadFileToOSS(Object.assign({}, c, {
  18672. onUploadProgress: s
  18673. }));
  18674. }).then(function () {
  18675. return _this13.reportOSSUpload({
  18676. cloudPath: t
  18677. });
  18678. }).then(function (t) {
  18679. return new Promise(function (n, s) {
  18680. t.success ? n({
  18681. success: !0,
  18682. filePath: e,
  18683. fileID: r
  18684. }) : s(new ne({
  18685. code: "UPLOAD_FAILED",
  18686. message: "文件上传失败"
  18687. }));
  18688. });
  18689. });
  18690. }
  18691. }, {
  18692. key: "deleteFile",
  18693. value: function deleteFile(_ref16) {
  18694. var e = _ref16.fileList;
  18695. var t = {
  18696. method: "serverless.file.resource.delete",
  18697. params: JSON.stringify({
  18698. fileList: e
  18699. })
  18700. };
  18701. return this.request(this.setupRequest(t)).then(function (e) {
  18702. if (e.success) return e.result;
  18703. throw new ne({
  18704. code: "DELETE_FILE_FAILED",
  18705. message: "删除文件失败"
  18706. });
  18707. });
  18708. }
  18709. }, {
  18710. key: "getTempFileURL",
  18711. value: function getTempFileURL() {
  18712. var _ref17 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18713. e = _ref17.fileList;
  18714. if (!Array.isArray(e) || 0 === e.length) throw new ne({
  18715. code: "INVALID_PARAM",
  18716. message: "fileList的元素必须是非空的字符串"
  18717. });
  18718. var t = {
  18719. method: "serverless.file.resource.getTempFileURL",
  18720. params: JSON.stringify({
  18721. fileList: e
  18722. })
  18723. };
  18724. return this.request(this.setupRequest(t)).then(function (e) {
  18725. if (e.success) return {
  18726. fileList: e.result.fileList.map(function (e) {
  18727. return {
  18728. fileID: e.fileID,
  18729. tempFileURL: e.tempFileURL
  18730. };
  18731. })
  18732. };
  18733. throw new ne({
  18734. code: "GET_TEMP_FILE_URL_FAILED",
  18735. message: "获取临时文件链接失败"
  18736. });
  18737. });
  18738. }
  18739. }]);
  18740. return St;
  18741. }(fe);
  18742. var bt = {
  18743. init: function init(e) {
  18744. var t = new St(e),
  18745. n = {
  18746. signInAnonymously: function signInAnonymously() {
  18747. return t.authorize();
  18748. },
  18749. getLoginState: function getLoginState() {
  18750. return Promise.resolve(!1);
  18751. }
  18752. };
  18753. return t.auth = function () {
  18754. return n;
  18755. }, t.customAuth = t.auth, t;
  18756. }
  18757. };
  18758. function kt(_ref18) {
  18759. var e = _ref18.data;
  18760. var t;
  18761. t = he();
  18762. var n = JSON.parse(JSON.stringify(e || {}));
  18763. if (Object.assign(n, {
  18764. clientInfo: t
  18765. }), !n.uniIdToken) {
  18766. var _re2 = re(),
  18767. _e19 = _re2.token;
  18768. _e19 && (n.uniIdToken = _e19);
  18769. }
  18770. return n;
  18771. }
  18772. function Ct() {
  18773. return _Ct.apply(this, arguments);
  18774. }
  18775. function _Ct() {
  18776. _Ct = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54() {
  18777. var _this26 = this;
  18778. var _ref60,
  18779. e,
  18780. t,
  18781. _this$__dev__,
  18782. n,
  18783. s,
  18784. r,
  18785. i,
  18786. o,
  18787. a,
  18788. _args6 = arguments;
  18789. return _regenerator.default.wrap(function _callee54$(_context54) {
  18790. while (1) {
  18791. switch (_context54.prev = _context54.next) {
  18792. case 0:
  18793. _ref60 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, e = _ref60.name, t = _ref60.data;
  18794. _context54.next = 3;
  18795. return this.__dev__.initLocalNetwork();
  18796. case 3:
  18797. _this$__dev__ = this.__dev__, n = _this$__dev__.localAddress, s = _this$__dev__.localPort, r = {
  18798. aliyun: "aliyun",
  18799. tencent: "tcb"
  18800. }[this.config.provider], i = this.config.spaceId, o = "http://".concat(n, ":").concat(s, "/system/check-function"), a = "http://".concat(n, ":").concat(s, "/cloudfunctions/").concat(e);
  18801. return _context54.abrupt("return", new Promise(function (t, n) {
  18802. se.request({
  18803. method: "POST",
  18804. url: o,
  18805. data: {
  18806. name: e,
  18807. platform: P,
  18808. provider: r,
  18809. spaceId: i
  18810. },
  18811. timeout: 3e3,
  18812. success: function success(e) {
  18813. t(e);
  18814. },
  18815. fail: function fail() {
  18816. t({
  18817. data: {
  18818. code: "NETWORK_ERROR",
  18819. message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。"
  18820. }
  18821. });
  18822. }
  18823. });
  18824. }).then(function () {
  18825. var _ref61 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18826. e = _ref61.data;
  18827. var _ref62 = e || {},
  18828. t = _ref62.code,
  18829. n = _ref62.message;
  18830. return {
  18831. code: 0 === t ? 0 : t || "SYS_ERR",
  18832. message: n || "SYS_ERR"
  18833. };
  18834. }).then(function (_ref63) {
  18835. var n = _ref63.code,
  18836. s = _ref63.message;
  18837. if (0 !== n) {
  18838. switch (n) {
  18839. case "MODULE_ENCRYPTED":
  18840. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u4F9D\u8D56\u52A0\u5BC6\u516C\u5171\u6A21\u5757\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  18841. break;
  18842. case "FUNCTION_ENCRYPTED":
  18843. console.error("\u6B64\u4E91\u51FD\u6570\uFF08".concat(e, "\uFF09\u5DF2\u52A0\u5BC6\u4E0D\u53EF\u672C\u5730\u8C03\u8BD5\uFF0C\u81EA\u52A8\u5207\u6362\u4E3A\u4E91\u7AEF\u5DF2\u90E8\u7F72\u7684\u4E91\u51FD\u6570"));
  18844. break;
  18845. case "ACTION_ENCRYPTED":
  18846. console.error(s || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
  18847. break;
  18848. case "NETWORK_ERROR":
  18849. {
  18850. var _e31 = "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下";
  18851. throw console.error(_e31), new Error(_e31);
  18852. }
  18853. case "SWITCH_TO_CLOUD":
  18854. break;
  18855. default:
  18856. {
  18857. var _e32 = "\u68C0\u6D4B\u672C\u5730\u8C03\u8BD5\u670D\u52A1\u51FA\u73B0\u9519\u8BEF\uFF1A".concat(s, "\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u73AF\u5883\u6216\u91CD\u542F\u5BA2\u6237\u7AEF\u518D\u8BD5");
  18858. throw console.error(_e32), new Error(_e32);
  18859. }
  18860. }
  18861. return _this26._callCloudFunction({
  18862. name: e,
  18863. data: t
  18864. });
  18865. }
  18866. return new Promise(function (e, n) {
  18867. var s = kt.call(_this26, {
  18868. data: t
  18869. });
  18870. se.request({
  18871. method: "POST",
  18872. url: a,
  18873. data: {
  18874. provider: r,
  18875. platform: P,
  18876. param: s
  18877. },
  18878. success: function success() {
  18879. var _ref64 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18880. t = _ref64.statusCode,
  18881. s = _ref64.data;
  18882. return !t || t >= 400 ? n(new ne({
  18883. code: s.code || "SYS_ERR",
  18884. message: s.message || "request:fail"
  18885. })) : e({
  18886. result: s
  18887. });
  18888. },
  18889. fail: function fail(e) {
  18890. n(new ne({
  18891. code: e.code || e.errCode || "SYS_ERR",
  18892. message: e.message || e.errMsg || "request:fail"
  18893. }));
  18894. }
  18895. });
  18896. });
  18897. }));
  18898. case 5:
  18899. case "end":
  18900. return _context54.stop();
  18901. }
  18902. }
  18903. }, _callee54, this);
  18904. }));
  18905. return _Ct.apply(this, arguments);
  18906. }
  18907. var Tt = [{
  18908. rule: /fc_function_not_found|FUNCTION_NOT_FOUND/,
  18909. content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间",
  18910. mode: "append"
  18911. }];
  18912. var Pt = /[\\^$.*+?()[\]{}|]/g,
  18913. At = RegExp(Pt.source);
  18914. function Et(e, t, n) {
  18915. return e.replace(new RegExp((s = t) && At.test(s) ? s.replace(Pt, "\\$&") : s, "g"), n);
  18916. var s;
  18917. }
  18918. var Ot = "none",
  18919. xt = "request",
  18920. Rt = "response",
  18921. Ut = "both";
  18922. var Lt = /*#__PURE__*/function () {
  18923. function Lt() {
  18924. var _ref19 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  18925. e = _ref19.secretType,
  18926. t = _ref19.uniCloudIns;
  18927. (0, _classCallCheck2.default)(this, Lt);
  18928. this.clientType = "", this.secretType = e || Ot, this.uniCloudIns = t;
  18929. var _this$uniCloudIns$con = this.uniCloudIns.config,
  18930. n = _this$uniCloudIns$con.provider,
  18931. s = _this$uniCloudIns$con.spaceId;
  18932. var r;
  18933. this.provider = n, this.spaceId = s, this.scopedGlobalCache = (r = this.uniCloudIns, U("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", r.config.spaceId)));
  18934. }
  18935. (0, _createClass2.default)(Lt, [{
  18936. key: "getSystemInfo",
  18937. value: function getSystemInfo() {
  18938. return this._systemInfo || (this._systemInfo = ce()), this._systemInfo;
  18939. }
  18940. }, {
  18941. key: "appId",
  18942. get: function get() {
  18943. return this.getSystemInfo().appId;
  18944. }
  18945. }, {
  18946. key: "deviceId",
  18947. get: function get() {
  18948. return this.getSystemInfo().deviceId;
  18949. }
  18950. }, {
  18951. key: "encryptData",
  18952. value: function () {
  18953. var _encryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(e) {
  18954. return _regenerator.default.wrap(function _callee34$(_context34) {
  18955. while (1) {
  18956. switch (_context34.prev = _context34.next) {
  18957. case 0:
  18958. return _context34.abrupt("return", this.secretType === Ot ? e : this.platformEncryptData(e));
  18959. case 1:
  18960. case "end":
  18961. return _context34.stop();
  18962. }
  18963. }
  18964. }, _callee34, this);
  18965. }));
  18966. function encryptData(_x31) {
  18967. return _encryptData.apply(this, arguments);
  18968. }
  18969. return encryptData;
  18970. }()
  18971. }, {
  18972. key: "decryptResult",
  18973. value: function () {
  18974. var _decryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35(e) {
  18975. var _ref20, t, n;
  18976. return _regenerator.default.wrap(function _callee35$(_context35) {
  18977. while (1) {
  18978. switch (_context35.prev = _context35.next) {
  18979. case 0:
  18980. if (!(this.secretType === Ot)) {
  18981. _context35.next = 2;
  18982. break;
  18983. }
  18984. return _context35.abrupt("return", e);
  18985. case 2:
  18986. _ref20 = e || {}, t = _ref20.errCode, n = _ref20.content;
  18987. return _context35.abrupt("return", t || !n ? e : this.secretType === xt ? n : this.platformDecryptResult(e));
  18988. case 4:
  18989. case "end":
  18990. return _context35.stop();
  18991. }
  18992. }
  18993. }, _callee35, this);
  18994. }));
  18995. function decryptResult(_x32) {
  18996. return _decryptResult.apply(this, arguments);
  18997. }
  18998. return decryptResult;
  18999. }()
  19000. }, {
  19001. key: "wrapVerifyClientCallFunction",
  19002. value: function wrapVerifyClientCallFunction(e) {
  19003. var t = this;
  19004. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
  19005. var _ref22,
  19006. n,
  19007. _ref22$data,
  19008. s,
  19009. r,
  19010. _args36 = arguments;
  19011. return _regenerator.default.wrap(function _callee36$(_context36) {
  19012. while (1) {
  19013. switch (_context36.prev = _context36.next) {
  19014. case 0:
  19015. _ref22 = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {}, n = _ref22.name, _ref22$data = _ref22.data, s = _ref22$data === void 0 ? {} : _ref22$data;
  19016. _context36.next = 3;
  19017. return t.prepare();
  19018. case 3:
  19019. _context36.next = 5;
  19020. return t.platformGetSignOption();
  19021. case 5:
  19022. (s = JSON.parse(JSON.stringify(s)))._uniCloudOptions = _context36.sent;
  19023. _context36.next = 8;
  19024. return e({
  19025. name: n,
  19026. data: s
  19027. });
  19028. case 8:
  19029. r = _context36.sent;
  19030. _context36.t0 = t.isClientKeyNotFound(r);
  19031. if (!_context36.t0) {
  19032. _context36.next = 19;
  19033. break;
  19034. }
  19035. _context36.next = 13;
  19036. return t.prepare({
  19037. forceUpdate: !0
  19038. });
  19039. case 13:
  19040. _context36.next = 15;
  19041. return t.platformGetSignOption();
  19042. case 15:
  19043. s._uniCloudOptions = _context36.sent;
  19044. _context36.next = 18;
  19045. return e({
  19046. name: n,
  19047. data: s
  19048. });
  19049. case 18:
  19050. r = _context36.sent;
  19051. case 19:
  19052. return _context36.abrupt("return", r);
  19053. case 20:
  19054. case "end":
  19055. return _context36.stop();
  19056. }
  19057. }
  19058. }, _callee36);
  19059. }));
  19060. }
  19061. }, {
  19062. key: "wrapEncryptDataCallFunction",
  19063. value: function wrapEncryptDataCallFunction(e) {
  19064. var t = this;
  19065. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
  19066. var _ref24,
  19067. n,
  19068. _ref24$data,
  19069. s,
  19070. r,
  19071. i,
  19072. _r3,
  19073. _args37 = arguments;
  19074. return _regenerator.default.wrap(function _callee37$(_context37) {
  19075. while (1) {
  19076. switch (_context37.prev = _context37.next) {
  19077. case 0:
  19078. _ref24 = _args37.length > 0 && _args37[0] !== undefined ? _args37[0] : {}, n = _ref24.name, _ref24$data = _ref24.data, s = _ref24$data === void 0 ? {} : _ref24$data;
  19079. _context37.next = 3;
  19080. return t.prepare();
  19081. case 3:
  19082. _context37.next = 5;
  19083. return t.encryptData(s);
  19084. case 5:
  19085. r = _context37.sent;
  19086. _context37.next = 8;
  19087. return e({
  19088. name: n,
  19089. data: r
  19090. });
  19091. case 8:
  19092. i = _context37.sent;
  19093. if (!t.isClientKeyNotFound(i)) {
  19094. _context37.next = 21;
  19095. break;
  19096. }
  19097. _context37.next = 12;
  19098. return t.prepare({
  19099. forceUpdate: !0
  19100. });
  19101. case 12:
  19102. _context37.next = 14;
  19103. return t.encryptData(s);
  19104. case 14:
  19105. _r3 = _context37.sent;
  19106. _context37.next = 17;
  19107. return t.platformGetSignOption();
  19108. case 17:
  19109. s._uniCloudOptions = _context37.sent;
  19110. _context37.next = 20;
  19111. return e({
  19112. name: n,
  19113. data: _r3
  19114. });
  19115. case 20:
  19116. i = _context37.sent;
  19117. case 21:
  19118. _context37.next = 23;
  19119. return t.decryptResult(i.result);
  19120. case 23:
  19121. i.result = _context37.sent;
  19122. return _context37.abrupt("return", i);
  19123. case 25:
  19124. case "end":
  19125. return _context37.stop();
  19126. }
  19127. }
  19128. }, _callee37);
  19129. }));
  19130. }
  19131. }]);
  19132. return Lt;
  19133. }();
  19134. /*! MIT License. Copyright 2015-2018 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
  19135. function Nt(e) {
  19136. return parseInt(e) === e;
  19137. }
  19138. function Dt(e) {
  19139. if (!Nt(e.length)) return !1;
  19140. for (var t = 0; t < e.length; t++) {
  19141. if (!Nt(e[t]) || e[t] < 0 || e[t] > 255) return !1;
  19142. }
  19143. return !0;
  19144. }
  19145. function Ft(e, t) {
  19146. if (e.buffer && "Uint8Array" === e.name) return t && (e = e.slice ? e.slice() : Array.prototype.slice.call(e)), e;
  19147. if (Array.isArray(e)) {
  19148. if (!Dt(e)) throw new Error("Array contains invalid value: " + e);
  19149. return new Uint8Array(e);
  19150. }
  19151. if (Nt(e.length) && Dt(e)) return new Uint8Array(e);
  19152. throw new Error("unsupported array-like object");
  19153. }
  19154. function qt(e) {
  19155. return new Uint8Array(e);
  19156. }
  19157. function Mt(e, t, n, s, r) {
  19158. null == s && null == r || (e = e.slice ? e.slice(s, r) : Array.prototype.slice.call(e, s, r)), t.set(e, n);
  19159. }
  19160. var Kt,
  19161. jt = {
  19162. toBytes: function toBytes(e) {
  19163. var t = [],
  19164. n = 0;
  19165. for (e = encodeURI(e); n < e.length;) {
  19166. var s = e.charCodeAt(n++);
  19167. 37 === s ? (t.push(parseInt(e.substr(n, 2), 16)), n += 2) : t.push(s);
  19168. }
  19169. return Ft(t);
  19170. },
  19171. fromBytes: function fromBytes(e) {
  19172. for (var t = [], n = 0; n < e.length;) {
  19173. var s = e[n];
  19174. s < 128 ? (t.push(String.fromCharCode(s)), n++) : s > 191 && s < 224 ? (t.push(String.fromCharCode((31 & s) << 6 | 63 & e[n + 1])), n += 2) : (t.push(String.fromCharCode((15 & s) << 12 | (63 & e[n + 1]) << 6 | 63 & e[n + 2])), n += 3);
  19175. }
  19176. return t.join("");
  19177. }
  19178. },
  19179. Bt = (Kt = "0123456789abcdef", {
  19180. toBytes: function toBytes(e) {
  19181. for (var t = [], n = 0; n < e.length; n += 2) {
  19182. t.push(parseInt(e.substr(n, 2), 16));
  19183. }
  19184. return t;
  19185. },
  19186. fromBytes: function fromBytes(e) {
  19187. for (var t = [], n = 0; n < e.length; n++) {
  19188. var s = e[n];
  19189. t.push(Kt[(240 & s) >> 4] + Kt[15 & s]);
  19190. }
  19191. return t.join("");
  19192. }
  19193. }),
  19194. $t = {
  19195. 16: 10,
  19196. 24: 12,
  19197. 32: 14
  19198. },
  19199. Wt = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145],
  19200. zt = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22],
  19201. Jt = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125],
  19202. Ht = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986],
  19203. Gt = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766],
  19204. Vt = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126],
  19205. Yt = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436],
  19206. Qt = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890],
  19207. Xt = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935],
  19208. Zt = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600],
  19209. en = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480],
  19210. tn = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795],
  19211. nn = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855],
  19212. sn = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150],
  19213. rn = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
  19214. function on(e) {
  19215. for (var t = [], n = 0; n < e.length; n += 4) {
  19216. t.push(e[n] << 24 | e[n + 1] << 16 | e[n + 2] << 8 | e[n + 3]);
  19217. }
  19218. return t;
  19219. }
  19220. var an = /*#__PURE__*/function () {
  19221. function an(e) {
  19222. (0, _classCallCheck2.default)(this, an);
  19223. if (!(this instanceof an)) throw Error("AES must be instanitated with `new`");
  19224. Object.defineProperty(this, "key", {
  19225. value: Ft(e, !0)
  19226. }), this._prepare();
  19227. }
  19228. (0, _createClass2.default)(an, [{
  19229. key: "_prepare",
  19230. value: function _prepare() {
  19231. var e = $t[this.key.length];
  19232. if (null == e) throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
  19233. this._Ke = [], this._Kd = [];
  19234. for (var t = 0; t <= e; t++) {
  19235. this._Ke.push([0, 0, 0, 0]), this._Kd.push([0, 0, 0, 0]);
  19236. }
  19237. var n,
  19238. s = 4 * (e + 1),
  19239. r = this.key.length / 4,
  19240. i = on(this.key);
  19241. for (t = 0; t < r; t++) {
  19242. n = t >> 2, this._Ke[n][t % 4] = i[t], this._Kd[e - n][t % 4] = i[t];
  19243. }
  19244. for (var o, a = 0, c = r; c < s;) {
  19245. if (o = i[r - 1], i[0] ^= zt[o >> 16 & 255] << 24 ^ zt[o >> 8 & 255] << 16 ^ zt[255 & o] << 8 ^ zt[o >> 24 & 255] ^ Wt[a] << 24, a += 1, 8 != r) for (t = 1; t < r; t++) {
  19246. i[t] ^= i[t - 1];
  19247. } else {
  19248. for (t = 1; t < r / 2; t++) {
  19249. i[t] ^= i[t - 1];
  19250. }
  19251. o = i[r / 2 - 1], i[r / 2] ^= zt[255 & o] ^ zt[o >> 8 & 255] << 8 ^ zt[o >> 16 & 255] << 16 ^ zt[o >> 24 & 255] << 24;
  19252. for (t = r / 2 + 1; t < r; t++) {
  19253. i[t] ^= i[t - 1];
  19254. }
  19255. }
  19256. for (t = 0; t < r && c < s;) {
  19257. u = c >> 2, h = c % 4, this._Ke[u][h] = i[t], this._Kd[e - u][h] = i[t++], c++;
  19258. }
  19259. }
  19260. for (var u = 1; u < e; u++) {
  19261. for (var h = 0; h < 4; h++) {
  19262. o = this._Kd[u][h], this._Kd[u][h] = tn[o >> 24 & 255] ^ nn[o >> 16 & 255] ^ sn[o >> 8 & 255] ^ rn[255 & o];
  19263. }
  19264. }
  19265. }
  19266. }, {
  19267. key: "encrypt",
  19268. value: function encrypt(e) {
  19269. if (16 != e.length) throw new Error("invalid plaintext size (must be 16 bytes)");
  19270. for (var t = this._Ke.length - 1, n = [0, 0, 0, 0], s = on(e), r = 0; r < 4; r++) {
  19271. s[r] ^= this._Ke[0][r];
  19272. }
  19273. for (var i = 1; i < t; i++) {
  19274. for (r = 0; r < 4; r++) {
  19275. n[r] = Ht[s[r] >> 24 & 255] ^ Gt[s[(r + 1) % 4] >> 16 & 255] ^ Vt[s[(r + 2) % 4] >> 8 & 255] ^ Yt[255 & s[(r + 3) % 4]] ^ this._Ke[i][r];
  19276. }
  19277. s = n.slice();
  19278. }
  19279. var o,
  19280. a = qt(16);
  19281. for (r = 0; r < 4; r++) {
  19282. o = this._Ke[t][r], a[4 * r] = 255 & (zt[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (zt[s[(r + 1) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (zt[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (zt[255 & s[(r + 3) % 4]] ^ o);
  19283. }
  19284. return a;
  19285. }
  19286. }, {
  19287. key: "decrypt",
  19288. value: function decrypt(e) {
  19289. if (16 != e.length) throw new Error("invalid ciphertext size (must be 16 bytes)");
  19290. for (var t = this._Kd.length - 1, n = [0, 0, 0, 0], s = on(e), r = 0; r < 4; r++) {
  19291. s[r] ^= this._Kd[0][r];
  19292. }
  19293. for (var i = 1; i < t; i++) {
  19294. for (r = 0; r < 4; r++) {
  19295. n[r] = Qt[s[r] >> 24 & 255] ^ Xt[s[(r + 3) % 4] >> 16 & 255] ^ Zt[s[(r + 2) % 4] >> 8 & 255] ^ en[255 & s[(r + 1) % 4]] ^ this._Kd[i][r];
  19296. }
  19297. s = n.slice();
  19298. }
  19299. var o,
  19300. a = qt(16);
  19301. for (r = 0; r < 4; r++) {
  19302. o = this._Kd[t][r], a[4 * r] = 255 & (Jt[s[r] >> 24 & 255] ^ o >> 24), a[4 * r + 1] = 255 & (Jt[s[(r + 3) % 4] >> 16 & 255] ^ o >> 16), a[4 * r + 2] = 255 & (Jt[s[(r + 2) % 4] >> 8 & 255] ^ o >> 8), a[4 * r + 3] = 255 & (Jt[255 & s[(r + 1) % 4]] ^ o);
  19303. }
  19304. return a;
  19305. }
  19306. }]);
  19307. return an;
  19308. }();
  19309. var cn = /*#__PURE__*/function () {
  19310. function cn(e) {
  19311. (0, _classCallCheck2.default)(this, cn);
  19312. if (!(this instanceof cn)) throw Error("AES must be instanitated with `new`");
  19313. this.description = "Electronic Code Block", this.name = "ecb", this._aes = new an(e);
  19314. }
  19315. (0, _createClass2.default)(cn, [{
  19316. key: "encrypt",
  19317. value: function encrypt(e) {
  19318. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  19319. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19320. Mt(e, n, 0, s, s + 16), Mt(n = this._aes.encrypt(n), t, s);
  19321. }
  19322. return t;
  19323. }
  19324. }, {
  19325. key: "decrypt",
  19326. value: function decrypt(e) {
  19327. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  19328. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19329. Mt(e, n, 0, s, s + 16), Mt(n = this._aes.decrypt(n), t, s);
  19330. }
  19331. return t;
  19332. }
  19333. }]);
  19334. return cn;
  19335. }();
  19336. var un = /*#__PURE__*/function () {
  19337. function un(e, t) {
  19338. (0, _classCallCheck2.default)(this, un);
  19339. if (!(this instanceof un)) throw Error("AES must be instanitated with `new`");
  19340. if (this.description = "Cipher Block Chaining", this.name = "cbc", t) {
  19341. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  19342. } else t = qt(16);
  19343. this._lastCipherblock = Ft(t, !0), this._aes = new an(e);
  19344. }
  19345. (0, _createClass2.default)(un, [{
  19346. key: "encrypt",
  19347. value: function encrypt(e) {
  19348. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
  19349. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19350. Mt(e, n, 0, s, s + 16);
  19351. for (var r = 0; r < 16; r++) {
  19352. n[r] ^= this._lastCipherblock[r];
  19353. }
  19354. this._lastCipherblock = this._aes.encrypt(n), Mt(this._lastCipherblock, t, s);
  19355. }
  19356. return t;
  19357. }
  19358. }, {
  19359. key: "decrypt",
  19360. value: function decrypt(e) {
  19361. if ((e = Ft(e)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
  19362. for (var t = qt(e.length), n = qt(16), s = 0; s < e.length; s += 16) {
  19363. Mt(e, n, 0, s, s + 16), n = this._aes.decrypt(n);
  19364. for (var r = 0; r < 16; r++) {
  19365. t[s + r] = n[r] ^ this._lastCipherblock[r];
  19366. }
  19367. Mt(e, this._lastCipherblock, 0, s, s + 16);
  19368. }
  19369. return t;
  19370. }
  19371. }]);
  19372. return un;
  19373. }();
  19374. var hn = /*#__PURE__*/function () {
  19375. function hn(e, t, n) {
  19376. (0, _classCallCheck2.default)(this, hn);
  19377. if (!(this instanceof hn)) throw Error("AES must be instanitated with `new`");
  19378. if (this.description = "Cipher Feedback", this.name = "cfb", t) {
  19379. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 size)");
  19380. } else t = qt(16);
  19381. n || (n = 1), this.segmentSize = n, this._shiftRegister = Ft(t, !0), this._aes = new an(e);
  19382. }
  19383. (0, _createClass2.default)(hn, [{
  19384. key: "encrypt",
  19385. value: function encrypt(e) {
  19386. if (e.length % this.segmentSize != 0) throw new Error("invalid plaintext size (must be segmentSize bytes)");
  19387. for (var t, n = Ft(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  19388. t = this._aes.encrypt(this._shiftRegister);
  19389. for (var r = 0; r < this.segmentSize; r++) {
  19390. n[s + r] ^= t[r];
  19391. }
  19392. Mt(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), Mt(n, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  19393. }
  19394. return n;
  19395. }
  19396. }, {
  19397. key: "decrypt",
  19398. value: function decrypt(e) {
  19399. if (e.length % this.segmentSize != 0) throw new Error("invalid ciphertext size (must be segmentSize bytes)");
  19400. for (var t, n = Ft(e, !0), s = 0; s < n.length; s += this.segmentSize) {
  19401. t = this._aes.encrypt(this._shiftRegister);
  19402. for (var r = 0; r < this.segmentSize; r++) {
  19403. n[s + r] ^= t[r];
  19404. }
  19405. Mt(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), Mt(e, this._shiftRegister, 16 - this.segmentSize, s, s + this.segmentSize);
  19406. }
  19407. return n;
  19408. }
  19409. }]);
  19410. return hn;
  19411. }();
  19412. var ln = /*#__PURE__*/function () {
  19413. function ln(e, t) {
  19414. (0, _classCallCheck2.default)(this, ln);
  19415. if (!(this instanceof ln)) throw Error("AES must be instanitated with `new`");
  19416. if (this.description = "Output Feedback", this.name = "ofb", t) {
  19417. if (16 != t.length) throw new Error("invalid initialation vector size (must be 16 bytes)");
  19418. } else t = qt(16);
  19419. this._lastPrecipher = Ft(t, !0), this._lastPrecipherIndex = 16, this._aes = new an(e);
  19420. }
  19421. (0, _createClass2.default)(ln, [{
  19422. key: "encrypt",
  19423. value: function encrypt(e) {
  19424. for (var t = Ft(e, !0), n = 0; n < t.length; n++) {
  19425. 16 === this._lastPrecipherIndex && (this._lastPrecipher = this._aes.encrypt(this._lastPrecipher), this._lastPrecipherIndex = 0), t[n] ^= this._lastPrecipher[this._lastPrecipherIndex++];
  19426. }
  19427. return t;
  19428. }
  19429. }, {
  19430. key: "decrypt",
  19431. value: function decrypt(e) {
  19432. return this.encrypt(e);
  19433. }
  19434. }]);
  19435. return ln;
  19436. }();
  19437. var dn = /*#__PURE__*/function () {
  19438. function dn(e) {
  19439. (0, _classCallCheck2.default)(this, dn);
  19440. if (!(this instanceof dn)) throw Error("Counter must be instanitated with `new`");
  19441. 0 === e || e || (e = 1), "number" == typeof e ? (this._counter = qt(16), this.setValue(e)) : this.setBytes(e);
  19442. }
  19443. (0, _createClass2.default)(dn, [{
  19444. key: "setValue",
  19445. value: function setValue(e) {
  19446. if ("number" != typeof e || parseInt(e) != e) throw new Error("invalid counter value (must be an integer)");
  19447. if (e > Number.MAX_SAFE_INTEGER) throw new Error("integer value out of safe range");
  19448. for (var t = 15; t >= 0; --t) {
  19449. this._counter[t] = e % 256, e = parseInt(e / 256);
  19450. }
  19451. }
  19452. }, {
  19453. key: "setBytes",
  19454. value: function setBytes(e) {
  19455. if (16 != (e = Ft(e, !0)).length) throw new Error("invalid counter bytes size (must be 16 bytes)");
  19456. this._counter = e;
  19457. }
  19458. }, {
  19459. key: "increment",
  19460. value: function increment() {
  19461. for (var e = 15; e >= 0; e--) {
  19462. if (255 !== this._counter[e]) {
  19463. this._counter[e]++;
  19464. break;
  19465. }
  19466. this._counter[e] = 0;
  19467. }
  19468. }
  19469. }]);
  19470. return dn;
  19471. }();
  19472. var pn = /*#__PURE__*/function () {
  19473. function pn(e, t) {
  19474. (0, _classCallCheck2.default)(this, pn);
  19475. if (!(this instanceof pn)) throw Error("AES must be instanitated with `new`");
  19476. this.description = "Counter", this.name = "ctr", t instanceof dn || (t = new dn(t)), this._counter = t, this._remainingCounter = null, this._remainingCounterIndex = 16, this._aes = new an(e);
  19477. }
  19478. (0, _createClass2.default)(pn, [{
  19479. key: "encrypt",
  19480. value: function encrypt(e) {
  19481. for (var t = Ft(e, !0), n = 0; n < t.length; n++) {
  19482. 16 === this._remainingCounterIndex && (this._remainingCounter = this._aes.encrypt(this._counter._counter), this._remainingCounterIndex = 0, this._counter.increment()), t[n] ^= this._remainingCounter[this._remainingCounterIndex++];
  19483. }
  19484. return t;
  19485. }
  19486. }, {
  19487. key: "decrypt",
  19488. value: function decrypt(e) {
  19489. return this.encrypt(e);
  19490. }
  19491. }]);
  19492. return pn;
  19493. }();
  19494. var fn = {
  19495. AES: an,
  19496. Counter: dn,
  19497. ModeOfOperation: {
  19498. ecb: cn,
  19499. cbc: un,
  19500. cfb: hn,
  19501. ofb: ln,
  19502. ctr: pn
  19503. },
  19504. utils: {
  19505. hex: Bt,
  19506. utf8: jt
  19507. },
  19508. padding: {
  19509. pkcs7: {
  19510. pad: function pad(e) {
  19511. var t = 16 - (e = Ft(e, !0)).length % 16,
  19512. n = qt(e.length + t);
  19513. Mt(e, n);
  19514. for (var s = e.length; s < n.length; s++) {
  19515. n[s] = t;
  19516. }
  19517. return n;
  19518. },
  19519. strip: function strip(e) {
  19520. if ((e = Ft(e, !0)).length < 16) throw new Error("PKCS#7 invalid length");
  19521. var t = e[e.length - 1];
  19522. if (t > 16) throw new Error("PKCS#7 padding byte out of range");
  19523. for (var n = e.length - t, s = 0; s < t; s++) {
  19524. if (e[n + s] !== t) throw new Error("PKCS#7 invalid padding byte");
  19525. }
  19526. var r = qt(n);
  19527. return Mt(e, r, 0, 0, n), r;
  19528. }
  19529. }
  19530. },
  19531. _arrayTest: {
  19532. coerceArray: Ft,
  19533. createArray: qt,
  19534. copyArray: Mt
  19535. }
  19536. };
  19537. function gn(e, t, n) {
  19538. var s = new Uint8Array(uni.base64ToArrayBuffer(t)),
  19539. r = fn.utils.utf8.toBytes(n),
  19540. i = fn.utils.utf8.toBytes(e),
  19541. o = new fn.ModeOfOperation.cbc(s, r),
  19542. a = fn.padding.pkcs7.pad(i),
  19543. c = o.encrypt(a);
  19544. return uni.arrayBufferToBase64(c);
  19545. }
  19546. var mn = {
  19547. code: 2e4,
  19548. message: "System error"
  19549. },
  19550. yn = {
  19551. code: 20101,
  19552. message: "Invalid client"
  19553. },
  19554. _n = {
  19555. code: 20102,
  19556. message: "Get encrypt key failed"
  19557. },
  19558. wn = {
  19559. 10001: "Secure network is not supported on current playground or unimpsdk",
  19560. 10003: "Config missing in current app. If the problem pesist, please contact DCloud.",
  19561. 10009: "Encrypt payload failed",
  19562. 10010: "Decrypt response failed"
  19563. };
  19564. function vn(e) {
  19565. var _ref25 = e || {},
  19566. t = _ref25.errSubject,
  19567. n = _ref25.subject,
  19568. s = _ref25.errCode,
  19569. r = _ref25.errMsg,
  19570. i = _ref25.code,
  19571. o = _ref25.message,
  19572. a = _ref25.cause;
  19573. return new ne({
  19574. subject: t || n || "uni-secure-network",
  19575. code: s || i || mn.code,
  19576. message: r || o,
  19577. cause: a
  19578. });
  19579. }
  19580. var In,
  19581. Sn,
  19582. bn = null;
  19583. var kn = /*#__PURE__*/function (_Lt) {
  19584. (0, _inherits2.default)(kn, _Lt);
  19585. var _super9 = _createSuper(kn);
  19586. function kn(e) {
  19587. var _this14;
  19588. (0, _classCallCheck2.default)(this, kn);
  19589. _this14 = _super9.call(this, e), _this14.clientType = "mp-weixin", _this14.userEncryptKey = null;
  19590. return _this14;
  19591. }
  19592. (0, _createClass2.default)(kn, [{
  19593. key: "isLogin",
  19594. value: function isLogin() {
  19595. return !!this.scopedGlobalCache.mpWeixinCode || !!this.scopedGlobalCache.mpWeixinOpenid;
  19596. }
  19597. }, {
  19598. key: "prepare",
  19599. value: function () {
  19600. var _prepare2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
  19601. return _regenerator.default.wrap(function _callee38$(_context38) {
  19602. while (1) {
  19603. switch (_context38.prev = _context38.next) {
  19604. case 0:
  19605. if (this.isLogin()) {
  19606. _context38.next = 7;
  19607. break;
  19608. }
  19609. if (this.scopedGlobalCache.initPromise) {
  19610. _context38.next = 3;
  19611. break;
  19612. }
  19613. throw new Error("`uniCloud.initSecureNetworkByWeixin` has not yet been called");
  19614. case 3:
  19615. _context38.next = 5;
  19616. return this.scopedGlobalCache.initPromise;
  19617. case 5:
  19618. if (this.isLogin()) {
  19619. _context38.next = 7;
  19620. break;
  19621. }
  19622. throw new Error("uniCloud.initSecureNetworkByWeixin` has not yet been called or successfully excuted");
  19623. case 7:
  19624. case "end":
  19625. return _context38.stop();
  19626. }
  19627. }
  19628. }, _callee38, this);
  19629. }));
  19630. function prepare() {
  19631. return _prepare2.apply(this, arguments);
  19632. }
  19633. return prepare;
  19634. }()
  19635. }, {
  19636. key: "getUserEncryptKey",
  19637. value: function () {
  19638. var _getUserEncryptKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
  19639. var _this15 = this;
  19640. var e;
  19641. return _regenerator.default.wrap(function _callee39$(_context39) {
  19642. while (1) {
  19643. switch (_context39.prev = _context39.next) {
  19644. case 0:
  19645. if (!this.userEncryptKey) {
  19646. _context39.next = 2;
  19647. break;
  19648. }
  19649. return _context39.abrupt("return", this.userEncryptKey);
  19650. case 2:
  19651. if (!(bn && bn.expireTime)) {
  19652. _context39.next = 6;
  19653. break;
  19654. }
  19655. e = Date.now();
  19656. if (!(bn.expireTime - e > 0)) {
  19657. _context39.next = 6;
  19658. break;
  19659. }
  19660. return _context39.abrupt("return", (this.userEncryptKey = bn, this.userEncryptKey));
  19661. case 6:
  19662. return _context39.abrupt("return", new Promise(function (e, t) {
  19663. uni.getUserCryptoManager().getLatestUserKey({
  19664. success: function success(t) {
  19665. bn = t, _this15.userEncryptKey = t, e(_this15.userEncryptKey);
  19666. },
  19667. fail: function fail(e) {
  19668. t(vn(_objectSpread(_objectSpread({}, _n), {}, {
  19669. cause: e
  19670. })));
  19671. }
  19672. });
  19673. }));
  19674. case 7:
  19675. case "end":
  19676. return _context39.stop();
  19677. }
  19678. }
  19679. }, _callee39, this);
  19680. }));
  19681. function getUserEncryptKey() {
  19682. return _getUserEncryptKey.apply(this, arguments);
  19683. }
  19684. return getUserEncryptKey;
  19685. }()
  19686. }, {
  19687. key: "getWxAppId",
  19688. value: function getWxAppId() {
  19689. return wx.getAccountInfoSync().miniProgram.appId;
  19690. }
  19691. }, {
  19692. key: "platformGetSignOption",
  19693. value: function () {
  19694. var _platformGetSignOption = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
  19695. var _yield$this$getUserEn, e, t, n;
  19696. return _regenerator.default.wrap(function _callee40$(_context40) {
  19697. while (1) {
  19698. switch (_context40.prev = _context40.next) {
  19699. case 0:
  19700. _context40.next = 2;
  19701. return this.getUserEncryptKey();
  19702. case 2:
  19703. _yield$this$getUserEn = _context40.sent;
  19704. e = _yield$this$getUserEn.encryptKey;
  19705. t = _yield$this$getUserEn.iv;
  19706. n = _yield$this$getUserEn.version;
  19707. return _context40.abrupt("return", {
  19708. verifyClientSign: gn(JSON.stringify({
  19709. data: JSON.stringify({}),
  19710. appId: this.appId,
  19711. deviceId: this.deviceId,
  19712. wxAppId: this.getWxAppId(),
  19713. simulator: "devtools" === ce().platform,
  19714. timestamp: Date.now()
  19715. }), e, t),
  19716. encryptKeyId: n,
  19717. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  19718. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  19719. });
  19720. case 7:
  19721. case "end":
  19722. return _context40.stop();
  19723. }
  19724. }
  19725. }, _callee40, this);
  19726. }));
  19727. function platformGetSignOption() {
  19728. return _platformGetSignOption.apply(this, arguments);
  19729. }
  19730. return platformGetSignOption;
  19731. }()
  19732. }, {
  19733. key: "platformEncryptData",
  19734. value: function () {
  19735. var _platformEncryptData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41(e) {
  19736. var _yield$this$getUserEn2, t, n, s, r;
  19737. return _regenerator.default.wrap(function _callee41$(_context41) {
  19738. while (1) {
  19739. switch (_context41.prev = _context41.next) {
  19740. case 0:
  19741. _context41.next = 2;
  19742. return this.getUserEncryptKey();
  19743. case 2:
  19744. _yield$this$getUserEn2 = _context41.sent;
  19745. t = _yield$this$getUserEn2.encryptKey;
  19746. n = _yield$this$getUserEn2.iv;
  19747. s = _yield$this$getUserEn2.version;
  19748. r = {
  19749. secretType: this.secretType,
  19750. encryptKeyId: s,
  19751. mpWeixinCode: this.scopedGlobalCache.mpWeixinCode,
  19752. mpWeixinOpenid: this.scopedGlobalCache.mpWeixinOpenid
  19753. };
  19754. return _context41.abrupt("return", this.secretType === Rt ? {
  19755. content: e,
  19756. _uniCloudOptions: r
  19757. } : {
  19758. content: gn(JSON.stringify({
  19759. data: JSON.stringify(e),
  19760. appId: this.appId,
  19761. deviceId: this.deviceId,
  19762. wxAppId: this.getWxAppId(),
  19763. simulator: "devtools" === ce().platform,
  19764. timestamp: Date.now()
  19765. }), t, n),
  19766. _uniCloudOptions: r
  19767. });
  19768. case 8:
  19769. case "end":
  19770. return _context41.stop();
  19771. }
  19772. }
  19773. }, _callee41, this);
  19774. }));
  19775. function platformEncryptData(_x33) {
  19776. return _platformEncryptData.apply(this, arguments);
  19777. }
  19778. return platformEncryptData;
  19779. }()
  19780. }, {
  19781. key: "platformDecryptResult",
  19782. value: function () {
  19783. var _platformDecryptResult = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(e) {
  19784. var t, _yield$this$getUserEn3, n, s;
  19785. return _regenerator.default.wrap(function _callee42$(_context42) {
  19786. while (1) {
  19787. switch (_context42.prev = _context42.next) {
  19788. case 0:
  19789. t = e.content;
  19790. _context42.next = 3;
  19791. return this.getUserEncryptKey();
  19792. case 3:
  19793. _yield$this$getUserEn3 = _context42.sent;
  19794. n = _yield$this$getUserEn3.encryptKey;
  19795. s = _yield$this$getUserEn3.iv;
  19796. return _context42.abrupt("return", JSON.parse(function (e, t, n) {
  19797. var s = new Uint8Array(uni.base64ToArrayBuffer(e)),
  19798. r = new Uint8Array(uni.base64ToArrayBuffer(t)),
  19799. i = fn.utils.utf8.toBytes(n),
  19800. o = new fn.ModeOfOperation.cbc(r, i),
  19801. a = fn.padding.pkcs7.strip(o.decrypt(s));
  19802. return fn.utils.utf8.fromBytes(a);
  19803. }(t, n, s)));
  19804. case 7:
  19805. case "end":
  19806. return _context42.stop();
  19807. }
  19808. }
  19809. }, _callee42, this);
  19810. }));
  19811. function platformDecryptResult(_x34) {
  19812. return _platformDecryptResult.apply(this, arguments);
  19813. }
  19814. return platformDecryptResult;
  19815. }()
  19816. }, {
  19817. key: "isClientKeyNotFound",
  19818. value: function isClientKeyNotFound() {
  19819. return !1;
  19820. }
  19821. }]);
  19822. return kn;
  19823. }(Lt);
  19824. function Cn(e) {
  19825. var t = ["hasClientKey", "encryptGetClientKeyPayload", "setClientKey", "encrypt", "decrypt"],
  19826. n = {};
  19827. var _loop = function _loop(_s10) {
  19828. var r = t[_s10];
  19829. n[r] = function () {
  19830. for (var _len = arguments.length, t = new Array(_len), _key = 0; _key < _len; _key++) {
  19831. t[_key] = arguments[_key];
  19832. }
  19833. return new Promise(function (n, s) {
  19834. "function" == typeof e[r] ? e[r].apply(e, t.concat([function () {
  19835. var _ref26 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  19836. e = _ref26.type,
  19837. t = _ref26.data,
  19838. r = _ref26.errCode,
  19839. i = _ref26.errMsg,
  19840. o = _ref26.errSubject,
  19841. a = _ref26.message;
  19842. "success" === e ? n(t) : s(vn({
  19843. errCode: r,
  19844. errMsg: wn[r] || i || a,
  19845. errSubject: o
  19846. }));
  19847. }])) : s(vn({
  19848. message: "请检查manifest.json内是否开启安全网络模块,另外注意标准基座不支持安全网络模块"
  19849. }));
  19850. });
  19851. };
  19852. };
  19853. for (var _s10 = 0; _s10 < t.length; _s10++) {
  19854. _loop(_s10);
  19855. }
  19856. return n;
  19857. }
  19858. var Tn = /*#__PURE__*/function (_Lt2) {
  19859. (0, _inherits2.default)(Tn, _Lt2);
  19860. var _super10 = _createSuper(Tn);
  19861. function Tn(e) {
  19862. var _this16;
  19863. (0, _classCallCheck2.default)(this, Tn);
  19864. _this16 = _super10.call(this, e), _this16.clientType = "app", _this16.appUtils = _objectSpread({}, Cn(uni.requireNativePlugin("plus"))), _this16.systemInfo = In || (In = ce());
  19865. return _this16;
  19866. }
  19867. (0, _createClass2.default)(Tn, [{
  19868. key: "hasClientKey",
  19869. value: function () {
  19870. var _hasClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
  19871. return _regenerator.default.wrap(function _callee43$(_context43) {
  19872. while (1) {
  19873. switch (_context43.prev = _context43.next) {
  19874. case 0:
  19875. _context43.next = 2;
  19876. return this.appUtils.hasClientKey({
  19877. provider: this.provider,
  19878. spaceId: this.spaceId
  19879. });
  19880. case 2:
  19881. this._hasClientKey = _context43.sent;
  19882. return _context43.abrupt("return", this._hasClientKey);
  19883. case 4:
  19884. case "end":
  19885. return _context43.stop();
  19886. }
  19887. }
  19888. }, _callee43, this);
  19889. }));
  19890. function hasClientKey() {
  19891. return _hasClientKey.apply(this, arguments);
  19892. }
  19893. return hasClientKey;
  19894. }()
  19895. }, {
  19896. key: "getAppClientKey",
  19897. value: function () {
  19898. var _getAppClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44() {
  19899. var _yield$this$appUtils$, e, t, n, s, r;
  19900. return _regenerator.default.wrap(function _callee44$(_context44) {
  19901. while (1) {
  19902. switch (_context44.prev = _context44.next) {
  19903. case 0:
  19904. _context44.next = 2;
  19905. return this.appUtils.encryptGetClientKeyPayload({
  19906. data: JSON.stringify({})
  19907. });
  19908. case 2:
  19909. _yield$this$appUtils$ = _context44.sent;
  19910. e = _yield$this$appUtils$.data;
  19911. t = _yield$this$appUtils$.key;
  19912. _context44.next = 7;
  19913. return this.uniCloudIns.callFunction({
  19914. name: "DCloud-clientDB",
  19915. data: {
  19916. redirectTo: "encryption",
  19917. action: "getAppClientKey",
  19918. data: e,
  19919. key: t
  19920. }
  19921. });
  19922. case 7:
  19923. _context44.t0 = _context44.sent.result;
  19924. if (_context44.t0) {
  19925. _context44.next = 10;
  19926. break;
  19927. }
  19928. _context44.t0 = {};
  19929. case 10:
  19930. n = _context44.t0;
  19931. if (!(0 !== n.errCode)) {
  19932. _context44.next = 13;
  19933. break;
  19934. }
  19935. throw function (e) {
  19936. return new ne({
  19937. subject: e.errSubject || "uni-secure-network",
  19938. code: e.errCode || e.code || mn.code,
  19939. message: e.errMsg || e.message
  19940. });
  19941. }(n);
  19942. case 13:
  19943. s = n.clientKey, r = n.key;
  19944. _context44.next = 16;
  19945. return this.appUtils.setClientKey({
  19946. provider: this.provider,
  19947. spaceId: this.spaceId,
  19948. clientKey: s,
  19949. key: r
  19950. });
  19951. case 16:
  19952. case "end":
  19953. return _context44.stop();
  19954. }
  19955. }
  19956. }, _callee44, this);
  19957. }));
  19958. function getAppClientKey() {
  19959. return _getAppClientKey.apply(this, arguments);
  19960. }
  19961. return getAppClientKey;
  19962. }()
  19963. }, {
  19964. key: "ensureClientKey",
  19965. value: function () {
  19966. var _ensureClientKey = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
  19967. var _this17 = this;
  19968. var _ref27,
  19969. _ref27$forceUpdate,
  19970. e,
  19971. _args45 = arguments;
  19972. return _regenerator.default.wrap(function _callee45$(_context45) {
  19973. while (1) {
  19974. switch (_context45.prev = _context45.next) {
  19975. case 0:
  19976. _ref27 = _args45.length > 0 && _args45[0] !== undefined ? _args45[0] : {}, _ref27$forceUpdate = _ref27.forceUpdate, e = _ref27$forceUpdate === void 0 ? !1 : _ref27$forceUpdate;
  19977. _context45.t1 = !0;
  19978. _context45.next = 4;
  19979. return this.hasClientKey();
  19980. case 4:
  19981. _context45.t2 = _context45.sent;
  19982. _context45.t0 = _context45.t1 !== _context45.t2;
  19983. if (_context45.t0) {
  19984. _context45.next = 8;
  19985. break;
  19986. }
  19987. _context45.t0 = e;
  19988. case 8:
  19989. if (!_context45.t0) {
  19990. _context45.next = 10;
  19991. break;
  19992. }
  19993. return _context45.abrupt("return", (e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus === d || !e && this.scopedGlobalCache.initPromise && this.scopedGlobalCache.initStatus !== f || (this.scopedGlobalCache.initPromise = this.getAppClientKey(), this.scopedGlobalCache.initPromise.then(function (e) {
  19994. _this17.scopedGlobalCache.initStatus = p;
  19995. }).catch(function (e) {
  19996. throw _this17.scopedGlobalCache.initStatus = f, e;
  19997. }), this.scopedGlobalCache.initStatus = d), this.scopedGlobalCache.initPromise));
  19998. case 10:
  19999. case "end":
  20000. return _context45.stop();
  20001. }
  20002. }
  20003. }, _callee45, this);
  20004. }));
  20005. function ensureClientKey() {
  20006. return _ensureClientKey.apply(this, arguments);
  20007. }
  20008. return ensureClientKey;
  20009. }()
  20010. }, {
  20011. key: "prepare",
  20012. value: function () {
  20013. var _prepare3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46() {
  20014. var _ref28,
  20015. _ref28$forceUpdate,
  20016. e,
  20017. _args46 = arguments;
  20018. return _regenerator.default.wrap(function _callee46$(_context46) {
  20019. while (1) {
  20020. switch (_context46.prev = _context46.next) {
  20021. case 0:
  20022. _ref28 = _args46.length > 0 && _args46[0] !== undefined ? _args46[0] : {}, _ref28$forceUpdate = _ref28.forceUpdate, e = _ref28$forceUpdate === void 0 ? !1 : _ref28$forceUpdate;
  20023. _context46.next = 3;
  20024. return this.ensureClientKey({
  20025. forceUpdate: e
  20026. });
  20027. case 3:
  20028. case "end":
  20029. return _context46.stop();
  20030. }
  20031. }
  20032. }, _callee46, this);
  20033. }));
  20034. function prepare() {
  20035. return _prepare3.apply(this, arguments);
  20036. }
  20037. return prepare;
  20038. }()
  20039. }, {
  20040. key: "platformGetSignOption",
  20041. value: function () {
  20042. var _platformGetSignOption2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
  20043. var _yield$this$appUtils$2, e, t;
  20044. return _regenerator.default.wrap(function _callee47$(_context47) {
  20045. while (1) {
  20046. switch (_context47.prev = _context47.next) {
  20047. case 0:
  20048. _context47.next = 2;
  20049. return this.appUtils.encrypt({
  20050. provider: this.provider,
  20051. spaceId: this.spaceId,
  20052. data: JSON.stringify({})
  20053. });
  20054. case 2:
  20055. _yield$this$appUtils$2 = _context47.sent;
  20056. e = _yield$this$appUtils$2.data;
  20057. t = _yield$this$appUtils$2.key;
  20058. return _context47.abrupt("return", {
  20059. verifyClientSign: e,
  20060. encryptKeyId: t
  20061. });
  20062. case 6:
  20063. case "end":
  20064. return _context47.stop();
  20065. }
  20066. }
  20067. }, _callee47, this);
  20068. }));
  20069. function platformGetSignOption() {
  20070. return _platformGetSignOption2.apply(this, arguments);
  20071. }
  20072. return platformGetSignOption;
  20073. }()
  20074. }, {
  20075. key: "platformEncryptData",
  20076. value: function () {
  20077. var _platformEncryptData2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(e) {
  20078. var _yield$this$appUtils$3, t, n, s;
  20079. return _regenerator.default.wrap(function _callee48$(_context48) {
  20080. while (1) {
  20081. switch (_context48.prev = _context48.next) {
  20082. case 0:
  20083. _context48.next = 2;
  20084. return this.appUtils.encrypt({
  20085. provider: this.provider,
  20086. spaceId: this.spaceId,
  20087. data: JSON.stringify(e)
  20088. });
  20089. case 2:
  20090. _yield$this$appUtils$3 = _context48.sent;
  20091. t = _yield$this$appUtils$3.data;
  20092. n = _yield$this$appUtils$3.key;
  20093. s = {
  20094. secretType: this.secretType,
  20095. encryptKeyId: n
  20096. };
  20097. return _context48.abrupt("return", this.secretType === Rt ? {
  20098. content: e,
  20099. _uniCloudOptions: s
  20100. } : {
  20101. content: t,
  20102. _uniCloudOptions: s
  20103. });
  20104. case 7:
  20105. case "end":
  20106. return _context48.stop();
  20107. }
  20108. }
  20109. }, _callee48, this);
  20110. }));
  20111. function platformEncryptData(_x35) {
  20112. return _platformEncryptData2.apply(this, arguments);
  20113. }
  20114. return platformEncryptData;
  20115. }()
  20116. }, {
  20117. key: "platformDecryptResult",
  20118. value: function () {
  20119. var _platformDecryptResult2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49(e) {
  20120. var t, _e$_uniCloudOptions, n, s, r;
  20121. return _regenerator.default.wrap(function _callee49$(_context49) {
  20122. while (1) {
  20123. switch (_context49.prev = _context49.next) {
  20124. case 0:
  20125. t = e.content;
  20126. _e$_uniCloudOptions = e._uniCloudOptions;
  20127. n = _e$_uniCloudOptions === void 0 ? {} : _e$_uniCloudOptions;
  20128. s = n.encryptKeyId;
  20129. _context49.next = 6;
  20130. return this.appUtils.decrypt({
  20131. provider: this.provider,
  20132. spaceId: this.spaceId,
  20133. data: t,
  20134. key: s
  20135. });
  20136. case 6:
  20137. r = _context49.sent;
  20138. return _context49.abrupt("return", JSON.parse(r.data));
  20139. case 8:
  20140. case "end":
  20141. return _context49.stop();
  20142. }
  20143. }
  20144. }, _callee49, this);
  20145. }));
  20146. function platformDecryptResult(_x36) {
  20147. return _platformDecryptResult2.apply(this, arguments);
  20148. }
  20149. return platformDecryptResult;
  20150. }()
  20151. }, {
  20152. key: "isClientKeyNotFound",
  20153. value: function isClientKeyNotFound() {
  20154. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20155. var t = e.result || {};
  20156. return 70009 === t.errCode && "uni-secure-network" === t.errSubject;
  20157. }
  20158. }]);
  20159. return Tn;
  20160. }(Lt);
  20161. function Pn() {
  20162. var _ref29 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20163. e = _ref29.secretType;
  20164. return e === xt || e === Rt || e === Ut;
  20165. }
  20166. function An() {
  20167. var _ref30 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20168. e = _ref30.name,
  20169. _ref30$data = _ref30.data,
  20170. t = _ref30$data === void 0 ? {} : _ref30$data;
  20171. return "app" === P && "DCloud-clientDB" === e && "encryption" === t.redirectTo && "getAppClientKey" === t.action;
  20172. }
  20173. function En() {
  20174. var _ref31 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20175. e = _ref31.provider,
  20176. t = _ref31.spaceId,
  20177. n = _ref31.functionName;
  20178. var _ce = ce(),
  20179. s = _ce.appId,
  20180. r = _ce.uniPlatform,
  20181. i = _ce.osName;
  20182. var o = r;
  20183. "app" === r && (o = i);
  20184. var a = function () {
  20185. var _ref32 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20186. e = _ref32.provider,
  20187. t = _ref32.spaceId;
  20188. var n = T;
  20189. if (!n) return {};
  20190. e = function (e) {
  20191. return "tencent" === e ? "tcb" : e;
  20192. }(e);
  20193. var s = n.find(function (n) {
  20194. return n.provider === e && n.spaceId === t;
  20195. });
  20196. return s && s.config;
  20197. }({
  20198. provider: e,
  20199. spaceId: t
  20200. });
  20201. if (!a || !a.accessControl || !a.accessControl.enable) return !1;
  20202. var c = a.accessControl.function || {},
  20203. u = Object.keys(c);
  20204. if (0 === u.length) return !0;
  20205. var h = function (e, t) {
  20206. var n, s, r;
  20207. for (var _i2 = 0; _i2 < e.length; _i2++) {
  20208. var _o2 = e[_i2];
  20209. _o2 !== t ? "*" !== _o2 ? _o2.split(",").map(function (e) {
  20210. return e.trim();
  20211. }).indexOf(t) > -1 && (s = _o2) : r = _o2 : n = _o2;
  20212. }
  20213. return n || s || r;
  20214. }(u, n);
  20215. if (!h) return !1;
  20216. if ((c[h] || []).find(function () {
  20217. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20218. return e.appId === s && (e.platform || "").toLowerCase() === o.toLowerCase();
  20219. })) return !0;
  20220. throw console.error("\u6B64\u5E94\u7528[appId: ".concat(s, ", platform: ").concat(o, "]\u4E0D\u5728\u4E91\u7AEF\u914D\u7F6E\u7684\u5141\u8BB8\u8BBF\u95EE\u7684\u5E94\u7528\u5217\u8868\u5185\uFF0C\u53C2\u8003\uFF1Ahttps://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client")), vn(yn);
  20221. }
  20222. function On(_ref33) {
  20223. var e = _ref33.functionName,
  20224. t = _ref33.result,
  20225. n = _ref33.logPvd;
  20226. if (b && this.__dev__.debugLog && t && t.requestId) {
  20227. var _s11 = JSON.stringify({
  20228. spaceId: this.config.spaceId,
  20229. functionName: e,
  20230. requestId: t.requestId
  20231. });
  20232. console.log("[".concat(n, "-request]").concat(_s11, "[/").concat(n, "-request]"));
  20233. }
  20234. }
  20235. function xn(e) {
  20236. var t = e.callFunction,
  20237. n = function n(_n7) {
  20238. var _this18 = this;
  20239. var s = _n7.name;
  20240. _n7.data = kt.call(e, {
  20241. data: _n7.data
  20242. });
  20243. var r = {
  20244. aliyun: "aliyun",
  20245. tencent: "tcb",
  20246. tcb: "tcb"
  20247. }[this.config.provider],
  20248. i = Pn(_n7),
  20249. o = An(_n7),
  20250. a = i || o;
  20251. return t.call(this, _n7).then(function (e) {
  20252. return e.errCode = 0, !a && On.call(_this18, {
  20253. functionName: s,
  20254. result: e,
  20255. logPvd: r
  20256. }), Promise.resolve(e);
  20257. }, function (e) {
  20258. return !a && On.call(_this18, {
  20259. functionName: s,
  20260. result: e,
  20261. logPvd: r
  20262. }), e && e.message && (e.message = function () {
  20263. var _ref34 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20264. _ref34$message = _ref34.message,
  20265. e = _ref34$message === void 0 ? "" : _ref34$message,
  20266. _ref34$extraInfo = _ref34.extraInfo,
  20267. t = _ref34$extraInfo === void 0 ? {} : _ref34$extraInfo,
  20268. _ref34$formatter = _ref34.formatter,
  20269. n = _ref34$formatter === void 0 ? [] : _ref34$formatter;
  20270. for (var _s12 = 0; _s12 < n.length; _s12++) {
  20271. var _n$_s = n[_s12],
  20272. _r4 = _n$_s.rule,
  20273. _i3 = _n$_s.content,
  20274. _o3 = _n$_s.mode,
  20275. _a = e.match(_r4);
  20276. if (!_a) continue;
  20277. var _c = _i3;
  20278. for (var _e20 = 1; _e20 < _a.length; _e20++) {
  20279. _c = Et(_c, "{$".concat(_e20, "}"), _a[_e20]);
  20280. }
  20281. for (var _e21 in t) {
  20282. _c = Et(_c, "{".concat(_e21, "}"), t[_e21]);
  20283. }
  20284. return "replace" === _o3 ? _c : e + _c;
  20285. }
  20286. return e;
  20287. }({
  20288. message: "[".concat(_n7.name, "]: ").concat(e.message),
  20289. formatter: Tt,
  20290. extraInfo: {
  20291. functionName: s
  20292. }
  20293. })), Promise.reject(e);
  20294. });
  20295. };
  20296. e.callFunction = function (t) {
  20297. var _e$config = e.config,
  20298. s = _e$config.provider,
  20299. r = _e$config.spaceId,
  20300. i = t.name;
  20301. var o, a;
  20302. if (t.data = t.data || {}, b && e.__dev__.debugInfo && !e.__dev__.debugInfo.forceRemote && E ? (e._callCloudFunction || (e._callCloudFunction = n, e._callLocalFunction = Ct), o = Ct) : o = n, o = o.bind(e), An(t)) a = n.call(e, t);else if (function (_ref35) {
  20303. var e = _ref35.name,
  20304. _ref35$data = _ref35.data,
  20305. t = _ref35$data === void 0 ? {} : _ref35$data;
  20306. return "mp-weixin" === P && "uni-id-co" === e && "secureNetworkHandshakeByWeixin" === t.method;
  20307. }(t)) a = o.call(e, t);else if (Pn(t)) {
  20308. a = new Sn({
  20309. secretType: t.secretType,
  20310. uniCloudIns: e
  20311. }).wrapEncryptDataCallFunction(n.bind(e))(t);
  20312. } else if (En({
  20313. provider: s,
  20314. spaceId: r,
  20315. functionName: i
  20316. })) {
  20317. a = new Sn({
  20318. secretType: t.secretType,
  20319. uniCloudIns: e
  20320. }).wrapVerifyClientCallFunction(n.bind(e))(t);
  20321. } else a = o(t);
  20322. return Object.defineProperty(a, "result", {
  20323. get: function get() {
  20324. return console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {};
  20325. }
  20326. }), a;
  20327. };
  20328. }
  20329. Sn = "mp-weixin" !== P && "app" !== P ? /*#__PURE__*/function () {
  20330. function _class2() {
  20331. (0, _classCallCheck2.default)(this, _class2);
  20332. throw vn({
  20333. message: "Platform ".concat(P, " is not supported by secure network")
  20334. });
  20335. }
  20336. return (0, _createClass2.default)(_class2);
  20337. }() : C ? "mp-weixin" === P ? kn : Tn : /*#__PURE__*/function () {
  20338. function _class3() {
  20339. (0, _classCallCheck2.default)(this, _class3);
  20340. throw vn({
  20341. message: "Platform ".concat(P, " is not enabled, please check whether secure network module is enabled in your manifest.json")
  20342. });
  20343. }
  20344. return (0, _createClass2.default)(_class3);
  20345. }();
  20346. var Rn = Symbol("CLIENT_DB_INTERNAL");
  20347. function Un(e, t) {
  20348. return e.then = "DoNotReturnProxyWithAFunctionNamedThen", e._internalType = Rn, e.inspect = null, e.__ob__ = void 0, new Proxy(e, {
  20349. get: function get(e, n, s) {
  20350. if ("_uniClient" === n) return null;
  20351. if ("symbol" == (0, _typeof2.default)(n)) return e[n];
  20352. if (n in e || "string" != typeof n) {
  20353. var _t10 = e[n];
  20354. return "function" == typeof _t10 ? _t10.bind(e) : _t10;
  20355. }
  20356. return t.get(e, n, s);
  20357. }
  20358. });
  20359. }
  20360. function Ln(e) {
  20361. return {
  20362. on: function on(t, n) {
  20363. e[t] = e[t] || [], e[t].indexOf(n) > -1 || e[t].push(n);
  20364. },
  20365. off: function off(t, n) {
  20366. e[t] = e[t] || [];
  20367. var s = e[t].indexOf(n);
  20368. -1 !== s && e[t].splice(s, 1);
  20369. }
  20370. };
  20371. }
  20372. var Nn = ["db.Geo", "db.command", "command.aggregate"];
  20373. function Dn(e, t) {
  20374. return Nn.indexOf("".concat(e, ".").concat(t)) > -1;
  20375. }
  20376. function Fn(e) {
  20377. switch (g(e)) {
  20378. case "array":
  20379. return e.map(function (e) {
  20380. return Fn(e);
  20381. });
  20382. case "object":
  20383. return e._internalType === Rn || Object.keys(e).forEach(function (t) {
  20384. e[t] = Fn(e[t]);
  20385. }), e;
  20386. case "regexp":
  20387. return {
  20388. $regexp: {
  20389. source: e.source,
  20390. flags: e.flags
  20391. }
  20392. };
  20393. case "date":
  20394. return {
  20395. $date: e.toISOString()
  20396. };
  20397. default:
  20398. return e;
  20399. }
  20400. }
  20401. function qn(e) {
  20402. return e && e.content && e.content.$method;
  20403. }
  20404. var Mn = /*#__PURE__*/function () {
  20405. function Mn(e, t, n) {
  20406. (0, _classCallCheck2.default)(this, Mn);
  20407. this.content = e, this.prevStage = t || null, this.udb = null, this._database = n;
  20408. }
  20409. (0, _createClass2.default)(Mn, [{
  20410. key: "toJSON",
  20411. value: function toJSON() {
  20412. var e = this;
  20413. var t = [e.content];
  20414. for (; e.prevStage;) {
  20415. e = e.prevStage, t.push(e.content);
  20416. }
  20417. return {
  20418. $db: t.reverse().map(function (e) {
  20419. return {
  20420. $method: e.$method,
  20421. $param: Fn(e.$param)
  20422. };
  20423. })
  20424. };
  20425. }
  20426. }, {
  20427. key: "toString",
  20428. value: function toString() {
  20429. return JSON.stringify(this.toJSON());
  20430. }
  20431. }, {
  20432. key: "getAction",
  20433. value: function getAction() {
  20434. var e = this.toJSON().$db.find(function (e) {
  20435. return "action" === e.$method;
  20436. });
  20437. return e && e.$param && e.$param[0];
  20438. }
  20439. }, {
  20440. key: "getCommand",
  20441. value: function getCommand() {
  20442. return {
  20443. $db: this.toJSON().$db.filter(function (e) {
  20444. return "action" !== e.$method;
  20445. })
  20446. };
  20447. }
  20448. }, {
  20449. key: "isAggregate",
  20450. get: function get() {
  20451. var e = this;
  20452. for (; e;) {
  20453. var t = qn(e),
  20454. _n8 = qn(e.prevStage);
  20455. if ("aggregate" === t && "collection" === _n8 || "pipeline" === t) return !0;
  20456. e = e.prevStage;
  20457. }
  20458. return !1;
  20459. }
  20460. }, {
  20461. key: "isCommand",
  20462. get: function get() {
  20463. var e = this;
  20464. for (; e;) {
  20465. if ("command" === qn(e)) return !0;
  20466. e = e.prevStage;
  20467. }
  20468. return !1;
  20469. }
  20470. }, {
  20471. key: "isAggregateCommand",
  20472. get: function get() {
  20473. var e = this;
  20474. for (; e;) {
  20475. var t = qn(e),
  20476. _n9 = qn(e.prevStage);
  20477. if ("aggregate" === t && "command" === _n9) return !0;
  20478. e = e.prevStage;
  20479. }
  20480. return !1;
  20481. }
  20482. }, {
  20483. key: "getNextStageFn",
  20484. value: function getNextStageFn(e) {
  20485. var t = this;
  20486. return function () {
  20487. return Kn({
  20488. $method: e,
  20489. $param: Fn(Array.from(arguments))
  20490. }, t, t._database);
  20491. };
  20492. }
  20493. }, {
  20494. key: "count",
  20495. get: function get() {
  20496. return this.isAggregate ? this.getNextStageFn("count") : function () {
  20497. return this._send("count", Array.from(arguments));
  20498. };
  20499. }
  20500. }, {
  20501. key: "remove",
  20502. get: function get() {
  20503. return this.isCommand ? this.getNextStageFn("remove") : function () {
  20504. return this._send("remove", Array.from(arguments));
  20505. };
  20506. }
  20507. }, {
  20508. key: "get",
  20509. value: function get() {
  20510. return this._send("get", Array.from(arguments));
  20511. }
  20512. }, {
  20513. key: "add",
  20514. get: function get() {
  20515. return this.isCommand ? this.getNextStageFn("add") : function () {
  20516. return this._send("add", Array.from(arguments));
  20517. };
  20518. }
  20519. }, {
  20520. key: "update",
  20521. value: function update() {
  20522. return this._send("update", Array.from(arguments));
  20523. }
  20524. }, {
  20525. key: "end",
  20526. value: function end() {
  20527. return this._send("end", Array.from(arguments));
  20528. }
  20529. }, {
  20530. key: "set",
  20531. get: function get() {
  20532. return this.isCommand ? this.getNextStageFn("set") : function () {
  20533. throw new Error("JQL禁止使用set方法");
  20534. };
  20535. }
  20536. }, {
  20537. key: "_send",
  20538. value: function _send(e, t) {
  20539. var n = this.getAction(),
  20540. s = this.getCommand();
  20541. if (s.$db.push({
  20542. $method: e,
  20543. $param: Fn(t)
  20544. }), b) {
  20545. var _e22 = s.$db.find(function (e) {
  20546. return "collection" === e.$method;
  20547. }),
  20548. _t11 = _e22 && _e22.$param;
  20549. _t11 && 1 === _t11.length && "string" == typeof _e22.$param[0] && _e22.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
  20550. }
  20551. return this._database._callCloudFunction({
  20552. action: n,
  20553. command: s
  20554. });
  20555. }
  20556. }]);
  20557. return Mn;
  20558. }();
  20559. function Kn(e, t, n) {
  20560. return Un(new Mn(e, t, n), {
  20561. get: function get(e, t) {
  20562. var s = "db";
  20563. return e && e.content && (s = e.content.$method), Dn(s, t) ? Kn({
  20564. $method: t
  20565. }, e, n) : function () {
  20566. return Kn({
  20567. $method: t,
  20568. $param: Fn(Array.from(arguments))
  20569. }, e, n);
  20570. };
  20571. }
  20572. });
  20573. }
  20574. function jn(_ref36) {
  20575. var e = _ref36.path,
  20576. t = _ref36.method;
  20577. return /*#__PURE__*/function () {
  20578. function _class4() {
  20579. (0, _classCallCheck2.default)(this, _class4);
  20580. this.param = Array.from(arguments);
  20581. }
  20582. (0, _createClass2.default)(_class4, [{
  20583. key: "toJSON",
  20584. value: function toJSON() {
  20585. return {
  20586. $newDb: [].concat((0, _toConsumableArray2.default)(e.map(function (e) {
  20587. return {
  20588. $method: e
  20589. };
  20590. })), [{
  20591. $method: t,
  20592. $param: this.param
  20593. }])
  20594. };
  20595. }
  20596. }, {
  20597. key: "toString",
  20598. value: function toString() {
  20599. return JSON.stringify(this.toJSON());
  20600. }
  20601. }]);
  20602. return _class4;
  20603. }();
  20604. }
  20605. function Bn(e) {
  20606. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20607. return Un(new e(t), {
  20608. get: function get(e, t) {
  20609. return Dn("db", t) ? Kn({
  20610. $method: t
  20611. }, null, e) : function () {
  20612. return Kn({
  20613. $method: t,
  20614. $param: Fn(Array.from(arguments))
  20615. }, null, e);
  20616. };
  20617. }
  20618. });
  20619. }
  20620. var $n = /*#__PURE__*/function (_ref37) {
  20621. (0, _inherits2.default)($n, _ref37);
  20622. var _super11 = _createSuper($n);
  20623. function $n() {
  20624. (0, _classCallCheck2.default)(this, $n);
  20625. return _super11.apply(this, arguments);
  20626. }
  20627. (0, _createClass2.default)($n, [{
  20628. key: "_parseResult",
  20629. value: function _parseResult(e) {
  20630. return this._isJQL ? e.result : e;
  20631. }
  20632. }, {
  20633. key: "_callCloudFunction",
  20634. value: function _callCloudFunction(_ref38) {
  20635. var _this19 = this;
  20636. var e = _ref38.action,
  20637. t = _ref38.command,
  20638. n = _ref38.multiCommand,
  20639. s = _ref38.queryList;
  20640. function r(e, t) {
  20641. if (n && s) for (var _n10 = 0; _n10 < s.length; _n10++) {
  20642. var _r5 = s[_n10];
  20643. _r5.udb && "function" == typeof _r5.udb.setResult && (t ? _r5.udb.setResult(t) : _r5.udb.setResult(e.result.dataList[_n10]));
  20644. }
  20645. }
  20646. var i = this,
  20647. o = this._isJQL ? "databaseForJQL" : "database";
  20648. function a(e) {
  20649. return i._callback("error", [e]), q(M(o, "fail"), e).then(function () {
  20650. return q(M(o, "complete"), e);
  20651. }).then(function () {
  20652. return r(null, e), Q(B, {
  20653. type: z,
  20654. content: e
  20655. }), Promise.reject(e);
  20656. });
  20657. }
  20658. var c = q(M(o, "invoke")),
  20659. u = this._uniClient;
  20660. return c.then(function () {
  20661. return u.callFunction({
  20662. name: "DCloud-clientDB",
  20663. type: l,
  20664. data: {
  20665. action: e,
  20666. command: t,
  20667. multiCommand: n
  20668. }
  20669. });
  20670. }).then(function (e) {
  20671. var _e$result = e.result,
  20672. t = _e$result.code,
  20673. n = _e$result.message,
  20674. s = _e$result.token,
  20675. c = _e$result.tokenExpired,
  20676. _e$result$systemInfo = _e$result.systemInfo,
  20677. u = _e$result$systemInfo === void 0 ? [] : _e$result$systemInfo;
  20678. if (u) for (var _e23 = 0; _e23 < u.length; _e23++) {
  20679. var _u$_e = u[_e23],
  20680. _t12 = _u$_e.level,
  20681. _n11 = _u$_e.message,
  20682. _s13 = _u$_e.detail,
  20683. _r6 = console["app" === P && "warn" === _t12 ? "error" : _t12] || console.log;
  20684. var _i4 = "[System Info]" + _n11;
  20685. _s13 && (_i4 = "".concat(_i4, "\n\u8BE6\u7EC6\u4FE1\u606F\uFF1A").concat(_s13)), _r6(_i4);
  20686. }
  20687. if (t) {
  20688. return a(new ne({
  20689. code: t,
  20690. message: n,
  20691. requestId: e.requestId
  20692. }));
  20693. }
  20694. e.result.errCode = e.result.errCode || e.result.code, e.result.errMsg = e.result.errMsg || e.result.message, s && c && (ie({
  20695. token: s,
  20696. tokenExpired: c
  20697. }), _this19._callbackAuth("refreshToken", [{
  20698. token: s,
  20699. tokenExpired: c
  20700. }]), _this19._callback("refreshToken", [{
  20701. token: s,
  20702. tokenExpired: c
  20703. }]), Q(W, {
  20704. token: s,
  20705. tokenExpired: c
  20706. }));
  20707. var h = [{
  20708. prop: "affectedDocs",
  20709. tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代"
  20710. }, {
  20711. prop: "code",
  20712. tips: "code不再推荐使用,请使用errCode替代"
  20713. }, {
  20714. prop: "message",
  20715. tips: "message不再推荐使用,请使用errMsg替代"
  20716. }];
  20717. var _loop2 = function _loop2(_t13) {
  20718. var _h$_t = h[_t13],
  20719. n = _h$_t.prop,
  20720. s = _h$_t.tips;
  20721. if (n in e.result) {
  20722. var _t14 = e.result[n];
  20723. Object.defineProperty(e.result, n, {
  20724. get: function get() {
  20725. return console.warn(s), _t14;
  20726. }
  20727. });
  20728. }
  20729. };
  20730. for (var _t13 = 0; _t13 < h.length; _t13++) {
  20731. _loop2(_t13);
  20732. }
  20733. return function (e) {
  20734. return q(M(o, "success"), e).then(function () {
  20735. return q(M(o, "complete"), e);
  20736. }).then(function () {
  20737. r(e, null);
  20738. var t = i._parseResult(e);
  20739. return Q(B, {
  20740. type: z,
  20741. content: t
  20742. }), Promise.resolve(t);
  20743. });
  20744. }(e);
  20745. }, function (e) {
  20746. /fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
  20747. return a(new ne({
  20748. code: e.code || "SYSTEM_ERROR",
  20749. message: e.message,
  20750. requestId: e.requestId
  20751. }));
  20752. });
  20753. }
  20754. }]);
  20755. return $n;
  20756. }( /*#__PURE__*/function () {
  20757. function _class5() {
  20758. var _ref39 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20759. _ref39$uniClient = _ref39.uniClient,
  20760. e = _ref39$uniClient === void 0 ? {} : _ref39$uniClient,
  20761. _ref39$isJQL = _ref39.isJQL,
  20762. t = _ref39$isJQL === void 0 ? !1 : _ref39$isJQL;
  20763. (0, _classCallCheck2.default)(this, _class5);
  20764. this._uniClient = e, this._authCallBacks = {}, this._dbCallBacks = {}, e._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t || (this.auth = Ln(this._authCallBacks)), this._isJQL = t, Object.assign(this, Ln(this._dbCallBacks)), this.env = Un({}, {
  20765. get: function get(e, t) {
  20766. return {
  20767. $env: t
  20768. };
  20769. }
  20770. }), this.Geo = Un({}, {
  20771. get: function get(e, t) {
  20772. return jn({
  20773. path: ["Geo"],
  20774. method: t
  20775. });
  20776. }
  20777. }), this.serverDate = jn({
  20778. path: [],
  20779. method: "serverDate"
  20780. }), this.RegExp = jn({
  20781. path: [],
  20782. method: "RegExp"
  20783. });
  20784. }
  20785. (0, _createClass2.default)(_class5, [{
  20786. key: "getCloudEnv",
  20787. value: function getCloudEnv(e) {
  20788. if ("string" != typeof e || !e.trim()) throw new Error("getCloudEnv参数错误");
  20789. return {
  20790. $env: e.replace("$cloudEnv_", "")
  20791. };
  20792. }
  20793. }, {
  20794. key: "_callback",
  20795. value: function _callback(e, t) {
  20796. var n = this._dbCallBacks;
  20797. n[e] && n[e].forEach(function (e) {
  20798. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  20799. });
  20800. }
  20801. }, {
  20802. key: "_callbackAuth",
  20803. value: function _callbackAuth(e, t) {
  20804. var n = this._authCallBacks;
  20805. n[e] && n[e].forEach(function (e) {
  20806. e.apply(void 0, (0, _toConsumableArray2.default)(t));
  20807. });
  20808. }
  20809. }, {
  20810. key: "multiSend",
  20811. value: function multiSend() {
  20812. var e = Array.from(arguments),
  20813. t = e.map(function (e) {
  20814. var t = e.getAction(),
  20815. n = e.getCommand();
  20816. if ("getTemp" !== n.$db[n.$db.length - 1].$method) throw new Error("multiSend只支持子命令内使用getTemp");
  20817. return {
  20818. action: t,
  20819. command: n
  20820. };
  20821. });
  20822. return this._callCloudFunction({
  20823. multiCommand: t,
  20824. queryList: e
  20825. });
  20826. }
  20827. }]);
  20828. return _class5;
  20829. }());
  20830. var Wn = "token无效,跳转登录页面",
  20831. zn = "token过期,跳转登录页面",
  20832. Jn = {
  20833. TOKEN_INVALID_TOKEN_EXPIRED: zn,
  20834. TOKEN_INVALID_INVALID_CLIENTID: Wn,
  20835. TOKEN_INVALID: Wn,
  20836. TOKEN_INVALID_WRONG_TOKEN: Wn,
  20837. TOKEN_INVALID_ANONYMOUS_USER: Wn
  20838. },
  20839. Hn = {
  20840. "uni-id-token-expired": zn,
  20841. "uni-id-check-token-failed": Wn,
  20842. "uni-id-token-not-exist": Wn,
  20843. "uni-id-check-device-feature-failed": Wn
  20844. };
  20845. function Gn(e, t) {
  20846. var n = "";
  20847. return n = e ? "".concat(e, "/").concat(t) : t, n.replace(/^\//, "");
  20848. }
  20849. function Vn() {
  20850. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  20851. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
  20852. var n = [],
  20853. s = [];
  20854. return e.forEach(function (e) {
  20855. !0 === e.needLogin ? n.push(Gn(t, e.path)) : !1 === e.needLogin && s.push(Gn(t, e.path));
  20856. }), {
  20857. needLoginPage: n,
  20858. notNeedLoginPage: s
  20859. };
  20860. }
  20861. function Yn(e) {
  20862. return e.split("?")[0].replace(/^\//, "");
  20863. }
  20864. function Qn() {
  20865. return function (e) {
  20866. var t = e && e.$page && e.$page.fullPath || "";
  20867. return t ? ("/" !== t.charAt(0) && (t = "/" + t), t) : t;
  20868. }(function () {
  20869. var e = getCurrentPages();
  20870. return e[e.length - 1];
  20871. }());
  20872. }
  20873. function Xn() {
  20874. return Yn(Qn());
  20875. }
  20876. function Zn() {
  20877. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
  20878. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  20879. if (!e) return !1;
  20880. if (!(t && t.list && t.list.length)) return !1;
  20881. var n = t.list,
  20882. s = Yn(e);
  20883. return n.some(function (e) {
  20884. return e.pagePath === s;
  20885. });
  20886. }
  20887. var es = !!_pages.default.uniIdRouter;
  20888. var _ref40 = function () {
  20889. var _ref21 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _pages.default,
  20890. _ref21$pages = _ref21.pages,
  20891. e = _ref21$pages === void 0 ? [] : _ref21$pages,
  20892. _ref21$subPackages = _ref21.subPackages,
  20893. n = _ref21$subPackages === void 0 ? [] : _ref21$subPackages,
  20894. _ref21$uniIdRouter = _ref21.uniIdRouter,
  20895. s = _ref21$uniIdRouter === void 0 ? {} : _ref21$uniIdRouter,
  20896. _ref21$tabBar = _ref21.tabBar,
  20897. r = _ref21$tabBar === void 0 ? {} : _ref21$tabBar;
  20898. var i = s.loginPage,
  20899. _s$needLogin = s.needLogin,
  20900. o = _s$needLogin === void 0 ? [] : _s$needLogin,
  20901. _s$resToLogin = s.resToLogin,
  20902. a = _s$resToLogin === void 0 ? !0 : _s$resToLogin,
  20903. _Vn = Vn(e),
  20904. c = _Vn.needLoginPage,
  20905. u = _Vn.notNeedLoginPage,
  20906. _ref23 = function () {
  20907. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  20908. var t = [],
  20909. n = [];
  20910. return e.forEach(function (e) {
  20911. var s = e.root,
  20912. _e$pages = e.pages,
  20913. r = _e$pages === void 0 ? [] : _e$pages,
  20914. _Vn2 = Vn(r, s),
  20915. i = _Vn2.needLoginPage,
  20916. o = _Vn2.notNeedLoginPage;
  20917. t.push.apply(t, (0, _toConsumableArray2.default)(i)), n.push.apply(n, (0, _toConsumableArray2.default)(o));
  20918. }), {
  20919. needLoginPage: t,
  20920. notNeedLoginPage: n
  20921. };
  20922. }(n),
  20923. h = _ref23.needLoginPage,
  20924. l = _ref23.notNeedLoginPage;
  20925. return {
  20926. loginPage: i,
  20927. routerNeedLogin: o,
  20928. resToLogin: a,
  20929. needLoginPage: [].concat((0, _toConsumableArray2.default)(c), (0, _toConsumableArray2.default)(h)),
  20930. notNeedLoginPage: [].concat((0, _toConsumableArray2.default)(u), (0, _toConsumableArray2.default)(l)),
  20931. loginPageInTabBar: Zn(i, r)
  20932. };
  20933. }(),
  20934. ts = _ref40.loginPage,
  20935. ns = _ref40.routerNeedLogin,
  20936. ss = _ref40.resToLogin,
  20937. rs = _ref40.needLoginPage,
  20938. is = _ref40.notNeedLoginPage,
  20939. os = _ref40.loginPageInTabBar;
  20940. if (rs.indexOf(ts) > -1) throw new Error("Login page [".concat(ts, "] should not be \"needLogin\", please check your pages.json"));
  20941. function as(e) {
  20942. var t = Xn();
  20943. if ("/" === e.charAt(0)) return e;
  20944. var _e$split = e.split("?"),
  20945. _e$split2 = (0, _slicedToArray2.default)(_e$split, 2),
  20946. n = _e$split2[0],
  20947. s = _e$split2[1],
  20948. r = n.replace(/^\//, "").split("/"),
  20949. i = t.split("/");
  20950. i.pop();
  20951. for (var _e24 = 0; _e24 < r.length; _e24++) {
  20952. var _t15 = r[_e24];
  20953. ".." === _t15 ? i.pop() : "." !== _t15 && i.push(_t15);
  20954. }
  20955. return "" === i[0] && i.shift(), "/" + i.join("/") + (s ? "?" + s : "");
  20956. }
  20957. function cs(e) {
  20958. var t = Yn(as(e));
  20959. return !(is.indexOf(t) > -1) && (rs.indexOf(t) > -1 || ns.some(function (t) {
  20960. return function (e, t) {
  20961. return new RegExp(t).test(e);
  20962. }(e, t);
  20963. }));
  20964. }
  20965. function us(_ref41) {
  20966. var e = _ref41.redirect;
  20967. var t = Yn(e),
  20968. n = Yn(ts);
  20969. return Xn() !== n && t !== n;
  20970. }
  20971. function hs() {
  20972. var _ref42 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20973. e = _ref42.api,
  20974. t = _ref42.redirect;
  20975. if (!t || !us({
  20976. redirect: t
  20977. })) return;
  20978. var n = function (e, t) {
  20979. return "/" !== e.charAt(0) && (e = "/" + e), t ? e.indexOf("?") > -1 ? e + "&uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e + "?uniIdRedirectUrl=".concat(encodeURIComponent(t)) : e;
  20980. }(ts, t);
  20981. os ? "navigateTo" !== e && "redirectTo" !== e || (e = "switchTab") : "switchTab" === e && (e = "navigateTo");
  20982. var s = {
  20983. navigateTo: uni.navigateTo,
  20984. redirectTo: uni.redirectTo,
  20985. switchTab: uni.switchTab,
  20986. reLaunch: uni.reLaunch
  20987. };
  20988. setTimeout(function () {
  20989. s[e]({
  20990. url: n
  20991. });
  20992. });
  20993. }
  20994. function ls() {
  20995. var _ref43 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  20996. e = _ref43.url;
  20997. var t = {
  20998. abortLoginPageJump: !1,
  20999. autoToLoginPage: !1
  21000. },
  21001. n = function () {
  21002. var _re3 = re(),
  21003. e = _re3.token,
  21004. t = _re3.tokenExpired;
  21005. var n;
  21006. if (e) {
  21007. if (t < Date.now()) {
  21008. var _e25 = "uni-id-token-expired";
  21009. n = {
  21010. errCode: _e25,
  21011. errMsg: Hn[_e25]
  21012. };
  21013. }
  21014. } else {
  21015. var _e26 = "uni-id-check-token-failed";
  21016. n = {
  21017. errCode: _e26,
  21018. errMsg: Hn[_e26]
  21019. };
  21020. }
  21021. return n;
  21022. }();
  21023. if (cs(e) && n) {
  21024. n.uniIdRedirectUrl = e;
  21025. if (G($).length > 0) return setTimeout(function () {
  21026. Q($, n);
  21027. }, 0), t.abortLoginPageJump = !0, t;
  21028. t.autoToLoginPage = !0;
  21029. }
  21030. return t;
  21031. }
  21032. function ds() {
  21033. !function () {
  21034. var e = Qn(),
  21035. _ls = ls({
  21036. url: e
  21037. }),
  21038. t = _ls.abortLoginPageJump,
  21039. n = _ls.autoToLoginPage;
  21040. t || n && hs({
  21041. api: "redirectTo",
  21042. redirect: e
  21043. });
  21044. }();
  21045. var e = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
  21046. var _loop3 = function _loop3(_t16) {
  21047. var n = e[_t16];
  21048. uni.addInterceptor(n, {
  21049. invoke: function invoke(e) {
  21050. var _ls2 = ls({
  21051. url: e.url
  21052. }),
  21053. t = _ls2.abortLoginPageJump,
  21054. s = _ls2.autoToLoginPage;
  21055. return t ? e : s ? (hs({
  21056. api: n,
  21057. redirect: as(e.url)
  21058. }), !1) : e;
  21059. }
  21060. });
  21061. };
  21062. for (var _t16 = 0; _t16 < e.length; _t16++) {
  21063. _loop3(_t16);
  21064. }
  21065. }
  21066. function ps() {
  21067. this.onResponse(function (e) {
  21068. var t = e.type,
  21069. n = e.content;
  21070. var s = !1;
  21071. switch (t) {
  21072. case "cloudobject":
  21073. s = function (e) {
  21074. if ("object" != (0, _typeof2.default)(e)) return !1;
  21075. var _ref44 = e || {},
  21076. t = _ref44.errCode;
  21077. return t in Hn;
  21078. }(n);
  21079. break;
  21080. case "clientdb":
  21081. s = function (e) {
  21082. if ("object" != (0, _typeof2.default)(e)) return !1;
  21083. var _ref45 = e || {},
  21084. t = _ref45.errCode;
  21085. return t in Jn;
  21086. }(n);
  21087. }
  21088. s && function () {
  21089. var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  21090. var t = G($);
  21091. ee().then(function () {
  21092. var n = Qn();
  21093. if (n && us({
  21094. redirect: n
  21095. })) return t.length > 0 ? Q($, Object.assign({
  21096. uniIdRedirectUrl: n
  21097. }, e)) : void (ts && hs({
  21098. api: "navigateTo",
  21099. redirect: n
  21100. }));
  21101. });
  21102. }(n);
  21103. });
  21104. }
  21105. function fs(e) {
  21106. !function (e) {
  21107. e.onResponse = function (e) {
  21108. V(B, e);
  21109. }, e.offResponse = function (e) {
  21110. Y(B, e);
  21111. };
  21112. }(e), function (e) {
  21113. e.onNeedLogin = function (e) {
  21114. V($, e);
  21115. }, e.offNeedLogin = function (e) {
  21116. Y($, e);
  21117. }, es && (U("_globalUniCloudStatus").needLoginInit || (U("_globalUniCloudStatus").needLoginInit = !0, ee().then(function () {
  21118. ds.call(e);
  21119. }), ss && ps.call(e)));
  21120. }(e), function (e) {
  21121. e.onRefreshToken = function (e) {
  21122. V(W, e);
  21123. }, e.offRefreshToken = function (e) {
  21124. Y(W, e);
  21125. };
  21126. }(e);
  21127. }
  21128. var gs;
  21129. var ms = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  21130. ys = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  21131. function _s() {
  21132. var e = re().token || "",
  21133. t = e.split(".");
  21134. if (!e || 3 !== t.length) return {
  21135. uid: null,
  21136. role: [],
  21137. permission: [],
  21138. tokenExpired: 0
  21139. };
  21140. var n;
  21141. try {
  21142. n = JSON.parse((s = t[1], decodeURIComponent(gs(s).split("").map(function (e) {
  21143. return "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2);
  21144. }).join(""))));
  21145. } catch (e) {
  21146. throw new Error("获取当前用户信息出错,详细错误信息为:" + e.message);
  21147. }
  21148. var s;
  21149. return n.tokenExpired = 1e3 * n.exp, delete n.exp, delete n.iat, n;
  21150. }
  21151. gs = "function" != typeof atob ? function (e) {
  21152. if (e = String(e).replace(/[\t\n\f\r ]+/g, ""), !ys.test(e)) throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
  21153. var t;
  21154. e += "==".slice(2 - (3 & e.length));
  21155. for (var n, s, r = "", i = 0; i < e.length;) {
  21156. t = ms.indexOf(e.charAt(i++)) << 18 | ms.indexOf(e.charAt(i++)) << 12 | (n = ms.indexOf(e.charAt(i++))) << 6 | (s = ms.indexOf(e.charAt(i++))), r += 64 === n ? String.fromCharCode(t >> 16 & 255) : 64 === s ? String.fromCharCode(t >> 16 & 255, t >> 8 & 255) : String.fromCharCode(t >> 16 & 255, t >> 8 & 255, 255 & t);
  21157. }
  21158. return r;
  21159. } : atob;
  21160. var ws = s(function (e, t) {
  21161. Object.defineProperty(t, "__esModule", {
  21162. value: !0
  21163. });
  21164. var n = "chooseAndUploadFile:ok",
  21165. s = "chooseAndUploadFile:fail";
  21166. function r(e, t) {
  21167. return e.tempFiles.forEach(function (e, n) {
  21168. e.name || (e.name = e.path.substring(e.path.lastIndexOf("/") + 1)), t && (e.fileType = t), e.cloudPath = Date.now() + "_" + n + e.name.substring(e.name.lastIndexOf("."));
  21169. }), e.tempFilePaths || (e.tempFilePaths = e.tempFiles.map(function (e) {
  21170. return e.path;
  21171. })), e;
  21172. }
  21173. function i(e, t, _ref46) {
  21174. var s = _ref46.onChooseFile,
  21175. r = _ref46.onUploadProgress;
  21176. return t.then(function (e) {
  21177. if (s) {
  21178. var _t17 = s(e);
  21179. if (void 0 !== _t17) return Promise.resolve(_t17).then(function (t) {
  21180. return void 0 === t ? e : t;
  21181. });
  21182. }
  21183. return e;
  21184. }).then(function (t) {
  21185. return !1 === t ? {
  21186. errMsg: n,
  21187. tempFilePaths: [],
  21188. tempFiles: []
  21189. } : function (e, t) {
  21190. var s = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
  21191. var r = arguments.length > 3 ? arguments[3] : undefined;
  21192. (t = Object.assign({}, t)).errMsg = n;
  21193. var i = t.tempFiles,
  21194. o = i.length;
  21195. var a = 0;
  21196. return new Promise(function (n) {
  21197. for (; a < s;) {
  21198. c();
  21199. }
  21200. function c() {
  21201. var s = a++;
  21202. if (s >= o) return void (!i.find(function (e) {
  21203. return !e.url && !e.errMsg;
  21204. }) && n(t));
  21205. var u = i[s];
  21206. e.uploadFile({
  21207. filePath: u.path,
  21208. cloudPath: u.cloudPath,
  21209. fileType: u.fileType,
  21210. onUploadProgress: function onUploadProgress(e) {
  21211. e.index = s, e.tempFile = u, e.tempFilePath = u.path, r && r(e);
  21212. }
  21213. }).then(function (e) {
  21214. u.url = e.fileID, s < o && c();
  21215. }).catch(function (e) {
  21216. u.errMsg = e.errMsg || e.message, s < o && c();
  21217. });
  21218. }
  21219. });
  21220. }(e, t, 5, r);
  21221. });
  21222. }
  21223. t.initChooseAndUploadFile = function (e) {
  21224. return function () {
  21225. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
  21226. type: "all"
  21227. };
  21228. return "image" === t.type ? i(e, function (e) {
  21229. var t = e.count,
  21230. n = e.sizeType,
  21231. _e$sourceType = e.sourceType,
  21232. i = _e$sourceType === void 0 ? ["album", "camera"] : _e$sourceType,
  21233. o = e.extension;
  21234. return new Promise(function (e, a) {
  21235. uni.chooseImage({
  21236. count: t,
  21237. sizeType: n,
  21238. sourceType: i,
  21239. extension: o,
  21240. success: function success(t) {
  21241. e(r(t, "image"));
  21242. },
  21243. fail: function fail(e) {
  21244. a({
  21245. errMsg: e.errMsg.replace("chooseImage:fail", s)
  21246. });
  21247. }
  21248. });
  21249. });
  21250. }(t), t) : "video" === t.type ? i(e, function (e) {
  21251. var t = e.camera,
  21252. n = e.compressed,
  21253. i = e.maxDuration,
  21254. _e$sourceType2 = e.sourceType,
  21255. o = _e$sourceType2 === void 0 ? ["album", "camera"] : _e$sourceType2,
  21256. a = e.extension;
  21257. return new Promise(function (e, c) {
  21258. uni.chooseVideo({
  21259. camera: t,
  21260. compressed: n,
  21261. maxDuration: i,
  21262. sourceType: o,
  21263. extension: a,
  21264. success: function success(t) {
  21265. var n = t.tempFilePath,
  21266. s = t.duration,
  21267. i = t.size,
  21268. o = t.height,
  21269. a = t.width;
  21270. e(r({
  21271. errMsg: "chooseVideo:ok",
  21272. tempFilePaths: [n],
  21273. tempFiles: [{
  21274. name: t.tempFile && t.tempFile.name || "",
  21275. path: n,
  21276. size: i,
  21277. type: t.tempFile && t.tempFile.type || "",
  21278. width: a,
  21279. height: o,
  21280. duration: s,
  21281. fileType: "video",
  21282. cloudPath: ""
  21283. }]
  21284. }, "video"));
  21285. },
  21286. fail: function fail(e) {
  21287. c({
  21288. errMsg: e.errMsg.replace("chooseVideo:fail", s)
  21289. });
  21290. }
  21291. });
  21292. });
  21293. }(t), t) : i(e, function (e) {
  21294. var t = e.count,
  21295. n = e.extension;
  21296. return new Promise(function (e, i) {
  21297. var o = uni.chooseFile;
  21298. if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o = wx.chooseMessageFile), "function" != typeof o) return i({
  21299. errMsg: s + " 请指定 type 类型,该平台仅支持选择 image 或 video。"
  21300. });
  21301. o({
  21302. type: "all",
  21303. count: t,
  21304. extension: n,
  21305. success: function success(t) {
  21306. e(r(t));
  21307. },
  21308. fail: function fail(e) {
  21309. i({
  21310. errMsg: e.errMsg.replace("chooseFile:fail", s)
  21311. });
  21312. }
  21313. });
  21314. });
  21315. }(t), t);
  21316. };
  21317. };
  21318. }),
  21319. vs = n(ws);
  21320. var Is = "manual";
  21321. function Ss(e) {
  21322. return {
  21323. props: {
  21324. localdata: {
  21325. type: Array,
  21326. default: function _default() {
  21327. return [];
  21328. }
  21329. },
  21330. options: {
  21331. type: [Object, Array],
  21332. default: function _default() {
  21333. return {};
  21334. }
  21335. },
  21336. spaceInfo: {
  21337. type: Object,
  21338. default: function _default() {
  21339. return {};
  21340. }
  21341. },
  21342. collection: {
  21343. type: [String, Array],
  21344. default: ""
  21345. },
  21346. action: {
  21347. type: String,
  21348. default: ""
  21349. },
  21350. field: {
  21351. type: String,
  21352. default: ""
  21353. },
  21354. orderby: {
  21355. type: String,
  21356. default: ""
  21357. },
  21358. where: {
  21359. type: [String, Object],
  21360. default: ""
  21361. },
  21362. pageData: {
  21363. type: String,
  21364. default: "add"
  21365. },
  21366. pageCurrent: {
  21367. type: Number,
  21368. default: 1
  21369. },
  21370. pageSize: {
  21371. type: Number,
  21372. default: 20
  21373. },
  21374. getcount: {
  21375. type: [Boolean, String],
  21376. default: !1
  21377. },
  21378. gettree: {
  21379. type: [Boolean, String],
  21380. default: !1
  21381. },
  21382. gettreepath: {
  21383. type: [Boolean, String],
  21384. default: !1
  21385. },
  21386. startwith: {
  21387. type: String,
  21388. default: ""
  21389. },
  21390. limitlevel: {
  21391. type: Number,
  21392. default: 10
  21393. },
  21394. groupby: {
  21395. type: String,
  21396. default: ""
  21397. },
  21398. groupField: {
  21399. type: String,
  21400. default: ""
  21401. },
  21402. distinct: {
  21403. type: [Boolean, String],
  21404. default: !1
  21405. },
  21406. foreignKey: {
  21407. type: String,
  21408. default: ""
  21409. },
  21410. loadtime: {
  21411. type: String,
  21412. default: "auto"
  21413. },
  21414. manual: {
  21415. type: Boolean,
  21416. default: !1
  21417. }
  21418. },
  21419. data: function data() {
  21420. return {
  21421. mixinDatacomLoading: !1,
  21422. mixinDatacomHasMore: !1,
  21423. mixinDatacomResData: [],
  21424. mixinDatacomErrorMessage: "",
  21425. mixinDatacomPage: {}
  21426. };
  21427. },
  21428. created: function created() {
  21429. var _this20 = this;
  21430. this.mixinDatacomPage = {
  21431. current: this.pageCurrent,
  21432. size: this.pageSize,
  21433. count: 0
  21434. }, this.$watch(function () {
  21435. var e = [];
  21436. return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach(function (t) {
  21437. e.push(_this20[t]);
  21438. }), e;
  21439. }, function (e, t) {
  21440. if (_this20.loadtime === Is) return;
  21441. var n = !1;
  21442. var s = [];
  21443. for (var _r7 = 2; _r7 < e.length; _r7++) {
  21444. e[_r7] !== t[_r7] && (s.push(e[_r7]), n = !0);
  21445. }
  21446. e[0] !== t[0] && (_this20.mixinDatacomPage.current = _this20.pageCurrent), _this20.mixinDatacomPage.size = _this20.pageSize, _this20.onMixinDatacomPropsChange(n, s);
  21447. });
  21448. },
  21449. methods: {
  21450. onMixinDatacomPropsChange: function onMixinDatacomPropsChange(e, t) {},
  21451. mixinDatacomEasyGet: function mixinDatacomEasyGet() {
  21452. var _this21 = this;
  21453. var _ref47 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21454. _ref47$getone = _ref47.getone,
  21455. e = _ref47$getone === void 0 ? !1 : _ref47$getone,
  21456. t = _ref47.success,
  21457. n = _ref47.fail;
  21458. this.mixinDatacomLoading || (this.mixinDatacomLoading = !0, this.mixinDatacomErrorMessage = "", this.mixinDatacomGet().then(function (n) {
  21459. _this21.mixinDatacomLoading = !1;
  21460. var _n$result = n.result,
  21461. s = _n$result.data,
  21462. r = _n$result.count;
  21463. _this21.getcount && (_this21.mixinDatacomPage.count = r), _this21.mixinDatacomHasMore = s.length < _this21.pageSize;
  21464. var i = e ? s.length ? s[0] : void 0 : s;
  21465. _this21.mixinDatacomResData = i, t && t(i);
  21466. }).catch(function (e) {
  21467. _this21.mixinDatacomLoading = !1, _this21.mixinDatacomErrorMessage = e, n && n(e);
  21468. }));
  21469. },
  21470. mixinDatacomGet: function mixinDatacomGet() {
  21471. var _n12;
  21472. var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  21473. var n = e.database(this.spaceInfo);
  21474. var s = t.action || this.action;
  21475. s && (n = n.action(s));
  21476. var r = t.collection || this.collection;
  21477. n = Array.isArray(r) ? (_n12 = n).collection.apply(_n12, (0, _toConsumableArray2.default)(r)) : n.collection(r);
  21478. var i = t.where || this.where;
  21479. i && Object.keys(i).length && (n = n.where(i));
  21480. var o = t.field || this.field;
  21481. o && (n = n.field(o));
  21482. var a = t.foreignKey || this.foreignKey;
  21483. a && (n = n.foreignKey(a));
  21484. var c = t.groupby || this.groupby;
  21485. c && (n = n.groupBy(c));
  21486. var u = t.groupField || this.groupField;
  21487. u && (n = n.groupField(u));
  21488. !0 === (void 0 !== t.distinct ? t.distinct : this.distinct) && (n = n.distinct());
  21489. var h = t.orderby || this.orderby;
  21490. h && (n = n.orderBy(h));
  21491. var l = void 0 !== t.pageCurrent ? t.pageCurrent : this.mixinDatacomPage.current,
  21492. d = void 0 !== t.pageSize ? t.pageSize : this.mixinDatacomPage.size,
  21493. p = void 0 !== t.getcount ? t.getcount : this.getcount,
  21494. f = void 0 !== t.gettree ? t.gettree : this.gettree,
  21495. g = void 0 !== t.gettreepath ? t.gettreepath : this.gettreepath,
  21496. m = {
  21497. getCount: p
  21498. },
  21499. y = {
  21500. limitLevel: void 0 !== t.limitlevel ? t.limitlevel : this.limitlevel,
  21501. startWith: void 0 !== t.startwith ? t.startwith : this.startwith
  21502. };
  21503. return f && (m.getTree = y), g && (m.getTreePath = y), n = n.skip(d * (l - 1)).limit(d).get(m), n;
  21504. }
  21505. }
  21506. };
  21507. }
  21508. function bs(e) {
  21509. return function (t) {
  21510. var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21511. n = function (e) {
  21512. var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  21513. return e.customUI = t.customUI || e.customUI, e.parseSystemError = t.parseSystemError || e.parseSystemError, Object.assign(e.loadingOptions, t.loadingOptions), Object.assign(e.errorOptions, t.errorOptions), "object" == (0, _typeof2.default)(t.secretMethods) && (e.secretMethods = t.secretMethods), e;
  21514. }({
  21515. customUI: !1,
  21516. loadingOptions: {
  21517. title: "加载中...",
  21518. mask: !0
  21519. },
  21520. errorOptions: {
  21521. type: "modal",
  21522. retry: !1
  21523. }
  21524. }, n);
  21525. var _n13 = n,
  21526. s = _n13.customUI,
  21527. r = _n13.loadingOptions,
  21528. i = _n13.errorOptions,
  21529. o = _n13.parseSystemError,
  21530. a = !s;
  21531. return new Proxy({}, {
  21532. get: function get(s, c) {
  21533. return function () {
  21534. var _ref48 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21535. e = _ref48.fn,
  21536. t = _ref48.interceptorName,
  21537. n = _ref48.getCallbackArgs;
  21538. return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50() {
  21539. var _len2,
  21540. s,
  21541. _key2,
  21542. r,
  21543. i,
  21544. o,
  21545. _args = arguments;
  21546. return _regenerator.default.wrap(function _callee50$(_context50) {
  21547. while (1) {
  21548. switch (_context50.prev = _context50.next) {
  21549. case 0:
  21550. for (_len2 = _args.length, s = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  21551. s[_key2] = _args[_key2];
  21552. }
  21553. r = n ? n({
  21554. params: s
  21555. }) : {};
  21556. _context50.prev = 2;
  21557. _context50.next = 5;
  21558. return q(M(t, "invoke"), _objectSpread({}, r));
  21559. case 5:
  21560. _context50.next = 7;
  21561. return e.apply(void 0, s);
  21562. case 7:
  21563. i = _context50.sent;
  21564. _context50.next = 10;
  21565. return q(M(t, "success"), _objectSpread(_objectSpread({}, r), {}, {
  21566. result: i
  21567. }));
  21568. case 10:
  21569. return _context50.abrupt("return", i);
  21570. case 13:
  21571. _context50.prev = 13;
  21572. _context50.t0 = _context50["catch"](2);
  21573. o = _context50.t0;
  21574. _context50.next = 18;
  21575. return q(M(t, "fail"), _objectSpread(_objectSpread({}, r), {}, {
  21576. error: o
  21577. }));
  21578. case 18:
  21579. throw o;
  21580. case 19:
  21581. _context50.prev = 19;
  21582. _context50.next = 22;
  21583. return q(M(t, "complete"), o ? _objectSpread(_objectSpread({}, r), {}, {
  21584. error: o
  21585. }) : _objectSpread(_objectSpread({}, r), {}, {
  21586. result: i
  21587. }));
  21588. case 22:
  21589. return _context50.finish(19);
  21590. case 23:
  21591. case "end":
  21592. return _context50.stop();
  21593. }
  21594. }
  21595. }, _callee50, null, [[2, 13, 19, 23]]);
  21596. }));
  21597. }({
  21598. fn: function () {
  21599. var _s14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52() {
  21600. var l,
  21601. _len3,
  21602. u,
  21603. _key3,
  21604. d,
  21605. p,
  21606. _ref50,
  21607. f,
  21608. g,
  21609. m,
  21610. y,
  21611. _e27,
  21612. _yield,
  21613. _t18,
  21614. _n14,
  21615. _args4 = arguments;
  21616. return _regenerator.default.wrap(function _callee52$(_context52) {
  21617. while (1) {
  21618. switch (_context52.prev = _context52.next) {
  21619. case 0:
  21620. a && uni.showLoading({
  21621. title: r.title,
  21622. mask: r.mask
  21623. });
  21624. for (_len3 = _args4.length, u = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  21625. u[_key3] = _args4[_key3];
  21626. }
  21627. d = {
  21628. name: t,
  21629. type: h,
  21630. data: {
  21631. method: c,
  21632. params: u
  21633. }
  21634. };
  21635. "object" == (0, _typeof2.default)(n.secretMethods) && function (e, t) {
  21636. var n = t.data.method,
  21637. s = e.secretMethods || {},
  21638. r = s[n] || s["*"];
  21639. r && (t.secretType = r);
  21640. }(n, d);
  21641. p = !1;
  21642. _context52.prev = 5;
  21643. _context52.next = 8;
  21644. return e.callFunction(d);
  21645. case 8:
  21646. l = _context52.sent;
  21647. _context52.next = 14;
  21648. break;
  21649. case 11:
  21650. _context52.prev = 11;
  21651. _context52.t0 = _context52["catch"](5);
  21652. p = !0, l = {
  21653. result: new ne(_context52.t0)
  21654. };
  21655. case 14:
  21656. _ref50 = l.result || {}, f = _ref50.errSubject, g = _ref50.errCode, m = _ref50.errMsg, y = _ref50.newToken;
  21657. if (!(a && uni.hideLoading(), y && y.token && y.tokenExpired && (ie(y), Q(W, _objectSpread({}, y))), g)) {
  21658. _context52.next = 39;
  21659. break;
  21660. }
  21661. _e27 = m;
  21662. if (!(p && o)) {
  21663. _context52.next = 24;
  21664. break;
  21665. }
  21666. _context52.next = 20;
  21667. return o({
  21668. objectName: t,
  21669. methodName: c,
  21670. params: u,
  21671. errSubject: f,
  21672. errCode: g,
  21673. errMsg: m
  21674. });
  21675. case 20:
  21676. _context52.t1 = _context52.sent.errMsg;
  21677. if (_context52.t1) {
  21678. _context52.next = 23;
  21679. break;
  21680. }
  21681. _context52.t1 = m;
  21682. case 23:
  21683. _e27 = _context52.t1;
  21684. case 24:
  21685. if (!a) {
  21686. _context52.next = 37;
  21687. break;
  21688. }
  21689. if (!("toast" === i.type)) {
  21690. _context52.next = 29;
  21691. break;
  21692. }
  21693. uni.showToast({
  21694. title: _e27,
  21695. icon: "none"
  21696. });
  21697. _context52.next = 37;
  21698. break;
  21699. case 29:
  21700. if (!("modal" !== i.type)) {
  21701. _context52.next = 31;
  21702. break;
  21703. }
  21704. throw new Error("Invalid errorOptions.type: ".concat(i.type));
  21705. case 31:
  21706. _context52.next = 33;
  21707. return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
  21708. var _ref52,
  21709. e,
  21710. t,
  21711. n,
  21712. s,
  21713. r,
  21714. _args2 = arguments;
  21715. return _regenerator.default.wrap(function _callee51$(_context51) {
  21716. while (1) {
  21717. switch (_context51.prev = _context51.next) {
  21718. case 0:
  21719. _ref52 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, e = _ref52.title, t = _ref52.content, n = _ref52.showCancel, s = _ref52.cancelText, r = _ref52.confirmText;
  21720. return _context51.abrupt("return", new Promise(function (i, o) {
  21721. uni.showModal({
  21722. title: e,
  21723. content: t,
  21724. showCancel: n,
  21725. cancelText: s,
  21726. confirmText: r,
  21727. success: function success(e) {
  21728. i(e);
  21729. },
  21730. fail: function fail() {
  21731. i({
  21732. confirm: !1,
  21733. cancel: !0
  21734. });
  21735. }
  21736. });
  21737. }));
  21738. case 2:
  21739. case "end":
  21740. return _context51.stop();
  21741. }
  21742. }
  21743. }, _callee51);
  21744. }))({
  21745. title: "提示",
  21746. content: _e27,
  21747. showCancel: i.retry,
  21748. cancelText: "取消",
  21749. confirmText: i.retry ? "重试" : "确定"
  21750. });
  21751. case 33:
  21752. _yield = _context52.sent;
  21753. _t18 = _yield.confirm;
  21754. if (!(i.retry && _t18)) {
  21755. _context52.next = 37;
  21756. break;
  21757. }
  21758. return _context52.abrupt("return", s.apply(void 0, u));
  21759. case 37:
  21760. _n14 = new ne({
  21761. subject: f,
  21762. code: g,
  21763. message: m,
  21764. requestId: l.requestId
  21765. });
  21766. throw _n14.detail = l.result, Q(B, {
  21767. type: H,
  21768. content: _n14
  21769. }), _n14;
  21770. case 39:
  21771. return _context52.abrupt("return", (Q(B, {
  21772. type: H,
  21773. content: l.result
  21774. }), l.result));
  21775. case 40:
  21776. case "end":
  21777. return _context52.stop();
  21778. }
  21779. }
  21780. }, _callee52, null, [[5, 11]]);
  21781. }));
  21782. function s() {
  21783. return _s14.apply(this, arguments);
  21784. }
  21785. return s;
  21786. }(),
  21787. interceptorName: "callObject",
  21788. getCallbackArgs: function getCallbackArgs() {
  21789. var _ref53 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21790. e = _ref53.params;
  21791. return {
  21792. objectName: t,
  21793. methodName: c,
  21794. params: e
  21795. };
  21796. }
  21797. });
  21798. }
  21799. });
  21800. };
  21801. }
  21802. function ks(e) {
  21803. return U("_globalUniCloudSecureNetworkCache__{spaceId}".replace("{spaceId}", e.config.spaceId));
  21804. }
  21805. function Cs() {
  21806. return _Cs.apply(this, arguments);
  21807. }
  21808. function _Cs() {
  21809. _Cs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
  21810. var _ref65,
  21811. e,
  21812. _ref65$callLoginByWei,
  21813. t,
  21814. n,
  21815. s,
  21816. r,
  21817. _args7 = arguments;
  21818. return _regenerator.default.wrap(function _callee55$(_context55) {
  21819. while (1) {
  21820. switch (_context55.prev = _context55.next) {
  21821. case 0:
  21822. _ref65 = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {}, e = _ref65.openid, _ref65$callLoginByWei = _ref65.callLoginByWeixin, t = _ref65$callLoginByWei === void 0 ? !1 : _ref65$callLoginByWei;
  21823. n = ks(this);
  21824. if (!("mp-weixin" !== P)) {
  21825. _context55.next = 4;
  21826. break;
  21827. }
  21828. throw new Error("[SecureNetwork] API `initSecureNetworkByWeixin` is not supported on platform `".concat(P, "`"));
  21829. case 4:
  21830. if (!(e && t)) {
  21831. _context55.next = 6;
  21832. break;
  21833. }
  21834. throw new Error("[SecureNetwork] openid and callLoginByWeixin cannot be passed at the same time");
  21835. case 6:
  21836. if (!e) {
  21837. _context55.next = 8;
  21838. break;
  21839. }
  21840. return _context55.abrupt("return", (n.mpWeixinOpenid = e, {}));
  21841. case 8:
  21842. _context55.next = 10;
  21843. return new Promise(function (e, t) {
  21844. uni.login({
  21845. success: function success(t) {
  21846. e(t.code);
  21847. },
  21848. fail: function fail(e) {
  21849. t(new Error(e.errMsg));
  21850. }
  21851. });
  21852. });
  21853. case 10:
  21854. s = _context55.sent;
  21855. r = this.importObject("uni-id-co", {
  21856. customUI: !0
  21857. });
  21858. _context55.next = 14;
  21859. return r.secureNetworkHandshakeByWeixin({
  21860. code: s,
  21861. callLoginByWeixin: t
  21862. });
  21863. case 14:
  21864. n.mpWeixinCode = s;
  21865. return _context55.abrupt("return", {
  21866. code: s
  21867. });
  21868. case 16:
  21869. case "end":
  21870. return _context55.stop();
  21871. }
  21872. }
  21873. }, _callee55, this);
  21874. }));
  21875. return _Cs.apply(this, arguments);
  21876. }
  21877. function Ts(_x37) {
  21878. return _Ts.apply(this, arguments);
  21879. }
  21880. function _Ts() {
  21881. _Ts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(e) {
  21882. var t;
  21883. return _regenerator.default.wrap(function _callee56$(_context56) {
  21884. while (1) {
  21885. switch (_context56.prev = _context56.next) {
  21886. case 0:
  21887. t = ks(this);
  21888. return _context56.abrupt("return", (t.initPromise || (t.initPromise = Cs.call(this, e)), t.initPromise));
  21889. case 2:
  21890. case "end":
  21891. return _context56.stop();
  21892. }
  21893. }
  21894. }, _callee56, this);
  21895. }));
  21896. return _Ts.apply(this, arguments);
  21897. }
  21898. function Ps(e) {
  21899. return function () {
  21900. var _ref54 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  21901. t = _ref54.openid,
  21902. _ref54$callLoginByWei = _ref54.callLoginByWeixin,
  21903. n = _ref54$callLoginByWei === void 0 ? !1 : _ref54$callLoginByWei;
  21904. return Ts.call(e, {
  21905. openid: t,
  21906. callLoginByWeixin: n
  21907. });
  21908. };
  21909. }
  21910. function As(e) {
  21911. var t = {
  21912. getSystemInfo: uni.getSystemInfo,
  21913. getPushClientId: uni.getPushClientId
  21914. };
  21915. return function (n) {
  21916. return new Promise(function (s, r) {
  21917. t[e](_objectSpread(_objectSpread({}, n), {}, {
  21918. success: function success(e) {
  21919. s(e);
  21920. },
  21921. fail: function fail(e) {
  21922. r(e);
  21923. }
  21924. }));
  21925. });
  21926. };
  21927. }
  21928. var Es = /*#__PURE__*/function (_ref55) {
  21929. (0, _inherits2.default)(Es, _ref55);
  21930. var _super12 = _createSuper(Es);
  21931. function Es() {
  21932. var _this22;
  21933. (0, _classCallCheck2.default)(this, Es);
  21934. _this22 = _super12.call(this), _this22._uniPushMessageCallback = _this22._receivePushMessage.bind((0, _assertThisInitialized2.default)(_this22)), _this22._currentMessageId = -1, _this22._payloadQueue = [];
  21935. return _this22;
  21936. }
  21937. (0, _createClass2.default)(Es, [{
  21938. key: "init",
  21939. value: function init() {
  21940. var _this23 = this;
  21941. return Promise.all([As("getSystemInfo")(), As("getPushClientId")()]).then(function () {
  21942. var _ref56 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [],
  21943. _ref57 = (0, _slicedToArray2.default)(_ref56, 2),
  21944. _ref57$ = _ref57[0];
  21945. _ref57$ = _ref57$ === void 0 ? {} : _ref57$;
  21946. var e = _ref57$.appId,
  21947. _ref57$2 = _ref57[1];
  21948. _ref57$2 = _ref57$2 === void 0 ? {} : _ref57$2;
  21949. var t = _ref57$2.cid;
  21950. if (!e) throw new Error("Invalid appId, please check the manifest.json file");
  21951. if (!t) throw new Error("Invalid push client id");
  21952. _this23._appId = e, _this23._pushClientId = t, _this23._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), _this23.emit("open"), _this23._initMessageListener();
  21953. }, function (e) {
  21954. throw _this23.emit("error", e), _this23.close(), e;
  21955. });
  21956. }
  21957. }, {
  21958. key: "open",
  21959. value: function () {
  21960. var _open = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
  21961. return _regenerator.default.wrap(function _callee53$(_context53) {
  21962. while (1) {
  21963. switch (_context53.prev = _context53.next) {
  21964. case 0:
  21965. return _context53.abrupt("return", this.init());
  21966. case 1:
  21967. case "end":
  21968. return _context53.stop();
  21969. }
  21970. }
  21971. }, _callee53, this);
  21972. }));
  21973. function open() {
  21974. return _open.apply(this, arguments);
  21975. }
  21976. return open;
  21977. }()
  21978. }, {
  21979. key: "_isUniCloudSSE",
  21980. value: function _isUniCloudSSE(e) {
  21981. if ("receive" !== e.type) return !1;
  21982. var t = e && e.data && e.data.payload;
  21983. return !(!t || "UNI_CLOUD_SSE" !== t.channel || t.seqId !== this._seqId);
  21984. }
  21985. }, {
  21986. key: "_receivePushMessage",
  21987. value: function _receivePushMessage(e) {
  21988. if (!this._isUniCloudSSE(e)) return;
  21989. var t = e && e.data && e.data.payload,
  21990. n = t.action,
  21991. s = t.messageId,
  21992. r = t.message;
  21993. this._payloadQueue.push({
  21994. action: n,
  21995. messageId: s,
  21996. message: r
  21997. }), this._consumMessage();
  21998. }
  21999. }, {
  22000. key: "_consumMessage",
  22001. value: function _consumMessage() {
  22002. var _this24 = this;
  22003. for (;;) {
  22004. var _e28 = this._payloadQueue.find(function (e) {
  22005. return e.messageId === _this24._currentMessageId + 1;
  22006. });
  22007. if (!_e28) break;
  22008. this._currentMessageId++, this._parseMessagePayload(_e28);
  22009. }
  22010. }
  22011. }, {
  22012. key: "_parseMessagePayload",
  22013. value: function _parseMessagePayload(e) {
  22014. var t = e.action,
  22015. n = e.messageId,
  22016. s = e.message;
  22017. "end" === t ? this._end({
  22018. messageId: n,
  22019. message: s
  22020. }) : "message" === t && this._appendMessage({
  22021. messageId: n,
  22022. message: s
  22023. });
  22024. }
  22025. }, {
  22026. key: "_appendMessage",
  22027. value: function _appendMessage() {
  22028. var _ref58 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22029. e = _ref58.messageId,
  22030. t = _ref58.message;
  22031. this.emit("message", t);
  22032. }
  22033. }, {
  22034. key: "_end",
  22035. value: function _end() {
  22036. var _ref59 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  22037. e = _ref59.messageId,
  22038. t = _ref59.message;
  22039. this.emit("end", t), this.close();
  22040. }
  22041. }, {
  22042. key: "_initMessageListener",
  22043. value: function _initMessageListener() {
  22044. uni.onPushMessage(this._uniPushMessageCallback);
  22045. }
  22046. }, {
  22047. key: "_destroy",
  22048. value: function _destroy() {
  22049. uni.offPushMessage(this._uniPushMessageCallback);
  22050. }
  22051. }, {
  22052. key: "toJSON",
  22053. value: function toJSON() {
  22054. return {
  22055. appId: this._appId,
  22056. pushClientId: this._pushClientId,
  22057. seqId: this._seqId
  22058. };
  22059. }
  22060. }, {
  22061. key: "close",
  22062. value: function close() {
  22063. this._destroy(), this.emit("close");
  22064. }
  22065. }]);
  22066. return Es;
  22067. }( /*#__PURE__*/function () {
  22068. function _class6() {
  22069. (0, _classCallCheck2.default)(this, _class6);
  22070. this._callback = {};
  22071. }
  22072. (0, _createClass2.default)(_class6, [{
  22073. key: "addListener",
  22074. value: function addListener(e, t) {
  22075. this._callback[e] || (this._callback[e] = []), this._callback[e].push(t);
  22076. }
  22077. }, {
  22078. key: "on",
  22079. value: function on(e, t) {
  22080. return this.addListener(e, t);
  22081. }
  22082. }, {
  22083. key: "removeListener",
  22084. value: function removeListener(e, t) {
  22085. if (!t) throw new Error('The "listener" argument must be of type function. Received undefined');
  22086. var n = this._callback[e];
  22087. if (!n) return;
  22088. var s = function (e, t) {
  22089. for (var _n15 = e.length - 1; _n15 >= 0; _n15--) {
  22090. if (e[_n15] === t) return _n15;
  22091. }
  22092. return -1;
  22093. }(n, t);
  22094. n.splice(s, 1);
  22095. }
  22096. }, {
  22097. key: "off",
  22098. value: function off(e, t) {
  22099. return this.removeListener(e, t);
  22100. }
  22101. }, {
  22102. key: "removeAllListener",
  22103. value: function removeAllListener(e) {
  22104. delete this._callback[e];
  22105. }
  22106. }, {
  22107. key: "emit",
  22108. value: function emit(e) {
  22109. var n = this._callback[e];
  22110. for (var _len4 = arguments.length, t = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
  22111. t[_key4 - 1] = arguments[_key4];
  22112. }
  22113. if (n) for (var _e29 = 0; _e29 < n.length; _e29++) {
  22114. n[_e29].apply(n, t);
  22115. }
  22116. }
  22117. }]);
  22118. return _class6;
  22119. }());
  22120. function Os(_x38, _x39) {
  22121. return _Os.apply(this, arguments);
  22122. }
  22123. function _Os() {
  22124. _Os = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(e, t) {
  22125. var n, _e33, s;
  22126. return _regenerator.default.wrap(function _callee57$(_context57) {
  22127. while (1) {
  22128. switch (_context57.prev = _context57.next) {
  22129. case 0:
  22130. n = "http://".concat(e, ":").concat(t, "/system/ping");
  22131. _context57.prev = 1;
  22132. _context57.next = 4;
  22133. return s = {
  22134. url: n,
  22135. timeout: 500
  22136. }, new Promise(function (e, t) {
  22137. se.request(_objectSpread(_objectSpread({}, s), {}, {
  22138. success: function success(t) {
  22139. e(t);
  22140. },
  22141. fail: function fail(e) {
  22142. t(e);
  22143. }
  22144. }));
  22145. });
  22146. case 4:
  22147. _e33 = _context57.sent;
  22148. return _context57.abrupt("return", !(!_e33.data || 0 !== _e33.data.code));
  22149. case 8:
  22150. _context57.prev = 8;
  22151. _context57.t0 = _context57["catch"](1);
  22152. return _context57.abrupt("return", !1);
  22153. case 11:
  22154. case "end":
  22155. return _context57.stop();
  22156. }
  22157. }
  22158. }, _callee57, null, [[1, 8]]);
  22159. }));
  22160. return _Os.apply(this, arguments);
  22161. }
  22162. function xs(_x40) {
  22163. return _xs.apply(this, arguments);
  22164. }
  22165. function _xs() {
  22166. _xs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(e) {
  22167. var _ce2, _e34, _t20, t, _t$debugInfo, n, s, _yield2, r, i, o;
  22168. return _regenerator.default.wrap(function _callee59$(_context59) {
  22169. while (1) {
  22170. switch (_context59.prev = _context59.next) {
  22171. case 0:
  22172. if (b) {
  22173. _context59.next = 2;
  22174. break;
  22175. }
  22176. return _context59.abrupt("return", Promise.resolve());
  22177. case 2:
  22178. if ("app" === P) {
  22179. _ce2 = ce(), _e34 = _ce2.osName, _t20 = _ce2.osVersion;
  22180. "ios" === _e34 && function (e) {
  22181. if (!e || "string" != typeof e) return 0;
  22182. var t = e.match(/^(\d+)./);
  22183. return t && t[1] ? parseInt(t[1]) : 0;
  22184. }(_t20) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发模式生效,发行模式会连接uniCloud云端服务)");
  22185. }
  22186. t = e.__dev__;
  22187. if (t.debugInfo) {
  22188. _context59.next = 6;
  22189. break;
  22190. }
  22191. return _context59.abrupt("return");
  22192. case 6:
  22193. _t$debugInfo = t.debugInfo;
  22194. n = _t$debugInfo.address;
  22195. s = _t$debugInfo.servePort;
  22196. _context59.next = 11;
  22197. return function () {
  22198. var _ref66 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(e, t) {
  22199. var n, _s15, _r8;
  22200. return _regenerator.default.wrap(function _callee58$(_context58) {
  22201. while (1) {
  22202. switch (_context58.prev = _context58.next) {
  22203. case 0:
  22204. _s15 = 0;
  22205. case 1:
  22206. if (!(_s15 < e.length)) {
  22207. _context58.next = 11;
  22208. break;
  22209. }
  22210. _r8 = e[_s15];
  22211. _context58.next = 5;
  22212. return Os(_r8, t);
  22213. case 5:
  22214. if (!_context58.sent) {
  22215. _context58.next = 8;
  22216. break;
  22217. }
  22218. n = _r8;
  22219. return _context58.abrupt("break", 11);
  22220. case 8:
  22221. _s15++;
  22222. _context58.next = 1;
  22223. break;
  22224. case 11:
  22225. return _context58.abrupt("return", {
  22226. address: n,
  22227. port: t
  22228. });
  22229. case 12:
  22230. case "end":
  22231. return _context58.stop();
  22232. }
  22233. }
  22234. }, _callee58);
  22235. }));
  22236. return function (_x41, _x42) {
  22237. return _ref66.apply(this, arguments);
  22238. };
  22239. }()(n, s);
  22240. case 11:
  22241. _yield2 = _context59.sent;
  22242. r = _yield2.address;
  22243. if (!r) {
  22244. _context59.next = 15;
  22245. break;
  22246. }
  22247. return _context59.abrupt("return", (t.localAddress = r, void (t.localPort = s)));
  22248. case 15:
  22249. i = console["app" === P ? "error" : "warn"];
  22250. o = "";
  22251. if (!("remote" === t.debugInfo.initialLaunchType ? (t.debugInfo.forceRemote = !0, o = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", "web" === P && (o += "\n- 部分浏览器开启节流模式之后访问本地地址受限,请检查是否启用了节流模式"), 0 === P.indexOf("mp-") && (o += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t.debugInfo.forceRemote)) {
  22252. _context59.next = 19;
  22253. break;
  22254. }
  22255. throw new Error(o);
  22256. case 19:
  22257. i(o);
  22258. case 20:
  22259. case "end":
  22260. return _context59.stop();
  22261. }
  22262. }
  22263. }, _callee59);
  22264. }));
  22265. return _xs.apply(this, arguments);
  22266. }
  22267. function Rs(e) {
  22268. e._initPromiseHub || (e._initPromiseHub = new I({
  22269. createPromise: function createPromise() {
  22270. var t = Promise.resolve();
  22271. var n;
  22272. n = 1, t = new Promise(function (e) {
  22273. setTimeout(function () {
  22274. e();
  22275. }, n);
  22276. });
  22277. var s = e.auth();
  22278. return t.then(function () {
  22279. return s.getLoginState();
  22280. }).then(function (e) {
  22281. return e ? Promise.resolve() : s.signInAnonymously();
  22282. });
  22283. }
  22284. }));
  22285. }
  22286. var Us = {
  22287. tcb: It,
  22288. tencent: It,
  22289. aliyun: ge,
  22290. private: bt
  22291. };
  22292. var Ls = new ( /*#__PURE__*/function () {
  22293. function _class7() {
  22294. (0, _classCallCheck2.default)(this, _class7);
  22295. }
  22296. (0, _createClass2.default)(_class7, [{
  22297. key: "init",
  22298. value: function init(e) {
  22299. var t = {};
  22300. var n = Us[e.provider];
  22301. if (!n) throw new Error("未提供正确的provider参数");
  22302. t = n.init(e), b && function (e) {
  22303. if (!b) return;
  22304. var t = {};
  22305. e.__dev__ = t, t.debugLog = b && ("web" === P && navigator.userAgent.indexOf("HBuilderX") > 0 || "app" === P);
  22306. var n = A;
  22307. n && !n.code && (t.debugInfo = n);
  22308. var s = new I({
  22309. createPromise: function createPromise() {
  22310. return xs(e);
  22311. }
  22312. });
  22313. t.initLocalNetwork = function () {
  22314. return s.exec();
  22315. };
  22316. }(t), Rs(t), xn(t), function (e) {
  22317. var t = e.uploadFile;
  22318. e.uploadFile = function (e) {
  22319. return t.call(this, e);
  22320. };
  22321. }(t), function (e) {
  22322. e.database = function (t) {
  22323. if (t && Object.keys(t).length > 0) return e.init(t).database();
  22324. if (this._database) return this._database;
  22325. var n = Bn($n, {
  22326. uniClient: e
  22327. });
  22328. return this._database = n, n;
  22329. }, e.databaseForJQL = function (t) {
  22330. if (t && Object.keys(t).length > 0) return e.init(t).databaseForJQL();
  22331. if (this._databaseForJQL) return this._databaseForJQL;
  22332. var n = Bn($n, {
  22333. uniClient: e,
  22334. isJQL: !0
  22335. });
  22336. return this._databaseForJQL = n, n;
  22337. };
  22338. }(t), function (e) {
  22339. e.getCurrentUserInfo = _s, e.chooseAndUploadFile = vs.initChooseAndUploadFile(e), Object.assign(e, {
  22340. get mixinDatacom() {
  22341. return Ss(e);
  22342. }
  22343. }), e.SSEChannel = Es, e.initSecureNetworkByWeixin = Ps(e), e.importObject = bs(e);
  22344. }(t);
  22345. return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach(function (e) {
  22346. if (!t[e]) return;
  22347. var n = t[e];
  22348. t[e] = function () {
  22349. return n.apply(t, Array.from(arguments));
  22350. }, t[e] = function (e, t) {
  22351. return function (n) {
  22352. var _this25 = this;
  22353. var s = !1;
  22354. if ("callFunction" === t) {
  22355. var _e30 = n && n.type || u;
  22356. s = _e30 !== u;
  22357. }
  22358. var r = "callFunction" === t && !s,
  22359. i = this._initPromiseHub.exec();
  22360. n = n || {};
  22361. var _te2 = te(n),
  22362. o = _te2.success,
  22363. a = _te2.fail,
  22364. c = _te2.complete,
  22365. h = i.then(function () {
  22366. return s ? Promise.resolve() : q(M(t, "invoke"), n);
  22367. }).then(function () {
  22368. return e.call(_this25, n);
  22369. }).then(function (e) {
  22370. return s ? Promise.resolve(e) : q(M(t, "success"), e).then(function () {
  22371. return q(M(t, "complete"), e);
  22372. }).then(function () {
  22373. return r && Q(B, {
  22374. type: J,
  22375. content: e
  22376. }), Promise.resolve(e);
  22377. });
  22378. }, function (e) {
  22379. return s ? Promise.reject(e) : q(M(t, "fail"), e).then(function () {
  22380. return q(M(t, "complete"), e);
  22381. }).then(function () {
  22382. return Q(B, {
  22383. type: J,
  22384. content: e
  22385. }), Promise.reject(e);
  22386. });
  22387. });
  22388. if (!(o || a || c)) return h;
  22389. h.then(function (e) {
  22390. o && o(e), c && c(e), r && Q(B, {
  22391. type: J,
  22392. content: e
  22393. });
  22394. }, function (e) {
  22395. a && a(e), c && c(e), r && Q(B, {
  22396. type: J,
  22397. content: e
  22398. });
  22399. });
  22400. };
  22401. }(t[e], e).bind(t);
  22402. }), t.init = this.init, t;
  22403. }
  22404. }]);
  22405. return _class7;
  22406. }())();
  22407. (function () {
  22408. var e = E;
  22409. var t = {};
  22410. if (e && 1 === e.length) t = e[0], Ls = Ls.init(t), Ls._isDefault = !0;else {
  22411. var _t19 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "database", "getCurrentUSerInfo", "importObject"];
  22412. var _n16;
  22413. _n16 = e && e.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : O ? "应用未关联服务空间,请在uniCloud目录右键关联服务空间" : "uni-app cli项目内使用uniCloud需要使用HBuilderX的运行菜单运行项目,且需要在uniCloud目录关联服务空间", _t19.forEach(function (e) {
  22414. Ls[e] = function () {
  22415. return console.error(_n16), Promise.reject(new ne({
  22416. code: "SYS_ERR",
  22417. message: _n16
  22418. }));
  22419. };
  22420. });
  22421. }
  22422. Object.assign(Ls, {
  22423. get mixinDatacom() {
  22424. return Ss(Ls);
  22425. }
  22426. }), fs(Ls), Ls.addInterceptor = D, Ls.removeInterceptor = F, Ls.interceptObject = K, b && "web" === P && (window.uniCloud = Ls);
  22427. })();
  22428. var Ns = Ls;
  22429. exports.default = Ns;
  22430. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3), __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))
  22431. /***/ }),
  22432. /***/ 674:
  22433. /*!**********************************************************************!*\
  22434. !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
  22435. \**********************************************************************/
  22436. /*! no static exports found */
  22437. /***/ (function(module, exports) {
  22438. function _assertThisInitialized(self) {
  22439. if (self === void 0) {
  22440. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  22441. }
  22442. return self;
  22443. }
  22444. module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22445. /***/ }),
  22446. /***/ 675:
  22447. /*!*********************************************************!*\
  22448. !*** ./node_modules/@babel/runtime/helpers/inherits.js ***!
  22449. \*********************************************************/
  22450. /*! no static exports found */
  22451. /***/ (function(module, exports, __webpack_require__) {
  22452. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  22453. function _inherits(subClass, superClass) {
  22454. if (typeof superClass !== "function" && superClass !== null) {
  22455. throw new TypeError("Super expression must either be null or a function");
  22456. }
  22457. subClass.prototype = Object.create(superClass && superClass.prototype, {
  22458. constructor: {
  22459. value: subClass,
  22460. writable: true,
  22461. configurable: true
  22462. }
  22463. });
  22464. Object.defineProperty(subClass, "prototype", {
  22465. writable: false
  22466. });
  22467. if (superClass) setPrototypeOf(subClass, superClass);
  22468. }
  22469. module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22470. /***/ }),
  22471. /***/ 676:
  22472. /*!**************************************************************************!*\
  22473. !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
  22474. \**************************************************************************/
  22475. /*! no static exports found */
  22476. /***/ (function(module, exports, __webpack_require__) {
  22477. var _typeof = __webpack_require__(/*! ./typeof.js */ 13)["default"];
  22478. var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ 674);
  22479. function _possibleConstructorReturn(self, call) {
  22480. if (call && (_typeof(call) === "object" || typeof call === "function")) {
  22481. return call;
  22482. } else if (call !== void 0) {
  22483. throw new TypeError("Derived constructors may only return object or undefined");
  22484. }
  22485. return assertThisInitialized(self);
  22486. }
  22487. module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22488. /***/ }),
  22489. /***/ 677:
  22490. /*!***************************************************************!*\
  22491. !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
  22492. \***************************************************************/
  22493. /*! no static exports found */
  22494. /***/ (function(module, exports) {
  22495. function _getPrototypeOf(o) {
  22496. module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
  22497. return o.__proto__ || Object.getPrototypeOf(o);
  22498. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22499. return _getPrototypeOf(o);
  22500. }
  22501. module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22502. /***/ }),
  22503. /***/ 678:
  22504. /*!****************************************************************!*\
  22505. !*** ./node_modules/@babel/runtime/helpers/wrapNativeSuper.js ***!
  22506. \****************************************************************/
  22507. /*! no static exports found */
  22508. /***/ (function(module, exports, __webpack_require__) {
  22509. var getPrototypeOf = __webpack_require__(/*! ./getPrototypeOf.js */ 677);
  22510. var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ 16);
  22511. var isNativeFunction = __webpack_require__(/*! ./isNativeFunction.js */ 679);
  22512. var construct = __webpack_require__(/*! ./construct.js */ 15);
  22513. function _wrapNativeSuper(Class) {
  22514. var _cache = typeof Map === "function" ? new Map() : undefined;
  22515. module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {
  22516. if (Class === null || !isNativeFunction(Class)) return Class;
  22517. if (typeof Class !== "function") {
  22518. throw new TypeError("Super expression must either be null or a function");
  22519. }
  22520. if (typeof _cache !== "undefined") {
  22521. if (_cache.has(Class)) return _cache.get(Class);
  22522. _cache.set(Class, Wrapper);
  22523. }
  22524. function Wrapper() {
  22525. return construct(Class, arguments, getPrototypeOf(this).constructor);
  22526. }
  22527. Wrapper.prototype = Object.create(Class.prototype, {
  22528. constructor: {
  22529. value: Wrapper,
  22530. enumerable: false,
  22531. writable: true,
  22532. configurable: true
  22533. }
  22534. });
  22535. return setPrototypeOf(Wrapper, Class);
  22536. }, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22537. return _wrapNativeSuper(Class);
  22538. }
  22539. module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22540. /***/ }),
  22541. /***/ 679:
  22542. /*!*****************************************************************!*\
  22543. !*** ./node_modules/@babel/runtime/helpers/isNativeFunction.js ***!
  22544. \*****************************************************************/
  22545. /*! no static exports found */
  22546. /***/ (function(module, exports) {
  22547. function _isNativeFunction(fn) {
  22548. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  22549. }
  22550. module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports;
  22551. /***/ }),
  22552. /***/ 68:
  22553. /*!*********************************!*\
  22554. !*** E:/work/mdapp/api/cust.js ***!
  22555. \*********************************/
  22556. /*! no static exports found */
  22557. /***/ (function(module, exports, __webpack_require__) {
  22558. "use strict";
  22559. Object.defineProperty(exports, "__esModule", {
  22560. value: true
  22561. });
  22562. exports.default = void 0;
  22563. var _http = __webpack_require__(/*! @/utils/http */ 65);
  22564. var _default = {
  22565. apicustomerlist: function apicustomerlist(params) {
  22566. // 客户 列表
  22567. return (0, _http.request)('api/customer/list', params);
  22568. },
  22569. apicustomeradd: function apicustomeradd(params) {
  22570. // 客户 添加
  22571. return (0, _http.request)('api/customer/add', params, 'loading');
  22572. },
  22573. apicustomeredit: function apicustomeredit(params) {
  22574. // 客户 编辑
  22575. return (0, _http.request)('api/customer/edit', params, 'loading');
  22576. },
  22577. apicustomerdel: function apicustomerdel(params) {
  22578. // 客户 删除
  22579. return (0, _http.request)('api/customer/del', params, 'loading');
  22580. },
  22581. apicustomerdetail: function apicustomerdetail(params) {
  22582. // 客户 详情
  22583. return (0, _http.request)('api/customer/detail', params, 'loading');
  22584. },
  22585. apireportvisitchange: function apireportvisitchange(params) {
  22586. // 到访材料添加
  22587. return (0, _http.request)('api/report/visit/change', params, 'loading');
  22588. },
  22589. apireportvisitdetail: function apireportvisitdetail(params) {
  22590. // 到访材料详情
  22591. return (0, _http.request)('api/report/visit/detail', params, 'loading');
  22592. },
  22593. apireportvisit: function apireportvisit(params) {
  22594. // 报备到访
  22595. return (0, _http.request)('api/report/visit', params, 'loading');
  22596. },
  22597. apireportverify: function apireportverify(params) {
  22598. // 报备审核
  22599. return (0, _http.request)('api/report/verify', params, 'loading');
  22600. },
  22601. apideptuserlist: function apideptuserlist(params) {
  22602. // 我的门店下级人员
  22603. return (0, _http.request)('api/dept/user/list', params, 'loading');
  22604. },
  22605. apiprivatecustomerlist: function apiprivatecustomerlist(params) {
  22606. // 内部客户 列表
  22607. return (0, _http.request)('api/private/customer/list', params);
  22608. },
  22609. apiprivatecustomeradd: function apiprivatecustomeradd(params) {
  22610. // 内部客户 添加
  22611. return (0, _http.request)('api/private/customer/add', params, 'loading');
  22612. },
  22613. apiprivatecustomeredit: function apiprivatecustomeredit(params) {
  22614. // 内部客户 编辑
  22615. return (0, _http.request)('api/private/customer/edit', params, 'loading');
  22616. },
  22617. apiprivatecustomerdel: function apiprivatecustomerdel(params) {
  22618. // 内部客户 删除
  22619. return (0, _http.request)('api/private/customer/del', params, 'loading');
  22620. },
  22621. apiprivatecustomerdetail: function apiprivatecustomerdetail(params) {
  22622. // 内部客户 详情
  22623. return (0, _http.request)('api/private/customer/detail', params, 'loading');
  22624. },
  22625. apiprivaterecordlist: function apiprivaterecordlist(params) {
  22626. // 内部客户 - 跟进记录 - 列表
  22627. return (0, _http.request)('api/private/record/list', params);
  22628. },
  22629. apiprivaterecordadd: function apiprivaterecordadd(params) {
  22630. // 内部客户 - 跟进记录 - 添加
  22631. return (0, _http.request)('api/private/record/add', params, 'loading');
  22632. },
  22633. apiprivaterecordedit: function apiprivaterecordedit(params) {
  22634. // 内部客户 - 跟进记录 - 编辑
  22635. return (0, _http.request)('api/private/record/edit', params, 'loading');
  22636. },
  22637. apiprivaterecorddel: function apiprivaterecorddel(params) {
  22638. // 内部客户 - 跟进记录 - 删除
  22639. return (0, _http.request)('api/private/record/del', params, 'loading');
  22640. },
  22641. apirecordremindcount: function apirecordremindcount(params) {
  22642. // 内部客户 - 跟进记录 - 数量统计
  22643. return (0, _http.request)('api/record/remind/count', params, 'loading');
  22644. },
  22645. apitradelist: function apitradelist(params) {
  22646. // 成交 - 列表
  22647. return (0, _http.request)('api/trade/list', params);
  22648. },
  22649. apitradeadd: function apitradeadd(params) {
  22650. // 成交 - 添加
  22651. return (0, _http.request)('api/trade/add', params, 'loading');
  22652. },
  22653. apitradeedit: function apitradeedit(params) {
  22654. // 成交 - 编辑
  22655. return (0, _http.request)('api/trade/edit', params, 'loading');
  22656. },
  22657. apitradedetail: function apitradedetail(params) {
  22658. // 成交 - 详情
  22659. return (0, _http.request)('api/trade/detail', params, 'loading');
  22660. },
  22661. apitradedel: function apitradedel(params) {
  22662. // 成交 - 删除
  22663. return (0, _http.request)('api/trade/del', params, 'loading');
  22664. },
  22665. apitraderecordlist: function apitraderecordlist(params) {
  22666. // 成交 更新记录 - 列表
  22667. return (0, _http.request)('api/trade/record/list', params);
  22668. },
  22669. apitraderecordadd: function apitraderecordadd(params) {
  22670. // 成交 更新记录 - 添加
  22671. return (0, _http.request)('api/trade/record/add', params, 'loading');
  22672. },
  22673. apitraderecordedit: function apitraderecordedit(params) {
  22674. // 成交 更新记录 - 编辑
  22675. return (0, _http.request)('api/trade/record/edit', params, 'loading');
  22676. },
  22677. apitraderecorddel: function apitraderecorddel(params) {
  22678. // 成交 更新记录 - 删除
  22679. return (0, _http.request)('api/trade/record/del', params, 'loading');
  22680. },
  22681. apitradesubmit: function apitradesubmit(params) {
  22682. // 成交审核 - 提交审核
  22683. return (0, _http.request)('api/trade/submit', params, 'loading');
  22684. },
  22685. apitradereview: function apitradereview(params) {
  22686. // 成交审核 - 一二三审 审核
  22687. return (0, _http.request)('api/trade/review', params, 'loading');
  22688. },
  22689. apitradesubtotal: function apitradesubtotal(params) {
  22690. // 成交审核 - 成交月度小计
  22691. return (0, _http.request)('api/trade/subtotal', params, 'loading');
  22692. },
  22693. apiactivitylist: function apiactivitylist(params) {
  22694. // 活动 列表
  22695. return (0, _http.request)('api/activity/list', params, 'loading');
  22696. },
  22697. apiactivityinfo: function apiactivityinfo(params) {
  22698. // 活动 详情
  22699. return (0, _http.request)('api/activity/info', params, 'loading');
  22700. },
  22701. apiactivityenroll: function apiactivityenroll(params) {
  22702. // 活动 报名
  22703. return (0, _http.request)('api/activity/enroll', params, 'loading');
  22704. },
  22705. apiactivitysign: function apiactivitysign(params) {
  22706. // 活动 报名 扫码签到
  22707. return (0, _http.request)('api/activity/sign', params, 'loading');
  22708. },
  22709. apitradestepinfo: function apitradestepinfo(params) {
  22710. // 二手房成交步骤管理 - 成交步骤明细
  22711. return (0, _http.request)('api/trade/step/info', params, 'loading');
  22712. },
  22713. apitradecontractedit: function apitradecontractedit(params) {
  22714. // 二手房成交步骤管理 - 成交合同修改
  22715. return (0, _http.request)('api/trade/contract/edit', params, 'loading');
  22716. },
  22717. apitradestepedit: function apitradestepedit(params) {
  22718. // 二手房成交步骤管理 - 成交步骤修改
  22719. return (0, _http.request)('api/trade/step/edit', params, 'loading');
  22720. }
  22721. };
  22722. exports.default = _default;
  22723. /***/ }),
  22724. /***/ 680:
  22725. /*!*************************************************************!*\
  22726. !*** E:/work/mdapp/pages.json?{"type":"origin-pages-json"} ***!
  22727. \*************************************************************/
  22728. /*! no static exports found */
  22729. /***/ (function(module, exports, __webpack_require__) {
  22730. "use strict";
  22731. Object.defineProperty(exports, "__esModule", {
  22732. value: true
  22733. });
  22734. exports.default = void 0;
  22735. var _default = {
  22736. "pages": [{
  22737. "path": "pages/index/index",
  22738. "style": {
  22739. "navigationBarTitleText": "首页"
  22740. }
  22741. }, {
  22742. "path": "pages/index/web",
  22743. "style": {
  22744. "navigationBarTitleText": "小程序使用说明",
  22745. "enablePullDownRefresh": false
  22746. }
  22747. }, {
  22748. "path": "pages/user/login/login",
  22749. "style": {
  22750. "navigationBarTitleText": "登录",
  22751. "enablePullDownRefresh": false
  22752. }
  22753. }, {
  22754. "path": "pages/user/login/register",
  22755. "style": {
  22756. "navigationBarTitleText": "注册",
  22757. "enablePullDownRefresh": false
  22758. }
  22759. }, {
  22760. "path": "pages/agent/recommend/create",
  22761. "style": {
  22762. "navigationBarTitleText": "客户推荐",
  22763. "enablePullDownRefresh": false
  22764. }
  22765. }, {
  22766. "path": "pages/agent/activity/list",
  22767. "style": {
  22768. "navigationBarTitleText": "活动列表",
  22769. "enablePullDownRefresh": false
  22770. }
  22771. }, {
  22772. "path": "pages/agent/activity/join",
  22773. "style": {
  22774. "navigationBarTitleText": "活动报名",
  22775. "enablePullDownRefresh": false
  22776. }
  22777. }, {
  22778. "path": "pages/agent/activity/join2",
  22779. "style": {
  22780. "navigationBarTitleText": "踩盘报名",
  22781. "enablePullDownRefresh": false
  22782. }
  22783. }, {
  22784. "path": "pages/agent/recommend/createin",
  22785. "style": {
  22786. "navigationBarTitleText": "内部报备",
  22787. "enablePullDownRefresh": false
  22788. }
  22789. }, {
  22790. "path": "pages/agent/recommend/list",
  22791. "style": {
  22792. "navigationStyle": "custom",
  22793. "enablePullDownRefresh": true
  22794. }
  22795. }, {
  22796. "path": "pages/agent/recommend/estate",
  22797. "style": {
  22798. "navigationStyle": "custom",
  22799. "enablePullDownRefresh": true
  22800. }
  22801. }, {
  22802. "path": "pages/agent/recommend/check",
  22803. "style": {
  22804. "navigationBarTitleText": "报备审核",
  22805. "enablePullDownRefresh": false
  22806. }
  22807. }, {
  22808. "path": "pages/agent/recommend/detail",
  22809. "style": {
  22810. "navigationBarTitleText": "报备详情",
  22811. "enablePullDownRefresh": false
  22812. }
  22813. }, {
  22814. "path": "pages/agent/recommend/detailGovern",
  22815. "style": {
  22816. "navigationBarTitleText": "报备详情",
  22817. "enablePullDownRefresh": false
  22818. }
  22819. }, {
  22820. "path": "pages/agent/recommend/visitimg",
  22821. "style": {
  22822. "navigationBarTitleText": "到访凭证和认购资料",
  22823. "enablePullDownRefresh": false
  22824. }
  22825. }, {
  22826. "path": "pages/agent/recommend/detail2",
  22827. "style": {
  22828. "navigationBarTitleText": "客户详情-案场",
  22829. "enablePullDownRefresh": false
  22830. }
  22831. }, {
  22832. "path": "pages/cust/create",
  22833. "style": {
  22834. "navigationBarTitleText": "添加客户",
  22835. "enablePullDownRefresh": false
  22836. }
  22837. }, {
  22838. "path": "pages/cust/list",
  22839. "style": {
  22840. "navigationBarTitleText": "客户列表",
  22841. "enablePullDownRefresh": true
  22842. }
  22843. }, {
  22844. "path": "pages/cust/mycreate",
  22845. "style": {
  22846. "navigationBarTitleText": "添加我的客户",
  22847. "enablePullDownRefresh": false
  22848. }
  22849. }, {
  22850. "path": "pages/cust/myrecord",
  22851. "style": {
  22852. "navigationBarTitleText": "客户跟进记录",
  22853. "enablePullDownRefresh": false
  22854. }
  22855. }, {
  22856. "path": "pages/cust/myrecordedit",
  22857. "style": {
  22858. "navigationBarTitleText": "客户跟进记录添加",
  22859. "enablePullDownRefresh": false
  22860. }
  22861. }, {
  22862. "path": "pages/cust/my",
  22863. "style": {
  22864. "navigationBarTitleText": "我的客户列表",
  22865. "enablePullDownRefresh": true
  22866. }
  22867. }, {
  22868. "path": "pages/user/setting/setting",
  22869. "style": {
  22870. "navigationBarTitleText": "设置",
  22871. "enablePullDownRefresh": false
  22872. }
  22873. }, {
  22874. "path": "pages/user/setting/profile",
  22875. "style": {
  22876. "navigationBarTitleText": "个人信息",
  22877. "enablePullDownRefresh": false
  22878. }
  22879. }, {
  22880. "path": "pages/user/setting/bank",
  22881. "style": {
  22882. "navigationBarTitleText": "认证身份信息",
  22883. "enablePullDownRefresh": false
  22884. }
  22885. }, {
  22886. "path": "pages/saler/list",
  22887. "style": {
  22888. "navigationBarTitleText": "我的门店",
  22889. "enablePullDownRefresh": false
  22890. }
  22891. }, {
  22892. "path": "pages/saler/check",
  22893. "style": {
  22894. "navigationBarTitleText": "认证审核列表",
  22895. "enablePullDownRefresh": false
  22896. }
  22897. }, {
  22898. "path": "pages/saler/deal",
  22899. "style": {
  22900. "navigationBarTitleText": "认证审核",
  22901. "enablePullDownRefresh": false
  22902. }
  22903. }, {
  22904. "path": "pages/agreement/agreement",
  22905. "style": {
  22906. "navigationBarTitleText": "用户协议",
  22907. "enablePullDownRefresh": false
  22908. }
  22909. }, {
  22910. "path": "pages/agreement/agreement2",
  22911. "style": {
  22912. "navigationBarTitleText": "隐私协议",
  22913. "enablePullDownRefresh": false
  22914. }
  22915. }, {
  22916. "path": "pages/estate/list",
  22917. "style": {
  22918. "navigationBarTitleText": "楼盘列表",
  22919. "enablePullDownRefresh": false
  22920. }
  22921. }, {
  22922. "path": "pages/estate/dtl",
  22923. "style": {
  22924. "navigationBarTitleText": "楼盘详情",
  22925. "enablePullDownRefresh": false
  22926. }
  22927. }, {
  22928. "path": "pages/estate/libPre",
  22929. "style": {
  22930. "navigationBarTitleText": "选择区域",
  22931. "enablePullDownRefresh": false
  22932. }
  22933. }, {
  22934. "path": "pages/estate/lib",
  22935. "style": {
  22936. "navigationBarTitleText": "内部各楼盘各平台佣金汇集(请勿外传)",
  22937. "enablePullDownRefresh": false
  22938. }
  22939. }, {
  22940. "path": "pages/agent/report/buycheck",
  22941. "style": {
  22942. "navigationBarTitleText": "认购审核列表",
  22943. "enablePullDownRefresh": false
  22944. }
  22945. }, {
  22946. "path": "pages/agent/report/deal",
  22947. "style": {
  22948. "navigationBarTitleText": "认购审核操作",
  22949. "enablePullDownRefresh": false
  22950. }
  22951. }, {
  22952. "path": "pages/user/setting/avatar",
  22953. "style": {
  22954. "navigationBarTitleText": "头像",
  22955. "enablePullDownRefresh": false
  22956. }
  22957. }, {
  22958. "path": "pages/trade/list",
  22959. "style": {
  22960. "navigationBarTitleText": "成交单列表",
  22961. "enablePullDownRefresh": false
  22962. }
  22963. }, {
  22964. "path": "pages/trade/create",
  22965. "style": {
  22966. "navigationBarTitleText": "添加成交单",
  22967. "enablePullDownRefresh": false
  22968. }
  22969. }, {
  22970. "path": "pages/trade/record",
  22971. "style": {
  22972. "navigationBarTitleText": "成交单详情",
  22973. "enablePullDownRefresh": false
  22974. }
  22975. }, {
  22976. "path": "pages/trade/check",
  22977. "style": {
  22978. "navigationBarTitleText": "成交单审核",
  22979. "enablePullDownRefresh": false
  22980. }
  22981. }, {
  22982. "path": "pages/trade/recordedit",
  22983. "style": {
  22984. "navigationBarTitleText": "成交单详情编辑",
  22985. "enablePullDownRefresh": false
  22986. }
  22987. }, {
  22988. "path": "pages/trade/recordTrade1",
  22989. "style": {
  22990. "navigationBarTitleText": "签订合同",
  22991. "enablePullDownRefresh": false
  22992. }
  22993. }, {
  22994. "path": "pages/trade/recordTrade2",
  22995. "style": {
  22996. "navigationBarTitleText": "合同流程",
  22997. "enablePullDownRefresh": false
  22998. }
  22999. }, {
  23000. "path": "pages/shop/chart",
  23001. "style": {
  23002. "navigationBarTitleText": "门店统计",
  23003. "enablePullDownRefresh": false
  23004. }
  23005. }, {
  23006. "path": "pages/shop/map",
  23007. "style": {
  23008. "navigationBarTitleText": "门店地图",
  23009. "enablePullDownRefresh": false
  23010. }
  23011. }],
  23012. "globalStyle": {
  23013. "navigationBarTextStyle": "white",
  23014. "navigationBarBackgroundColor": "#2080f0",
  23015. "navigationBarTitleText": "",
  23016. "backgroundColor": "#F8F8F8"
  23017. }
  23018. };
  23019. exports.default = _default;
  23020. /***/ }),
  23021. /***/ 681:
  23022. /*!************************************************!*\
  23023. !*** E:/work/mdapp/pages.json?{"type":"stat"} ***!
  23024. \************************************************/
  23025. /*! no static exports found */
  23026. /***/ (function(module, exports, __webpack_require__) {
  23027. "use strict";
  23028. Object.defineProperty(exports, "__esModule", {
  23029. value: true
  23030. });
  23031. exports.default = void 0;
  23032. var _default = {
  23033. "appid": "__UNI__1C40FB4"
  23034. };
  23035. exports.default = _default;
  23036. /***/ }),
  23037. /***/ 682:
  23038. /*!******************************************************************************!*\
  23039. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
  23040. \******************************************************************************/
  23041. /*! no static exports found */
  23042. /***/ (function(module, exports, __webpack_require__) {
  23043. "use strict";
  23044. /*
  23045. * uCharts (R)
  23046. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
  23047. * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
  23048. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  23049. * 复制使用请保留本段注释,感谢支持开源!
  23050. *
  23051. * uCharts (R) 官方网站
  23052. * https://www.uCharts.cn
  23053. *
  23054. * 开源地址:
  23055. * https://gitee.com/uCharts/uCharts
  23056. *
  23057. * uni-app插件市场地址:
  23058. * http://ext.dcloud.net.cn/plugin?id=271
  23059. *
  23060. */
  23061. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  23062. Object.defineProperty(exports, "__esModule", {
  23063. value: true
  23064. });
  23065. exports.default = void 0;
  23066. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  23067. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  23068. var config = {
  23069. version: 'v2.5.0-20230101',
  23070. yAxisWidth: 15,
  23071. xAxisHeight: 22,
  23072. padding: [10, 10, 10, 10],
  23073. rotate: false,
  23074. fontSize: 13,
  23075. fontColor: '#666666',
  23076. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  23077. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  23078. linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
  23079. pieChartLinePadding: 15,
  23080. pieChartTextPadding: 5,
  23081. titleFontSize: 20,
  23082. subtitleFontSize: 15,
  23083. radarLabelTextMargin: 13
  23084. };
  23085. var assign = function assign(target) {
  23086. for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  23087. varArgs[_key2 - 1] = arguments[_key2];
  23088. }
  23089. if (target == null) {
  23090. throw new TypeError('[uCharts] Cannot convert undefined or null to object');
  23091. }
  23092. if (!varArgs || varArgs.length <= 0) {
  23093. return target;
  23094. }
  23095. // 深度合并对象
  23096. function deepAssign(obj1, obj2) {
  23097. for (var key in obj2) {
  23098. obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
  23099. }
  23100. return obj1;
  23101. }
  23102. varArgs.forEach(function (val) {
  23103. target = deepAssign(target, val);
  23104. });
  23105. return target;
  23106. };
  23107. var util = {
  23108. toFixed: function toFixed(num, limit) {
  23109. limit = limit || 2;
  23110. if (this.isFloat(num)) {
  23111. num = num.toFixed(limit);
  23112. }
  23113. return num;
  23114. },
  23115. isFloat: function isFloat(num) {
  23116. return num % 1 !== 0;
  23117. },
  23118. approximatelyEqual: function approximatelyEqual(num1, num2) {
  23119. return Math.abs(num1 - num2) < 1e-10;
  23120. },
  23121. isSameSign: function isSameSign(num1, num2) {
  23122. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  23123. },
  23124. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  23125. return this.isSameSign(p1.x, p2.x);
  23126. },
  23127. isCollision: function isCollision(obj1, obj2) {
  23128. obj1.end = {};
  23129. obj1.end.x = obj1.start.x + obj1.width;
  23130. obj1.end.y = obj1.start.y - obj1.height;
  23131. obj2.end = {};
  23132. obj2.end.x = obj2.start.x + obj2.width;
  23133. obj2.end.y = obj2.start.y - obj2.height;
  23134. var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2.start.y < obj1.end.y;
  23135. return !flag;
  23136. }
  23137. };
  23138. //兼容H5点击事件
  23139. function getH5Offset(e) {
  23140. e.mp = {
  23141. changedTouches: []
  23142. };
  23143. e.mp.changedTouches.push({
  23144. x: e.offsetX,
  23145. y: e.offsetY
  23146. });
  23147. return e;
  23148. }
  23149. // hex 转 rgba
  23150. function hexToRgb(hexValue, opc) {
  23151. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  23152. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  23153. return r + r + g + g + b + b;
  23154. });
  23155. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  23156. var r = parseInt(rgb[1], 16);
  23157. var g = parseInt(rgb[2], 16);
  23158. var b = parseInt(rgb[3], 16);
  23159. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  23160. }
  23161. function findRange(num, type, limit) {
  23162. if (isNaN(num)) {
  23163. throw new Error('[uCharts] series数据需为Number格式');
  23164. }
  23165. limit = limit || 10;
  23166. type = type ? type : 'upper';
  23167. var multiple = 1;
  23168. while (limit < 1) {
  23169. limit *= 10;
  23170. multiple *= 10;
  23171. }
  23172. if (type === 'upper') {
  23173. num = Math.ceil(num * multiple);
  23174. } else {
  23175. num = Math.floor(num * multiple);
  23176. }
  23177. while (num % limit !== 0) {
  23178. if (type === 'upper') {
  23179. if (num == num + 1) {
  23180. //修复数据值过大num++无效的bug by 向日葵 @xrk_jy
  23181. break;
  23182. }
  23183. num++;
  23184. } else {
  23185. num--;
  23186. }
  23187. }
  23188. return num / multiple;
  23189. }
  23190. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  23191. var seriesTemp = [];
  23192. for (var k = 0; k < dayArr.length; k++) {
  23193. var seriesItem = {
  23194. data: [],
  23195. name: nameArr[k],
  23196. color: colorArr[k]
  23197. };
  23198. for (var i = 0, len = kdata.length; i < len; i++) {
  23199. if (i < dayArr[k]) {
  23200. seriesItem.data.push(null);
  23201. continue;
  23202. }
  23203. var sum = 0;
  23204. for (var j = 0; j < dayArr[k]; j++) {
  23205. sum += kdata[i - j][1];
  23206. }
  23207. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  23208. }
  23209. seriesTemp.push(seriesItem);
  23210. }
  23211. return seriesTemp;
  23212. }
  23213. function calValidDistance(self, distance, chartData, config, opts) {
  23214. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  23215. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  23216. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  23217. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  23218. dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
  23219. }
  23220. var validDistance = distance;
  23221. if (distance >= 0) {
  23222. validDistance = 0;
  23223. self.uevent.trigger('scrollLeft');
  23224. self.scrollOption.position = 'left';
  23225. opts.xAxis.scrollPosition = 'left';
  23226. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  23227. validDistance = dataChartAreaWidth - dataChartWidth;
  23228. self.uevent.trigger('scrollRight');
  23229. self.scrollOption.position = 'right';
  23230. opts.xAxis.scrollPosition = 'right';
  23231. } else {
  23232. self.scrollOption.position = distance;
  23233. opts.xAxis.scrollPosition = distance;
  23234. }
  23235. return validDistance;
  23236. }
  23237. function isInAngleRange(angle, startAngle, endAngle) {
  23238. function adjust(angle) {
  23239. while (angle < 0) {
  23240. angle += 2 * Math.PI;
  23241. }
  23242. while (angle > 2 * Math.PI) {
  23243. angle -= 2 * Math.PI;
  23244. }
  23245. return angle;
  23246. }
  23247. angle = adjust(angle);
  23248. startAngle = adjust(startAngle);
  23249. endAngle = adjust(endAngle);
  23250. if (startAngle > endAngle) {
  23251. endAngle += 2 * Math.PI;
  23252. if (angle < startAngle) {
  23253. angle += 2 * Math.PI;
  23254. }
  23255. }
  23256. return angle >= startAngle && angle <= endAngle;
  23257. }
  23258. function createCurveControlPoints(points, i) {
  23259. function isNotMiddlePoint(points, i) {
  23260. if (points[i - 1] && points[i + 1]) {
  23261. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, points[i + 1].y);
  23262. } else {
  23263. return false;
  23264. }
  23265. }
  23266. function isNotMiddlePointX(points, i) {
  23267. if (points[i - 1] && points[i + 1]) {
  23268. return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x, points[i + 1].x);
  23269. } else {
  23270. return false;
  23271. }
  23272. }
  23273. var a = 0.2;
  23274. var b = 0.2;
  23275. var pAx = null;
  23276. var pAy = null;
  23277. var pBx = null;
  23278. var pBy = null;
  23279. if (i < 1) {
  23280. pAx = points[0].x + (points[1].x - points[0].x) * a;
  23281. pAy = points[0].y + (points[1].y - points[0].y) * a;
  23282. } else {
  23283. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  23284. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  23285. }
  23286. if (i > points.length - 3) {
  23287. var last = points.length - 1;
  23288. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  23289. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  23290. } else {
  23291. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  23292. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  23293. }
  23294. if (isNotMiddlePoint(points, i + 1)) {
  23295. pBy = points[i + 1].y;
  23296. }
  23297. if (isNotMiddlePoint(points, i)) {
  23298. pAy = points[i].y;
  23299. }
  23300. if (isNotMiddlePointX(points, i + 1)) {
  23301. pBx = points[i + 1].x;
  23302. }
  23303. if (isNotMiddlePointX(points, i)) {
  23304. pAx = points[i].x;
  23305. }
  23306. if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
  23307. pAy = points[i].y;
  23308. }
  23309. if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
  23310. pBy = points[i + 1].y;
  23311. }
  23312. if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
  23313. pAx = points[i].x;
  23314. }
  23315. if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
  23316. pBx = points[i + 1].x;
  23317. }
  23318. return {
  23319. ctrA: {
  23320. x: pAx,
  23321. y: pAy
  23322. },
  23323. ctrB: {
  23324. x: pBx,
  23325. y: pBy
  23326. }
  23327. };
  23328. }
  23329. function convertCoordinateOrigin(x, y, center) {
  23330. return {
  23331. x: center.x + x,
  23332. y: center.y - y
  23333. };
  23334. }
  23335. function avoidCollision(obj, target) {
  23336. if (target) {
  23337. // is collision test
  23338. while (util.isCollision(obj, target)) {
  23339. if (obj.start.x > 0) {
  23340. obj.start.y--;
  23341. } else if (obj.start.x < 0) {
  23342. obj.start.y++;
  23343. } else {
  23344. if (obj.start.y > 0) {
  23345. obj.start.y++;
  23346. } else {
  23347. obj.start.y--;
  23348. }
  23349. }
  23350. }
  23351. }
  23352. return obj;
  23353. }
  23354. function fixPieSeries(series, opts, config) {
  23355. var pieSeriesArr = [];
  23356. if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
  23357. opts._pieSeries_ = series;
  23358. var oldseries = series[0].data;
  23359. for (var i = 0; i < oldseries.length; i++) {
  23360. oldseries[i].formatter = series[0].formatter;
  23361. oldseries[i].data = oldseries[i].value;
  23362. pieSeriesArr.push(oldseries[i]);
  23363. }
  23364. opts.series = pieSeriesArr;
  23365. } else {
  23366. pieSeriesArr = series;
  23367. }
  23368. return pieSeriesArr;
  23369. }
  23370. function fillSeries(series, opts, config) {
  23371. var index = 0;
  23372. for (var i = 0; i < series.length; i++) {
  23373. var item = series[i];
  23374. if (!item.color) {
  23375. item.color = config.color[index];
  23376. index = (index + 1) % config.color.length;
  23377. }
  23378. if (!item.linearIndex) {
  23379. item.linearIndex = i;
  23380. }
  23381. if (!item.index) {
  23382. item.index = 0;
  23383. }
  23384. if (!item.type) {
  23385. item.type = opts.type;
  23386. }
  23387. if (typeof item.show == "undefined") {
  23388. item.show = true;
  23389. }
  23390. if (!item.type) {
  23391. item.type = opts.type;
  23392. }
  23393. if (!item.pointShape) {
  23394. item.pointShape = "circle";
  23395. }
  23396. if (!item.legendShape) {
  23397. switch (item.type) {
  23398. case 'line':
  23399. item.legendShape = "line";
  23400. break;
  23401. case 'column':
  23402. case 'bar':
  23403. item.legendShape = "rect";
  23404. break;
  23405. case 'area':
  23406. case 'mount':
  23407. item.legendShape = "triangle";
  23408. break;
  23409. default:
  23410. item.legendShape = "circle";
  23411. }
  23412. }
  23413. }
  23414. return series;
  23415. }
  23416. function fillCustomColor(linearType, customColor, series, config) {
  23417. var newcolor = customColor || [];
  23418. if (linearType == 'custom' && newcolor.length == 0) {
  23419. newcolor = config.linearColor;
  23420. }
  23421. if (linearType == 'custom' && newcolor.length < series.length) {
  23422. var chazhi = series.length - newcolor.length;
  23423. for (var i = 0; i < chazhi; i++) {
  23424. newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
  23425. }
  23426. }
  23427. return newcolor;
  23428. }
  23429. function getDataRange(minData, maxData) {
  23430. var limit = 0;
  23431. var range = maxData - minData;
  23432. if (range >= 10000) {
  23433. limit = 1000;
  23434. } else if (range >= 1000) {
  23435. limit = 100;
  23436. } else if (range >= 100) {
  23437. limit = 10;
  23438. } else if (range >= 10) {
  23439. limit = 5;
  23440. } else if (range >= 1) {
  23441. limit = 1;
  23442. } else if (range >= 0.1) {
  23443. limit = 0.1;
  23444. } else if (range >= 0.01) {
  23445. limit = 0.01;
  23446. } else if (range >= 0.001) {
  23447. limit = 0.001;
  23448. } else if (range >= 0.0001) {
  23449. limit = 0.0001;
  23450. } else if (range >= 0.00001) {
  23451. limit = 0.00001;
  23452. } else {
  23453. limit = 0.000001;
  23454. }
  23455. return {
  23456. minRange: findRange(minData, 'lower', limit),
  23457. maxRange: findRange(maxData, 'upper', limit)
  23458. };
  23459. }
  23460. function measureText(text, fontSize, context) {
  23461. var width = 0;
  23462. text = String(text);
  23463. if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
  23464. context.setFontSize(fontSize);
  23465. return context.measureText(text).width;
  23466. } else {
  23467. var text = text.split('');
  23468. for (var i = 0; i < text.length; i++) {
  23469. var item = text[i];
  23470. if (/[a-zA-Z]/.test(item)) {
  23471. width += 7;
  23472. } else if (/[0-9]/.test(item)) {
  23473. width += 5.5;
  23474. } else if (/\./.test(item)) {
  23475. width += 2.7;
  23476. } else if (/-/.test(item)) {
  23477. width += 3.25;
  23478. } else if (/:/.test(item)) {
  23479. width += 2.5;
  23480. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  23481. width += 10;
  23482. } else if (/\(|\)/.test(item)) {
  23483. width += 3.73;
  23484. } else if (/\s/.test(item)) {
  23485. width += 2.5;
  23486. } else if (/%/.test(item)) {
  23487. width += 8;
  23488. } else {
  23489. width += 10;
  23490. }
  23491. }
  23492. return width * fontSize / 10;
  23493. }
  23494. }
  23495. function dataCombine(series) {
  23496. return series.reduce(function (a, b) {
  23497. return (a.data ? a.data : a).concat(b.data);
  23498. }, []);
  23499. }
  23500. function dataCombineStack(series, len) {
  23501. var sum = new Array(len);
  23502. for (var j = 0; j < sum.length; j++) {
  23503. sum[j] = 0;
  23504. }
  23505. for (var i = 0; i < series.length; i++) {
  23506. for (var j = 0; j < sum.length; j++) {
  23507. sum[j] += series[i].data[j];
  23508. }
  23509. }
  23510. return series.reduce(function (a, b) {
  23511. return (a.data ? a.data : a).concat(b.data).concat(sum);
  23512. }, []);
  23513. }
  23514. function getTouches(touches, opts, e) {
  23515. var x, y;
  23516. if (touches.clientX) {
  23517. if (opts.rotate) {
  23518. y = opts.height - touches.clientX * opts.pix;
  23519. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23520. } else {
  23521. x = touches.clientX * opts.pix;
  23522. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23523. }
  23524. } else {
  23525. if (opts.rotate) {
  23526. y = opts.height - touches.x * opts.pix;
  23527. x = touches.y * opts.pix;
  23528. } else {
  23529. x = touches.x * opts.pix;
  23530. y = touches.y * opts.pix;
  23531. }
  23532. }
  23533. return {
  23534. x: x,
  23535. y: y
  23536. };
  23537. }
  23538. function getSeriesDataItem(series, index, group) {
  23539. var data = [];
  23540. var newSeries = [];
  23541. var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
  23542. if (indexIsArr) {
  23543. var tempSeries = filterSeries(series);
  23544. for (var i = 0; i < group.length; i++) {
  23545. newSeries.push(tempSeries[group[i]]);
  23546. }
  23547. } else {
  23548. newSeries = series;
  23549. }
  23550. ;
  23551. for (var _i = 0; _i < newSeries.length; _i++) {
  23552. var item = newSeries[_i];
  23553. var tmpindex = -1;
  23554. if (indexIsArr) {
  23555. tmpindex = index[_i];
  23556. } else {
  23557. tmpindex = index;
  23558. }
  23559. if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
  23560. var seriesItem = {};
  23561. seriesItem.color = item.color;
  23562. seriesItem.type = item.type;
  23563. seriesItem.style = item.style;
  23564. seriesItem.pointShape = item.pointShape;
  23565. seriesItem.disableLegend = item.disableLegend;
  23566. seriesItem.legendShape = item.legendShape;
  23567. seriesItem.name = item.name;
  23568. seriesItem.show = item.show;
  23569. seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
  23570. data.push(seriesItem);
  23571. }
  23572. }
  23573. return data;
  23574. }
  23575. function getMaxTextListLength(list, fontSize, context) {
  23576. var lengthList = list.map(function (item) {
  23577. return measureText(item, fontSize, context);
  23578. });
  23579. return Math.max.apply(null, lengthList);
  23580. }
  23581. function getRadarCoordinateSeries(length) {
  23582. var eachAngle = 2 * Math.PI / length;
  23583. var CoordinateSeries = [];
  23584. for (var i = 0; i < length; i++) {
  23585. CoordinateSeries.push(eachAngle * i);
  23586. }
  23587. return CoordinateSeries.map(function (item) {
  23588. return -1 * item + Math.PI / 2;
  23589. });
  23590. }
  23591. function getToolTipData(seriesData, opts, index, group, categories) {
  23592. var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  23593. var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
  23594. var points = {};
  23595. if (group.length > 0) {
  23596. var filterPoints = [];
  23597. for (var i = 0; i < group.length; i++) {
  23598. filterPoints.push(calPoints[group[i]]);
  23599. }
  23600. points = filterPoints[0][index[0]];
  23601. } else {
  23602. for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
  23603. if (calPoints[_i2][index]) {
  23604. points = calPoints[_i2][index];
  23605. break;
  23606. }
  23607. }
  23608. }
  23609. ;
  23610. var textList = seriesData.map(function (item) {
  23611. var titleText = null;
  23612. if (opts.categories && opts.categories.length > 0) {
  23613. titleText = categories[index];
  23614. }
  23615. ;
  23616. return {
  23617. text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
  23618. color: item.color,
  23619. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23620. };
  23621. });
  23622. var offset = {
  23623. x: Math.round(points.x),
  23624. y: Math.round(points.y)
  23625. };
  23626. return {
  23627. textList: textList,
  23628. offset: offset
  23629. };
  23630. }
  23631. function getMixToolTipData(seriesData, opts, index, categories) {
  23632. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  23633. var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
  23634. var textList = seriesData.map(function (item) {
  23635. return {
  23636. text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
  23637. color: item.color,
  23638. disableLegend: item.disableLegend ? true : false,
  23639. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23640. };
  23641. });
  23642. textList = textList.filter(function (item) {
  23643. if (item.disableLegend !== true) {
  23644. return item;
  23645. }
  23646. });
  23647. var offset = {
  23648. x: Math.round(points),
  23649. y: 0
  23650. };
  23651. return {
  23652. textList: textList,
  23653. offset: offset
  23654. };
  23655. }
  23656. function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
  23657. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  23658. var calPoints = opts.chartData.calPoints;
  23659. var upColor = extra.color.upFill;
  23660. var downColor = extra.color.downFill;
  23661. //颜色顺序为开盘,收盘,最低,最高
  23662. var color = [upColor, upColor, downColor, upColor];
  23663. var textList = [];
  23664. seriesData.map(function (item) {
  23665. if (index == 0) {
  23666. if (item.data[1] - item.data[0] < 0) {
  23667. color[1] = downColor;
  23668. } else {
  23669. color[1] = upColor;
  23670. }
  23671. } else {
  23672. if (item.data[0] < series[index - 1][1]) {
  23673. color[0] = downColor;
  23674. }
  23675. if (item.data[1] < item.data[0]) {
  23676. color[1] = downColor;
  23677. }
  23678. if (item.data[2] > series[index - 1][1]) {
  23679. color[2] = upColor;
  23680. }
  23681. if (item.data[3] < series[index - 1][1]) {
  23682. color[3] = downColor;
  23683. }
  23684. }
  23685. var text1 = {
  23686. text: '开盘:' + item.data[0],
  23687. color: color[0],
  23688. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23689. };
  23690. var text2 = {
  23691. text: '收盘:' + item.data[1],
  23692. color: color[1],
  23693. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23694. };
  23695. var text3 = {
  23696. text: '最低:' + item.data[2],
  23697. color: color[2],
  23698. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23699. };
  23700. var text4 = {
  23701. text: '最高:' + item.data[3],
  23702. color: color[3],
  23703. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23704. };
  23705. textList.push(text1, text2, text3, text4);
  23706. });
  23707. var validCalPoints = [];
  23708. var offset = {
  23709. x: 0,
  23710. y: 0
  23711. };
  23712. for (var i = 0; i < calPoints.length; i++) {
  23713. var points = calPoints[i];
  23714. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  23715. validCalPoints.push(points[index]);
  23716. }
  23717. }
  23718. offset.x = Math.round(validCalPoints[0][0].x);
  23719. return {
  23720. textList: textList,
  23721. offset: offset
  23722. };
  23723. }
  23724. function filterSeries(series) {
  23725. var tempSeries = [];
  23726. for (var i = 0; i < series.length; i++) {
  23727. if (series[i].show == true) {
  23728. tempSeries.push(series[i]);
  23729. }
  23730. }
  23731. return tempSeries;
  23732. }
  23733. function findCurrentIndex(currentPoints, calPoints, opts, config) {
  23734. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23735. var current = {
  23736. index: -1,
  23737. group: []
  23738. };
  23739. var spacing = opts.chartData.eachSpacing / 2;
  23740. var xAxisPoints = [];
  23741. if (calPoints && calPoints.length > 0) {
  23742. if (!opts.categories) {
  23743. spacing = 0;
  23744. } else {
  23745. for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
  23746. xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
  23747. }
  23748. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  23749. xAxisPoints = opts.chartData.xAxisPoints;
  23750. }
  23751. }
  23752. if (isInExactChartArea(currentPoints, opts, config)) {
  23753. if (!opts.categories) {
  23754. var timePoints = Array(calPoints.length);
  23755. for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
  23756. timePoints[_i3] = Array(calPoints[_i3].length);
  23757. for (var j = 0; j < calPoints[_i3].length; j++) {
  23758. timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
  23759. }
  23760. }
  23761. ;
  23762. var pointValue = Array(timePoints.length);
  23763. var pointIndex = Array(timePoints.length);
  23764. for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
  23765. pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
  23766. pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
  23767. }
  23768. var minValue = Math.min.apply(null, pointValue);
  23769. current.index = [];
  23770. for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
  23771. if (pointValue[_i5] == minValue) {
  23772. current.group.push(_i5);
  23773. current.index.push(pointIndex[_i5]);
  23774. }
  23775. }
  23776. ;
  23777. } else {
  23778. xAxisPoints.forEach(function (item, index) {
  23779. if (currentPoints.x + offset + spacing > item) {
  23780. current.index = index;
  23781. }
  23782. });
  23783. }
  23784. }
  23785. }
  23786. return current;
  23787. }
  23788. function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
  23789. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23790. var current = {
  23791. index: -1,
  23792. group: []
  23793. };
  23794. var spacing = opts.chartData.eachSpacing / 2;
  23795. var yAxisPoints = opts.chartData.yAxisPoints;
  23796. if (calPoints && calPoints.length > 0) {
  23797. if (isInExactChartArea(currentPoints, opts, config)) {
  23798. yAxisPoints.forEach(function (item, index) {
  23799. if (currentPoints.y + offset + spacing > item) {
  23800. current.index = index;
  23801. }
  23802. });
  23803. }
  23804. }
  23805. return current;
  23806. }
  23807. function findLegendIndex(currentPoints, legendData, opts) {
  23808. var currentIndex = -1;
  23809. var gap = 0;
  23810. if (isInExactLegendArea(currentPoints, legendData.area)) {
  23811. var points = legendData.points;
  23812. var index = -1;
  23813. for (var i = 0, len = points.length; i < len; i++) {
  23814. var item = points[i];
  23815. for (var j = 0; j < item.length; j++) {
  23816. index += 1;
  23817. var area = item[j]['area'];
  23818. if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
  23819. currentIndex = index;
  23820. break;
  23821. }
  23822. }
  23823. }
  23824. return currentIndex;
  23825. }
  23826. return currentIndex;
  23827. }
  23828. function isInExactLegendArea(currentPoints, area) {
  23829. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
  23830. }
  23831. function isInExactChartArea(currentPoints, opts, config) {
  23832. return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] - 10 && currentPoints.y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2];
  23833. }
  23834. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  23835. var eachAngleArea = 2 * Math.PI / count;
  23836. var currentIndex = -1;
  23837. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  23838. var fixAngle = function fixAngle(angle) {
  23839. if (angle < 0) {
  23840. angle += 2 * Math.PI;
  23841. }
  23842. if (angle > 2 * Math.PI) {
  23843. angle -= 2 * Math.PI;
  23844. }
  23845. return angle;
  23846. };
  23847. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  23848. angle = -1 * angle;
  23849. if (angle < 0) {
  23850. angle += 2 * Math.PI;
  23851. }
  23852. var angleList = radarData.angleList.map(function (item) {
  23853. item = fixAngle(-1 * item);
  23854. return item;
  23855. });
  23856. angleList.forEach(function (item, index) {
  23857. var rangeStart = fixAngle(item - eachAngleArea / 2);
  23858. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  23859. if (rangeEnd < rangeStart) {
  23860. rangeEnd += 2 * Math.PI;
  23861. }
  23862. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
  23863. currentIndex = index;
  23864. }
  23865. });
  23866. }
  23867. return currentIndex;
  23868. }
  23869. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  23870. var currentIndex = -1;
  23871. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  23872. var item = funnelData.series[i];
  23873. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  23874. currentIndex = i;
  23875. break;
  23876. }
  23877. }
  23878. return currentIndex;
  23879. }
  23880. function findWordChartCurrentIndex(currentPoints, wordData) {
  23881. var currentIndex = -1;
  23882. for (var i = 0, len = wordData.length; i < len; i++) {
  23883. var item = wordData[i];
  23884. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  23885. currentIndex = i;
  23886. break;
  23887. }
  23888. }
  23889. return currentIndex;
  23890. }
  23891. function findMapChartCurrentIndex(currentPoints, opts) {
  23892. var currentIndex = -1;
  23893. var cData = opts.chartData.mapData;
  23894. var data = opts.series;
  23895. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  23896. var poi = [tmp.x, tmp.y];
  23897. for (var i = 0, len = data.length; i < len; i++) {
  23898. var item = data[i].geometry.coordinates;
  23899. if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
  23900. currentIndex = i;
  23901. break;
  23902. }
  23903. }
  23904. return currentIndex;
  23905. }
  23906. function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
  23907. var currentIndex = -1;
  23908. var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
  23909. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  23910. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  23911. angle = -angle;
  23912. if (opts.extra.rose && opts.extra.rose.offsetAngle) {
  23913. angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
  23914. }
  23915. for (var i = 0, len = series.length; i < len; i++) {
  23916. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
  23917. currentIndex = i;
  23918. break;
  23919. }
  23920. }
  23921. }
  23922. return currentIndex;
  23923. }
  23924. function findPieChartCurrentIndex(currentPoints, pieData, opts) {
  23925. var currentIndex = -1;
  23926. var series = getPieDataPoints(pieData.series);
  23927. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  23928. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  23929. angle = -angle;
  23930. if (opts.extra.pie && opts.extra.pie.offsetAngle) {
  23931. angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
  23932. }
  23933. if (opts.extra.ring && opts.extra.ring.offsetAngle) {
  23934. angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
  23935. }
  23936. for (var i = 0, len = series.length; i < len; i++) {
  23937. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
  23938. currentIndex = i;
  23939. break;
  23940. }
  23941. }
  23942. }
  23943. return currentIndex;
  23944. }
  23945. function isInExactPieChartArea(currentPoints, center, radius) {
  23946. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  23947. }
  23948. function splitPoints(points, eachSeries) {
  23949. var newPoints = [];
  23950. var items = [];
  23951. points.forEach(function (item, index) {
  23952. if (eachSeries.connectNulls) {
  23953. if (item !== null) {
  23954. items.push(item);
  23955. }
  23956. } else {
  23957. if (item !== null) {
  23958. items.push(item);
  23959. } else {
  23960. if (items.length) {
  23961. newPoints.push(items);
  23962. }
  23963. items = [];
  23964. }
  23965. }
  23966. });
  23967. if (items.length) {
  23968. newPoints.push(items);
  23969. }
  23970. return newPoints;
  23971. }
  23972. function calLegendData(series, opts, config, chartData, context) {
  23973. var legendData = {
  23974. area: {
  23975. start: {
  23976. x: 0,
  23977. y: 0
  23978. },
  23979. end: {
  23980. x: 0,
  23981. y: 0
  23982. },
  23983. width: 0,
  23984. height: 0,
  23985. wholeWidth: 0,
  23986. wholeHeight: 0
  23987. },
  23988. points: [],
  23989. widthArr: [],
  23990. heightArr: []
  23991. };
  23992. if (opts.legend.show === false) {
  23993. chartData.legendData = legendData;
  23994. return legendData;
  23995. }
  23996. var padding = opts.legend.padding * opts.pix;
  23997. var margin = opts.legend.margin * opts.pix;
  23998. var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
  23999. var shapeWidth = 15 * opts.pix;
  24000. var shapeRight = 5 * opts.pix;
  24001. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  24002. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  24003. var legendList = [];
  24004. var widthCount = 0;
  24005. var widthCountArr = [];
  24006. var currentRow = [];
  24007. for (var i = 0; i < series.length; i++) {
  24008. var item = series[i];
  24009. var legendText = item.legendText ? item.legendText : item.name;
  24010. var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24011. if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
  24012. legendList.push(currentRow);
  24013. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24014. widthCount = itemWidth;
  24015. currentRow = [item];
  24016. } else {
  24017. widthCount += itemWidth;
  24018. currentRow.push(item);
  24019. }
  24020. }
  24021. if (currentRow.length) {
  24022. legendList.push(currentRow);
  24023. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24024. legendData.widthArr = widthCountArr;
  24025. var legendWidth = Math.max.apply(null, widthCountArr);
  24026. switch (opts.legend.float) {
  24027. case 'left':
  24028. legendData.area.start.x = opts.area[3];
  24029. legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
  24030. break;
  24031. case 'right':
  24032. legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
  24033. legendData.area.end.x = opts.width - opts.area[1];
  24034. break;
  24035. default:
  24036. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  24037. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
  24038. }
  24039. legendData.area.width = legendWidth + 2 * padding;
  24040. legendData.area.wholeWidth = legendWidth + 2 * padding;
  24041. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  24042. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  24043. legendData.points = legendList;
  24044. }
  24045. } else {
  24046. var len = series.length;
  24047. var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
  24048. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  24049. legendData.area.height = maxLength * lineHeight + padding * 2;
  24050. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  24051. switch (opts.legend.float) {
  24052. case 'top':
  24053. legendData.area.start.y = opts.area[0] + margin;
  24054. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24055. break;
  24056. case 'bottom':
  24057. legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
  24058. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24059. break;
  24060. default:
  24061. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  24062. legendData.area.end.y = (opts.height + legendData.area.height) / 2;
  24063. }
  24064. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  24065. var _currentRow = [];
  24066. for (var _i6 = 0; _i6 < lineNum; _i6++) {
  24067. var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
  24068. _currentRow.push(temp);
  24069. }
  24070. legendData.points = _currentRow;
  24071. if (_currentRow.length) {
  24072. for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
  24073. var _item = _currentRow[_i7];
  24074. var maxWidth = 0;
  24075. for (var j = 0; j < _item.length; j++) {
  24076. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24077. if (_itemWidth > maxWidth) {
  24078. maxWidth = _itemWidth;
  24079. }
  24080. }
  24081. legendData.widthArr.push(maxWidth);
  24082. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  24083. }
  24084. var _legendWidth = 0;
  24085. for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
  24086. _legendWidth += legendData.widthArr[_i8];
  24087. }
  24088. legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
  24089. legendData.area.wholeWidth = legendData.area.width + padding;
  24090. }
  24091. }
  24092. switch (opts.legend.position) {
  24093. case 'top':
  24094. legendData.area.start.y = opts.area[0] + margin;
  24095. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24096. break;
  24097. case 'bottom':
  24098. legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
  24099. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24100. break;
  24101. case 'left':
  24102. legendData.area.start.x = opts.area[3];
  24103. legendData.area.end.x = opts.area[3] + legendData.area.width;
  24104. break;
  24105. case 'right':
  24106. legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
  24107. legendData.area.end.x = opts.width - opts.area[1];
  24108. break;
  24109. }
  24110. chartData.legendData = legendData;
  24111. return legendData;
  24112. }
  24113. function calCategoriesData(categories, opts, config, eachSpacing, context) {
  24114. var result = {
  24115. angle: 0,
  24116. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24117. };
  24118. var fontSize = opts.xAxis.fontSize * opts.pix;
  24119. var categoriesTextLenth = categories.map(function (item, index) {
  24120. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  24121. return measureText(String(xitem), fontSize, context);
  24122. });
  24123. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  24124. if (opts.xAxis.rotateLabel == true) {
  24125. result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
  24126. var tempHeight = opts.xAxis.marginTop * opts.pix * 2 + Math.abs(maxTextLength * Math.sin(result.angle));
  24127. tempHeight = tempHeight < fontSize + opts.xAxis.marginTop * opts.pix * 2 ? tempHeight + opts.xAxis.marginTop * opts.pix * 2 : tempHeight;
  24128. result.xAxisHeight = tempHeight;
  24129. }
  24130. if (opts.enableScroll && opts.xAxis.scrollShow) {
  24131. result.xAxisHeight += 6 * opts.pix;
  24132. }
  24133. if (opts.xAxis.disabled) {
  24134. result.xAxisHeight = 0;
  24135. }
  24136. return result;
  24137. }
  24138. function getXAxisTextList(series, opts, config, stack) {
  24139. var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
  24140. var data;
  24141. if (stack == 'stack') {
  24142. data = dataCombineStack(series, opts.categories.length);
  24143. } else {
  24144. data = dataCombine(series);
  24145. }
  24146. var sorted = [];
  24147. // remove null from data
  24148. data = data.filter(function (item) {
  24149. //return item !== null;
  24150. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24151. if (item.constructor.toString().indexOf('Array') > -1) {
  24152. return item !== null;
  24153. } else {
  24154. return item.value !== null;
  24155. }
  24156. } else {
  24157. return item !== null;
  24158. }
  24159. });
  24160. data.map(function (item) {
  24161. if ((0, _typeof2.default)(item) === 'object') {
  24162. if (item.constructor.toString().indexOf('Array') > -1) {
  24163. if (opts.type == 'candle') {
  24164. item.map(function (subitem) {
  24165. sorted.push(subitem);
  24166. });
  24167. } else {
  24168. sorted.push(item[0]);
  24169. }
  24170. } else {
  24171. sorted.push(item.value);
  24172. }
  24173. } else {
  24174. sorted.push(item);
  24175. }
  24176. });
  24177. var minData = 0;
  24178. var maxData = 0;
  24179. if (sorted.length > 0) {
  24180. minData = Math.min.apply(this, sorted);
  24181. maxData = Math.max.apply(this, sorted);
  24182. }
  24183. //为了兼容v1.9.0之前的项目
  24184. if (index > -1) {
  24185. if (typeof opts.xAxis.data[index].min === 'number') {
  24186. minData = Math.min(opts.xAxis.data[index].min, minData);
  24187. }
  24188. if (typeof opts.xAxis.data[index].max === 'number') {
  24189. maxData = Math.max(opts.xAxis.data[index].max, maxData);
  24190. }
  24191. } else {
  24192. if (typeof opts.xAxis.min === 'number') {
  24193. minData = Math.min(opts.xAxis.min, minData);
  24194. }
  24195. if (typeof opts.xAxis.max === 'number') {
  24196. maxData = Math.max(opts.xAxis.max, maxData);
  24197. }
  24198. }
  24199. if (minData === maxData) {
  24200. var rangeSpan = maxData || 10;
  24201. maxData += rangeSpan;
  24202. }
  24203. //var dataRange = getDataRange(minData, maxData);
  24204. var minRange = minData;
  24205. var maxRange = maxData;
  24206. var range = [];
  24207. var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
  24208. for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
  24209. range.push(minRange + eachRange * i);
  24210. }
  24211. return range;
  24212. }
  24213. function calXAxisData(series, opts, config, context) {
  24214. //堆叠图重算Y轴
  24215. var columnstyle = assign({}, {
  24216. type: ""
  24217. }, opts.extra.bar);
  24218. var result = {
  24219. angle: 0,
  24220. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24221. };
  24222. result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
  24223. result.rangesFormat = result.ranges.map(function (item) {
  24224. //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
  24225. item = util.toFixed(item, 2);
  24226. return item;
  24227. });
  24228. var xAxisScaleValues = result.ranges.map(function (item) {
  24229. // 如果刻度值是浮点数,则保留两位小数
  24230. item = util.toFixed(item, 2);
  24231. // 若有自定义格式则调用自定义的格式化函数
  24232. //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
  24233. return item;
  24234. });
  24235. result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
  24236. // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
  24237. var eachSpacing = result.eachSpacing;
  24238. var textLength = xAxisScaleValues.map(function (item) {
  24239. return measureText(item, opts.xAxis.fontSize * opts.pix, context);
  24240. });
  24241. if (opts.xAxis.disabled === true) {
  24242. result.xAxisHeight = 0;
  24243. }
  24244. return result;
  24245. }
  24246. function getRadarDataPoints(angleList, center, radius, series, opts) {
  24247. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  24248. var radarOption = opts.extra.radar || {};
  24249. radarOption.max = radarOption.max || 0;
  24250. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  24251. var data = [];
  24252. var _loop2 = function _loop2(i) {
  24253. var each = series[i];
  24254. var listItem = {};
  24255. listItem.color = each.color;
  24256. listItem.legendShape = each.legendShape;
  24257. listItem.pointShape = each.pointShape;
  24258. listItem.data = [];
  24259. each.data.forEach(function (item, index) {
  24260. var tmp = {};
  24261. tmp.angle = angleList[index];
  24262. tmp.proportion = item / maxData;
  24263. tmp.value = item;
  24264. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
  24265. listItem.data.push(tmp);
  24266. });
  24267. data.push(listItem);
  24268. };
  24269. for (var i = 0; i < series.length; i++) {
  24270. _loop2(i);
  24271. }
  24272. return data;
  24273. }
  24274. function getPieDataPoints(series, radius) {
  24275. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24276. var count = 0;
  24277. var _start_ = 0;
  24278. for (var i = 0; i < series.length; i++) {
  24279. var item = series[i];
  24280. item.data = item.data === null ? 0 : item.data;
  24281. count += item.data;
  24282. }
  24283. for (var _i9 = 0; _i9 < series.length; _i9++) {
  24284. var _item2 = series[_i9];
  24285. _item2.data = _item2.data === null ? 0 : _item2.data;
  24286. if (count === 0) {
  24287. _item2._proportion_ = 1 / series.length * process;
  24288. } else {
  24289. _item2._proportion_ = _item2.data / count * process;
  24290. }
  24291. _item2._radius_ = radius;
  24292. }
  24293. for (var _i10 = 0; _i10 < series.length; _i10++) {
  24294. var _item3 = series[_i10];
  24295. _item3._start_ = _start_;
  24296. _start_ += 2 * _item3._proportion_ * Math.PI;
  24297. }
  24298. return series;
  24299. }
  24300. function getFunnelDataPoints(series, radius, option, eachSpacing) {
  24301. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24302. for (var i = 0; i < series.length; i++) {
  24303. if (option.type == 'funnel') {
  24304. series[i].radius = series[i].data / series[0].data * radius * process;
  24305. } else {
  24306. series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
  24307. }
  24308. series[i]._proportion_ = series[i].data / series[0].data;
  24309. }
  24310. // if(option.type !== 'pyramid'){
  24311. // series.reverse();
  24312. // }
  24313. return series;
  24314. }
  24315. function getRoseDataPoints(series, type, minRadius, radius) {
  24316. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24317. var count = 0;
  24318. var _start_ = 0;
  24319. var dataArr = [];
  24320. for (var i = 0; i < series.length; i++) {
  24321. var item = series[i];
  24322. item.data = item.data === null ? 0 : item.data;
  24323. count += item.data;
  24324. dataArr.push(item.data);
  24325. }
  24326. var minData = Math.min.apply(null, dataArr);
  24327. var maxData = Math.max.apply(null, dataArr);
  24328. var radiusLength = radius - minRadius;
  24329. for (var _i11 = 0; _i11 < series.length; _i11++) {
  24330. var _item4 = series[_i11];
  24331. _item4.data = _item4.data === null ? 0 : _item4.data;
  24332. if (count === 0) {
  24333. _item4._proportion_ = 1 / series.length * process;
  24334. _item4._rose_proportion_ = 1 / series.length * process;
  24335. } else {
  24336. _item4._proportion_ = _item4.data / count * process;
  24337. if (type == 'area') {
  24338. _item4._rose_proportion_ = 1 / series.length * process;
  24339. } else {
  24340. _item4._rose_proportion_ = _item4.data / count * process;
  24341. }
  24342. }
  24343. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
  24344. }
  24345. for (var _i12 = 0; _i12 < series.length; _i12++) {
  24346. var _item5 = series[_i12];
  24347. _item5._start_ = _start_;
  24348. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  24349. }
  24350. return series;
  24351. }
  24352. function getArcbarDataPoints(series, arcbarOption) {
  24353. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24354. if (process == 1) {
  24355. process = 0.999999;
  24356. }
  24357. for (var i = 0; i < series.length; i++) {
  24358. var item = series[i];
  24359. item.data = item.data === null ? 0 : item.data;
  24360. var totalAngle = void 0;
  24361. if (arcbarOption.type == 'circle') {
  24362. totalAngle = 2;
  24363. } else {
  24364. if (arcbarOption.direction == 'ccw') {
  24365. if (arcbarOption.startAngle < arcbarOption.endAngle) {
  24366. totalAngle = 2 + arcbarOption.startAngle - arcbarOption.endAngle;
  24367. } else {
  24368. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24369. }
  24370. } else {
  24371. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24372. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24373. } else {
  24374. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24375. }
  24376. }
  24377. }
  24378. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24379. if (arcbarOption.direction == 'ccw') {
  24380. item._proportion_ = arcbarOption.startAngle - totalAngle * item.data * process;
  24381. }
  24382. if (item._proportion_ >= 2) {
  24383. item._proportion_ = item._proportion_ % 2;
  24384. }
  24385. }
  24386. return series;
  24387. }
  24388. function getGaugeArcbarDataPoints(series, arcbarOption) {
  24389. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24390. if (process == 1) {
  24391. process = 0.999999;
  24392. }
  24393. for (var i = 0; i < series.length; i++) {
  24394. var item = series[i];
  24395. item.data = item.data === null ? 0 : item.data;
  24396. var totalAngle = void 0;
  24397. if (arcbarOption.type == 'circle') {
  24398. totalAngle = 2;
  24399. } else {
  24400. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24401. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24402. } else {
  24403. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24404. }
  24405. }
  24406. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24407. if (item._proportion_ >= 2) {
  24408. item._proportion_ = item._proportion_ % 2;
  24409. }
  24410. }
  24411. return series;
  24412. }
  24413. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  24414. var totalAngle;
  24415. if (endAngle < startAngle) {
  24416. totalAngle = 2 + endAngle - startAngle;
  24417. } else {
  24418. totalAngle = startAngle - endAngle;
  24419. }
  24420. var tempStartAngle = startAngle;
  24421. for (var i = 0; i < categories.length; i++) {
  24422. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  24423. categories[i]._startAngle_ = tempStartAngle;
  24424. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  24425. if (categories[i]._endAngle_ >= 2) {
  24426. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  24427. }
  24428. tempStartAngle = categories[i]._endAngle_;
  24429. }
  24430. return categories;
  24431. }
  24432. function getGaugeDataPoints(series, categories, gaugeOption) {
  24433. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  24434. for (var i = 0; i < series.length; i++) {
  24435. var item = series[i];
  24436. item.data = item.data === null ? 0 : item.data;
  24437. if (gaugeOption.pointer.color == 'auto') {
  24438. for (var _i13 = 0; _i13 < categories.length; _i13++) {
  24439. if (item.data <= categories[_i13].value) {
  24440. item.color = categories[_i13].color;
  24441. break;
  24442. }
  24443. }
  24444. } else {
  24445. item.color = gaugeOption.pointer.color;
  24446. }
  24447. var totalAngle = void 0;
  24448. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  24449. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  24450. } else {
  24451. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  24452. }
  24453. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  24454. item._oldAngle_ = gaugeOption.oldAngle;
  24455. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  24456. item._oldAngle_ += 2;
  24457. }
  24458. if (item.data >= gaugeOption.oldData) {
  24459. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  24460. } else {
  24461. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  24462. }
  24463. if (item._proportion_ >= 2) {
  24464. item._proportion_ = item._proportion_ % 2;
  24465. }
  24466. }
  24467. return series;
  24468. }
  24469. function getPieTextMaxLength(series, config, context, opts) {
  24470. series = getPieDataPoints(series);
  24471. var maxLength = 0;
  24472. for (var i = 0; i < series.length; i++) {
  24473. var item = series[i];
  24474. var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  24475. maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
  24476. }
  24477. return maxLength;
  24478. }
  24479. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  24480. return points.map(function (item) {
  24481. if (item === null) {
  24482. return null;
  24483. }
  24484. var seriesGap = 0;
  24485. var categoryGap = 0;
  24486. if (opts.type == 'mix') {
  24487. seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
  24488. categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
  24489. } else {
  24490. seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
  24491. categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24492. }
  24493. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24494. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24495. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24496. if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
  24497. item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
  24498. }
  24499. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24500. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24501. }
  24502. if (item.width <= 0) {
  24503. item.width = 1;
  24504. }
  24505. item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24506. return item;
  24507. });
  24508. }
  24509. function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
  24510. return points.map(function (item) {
  24511. if (item === null) {
  24512. return null;
  24513. }
  24514. var seriesGap = 0;
  24515. var categoryGap = 0;
  24516. seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
  24517. categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24518. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24519. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24520. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24521. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24522. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24523. }
  24524. if (item.width <= 0) {
  24525. item.width = 1;
  24526. }
  24527. item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24528. return item;
  24529. });
  24530. }
  24531. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  24532. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24533. return points.map(function (item) {
  24534. if (item === null) {
  24535. return null;
  24536. }
  24537. item.width = eachSpacing - 2 * categoryGap;
  24538. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24539. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24540. }
  24541. if (index > 0) {
  24542. item.width -= border;
  24543. }
  24544. return item;
  24545. });
  24546. }
  24547. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24548. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24549. return points.map(function (item, indexn) {
  24550. if (item === null) {
  24551. return null;
  24552. }
  24553. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24554. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24555. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24556. }
  24557. if (item.width <= 0) {
  24558. item.width = 1;
  24559. }
  24560. return item;
  24561. });
  24562. }
  24563. function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24564. var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24565. return points.map(function (item, indexn) {
  24566. if (item === null) {
  24567. return null;
  24568. }
  24569. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24570. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24571. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24572. }
  24573. if (item.width <= 0) {
  24574. item.width = 1;
  24575. }
  24576. return item;
  24577. });
  24578. }
  24579. function getXAxisPoints(categories, opts, config) {
  24580. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  24581. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  24582. if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  24583. dataCount -= 1;
  24584. }
  24585. var widthRatio = 0;
  24586. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  24587. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  24588. widthRatio = opts.extra.mount.widthRatio - 1;
  24589. dataCount += widthRatio;
  24590. }
  24591. var eachSpacing = spacingValid / dataCount;
  24592. var xAxisPoints = [];
  24593. var startX = opts.area[3];
  24594. var endX = opts.width - opts.area[1];
  24595. categories.forEach(function (item, index) {
  24596. xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
  24597. });
  24598. if (opts.xAxis.boundaryGap !== 'justify') {
  24599. if (opts.enableScroll === true) {
  24600. xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
  24601. } else {
  24602. xAxisPoints.push(endX);
  24603. }
  24604. }
  24605. return {
  24606. xAxisPoints: xAxisPoints,
  24607. startX: startX,
  24608. endX: endX,
  24609. eachSpacing: eachSpacing
  24610. };
  24611. }
  24612. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24613. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24614. var points = [];
  24615. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24616. data.forEach(function (item, index) {
  24617. if (item === null) {
  24618. points.push(null);
  24619. } else {
  24620. var cPoints = [];
  24621. item.forEach(function (items, indexs) {
  24622. var point = {};
  24623. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24624. var value = items.value || items;
  24625. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24626. height *= process;
  24627. point.y = opts.height - Math.round(height) - opts.area[2];
  24628. cPoints.push(point);
  24629. });
  24630. points.push(cPoints);
  24631. }
  24632. });
  24633. return points;
  24634. }
  24635. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24636. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24637. var boundaryGap = 'center';
  24638. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  24639. boundaryGap = opts.xAxis.boundaryGap;
  24640. }
  24641. var points = [];
  24642. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24643. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24644. data.forEach(function (item, index) {
  24645. if (item === null) {
  24646. points.push(null);
  24647. } else {
  24648. var point = {};
  24649. point.color = item.color;
  24650. point.x = xAxisPoints[index];
  24651. var value = item;
  24652. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24653. if (item.constructor.toString().indexOf('Array') > -1) {
  24654. var xranges, xminRange, xmaxRange;
  24655. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24656. xminRange = xranges.shift();
  24657. xmaxRange = xranges.pop();
  24658. value = item[1];
  24659. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24660. if (opts.type == 'bubble') {
  24661. point.r = item[2];
  24662. point.t = item[3];
  24663. }
  24664. } else {
  24665. value = item.value;
  24666. }
  24667. }
  24668. if (boundaryGap == 'center') {
  24669. point.x += eachSpacing / 2;
  24670. }
  24671. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24672. height *= process;
  24673. point.y = opts.height - height - opts.area[2];
  24674. points.push(point);
  24675. }
  24676. });
  24677. return points;
  24678. }
  24679. function getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process) {
  24680. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24681. var boundaryGap = opts.xAxis.boundaryGap;
  24682. var points = [];
  24683. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24684. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24685. data.forEach(function (item, index) {
  24686. if (item === null) {
  24687. points.push(null);
  24688. } else {
  24689. var point = {};
  24690. point.color = item.color;
  24691. if (lineOption.animation == 'vertical') {
  24692. point.x = xAxisPoints[index];
  24693. var value = item;
  24694. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24695. if (item.constructor.toString().indexOf('Array') > -1) {
  24696. var xranges, xminRange, xmaxRange;
  24697. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24698. xminRange = xranges.shift();
  24699. xmaxRange = xranges.pop();
  24700. value = item[1];
  24701. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24702. } else {
  24703. value = item.value;
  24704. }
  24705. }
  24706. if (boundaryGap == 'center') {
  24707. point.x += eachSpacing / 2;
  24708. }
  24709. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24710. height *= process;
  24711. point.y = opts.height - height - opts.area[2];
  24712. points.push(point);
  24713. } else {
  24714. point.x = xAxisPoints[0] + eachSpacing * index * process;
  24715. var value = item;
  24716. if (boundaryGap == 'center') {
  24717. point.x += eachSpacing / 2;
  24718. }
  24719. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24720. point.y = opts.height - height - opts.area[2];
  24721. points.push(point);
  24722. }
  24723. }
  24724. });
  24725. return points;
  24726. }
  24727. function getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process) {
  24728. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24729. var points = [];
  24730. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24731. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24732. data.forEach(function (item, index) {
  24733. if (item === null) {
  24734. points.push(null);
  24735. } else {
  24736. var point = {};
  24737. point.color = item.color;
  24738. point.x = xAxisPoints[index];
  24739. var value = item;
  24740. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24741. if (item.constructor.toString().indexOf('Array') > -1) {
  24742. var xranges, xminRange, xmaxRange;
  24743. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24744. xminRange = xranges.shift();
  24745. xmaxRange = xranges.pop();
  24746. value = item[1];
  24747. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24748. } else {
  24749. value = item.value;
  24750. }
  24751. }
  24752. point.x += eachSpacing / 2;
  24753. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24754. point.y = opts.height - height - opts.area[2];
  24755. points.push(point);
  24756. }
  24757. });
  24758. return points;
  24759. }
  24760. function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints) {
  24761. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24762. var points = [];
  24763. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24764. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24765. var mountWidth = eachSpacing * mountOption.widthRatio;
  24766. series.forEach(function (item, index) {
  24767. if (item === null) {
  24768. points.push(null);
  24769. } else {
  24770. var point = {};
  24771. point.color = item.color;
  24772. point.x = xAxisPoints[index];
  24773. point.x += eachSpacing / 2;
  24774. var value = item.data;
  24775. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24776. point.y = opts.height - height - opts.area[2];
  24777. point.value = value;
  24778. point.width = mountWidth;
  24779. points.push(point);
  24780. }
  24781. });
  24782. return points;
  24783. }
  24784. function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
  24785. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24786. var points = [];
  24787. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24788. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24789. data.forEach(function (item, index) {
  24790. if (item === null) {
  24791. points.push(null);
  24792. } else {
  24793. var point = {};
  24794. point.color = item.color;
  24795. point.y = yAxisPoints[index];
  24796. var value = item;
  24797. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24798. value = item.value;
  24799. }
  24800. var height = validWidth * (value - minRange) / (maxRange - minRange);
  24801. height *= process;
  24802. point.height = height;
  24803. point.value = value;
  24804. point.x = height + opts.area[3];
  24805. points.push(point);
  24806. }
  24807. });
  24808. return points;
  24809. }
  24810. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24811. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24812. var points = [];
  24813. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24814. data.forEach(function (item, index) {
  24815. if (item === null) {
  24816. points.push(null);
  24817. } else {
  24818. var point = {};
  24819. point.color = item.color;
  24820. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24821. if (seriesIndex > 0) {
  24822. var value = 0;
  24823. for (var i = 0; i <= seriesIndex; i++) {
  24824. value += stackSeries[i].data[index];
  24825. }
  24826. var value0 = value - item;
  24827. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24828. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  24829. } else {
  24830. var value = item;
  24831. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24832. value = item.value;
  24833. }
  24834. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24835. var height0 = 0;
  24836. }
  24837. var heightc = height0;
  24838. height *= process;
  24839. heightc *= process;
  24840. point.y = opts.height - Math.round(height) - opts.area[2];
  24841. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  24842. points.push(point);
  24843. }
  24844. });
  24845. return points;
  24846. }
  24847. function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24848. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24849. var points = [];
  24850. var validHeight = opts.width - opts.area[1] - opts.area[3];
  24851. data.forEach(function (item, index) {
  24852. if (item === null) {
  24853. points.push(null);
  24854. } else {
  24855. var point = {};
  24856. point.color = item.color;
  24857. point.y = yAxisPoints[index];
  24858. if (seriesIndex > 0) {
  24859. var value = 0;
  24860. for (var i = 0; i <= seriesIndex; i++) {
  24861. value += stackSeries[i].data[index];
  24862. }
  24863. var value0 = value - item;
  24864. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24865. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  24866. } else {
  24867. var value = item;
  24868. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24869. value = item.value;
  24870. }
  24871. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24872. var height0 = 0;
  24873. }
  24874. var heightc = height0;
  24875. height *= process;
  24876. heightc *= process;
  24877. point.height = height - heightc;
  24878. point.x = opts.area[3] + height;
  24879. point.x0 = opts.area[3] + heightc;
  24880. points.push(point);
  24881. }
  24882. });
  24883. return points;
  24884. }
  24885. function getYAxisTextList(series, opts, config, stack, yData) {
  24886. var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
  24887. var data;
  24888. if (stack == 'stack') {
  24889. data = dataCombineStack(series, opts.categories.length);
  24890. } else {
  24891. data = dataCombine(series);
  24892. }
  24893. var sorted = [];
  24894. // remove null from data
  24895. data = data.filter(function (item) {
  24896. //return item !== null;
  24897. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24898. if (item.constructor.toString().indexOf('Array') > -1) {
  24899. return item !== null;
  24900. } else {
  24901. return item.value !== null;
  24902. }
  24903. } else {
  24904. return item !== null;
  24905. }
  24906. });
  24907. data.map(function (item) {
  24908. if ((0, _typeof2.default)(item) === 'object') {
  24909. if (item.constructor.toString().indexOf('Array') > -1) {
  24910. if (opts.type == 'candle') {
  24911. item.map(function (subitem) {
  24912. sorted.push(subitem);
  24913. });
  24914. } else {
  24915. sorted.push(item[1]);
  24916. }
  24917. } else {
  24918. sorted.push(item.value);
  24919. }
  24920. } else {
  24921. sorted.push(item);
  24922. }
  24923. });
  24924. var minData = yData.min || 0;
  24925. var maxData = yData.max || 0;
  24926. if (sorted.length > 0) {
  24927. minData = Math.min.apply(this, sorted);
  24928. maxData = Math.max.apply(this, sorted);
  24929. }
  24930. if (minData === maxData) {
  24931. if (maxData == 0) {
  24932. maxData = 10;
  24933. } else {
  24934. minData = 0;
  24935. }
  24936. }
  24937. var dataRange = getDataRange(minData, maxData);
  24938. var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
  24939. var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
  24940. var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
  24941. var range = [];
  24942. for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
  24943. range.push(minRange + eachRange * i);
  24944. }
  24945. return range.reverse();
  24946. }
  24947. function calYAxisData(series, opts, config, context) {
  24948. //堆叠图重算Y轴
  24949. var columnstyle = assign({}, {
  24950. type: ""
  24951. }, opts.extra.column);
  24952. //如果是多Y轴,重新计算
  24953. var YLength = opts.yAxis.data.length;
  24954. var newSeries = new Array(YLength);
  24955. if (YLength > 0) {
  24956. for (var i = 0; i < YLength; i++) {
  24957. newSeries[i] = [];
  24958. for (var j = 0; j < series.length; j++) {
  24959. if (series[j].index == i) {
  24960. newSeries[i].push(series[j]);
  24961. }
  24962. }
  24963. }
  24964. var rangesArr = new Array(YLength);
  24965. var rangesFormatArr = new Array(YLength);
  24966. var yAxisWidthArr = new Array(YLength);
  24967. var _loop3 = function _loop3(_i14) {
  24968. var yData = opts.yAxis.data[_i14];
  24969. //如果总开关不显示,强制每个Y轴为不显示
  24970. if (opts.yAxis.disabled == true) {
  24971. yData.disabled = true;
  24972. }
  24973. if (yData.type === 'categories') {
  24974. if (!yData.formatter) {
  24975. yData.formatter = function (val, index, opts) {
  24976. return val + (yData.unit || '');
  24977. };
  24978. }
  24979. yData.categories = yData.categories || opts.categories;
  24980. rangesArr[_i14] = yData.categories;
  24981. } else {
  24982. if (!yData.formatter) {
  24983. yData.formatter = function (val, index, opts) {
  24984. return util.toFixed(val, yData.tofix || 0) + (yData.unit || '');
  24985. };
  24986. }
  24987. rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
  24988. }
  24989. var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
  24990. yAxisWidthArr[_i14] = {
  24991. position: yData.position ? yData.position : 'left',
  24992. width: 0
  24993. };
  24994. rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
  24995. items = yData.formatter(items, index, opts);
  24996. yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
  24997. return items;
  24998. });
  24999. var calibration = yData.calibration ? 4 * opts.pix : 0;
  25000. yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
  25001. if (yData.disabled === true) {
  25002. yAxisWidthArr[_i14].width = 0;
  25003. }
  25004. };
  25005. for (var _i14 = 0; _i14 < YLength; _i14++) {
  25006. _loop3(_i14);
  25007. }
  25008. } else {
  25009. var rangesArr = new Array(1);
  25010. var rangesFormatArr = new Array(1);
  25011. var yAxisWidthArr = new Array(1);
  25012. if (opts.type === 'bar') {
  25013. rangesArr[0] = opts.categories;
  25014. if (!opts.yAxis.formatter) {
  25015. opts.yAxis.formatter = function (val, index, opts) {
  25016. return val + (opts.yAxis.unit || '');
  25017. };
  25018. }
  25019. } else {
  25020. if (!opts.yAxis.formatter) {
  25021. opts.yAxis.formatter = function (val, index, opts) {
  25022. return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');
  25023. };
  25024. }
  25025. rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
  25026. }
  25027. yAxisWidthArr[0] = {
  25028. position: 'left',
  25029. width: 0
  25030. };
  25031. var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
  25032. rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
  25033. item = opts.yAxis.formatter(item, index, opts);
  25034. yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
  25035. return item;
  25036. });
  25037. yAxisWidthArr[0].width += 3 * opts.pix;
  25038. if (opts.yAxis.disabled === true) {
  25039. yAxisWidthArr[0] = {
  25040. position: 'left',
  25041. width: 0
  25042. };
  25043. opts.yAxis.data[0] = {
  25044. disabled: true
  25045. };
  25046. } else {
  25047. opts.yAxis.data[0] = {
  25048. disabled: false,
  25049. position: 'left',
  25050. max: opts.yAxis.max,
  25051. min: opts.yAxis.min,
  25052. formatter: opts.yAxis.formatter
  25053. };
  25054. if (opts.type === 'bar') {
  25055. opts.yAxis.data[0].categories = opts.categories;
  25056. opts.yAxis.data[0].type = 'categories';
  25057. }
  25058. }
  25059. }
  25060. return {
  25061. rangesFormat: rangesFormatArr,
  25062. ranges: rangesArr,
  25063. yAxisWidth: yAxisWidthArr
  25064. };
  25065. }
  25066. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  25067. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  25068. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25069. var minAxis = opts.area[0];
  25070. var items = [];
  25071. for (var i = 0; i < ranges.length; i++) {
  25072. var maxVal = Math.max.apply(this, ranges[i]);
  25073. var minVal = Math.min.apply(this, ranges[i]);
  25074. var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
  25075. item = opts.yAxis.data && opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item, i, opts) : item.toFixed(0);
  25076. items.push(String(item));
  25077. }
  25078. return items;
  25079. }
  25080. function calMarkLineData(points, opts) {
  25081. var minRange, maxRange;
  25082. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25083. for (var i = 0; i < points.length; i++) {
  25084. points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
  25085. var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
  25086. minRange = range.pop();
  25087. maxRange = range.shift();
  25088. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  25089. points[i].y = opts.height - Math.round(height) - opts.area[2];
  25090. }
  25091. return points;
  25092. }
  25093. function contextRotate(context, opts) {
  25094. if (opts.rotateLock !== true) {
  25095. context.translate(opts.height, 0);
  25096. context.rotate(90 * Math.PI / 180);
  25097. } else if (opts._rotate_ !== true) {
  25098. context.translate(opts.height, 0);
  25099. context.rotate(90 * Math.PI / 180);
  25100. opts._rotate_ = true;
  25101. }
  25102. }
  25103. function drawPointShape(points, color, shape, context, opts) {
  25104. context.beginPath();
  25105. if (opts.dataPointShapeType == 'hollow') {
  25106. context.setStrokeStyle(color);
  25107. context.setFillStyle(opts.background);
  25108. context.setLineWidth(2 * opts.pix);
  25109. } else {
  25110. context.setStrokeStyle("#ffffff");
  25111. context.setFillStyle(color);
  25112. context.setLineWidth(1 * opts.pix);
  25113. }
  25114. if (shape === 'diamond') {
  25115. points.forEach(function (item, index) {
  25116. if (item !== null) {
  25117. context.moveTo(item.x, item.y - 4.5);
  25118. context.lineTo(item.x - 4.5, item.y);
  25119. context.lineTo(item.x, item.y + 4.5);
  25120. context.lineTo(item.x + 4.5, item.y);
  25121. context.lineTo(item.x, item.y - 4.5);
  25122. }
  25123. });
  25124. } else if (shape === 'circle') {
  25125. points.forEach(function (item, index) {
  25126. if (item !== null) {
  25127. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25128. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25129. }
  25130. });
  25131. } else if (shape === 'square') {
  25132. points.forEach(function (item, index) {
  25133. if (item !== null) {
  25134. context.moveTo(item.x - 3.5, item.y - 3.5);
  25135. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25136. }
  25137. });
  25138. } else if (shape === 'triangle') {
  25139. points.forEach(function (item, index) {
  25140. if (item !== null) {
  25141. context.moveTo(item.x, item.y - 4.5);
  25142. context.lineTo(item.x - 4.5, item.y + 4.5);
  25143. context.lineTo(item.x + 4.5, item.y + 4.5);
  25144. context.lineTo(item.x, item.y - 4.5);
  25145. }
  25146. });
  25147. } else if (shape === 'none') {
  25148. return;
  25149. }
  25150. context.closePath();
  25151. context.fill();
  25152. context.stroke();
  25153. }
  25154. function drawActivePoint(points, color, shape, context, opts, option, seriesIndex) {
  25155. if (!opts.tooltip) {
  25156. return;
  25157. }
  25158. if (opts.tooltip.group.length > 0 && opts.tooltip.group.includes(seriesIndex) == false) {
  25159. return;
  25160. }
  25161. var pointIndex = typeof opts.tooltip.index === 'number' ? opts.tooltip.index : opts.tooltip.index[opts.tooltip.group.indexOf(seriesIndex)];
  25162. context.beginPath();
  25163. if (option.activeType == 'hollow') {
  25164. context.setStrokeStyle(color);
  25165. context.setFillStyle(opts.background);
  25166. context.setLineWidth(2 * opts.pix);
  25167. } else {
  25168. context.setStrokeStyle("#ffffff");
  25169. context.setFillStyle(color);
  25170. context.setLineWidth(1 * opts.pix);
  25171. }
  25172. if (shape === 'diamond') {
  25173. points.forEach(function (item, index) {
  25174. if (item !== null && pointIndex == index) {
  25175. context.moveTo(item.x, item.y - 4.5);
  25176. context.lineTo(item.x - 4.5, item.y);
  25177. context.lineTo(item.x, item.y + 4.5);
  25178. context.lineTo(item.x + 4.5, item.y);
  25179. context.lineTo(item.x, item.y - 4.5);
  25180. }
  25181. });
  25182. } else if (shape === 'circle') {
  25183. points.forEach(function (item, index) {
  25184. if (item !== null && pointIndex == index) {
  25185. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25186. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25187. }
  25188. });
  25189. } else if (shape === 'square') {
  25190. points.forEach(function (item, index) {
  25191. if (item !== null && pointIndex == index) {
  25192. context.moveTo(item.x - 3.5, item.y - 3.5);
  25193. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25194. }
  25195. });
  25196. } else if (shape === 'triangle') {
  25197. points.forEach(function (item, index) {
  25198. if (item !== null && pointIndex == index) {
  25199. context.moveTo(item.x, item.y - 4.5);
  25200. context.lineTo(item.x - 4.5, item.y + 4.5);
  25201. context.lineTo(item.x + 4.5, item.y + 4.5);
  25202. context.lineTo(item.x, item.y - 4.5);
  25203. }
  25204. });
  25205. } else if (shape === 'none') {
  25206. return;
  25207. }
  25208. context.closePath();
  25209. context.fill();
  25210. context.stroke();
  25211. }
  25212. function drawRingTitle(opts, config, context, center) {
  25213. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  25214. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  25215. var title = opts.title.name || '';
  25216. var subtitle = opts.subtitle.name || '';
  25217. var titleFontColor = opts.title.color || opts.fontColor;
  25218. var subtitleFontColor = opts.subtitle.color || opts.fontColor;
  25219. var titleHeight = title ? titlefontSize : 0;
  25220. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  25221. var margin = 5;
  25222. if (subtitle) {
  25223. var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
  25224. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
  25225. var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
  25226. if (title) {
  25227. startY += (titleHeight * opts.pix + margin) / 2;
  25228. }
  25229. context.beginPath();
  25230. context.setFontSize(subtitlefontSize * opts.pix);
  25231. context.setFillStyle(subtitleFontColor);
  25232. context.fillText(subtitle, startX, startY);
  25233. context.closePath();
  25234. context.stroke();
  25235. }
  25236. if (title) {
  25237. var _textWidth = measureText(title, titlefontSize * opts.pix, context);
  25238. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  25239. var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
  25240. if (subtitle) {
  25241. _startY -= (subtitleHeight * opts.pix + margin) / 2;
  25242. }
  25243. context.beginPath();
  25244. context.setFontSize(titlefontSize * opts.pix);
  25245. context.setFillStyle(titleFontColor);
  25246. context.fillText(title, _startX, _startY);
  25247. context.closePath();
  25248. context.stroke();
  25249. }
  25250. }
  25251. function drawPointText(points, series, config, context, opts) {
  25252. // 绘制数据文案
  25253. var data = series.data;
  25254. var textOffset = series.textOffset ? series.textOffset : 0;
  25255. points.forEach(function (item, index) {
  25256. if (item !== null) {
  25257. context.beginPath();
  25258. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25259. context.setFontSize(fontSize);
  25260. context.setFillStyle(series.textColor || opts.fontColor);
  25261. var value = data[index];
  25262. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25263. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25264. value = data[index][1];
  25265. } else {
  25266. value = data[index].value;
  25267. }
  25268. }
  25269. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25270. context.setTextAlign('center');
  25271. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  25272. context.closePath();
  25273. context.stroke();
  25274. context.setTextAlign('left');
  25275. }
  25276. });
  25277. }
  25278. function drawColumePointText(points, series, config, context, opts) {
  25279. // 绘制数据文案
  25280. var data = series.data;
  25281. var textOffset = series.textOffset ? series.textOffset : 0;
  25282. var Position = opts.extra.column.labelPosition;
  25283. points.forEach(function (item, index) {
  25284. if (item !== null) {
  25285. context.beginPath();
  25286. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25287. context.setFontSize(fontSize);
  25288. context.setFillStyle(series.textColor || opts.fontColor);
  25289. var value = data[index];
  25290. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25291. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25292. value = data[index][1];
  25293. } else {
  25294. value = data[index].value;
  25295. }
  25296. }
  25297. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25298. context.setTextAlign('center');
  25299. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25300. if (item.y > series.zeroPoints) {
  25301. startY = item.y + textOffset * opts.pix + fontSize;
  25302. }
  25303. if (Position == 'insideTop') {
  25304. startY = item.y + fontSize + textOffset * opts.pix;
  25305. if (item.y > series.zeroPoints) {
  25306. startY = item.y - textOffset * opts.pix - 4 * opts.pix;
  25307. }
  25308. }
  25309. if (Position == 'center') {
  25310. startY = item.y + textOffset * opts.pix + (opts.height - opts.area[2] - item.y + fontSize) / 2;
  25311. if (series.zeroPoints < opts.height - opts.area[2]) {
  25312. startY = item.y + textOffset * opts.pix + (series.zeroPoints - item.y + fontSize) / 2;
  25313. }
  25314. if (item.y > series.zeroPoints) {
  25315. startY = item.y - textOffset * opts.pix - (item.y - series.zeroPoints - fontSize) / 2;
  25316. }
  25317. if (opts.extra.column.type == 'stack') {
  25318. startY = item.y + textOffset * opts.pix + (item.y0 - item.y + fontSize) / 2;
  25319. }
  25320. }
  25321. if (Position == 'bottom') {
  25322. startY = opts.height - opts.area[2] + textOffset * opts.pix - 4 * opts.pix;
  25323. if (series.zeroPoints < opts.height - opts.area[2]) {
  25324. startY = series.zeroPoints + textOffset * opts.pix - 4 * opts.pix;
  25325. }
  25326. if (item.y > series.zeroPoints) {
  25327. startY = series.zeroPoints - textOffset * opts.pix + fontSize + 2 * opts.pix;
  25328. }
  25329. if (opts.extra.column.type == 'stack') {
  25330. startY = item.y0 + textOffset * opts.pix - 4 * opts.pix;
  25331. }
  25332. }
  25333. context.fillText(String(formatVal), item.x, startY);
  25334. context.closePath();
  25335. context.stroke();
  25336. context.setTextAlign('left');
  25337. }
  25338. });
  25339. }
  25340. function drawMountPointText(points, series, config, context, opts, zeroPoints) {
  25341. // 绘制数据文案
  25342. var data = series.data;
  25343. var textOffset = series.textOffset ? series.textOffset : 0;
  25344. var Position = opts.extra.mount.labelPosition;
  25345. points.forEach(function (item, index) {
  25346. if (item !== null) {
  25347. context.beginPath();
  25348. var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
  25349. context.setFontSize(fontSize);
  25350. context.setFillStyle(series[index].textColor || opts.fontColor);
  25351. var value = item.value;
  25352. var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
  25353. context.setTextAlign('center');
  25354. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25355. if (item.y > zeroPoints) {
  25356. startY = item.y + textOffset * opts.pix + fontSize;
  25357. }
  25358. context.fillText(String(formatVal), item.x, startY);
  25359. context.closePath();
  25360. context.stroke();
  25361. context.setTextAlign('left');
  25362. }
  25363. });
  25364. }
  25365. function drawBarPointText(points, series, config, context, opts) {
  25366. // 绘制数据文案
  25367. var data = series.data;
  25368. var textOffset = series.textOffset ? series.textOffset : 0;
  25369. points.forEach(function (item, index) {
  25370. if (item !== null) {
  25371. context.beginPath();
  25372. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25373. context.setFontSize(fontSize);
  25374. context.setFillStyle(series.textColor || opts.fontColor);
  25375. var value = data[index];
  25376. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25377. value = data[index].value;
  25378. }
  25379. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25380. context.setTextAlign('left');
  25381. context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
  25382. context.closePath();
  25383. context.stroke();
  25384. }
  25385. });
  25386. }
  25387. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  25388. radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
  25389. radius = radius < 10 ? 10 : radius;
  25390. var totalAngle;
  25391. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  25392. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  25393. } else {
  25394. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  25395. }
  25396. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  25397. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  25398. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  25399. var nowAngle = gaugeOption.startAngle;
  25400. var nowNumber = gaugeOption.startNumber;
  25401. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  25402. var pos = {
  25403. x: radius * Math.cos(nowAngle * Math.PI),
  25404. y: radius * Math.sin(nowAngle * Math.PI)
  25405. };
  25406. var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
  25407. pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
  25408. pos.y += centerPosition.y;
  25409. var startX = pos.x;
  25410. var startY = pos.y;
  25411. context.beginPath();
  25412. context.setFontSize(config.fontSize);
  25413. context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
  25414. context.fillText(labelText, startX, startY + config.fontSize / 2);
  25415. context.closePath();
  25416. context.stroke();
  25417. nowAngle += splitAngle;
  25418. if (nowAngle >= 2) {
  25419. nowAngle = nowAngle % 2;
  25420. }
  25421. nowNumber += splitNumber;
  25422. }
  25423. }
  25424. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  25425. var radarOption = opts.extra.radar || {};
  25426. angleList.forEach(function (angle, index) {
  25427. if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
  25428. var posPoint = {
  25429. x: radius * Math.cos(angle),
  25430. y: radius * Math.sin(angle)
  25431. };
  25432. var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
  25433. context.setFillStyle(radarOption.labelPointColor);
  25434. context.beginPath();
  25435. context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
  25436. context.closePath();
  25437. context.fill();
  25438. }
  25439. if (radarOption.labelShow === true) {
  25440. var pos = {
  25441. x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
  25442. y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle)
  25443. };
  25444. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  25445. var startX = posRelativeCanvas.x;
  25446. var startY = posRelativeCanvas.y;
  25447. if (util.approximatelyEqual(pos.x, 0)) {
  25448. startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
  25449. } else if (pos.x < 0) {
  25450. startX -= measureText(opts.categories[index] || '', config.fontSize, context);
  25451. }
  25452. context.beginPath();
  25453. context.setFontSize(config.fontSize);
  25454. context.setFillStyle(radarOption.labelColor || opts.fontColor);
  25455. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  25456. context.closePath();
  25457. context.stroke();
  25458. }
  25459. });
  25460. }
  25461. function drawPieText(series, opts, config, context, radius, center) {
  25462. var lineRadius = config.pieChartLinePadding;
  25463. var textObjectCollection = [];
  25464. var lastTextObject = null;
  25465. var seriesConvert = series.map(function (item, index) {
  25466. var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  25467. text = item.labelText ? item.labelText : text;
  25468. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  25469. if (item._rose_proportion_) {
  25470. arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
  25471. }
  25472. var color = item.color;
  25473. var radius = item._radius_;
  25474. return {
  25475. arc: arc,
  25476. text: text,
  25477. color: color,
  25478. radius: radius,
  25479. textColor: item.textColor,
  25480. textSize: item.textSize,
  25481. labelShow: item.labelShow
  25482. };
  25483. });
  25484. for (var i = 0; i < seriesConvert.length; i++) {
  25485. var item = seriesConvert[i];
  25486. // line end
  25487. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  25488. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  25489. // line start
  25490. var orginX2 = Math.cos(item.arc) * item.radius;
  25491. var orginY2 = Math.sin(item.arc) * item.radius;
  25492. // text start
  25493. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  25494. var orginY3 = orginY1;
  25495. var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
  25496. var startY = orginY3;
  25497. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  25498. x: orginX3
  25499. })) {
  25500. if (orginX3 > 0) {
  25501. startY = Math.min(orginY3, lastTextObject.start.y);
  25502. } else if (orginX1 < 0) {
  25503. startY = Math.max(orginY3, lastTextObject.start.y);
  25504. } else {
  25505. if (orginY3 > 0) {
  25506. startY = Math.max(orginY3, lastTextObject.start.y);
  25507. } else {
  25508. startY = Math.min(orginY3, lastTextObject.start.y);
  25509. }
  25510. }
  25511. }
  25512. if (orginX3 < 0) {
  25513. orginX3 -= textWidth;
  25514. }
  25515. var textObject = {
  25516. lineStart: {
  25517. x: orginX2,
  25518. y: orginY2
  25519. },
  25520. lineEnd: {
  25521. x: orginX1,
  25522. y: orginY1
  25523. },
  25524. start: {
  25525. x: orginX3,
  25526. y: startY
  25527. },
  25528. width: textWidth,
  25529. height: config.fontSize,
  25530. text: item.text,
  25531. color: item.color,
  25532. textColor: item.textColor,
  25533. textSize: item.textSize
  25534. };
  25535. lastTextObject = avoidCollision(textObject, lastTextObject);
  25536. textObjectCollection.push(lastTextObject);
  25537. }
  25538. for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
  25539. if (seriesConvert[_i15].labelShow === false) {
  25540. continue;
  25541. }
  25542. var _item6 = textObjectCollection[_i15];
  25543. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  25544. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  25545. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  25546. context.setLineWidth(1 * opts.pix);
  25547. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25548. context.beginPath();
  25549. context.setStrokeStyle(_item6.color);
  25550. context.setFillStyle(_item6.color);
  25551. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25552. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  25553. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  25554. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  25555. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25556. context.stroke();
  25557. context.closePath();
  25558. context.beginPath();
  25559. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  25560. context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
  25561. context.closePath();
  25562. context.fill();
  25563. context.beginPath();
  25564. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25565. context.setFillStyle(_item6.textColor || opts.fontColor);
  25566. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  25567. context.closePath();
  25568. context.stroke();
  25569. context.closePath();
  25570. }
  25571. }
  25572. function drawToolTipSplitLine(offsetX, opts, config, context) {
  25573. var toolTipOption = opts.extra.tooltip || {};
  25574. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  25575. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  25576. var startY = opts.area[0];
  25577. var endY = opts.height - opts.area[2];
  25578. if (toolTipOption.gridType == 'dash') {
  25579. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25580. }
  25581. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25582. context.setLineWidth(1 * opts.pix);
  25583. context.beginPath();
  25584. context.moveTo(offsetX, startY);
  25585. context.lineTo(offsetX, endY);
  25586. context.stroke();
  25587. context.setLineDash([]);
  25588. if (toolTipOption.xAxisLabel) {
  25589. var labelText = opts.categories[opts.tooltip.index];
  25590. context.setFontSize(config.fontSize);
  25591. var textWidth = measureText(labelText, config.fontSize, context);
  25592. var textX = offsetX - 0.5 * textWidth;
  25593. var textY = endY + 2 * opts.pix;
  25594. context.beginPath();
  25595. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25596. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25597. context.setLineWidth(1 * opts.pix);
  25598. context.rect(textX - toolTipOption.boxPadding * opts.pix, textY, textWidth + 2 * toolTipOption.boxPadding * opts.pix, config.fontSize + 2 * toolTipOption.boxPadding * opts.pix);
  25599. context.closePath();
  25600. context.stroke();
  25601. context.fill();
  25602. context.beginPath();
  25603. context.setFontSize(config.fontSize);
  25604. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25605. context.fillText(String(labelText), textX, textY + toolTipOption.boxPadding * opts.pix + config.fontSize);
  25606. context.closePath();
  25607. context.stroke();
  25608. }
  25609. }
  25610. function drawMarkLine(opts, config, context) {
  25611. var markLineOption = assign({}, {
  25612. type: 'solid',
  25613. dashLength: 4,
  25614. data: []
  25615. }, opts.extra.markLine);
  25616. var startX = opts.area[3];
  25617. var endX = opts.width - opts.area[1];
  25618. var points = calMarkLineData(markLineOption.data, opts);
  25619. for (var i = 0; i < points.length; i++) {
  25620. var item = assign({}, {
  25621. lineColor: '#DE4A42',
  25622. showLabel: false,
  25623. labelFontSize: 13,
  25624. labelPadding: 6,
  25625. labelFontColor: '#666666',
  25626. labelBgColor: '#DFE8FF',
  25627. labelBgOpacity: 0.8,
  25628. labelAlign: 'left',
  25629. labelOffsetX: 0,
  25630. labelOffsetY: 0
  25631. }, points[i]);
  25632. if (markLineOption.type == 'dash') {
  25633. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  25634. }
  25635. context.setStrokeStyle(item.lineColor);
  25636. context.setLineWidth(1 * opts.pix);
  25637. context.beginPath();
  25638. context.moveTo(startX, item.y);
  25639. context.lineTo(endX, item.y);
  25640. context.stroke();
  25641. context.setLineDash([]);
  25642. if (item.showLabel) {
  25643. var fontSize = item.labelFontSize * opts.pix;
  25644. var labelText = item.labelText ? item.labelText : item.value;
  25645. context.setFontSize(fontSize);
  25646. var textWidth = measureText(labelText, fontSize, context);
  25647. var bgWidth = textWidth + item.labelPadding * opts.pix * 2;
  25648. var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
  25649. bgStartX += item.labelOffsetX;
  25650. var bgStartY = item.y - 0.5 * fontSize - item.labelPadding * opts.pix;
  25651. bgStartY += item.labelOffsetY;
  25652. var textX = bgStartX + item.labelPadding * opts.pix;
  25653. var textY = item.y;
  25654. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  25655. context.setStrokeStyle(item.labelBgColor);
  25656. context.setLineWidth(1 * opts.pix);
  25657. context.beginPath();
  25658. context.rect(bgStartX, bgStartY, bgWidth, fontSize + 2 * item.labelPadding * opts.pix);
  25659. context.closePath();
  25660. context.stroke();
  25661. context.fill();
  25662. context.setFontSize(fontSize);
  25663. context.setTextAlign('left');
  25664. context.setFillStyle(item.labelFontColor);
  25665. context.fillText(String(labelText), textX, bgStartY + fontSize + item.labelPadding * opts.pix / 2);
  25666. context.stroke();
  25667. context.setTextAlign('left');
  25668. }
  25669. }
  25670. }
  25671. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  25672. var toolTipOption = assign({}, {
  25673. gridType: 'solid',
  25674. dashLength: 4
  25675. }, opts.extra.tooltip);
  25676. var startX = opts.area[3];
  25677. var endX = opts.width - opts.area[1];
  25678. if (toolTipOption.gridType == 'dash') {
  25679. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25680. }
  25681. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25682. context.setLineWidth(1 * opts.pix);
  25683. context.beginPath();
  25684. context.moveTo(startX, opts.tooltip.offset.y);
  25685. context.lineTo(endX, opts.tooltip.offset.y);
  25686. context.stroke();
  25687. context.setLineDash([]);
  25688. if (toolTipOption.yAxisLabel) {
  25689. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25690. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  25691. var widthArr = opts.chartData.yAxisData.yAxisWidth;
  25692. var tStartLeft = opts.area[3];
  25693. var tStartRight = opts.width - opts.area[1];
  25694. for (var i = 0; i < labelText.length; i++) {
  25695. context.setFontSize(toolTipOption.fontSize * opts.pix);
  25696. var textWidth = measureText(labelText[i], toolTipOption.fontSize * opts.pix, context);
  25697. var bgStartX = void 0,
  25698. bgEndX = void 0,
  25699. bgWidth = void 0;
  25700. if (widthArr[i].position == 'left') {
  25701. bgStartX = tStartLeft - (textWidth + boxPadding * 2) - 2 * opts.pix;
  25702. bgEndX = Math.max(bgStartX, bgStartX + textWidth + boxPadding * 2);
  25703. } else {
  25704. bgStartX = tStartRight + 2 * opts.pix;
  25705. bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + boxPadding * 2);
  25706. }
  25707. bgWidth = bgEndX - bgStartX;
  25708. var textX = bgStartX + (bgWidth - textWidth) / 2;
  25709. var textY = opts.tooltip.offset.y;
  25710. context.beginPath();
  25711. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25712. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25713. context.setLineWidth(1 * opts.pix);
  25714. context.rect(bgStartX, textY - 0.5 * config.fontSize - boxPadding, bgWidth, config.fontSize + 2 * boxPadding);
  25715. context.closePath();
  25716. context.stroke();
  25717. context.fill();
  25718. context.beginPath();
  25719. context.setFontSize(config.fontSize);
  25720. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25721. context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
  25722. context.closePath();
  25723. context.stroke();
  25724. if (widthArr[i].position == 'left') {
  25725. tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
  25726. } else {
  25727. tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
  25728. }
  25729. }
  25730. }
  25731. }
  25732. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25733. var toolTipOption = assign({}, {
  25734. activeBgColor: '#000000',
  25735. activeBgOpacity: 0.08,
  25736. activeWidth: eachSpacing
  25737. }, opts.extra.column);
  25738. toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
  25739. var startY = opts.area[0];
  25740. var endY = opts.height - opts.area[2];
  25741. context.beginPath();
  25742. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25743. context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
  25744. context.closePath();
  25745. context.fill();
  25746. context.setFillStyle("#FFFFFF");
  25747. }
  25748. function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25749. var toolTipOption = assign({}, {
  25750. activeBgColor: '#000000',
  25751. activeBgOpacity: 0.08
  25752. }, opts.extra.bar);
  25753. var startX = opts.area[3];
  25754. var endX = opts.width - opts.area[1];
  25755. context.beginPath();
  25756. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25757. context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
  25758. context.closePath();
  25759. context.fill();
  25760. context.setFillStyle("#FFFFFF");
  25761. }
  25762. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  25763. var toolTipOption = assign({}, {
  25764. showBox: true,
  25765. showArrow: true,
  25766. showCategory: false,
  25767. bgColor: '#000000',
  25768. bgOpacity: 0.7,
  25769. borderColor: '#000000',
  25770. borderWidth: 0,
  25771. borderRadius: 0,
  25772. borderOpacity: 0.7,
  25773. boxPadding: 3,
  25774. fontColor: '#FFFFFF',
  25775. fontSize: 13,
  25776. lineHeight: 20,
  25777. legendShow: true,
  25778. legendShape: 'auto',
  25779. splitLine: true
  25780. }, opts.extra.tooltip);
  25781. if (toolTipOption.showCategory == true && opts.categories) {
  25782. textList.unshift({
  25783. text: opts.categories[opts.tooltip.index],
  25784. color: null
  25785. });
  25786. }
  25787. var fontSize = toolTipOption.fontSize * opts.pix;
  25788. var lineHeight = toolTipOption.lineHeight * opts.pix;
  25789. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25790. var legendWidth = fontSize;
  25791. var legendMarginRight = 5 * opts.pix;
  25792. if (toolTipOption.legendShow == false) {
  25793. legendWidth = 0;
  25794. legendMarginRight = 0;
  25795. }
  25796. var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
  25797. var isOverRightBorder = false;
  25798. if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  25799. if (toolTipOption.splitLine == true) {
  25800. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  25801. }
  25802. }
  25803. offset = assign({
  25804. x: 0,
  25805. y: 0
  25806. }, offset);
  25807. offset.y -= 8 * opts.pix;
  25808. var textWidth = textList.map(function (item) {
  25809. return measureText(item.text, fontSize, context);
  25810. });
  25811. var toolTipWidth = legendWidth + legendMarginRight + 4 * boxPadding + Math.max.apply(null, textWidth);
  25812. var toolTipHeight = 2 * boxPadding + textList.length * lineHeight;
  25813. if (toolTipOption.showBox == false) {
  25814. return;
  25815. }
  25816. // if beyond the right border
  25817. if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
  25818. isOverRightBorder = true;
  25819. }
  25820. if (toolTipHeight + offset.y > opts.height) {
  25821. offset.y = opts.height - toolTipHeight;
  25822. }
  25823. // draw background rect
  25824. context.beginPath();
  25825. context.setFillStyle(hexToRgb(toolTipOption.bgColor, toolTipOption.bgOpacity));
  25826. context.setLineWidth(toolTipOption.borderWidth * opts.pix);
  25827. context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
  25828. var radius = toolTipOption.borderRadius;
  25829. if (isOverRightBorder) {
  25830. // 增加左侧仍然超出的判断
  25831. if (toolTipWidth + arrowWidth > opts.width) {
  25832. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25833. }
  25834. if (toolTipWidth > offset.x) {
  25835. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25836. }
  25837. if (toolTipOption.showArrow) {
  25838. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25839. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  25840. }
  25841. context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  25842. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  25843. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  25844. context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  25845. if (toolTipOption.showArrow) {
  25846. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25847. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  25848. }
  25849. } else {
  25850. if (toolTipOption.showArrow) {
  25851. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25852. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25853. }
  25854. context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  25855. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  25856. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  25857. context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  25858. if (toolTipOption.showArrow) {
  25859. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  25860. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  25861. }
  25862. }
  25863. context.closePath();
  25864. context.fill();
  25865. if (toolTipOption.borderWidth > 0) {
  25866. context.stroke();
  25867. }
  25868. // draw legend
  25869. if (toolTipOption.legendShow) {
  25870. textList.forEach(function (item, index) {
  25871. if (item.color !== null) {
  25872. context.beginPath();
  25873. context.setFillStyle(item.color);
  25874. var startX = offset.x + arrowWidth + 2 * boxPadding;
  25875. var startY = offset.y + (lineHeight - fontSize) / 2 + lineHeight * index + boxPadding + 1;
  25876. if (isOverRightBorder) {
  25877. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding;
  25878. }
  25879. switch (item.legendShape) {
  25880. case 'line':
  25881. context.moveTo(startX, startY + 0.5 * legendWidth - 2 * opts.pix);
  25882. context.fillRect(startX, startY + 0.5 * legendWidth - 2 * opts.pix, legendWidth, 4 * opts.pix);
  25883. break;
  25884. case 'triangle':
  25885. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25886. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25887. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25888. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25889. break;
  25890. case 'diamond':
  25891. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25892. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth);
  25893. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25894. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth);
  25895. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25896. break;
  25897. case 'circle':
  25898. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth);
  25899. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth, 5 * opts.pix, 0, 2 * Math.PI);
  25900. break;
  25901. case 'rect':
  25902. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  25903. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  25904. break;
  25905. case 'square':
  25906. context.moveTo(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25907. context.fillRect(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  25908. break;
  25909. default:
  25910. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  25911. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  25912. }
  25913. context.closePath();
  25914. context.fill();
  25915. }
  25916. });
  25917. }
  25918. // draw text list
  25919. textList.forEach(function (item, index) {
  25920. var startX = offset.x + arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  25921. if (isOverRightBorder) {
  25922. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  25923. }
  25924. var startY = offset.y + lineHeight * index + (lineHeight - fontSize) / 2 - 1 + boxPadding + fontSize;
  25925. context.beginPath();
  25926. context.setFontSize(fontSize);
  25927. context.setTextBaseline('normal');
  25928. context.setFillStyle(toolTipOption.fontColor);
  25929. context.fillText(item.text, startX, startY);
  25930. context.closePath();
  25931. context.stroke();
  25932. });
  25933. }
  25934. function drawColumnDataPoints(series, opts, config, context) {
  25935. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  25936. var xAxisData = opts.chartData.xAxisData,
  25937. xAxisPoints = xAxisData.xAxisPoints,
  25938. eachSpacing = xAxisData.eachSpacing;
  25939. var columnOption = assign({}, {
  25940. type: 'group',
  25941. width: eachSpacing / 2,
  25942. meterBorder: 4,
  25943. meterFillColor: '#FFFFFF',
  25944. barBorderCircle: false,
  25945. barBorderRadius: [],
  25946. seriesGap: 2,
  25947. linearType: 'none',
  25948. linearOpacity: 1,
  25949. customColor: [],
  25950. colorStop: 0,
  25951. labelPosition: 'outside'
  25952. }, opts.extra.column);
  25953. var calPoints = [];
  25954. context.save();
  25955. var leftNum = -2;
  25956. var rightNum = xAxisPoints.length + 2;
  25957. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  25958. context.translate(opts._scrollDistance_, 0);
  25959. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  25960. rightNum = leftNum + opts.xAxis.itemCount + 4;
  25961. }
  25962. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  25963. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  25964. }
  25965. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  25966. series.forEach(function (eachSeries, seriesIndex) {
  25967. var ranges, minRange, maxRange;
  25968. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  25969. minRange = ranges.pop();
  25970. maxRange = ranges.shift();
  25971. // 计算0轴坐标
  25972. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25973. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  25974. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  25975. eachSeries.zeroPoints = zeroPoints;
  25976. var data = eachSeries.data;
  25977. switch (columnOption.type) {
  25978. case 'group':
  25979. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process);
  25980. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  25981. calPoints.push(tooltipPoints);
  25982. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  25983. for (var i = 0; i < points.length; i++) {
  25984. var item = points[i];
  25985. //fix issues/I27B1N yyoinge & Joeshu
  25986. if (item !== null && i > leftNum && i < rightNum) {
  25987. var startX = item.x - item.width / 2;
  25988. var height = opts.height - item.y - opts.area[2];
  25989. context.beginPath();
  25990. var fillColor = item.color || eachSeries.color;
  25991. var strokeColor = item.color || eachSeries.color;
  25992. if (columnOption.linearType !== 'none') {
  25993. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  25994. //透明渐变
  25995. if (columnOption.linearType == 'opacity') {
  25996. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  25997. grd.addColorStop(1, hexToRgb(fillColor, 1));
  25998. } else {
  25999. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26000. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26001. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26002. }
  26003. fillColor = grd;
  26004. }
  26005. // 圆角边框
  26006. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26007. var left = startX;
  26008. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26009. var width = item.width;
  26010. var _height = Math.abs(zeroPoints - item.y);
  26011. if (columnOption.barBorderCircle) {
  26012. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26013. }
  26014. if (item.y > zeroPoints) {
  26015. columnOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26016. }
  26017. var _columnOption$barBord = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26018. r0 = _columnOption$barBord[0],
  26019. r1 = _columnOption$barBord[1],
  26020. r2 = _columnOption$barBord[2],
  26021. r3 = _columnOption$barBord[3];
  26022. var minRadius = Math.min(width / 2, _height / 2);
  26023. r0 = r0 > minRadius ? minRadius : r0;
  26024. r1 = r1 > minRadius ? minRadius : r1;
  26025. r2 = r2 > minRadius ? minRadius : r2;
  26026. r3 = r3 > minRadius ? minRadius : r3;
  26027. r0 = r0 < 0 ? 0 : r0;
  26028. r1 = r1 < 0 ? 0 : r1;
  26029. r2 = r2 < 0 ? 0 : r2;
  26030. r3 = r3 < 0 ? 0 : r3;
  26031. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26032. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26033. context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
  26034. context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
  26035. } else {
  26036. context.moveTo(startX, item.y);
  26037. context.lineTo(startX + item.width, item.y);
  26038. context.lineTo(startX + item.width, zeroPoints);
  26039. context.lineTo(startX, zeroPoints);
  26040. context.lineTo(startX, item.y);
  26041. context.setLineWidth(1);
  26042. context.setStrokeStyle(strokeColor);
  26043. }
  26044. context.setFillStyle(fillColor);
  26045. context.closePath();
  26046. //context.stroke();
  26047. context.fill();
  26048. }
  26049. }
  26050. ;
  26051. break;
  26052. case 'stack':
  26053. // 绘制堆叠数据图
  26054. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26055. calPoints.push(points);
  26056. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26057. for (var _i16 = 0; _i16 < points.length; _i16++) {
  26058. var _item7 = points[_i16];
  26059. if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
  26060. context.beginPath();
  26061. var fillColor = _item7.color || eachSeries.color;
  26062. var startX = _item7.x - _item7.width / 2 + 1;
  26063. var height = opts.height - _item7.y - opts.area[2];
  26064. var height0 = opts.height - _item7.y0 - opts.area[2];
  26065. if (seriesIndex > 0) {
  26066. height -= height0;
  26067. }
  26068. context.setFillStyle(fillColor);
  26069. context.moveTo(startX, _item7.y);
  26070. context.fillRect(startX, _item7.y, _item7.width, height);
  26071. context.closePath();
  26072. context.fill();
  26073. }
  26074. }
  26075. ;
  26076. break;
  26077. case 'meter':
  26078. // 绘制温度计数据图
  26079. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26080. calPoints.push(points);
  26081. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
  26082. for (var _i17 = 0; _i17 < points.length; _i17++) {
  26083. var _item8 = points[_i17];
  26084. if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
  26085. //画背景颜色
  26086. context.beginPath();
  26087. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26088. context.setStrokeStyle(eachSeries.color);
  26089. context.setLineWidth(columnOption.meterBorder * opts.pix);
  26090. }
  26091. if (seriesIndex == 0) {
  26092. context.setFillStyle(columnOption.meterFillColor);
  26093. } else {
  26094. context.setFillStyle(_item8.color || eachSeries.color);
  26095. }
  26096. var startX = _item8.x - _item8.width / 2;
  26097. var height = opts.height - _item8.y - opts.area[2];
  26098. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26099. var _left = startX;
  26100. var _top = _item8.y;
  26101. var _width = _item8.width;
  26102. var _height2 = zeroPoints - _item8.y;
  26103. if (columnOption.barBorderCircle) {
  26104. columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
  26105. }
  26106. var _columnOption$barBord2 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26107. _r = _columnOption$barBord2[0],
  26108. _r2 = _columnOption$barBord2[1],
  26109. _r3 = _columnOption$barBord2[2],
  26110. _r4 = _columnOption$barBord2[3];
  26111. var _minRadius = Math.min(_width / 2, _height2 / 2);
  26112. _r = _r > _minRadius ? _minRadius : _r;
  26113. _r2 = _r2 > _minRadius ? _minRadius : _r2;
  26114. _r3 = _r3 > _minRadius ? _minRadius : _r3;
  26115. _r4 = _r4 > _minRadius ? _minRadius : _r4;
  26116. _r = _r < 0 ? 0 : _r;
  26117. _r2 = _r2 < 0 ? 0 : _r2;
  26118. _r3 = _r3 < 0 ? 0 : _r3;
  26119. _r4 = _r4 < 0 ? 0 : _r4;
  26120. context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
  26121. context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
  26122. context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
  26123. context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
  26124. context.fill();
  26125. } else {
  26126. context.moveTo(startX, _item8.y);
  26127. context.lineTo(startX + _item8.width, _item8.y);
  26128. context.lineTo(startX + _item8.width, zeroPoints);
  26129. context.lineTo(startX, zeroPoints);
  26130. context.lineTo(startX, _item8.y);
  26131. context.fill();
  26132. }
  26133. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26134. context.closePath();
  26135. context.stroke();
  26136. }
  26137. }
  26138. }
  26139. break;
  26140. }
  26141. });
  26142. if (opts.dataLabel !== false && process === 1) {
  26143. series.forEach(function (eachSeries, seriesIndex) {
  26144. var ranges, minRange, maxRange;
  26145. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26146. minRange = ranges.pop();
  26147. maxRange = ranges.shift();
  26148. var data = eachSeries.data;
  26149. switch (columnOption.type) {
  26150. case 'group':
  26151. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26152. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26153. drawColumePointText(points, eachSeries, config, context, opts);
  26154. break;
  26155. case 'stack':
  26156. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26157. drawColumePointText(points, eachSeries, config, context, opts);
  26158. break;
  26159. case 'meter':
  26160. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26161. drawColumePointText(points, eachSeries, config, context, opts);
  26162. break;
  26163. }
  26164. });
  26165. }
  26166. context.restore();
  26167. return {
  26168. xAxisPoints: xAxisPoints,
  26169. calPoints: calPoints,
  26170. eachSpacing: eachSpacing
  26171. };
  26172. }
  26173. function drawMountDataPoints(series, opts, config, context) {
  26174. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26175. var xAxisData = opts.chartData.xAxisData,
  26176. xAxisPoints = xAxisData.xAxisPoints,
  26177. eachSpacing = xAxisData.eachSpacing;
  26178. var mountOption = assign({}, {
  26179. type: 'mount',
  26180. widthRatio: 1,
  26181. borderWidth: 1,
  26182. barBorderCircle: false,
  26183. barBorderRadius: [],
  26184. linearType: 'none',
  26185. linearOpacity: 1,
  26186. customColor: [],
  26187. colorStop: 0
  26188. }, opts.extra.mount);
  26189. mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
  26190. mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
  26191. var calPoints = [];
  26192. context.save();
  26193. var leftNum = -2;
  26194. var rightNum = xAxisPoints.length + 2;
  26195. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26196. context.translate(opts._scrollDistance_, 0);
  26197. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26198. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26199. }
  26200. mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
  26201. var ranges, minRange, maxRange;
  26202. ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26203. minRange = ranges.pop();
  26204. maxRange = ranges.shift();
  26205. // 计算0轴坐标
  26206. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  26207. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  26208. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  26209. var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26210. switch (mountOption.type) {
  26211. case 'bar':
  26212. for (var i = 0; i < points.length; i++) {
  26213. var item = points[i];
  26214. if (item !== null && i > leftNum && i < rightNum) {
  26215. var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
  26216. var height = opts.height - item.y - opts.area[2];
  26217. context.beginPath();
  26218. var fillColor = item.color || series[i].color;
  26219. var strokeColor = item.color || series[i].color;
  26220. if (mountOption.linearType !== 'none') {
  26221. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  26222. //透明渐变
  26223. if (mountOption.linearType == 'opacity') {
  26224. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26225. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26226. } else {
  26227. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26228. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26229. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26230. }
  26231. fillColor = grd;
  26232. }
  26233. // 圆角边框
  26234. if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
  26235. var left = startX;
  26236. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26237. var width = item.width;
  26238. var _height3 = Math.abs(zeroPoints - item.y);
  26239. if (mountOption.barBorderCircle) {
  26240. mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26241. }
  26242. if (item.y > zeroPoints) {
  26243. mountOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26244. }
  26245. var _mountOption$barBorde = (0, _slicedToArray2.default)(mountOption.barBorderRadius, 4),
  26246. r0 = _mountOption$barBorde[0],
  26247. r1 = _mountOption$barBorde[1],
  26248. r2 = _mountOption$barBorde[2],
  26249. r3 = _mountOption$barBorde[3];
  26250. var minRadius = Math.min(width / 2, _height3 / 2);
  26251. r0 = r0 > minRadius ? minRadius : r0;
  26252. r1 = r1 > minRadius ? minRadius : r1;
  26253. r2 = r2 > minRadius ? minRadius : r2;
  26254. r3 = r3 > minRadius ? minRadius : r3;
  26255. r0 = r0 < 0 ? 0 : r0;
  26256. r1 = r1 < 0 ? 0 : r1;
  26257. r2 = r2 < 0 ? 0 : r2;
  26258. r3 = r3 < 0 ? 0 : r3;
  26259. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26260. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26261. context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
  26262. context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
  26263. } else {
  26264. context.moveTo(startX, item.y);
  26265. context.lineTo(startX + item.width, item.y);
  26266. context.lineTo(startX + item.width, zeroPoints);
  26267. context.lineTo(startX, zeroPoints);
  26268. context.lineTo(startX, item.y);
  26269. }
  26270. context.setStrokeStyle(strokeColor);
  26271. context.setFillStyle(fillColor);
  26272. if (mountOption.borderWidth > 0) {
  26273. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26274. context.closePath();
  26275. context.stroke();
  26276. }
  26277. context.fill();
  26278. }
  26279. }
  26280. ;
  26281. break;
  26282. case 'triangle':
  26283. for (var _i18 = 0; _i18 < points.length; _i18++) {
  26284. var _item9 = points[_i18];
  26285. if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
  26286. var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
  26287. var height = opts.height - _item9.y - opts.area[2];
  26288. context.beginPath();
  26289. var fillColor = _item9.color || series[_i18].color;
  26290. var strokeColor = _item9.color || series[_i18].color;
  26291. if (mountOption.linearType !== 'none') {
  26292. var grd = context.createLinearGradient(startX, _item9.y, startX, zeroPoints);
  26293. //透明渐变
  26294. if (mountOption.linearType == 'opacity') {
  26295. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26296. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26297. } else {
  26298. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26299. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26300. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26301. }
  26302. fillColor = grd;
  26303. }
  26304. context.moveTo(startX, zeroPoints);
  26305. context.lineTo(_item9.x, _item9.y);
  26306. context.lineTo(startX + _item9.width, zeroPoints);
  26307. context.setStrokeStyle(strokeColor);
  26308. context.setFillStyle(fillColor);
  26309. if (mountOption.borderWidth > 0) {
  26310. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26311. context.stroke();
  26312. }
  26313. context.fill();
  26314. }
  26315. }
  26316. ;
  26317. break;
  26318. case 'mount':
  26319. for (var _i19 = 0; _i19 < points.length; _i19++) {
  26320. var _item10 = points[_i19];
  26321. if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
  26322. var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
  26323. var height = opts.height - _item10.y - opts.area[2];
  26324. context.beginPath();
  26325. var fillColor = _item10.color || series[_i19].color;
  26326. var strokeColor = _item10.color || series[_i19].color;
  26327. if (mountOption.linearType !== 'none') {
  26328. var grd = context.createLinearGradient(startX, _item10.y, startX, zeroPoints);
  26329. //透明渐变
  26330. if (mountOption.linearType == 'opacity') {
  26331. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26332. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26333. } else {
  26334. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26335. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26336. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26337. }
  26338. fillColor = grd;
  26339. }
  26340. context.moveTo(startX, zeroPoints);
  26341. context.bezierCurveTo(_item10.x - _item10.width / 4, zeroPoints, _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
  26342. context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, zeroPoints, startX + _item10.width, zeroPoints);
  26343. context.setStrokeStyle(strokeColor);
  26344. context.setFillStyle(fillColor);
  26345. if (mountOption.borderWidth > 0) {
  26346. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26347. context.stroke();
  26348. }
  26349. context.fill();
  26350. }
  26351. }
  26352. ;
  26353. break;
  26354. case 'sharp':
  26355. for (var _i20 = 0; _i20 < points.length; _i20++) {
  26356. var _item11 = points[_i20];
  26357. if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
  26358. var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
  26359. var height = opts.height - _item11.y - opts.area[2];
  26360. context.beginPath();
  26361. var fillColor = _item11.color || series[_i20].color;
  26362. var strokeColor = _item11.color || series[_i20].color;
  26363. if (mountOption.linearType !== 'none') {
  26364. var grd = context.createLinearGradient(startX, _item11.y, startX, zeroPoints);
  26365. //透明渐变
  26366. if (mountOption.linearType == 'opacity') {
  26367. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26368. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26369. } else {
  26370. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26371. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26372. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26373. }
  26374. fillColor = grd;
  26375. }
  26376. context.moveTo(startX, zeroPoints);
  26377. context.quadraticCurveTo(_item11.x - 0, zeroPoints - height / 4, _item11.x, _item11.y);
  26378. context.quadraticCurveTo(_item11.x + 0, zeroPoints - height / 4, startX + _item11.width, zeroPoints);
  26379. context.setStrokeStyle(strokeColor);
  26380. context.setFillStyle(fillColor);
  26381. if (mountOption.borderWidth > 0) {
  26382. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26383. context.stroke();
  26384. }
  26385. context.fill();
  26386. }
  26387. }
  26388. ;
  26389. break;
  26390. }
  26391. if (opts.dataLabel !== false && process === 1) {
  26392. var _ranges, _minRange, _maxRange;
  26393. _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26394. _minRange = _ranges.pop();
  26395. _maxRange = _ranges.shift();
  26396. var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26397. drawMountPointText(points, series, config, context, opts, zeroPoints);
  26398. }
  26399. context.restore();
  26400. return {
  26401. xAxisPoints: xAxisPoints,
  26402. calPoints: points,
  26403. eachSpacing: eachSpacing
  26404. };
  26405. }
  26406. function drawBarDataPoints(series, opts, config, context) {
  26407. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26408. var yAxisPoints = [];
  26409. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
  26410. for (var i = 0; i < opts.categories.length; i++) {
  26411. yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
  26412. }
  26413. var columnOption = assign({}, {
  26414. type: 'group',
  26415. width: eachSpacing / 2,
  26416. meterBorder: 4,
  26417. meterFillColor: '#FFFFFF',
  26418. barBorderCircle: false,
  26419. barBorderRadius: [],
  26420. seriesGap: 2,
  26421. linearType: 'none',
  26422. linearOpacity: 1,
  26423. customColor: [],
  26424. colorStop: 0
  26425. }, opts.extra.bar);
  26426. var calPoints = [];
  26427. context.save();
  26428. var leftNum = -2;
  26429. var rightNum = yAxisPoints.length + 2;
  26430. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  26431. drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
  26432. }
  26433. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  26434. series.forEach(function (eachSeries, seriesIndex) {
  26435. var ranges, minRange, maxRange;
  26436. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26437. maxRange = ranges.pop();
  26438. minRange = ranges.shift();
  26439. var data = eachSeries.data;
  26440. switch (columnOption.type) {
  26441. case 'group':
  26442. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26443. var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26444. calPoints.push(tooltipPoints);
  26445. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26446. for (var _i21 = 0; _i21 < points.length; _i21++) {
  26447. var item = points[_i21];
  26448. //fix issues/I27B1N yyoinge & Joeshu
  26449. if (item !== null && _i21 > leftNum && _i21 < rightNum) {
  26450. //var startX = item.x - item.width / 2;
  26451. var startX = opts.area[3];
  26452. var startY = item.y - item.width / 2;
  26453. var height = item.height;
  26454. context.beginPath();
  26455. var fillColor = item.color || eachSeries.color;
  26456. var strokeColor = item.color || eachSeries.color;
  26457. if (columnOption.linearType !== 'none') {
  26458. var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
  26459. //透明渐变
  26460. if (columnOption.linearType == 'opacity') {
  26461. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  26462. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26463. } else {
  26464. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26465. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26466. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26467. }
  26468. fillColor = grd;
  26469. }
  26470. // 圆角边框
  26471. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26472. var left = startX;
  26473. var width = item.width;
  26474. var top = item.y - item.width / 2;
  26475. var _height4 = item.height;
  26476. if (columnOption.barBorderCircle) {
  26477. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26478. }
  26479. var _columnOption$barBord3 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26480. r0 = _columnOption$barBord3[0],
  26481. r1 = _columnOption$barBord3[1],
  26482. r2 = _columnOption$barBord3[2],
  26483. r3 = _columnOption$barBord3[3];
  26484. var minRadius = Math.min(width / 2, _height4 / 2);
  26485. r0 = r0 > minRadius ? minRadius : r0;
  26486. r1 = r1 > minRadius ? minRadius : r1;
  26487. r2 = r2 > minRadius ? minRadius : r2;
  26488. r3 = r3 > minRadius ? minRadius : r3;
  26489. r0 = r0 < 0 ? 0 : r0;
  26490. r1 = r1 < 0 ? 0 : r1;
  26491. r2 = r2 < 0 ? 0 : r2;
  26492. r3 = r3 < 0 ? 0 : r3;
  26493. context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
  26494. context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
  26495. context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
  26496. context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
  26497. } else {
  26498. context.moveTo(startX, startY);
  26499. context.lineTo(item.x, startY);
  26500. context.lineTo(item.x, startY + item.width);
  26501. context.lineTo(startX, startY + item.width);
  26502. context.lineTo(startX, startY);
  26503. context.setLineWidth(1);
  26504. context.setStrokeStyle(strokeColor);
  26505. }
  26506. context.setFillStyle(fillColor);
  26507. context.closePath();
  26508. //context.stroke();
  26509. context.fill();
  26510. }
  26511. }
  26512. ;
  26513. break;
  26514. case 'stack':
  26515. // 绘制堆叠数据图
  26516. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26517. calPoints.push(points);
  26518. points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26519. for (var _i22 = 0; _i22 < points.length; _i22++) {
  26520. var _item12 = points[_i22];
  26521. if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
  26522. context.beginPath();
  26523. var fillColor = _item12.color || eachSeries.color;
  26524. var startX = _item12.x0;
  26525. context.setFillStyle(fillColor);
  26526. context.moveTo(startX, _item12.y - _item12.width / 2);
  26527. context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
  26528. context.closePath();
  26529. context.fill();
  26530. }
  26531. }
  26532. ;
  26533. break;
  26534. }
  26535. });
  26536. if (opts.dataLabel !== false && process === 1) {
  26537. series.forEach(function (eachSeries, seriesIndex) {
  26538. var ranges, minRange, maxRange;
  26539. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26540. maxRange = ranges.pop();
  26541. minRange = ranges.shift();
  26542. var data = eachSeries.data;
  26543. switch (columnOption.type) {
  26544. case 'group':
  26545. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26546. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26547. drawBarPointText(points, eachSeries, config, context, opts);
  26548. break;
  26549. case 'stack':
  26550. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26551. drawBarPointText(points, eachSeries, config, context, opts);
  26552. break;
  26553. }
  26554. });
  26555. }
  26556. return {
  26557. yAxisPoints: yAxisPoints,
  26558. calPoints: calPoints,
  26559. eachSpacing: eachSpacing
  26560. };
  26561. }
  26562. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  26563. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  26564. var candleOption = assign({}, {
  26565. color: {},
  26566. average: {}
  26567. }, opts.extra.candle);
  26568. candleOption.color = assign({}, {
  26569. upLine: '#f04864',
  26570. upFill: '#f04864',
  26571. downLine: '#2fc25b',
  26572. downFill: '#2fc25b'
  26573. }, candleOption.color);
  26574. candleOption.average = assign({}, {
  26575. show: false,
  26576. name: [],
  26577. day: [],
  26578. color: config.color
  26579. }, candleOption.average);
  26580. opts.extra.candle = candleOption;
  26581. var xAxisData = opts.chartData.xAxisData,
  26582. xAxisPoints = xAxisData.xAxisPoints,
  26583. eachSpacing = xAxisData.eachSpacing;
  26584. var calPoints = [];
  26585. context.save();
  26586. var leftNum = -2;
  26587. var rightNum = xAxisPoints.length + 2;
  26588. var leftSpace = 0;
  26589. var rightSpace = opts.width + eachSpacing;
  26590. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26591. context.translate(opts._scrollDistance_, 0);
  26592. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26593. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26594. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26595. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26596. }
  26597. //画均线
  26598. if (candleOption.average.show || seriesMA) {
  26599. //Merge pull request !12 from 邱贵翔
  26600. seriesMA.forEach(function (eachSeries, seriesIndex) {
  26601. var ranges, minRange, maxRange;
  26602. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26603. minRange = ranges.pop();
  26604. maxRange = ranges.shift();
  26605. var data = eachSeries.data;
  26606. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26607. var splitPointList = splitPoints(points, eachSeries);
  26608. for (var i = 0; i < splitPointList.length; i++) {
  26609. var _points = splitPointList[i];
  26610. context.beginPath();
  26611. context.setStrokeStyle(eachSeries.color);
  26612. context.setLineWidth(1);
  26613. if (_points.length === 1) {
  26614. context.moveTo(_points[0].x, _points[0].y);
  26615. context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
  26616. } else {
  26617. context.moveTo(_points[0].x, _points[0].y);
  26618. var startPoint = 0;
  26619. for (var j = 0; j < _points.length; j++) {
  26620. var item = _points[j];
  26621. if (startPoint == 0 && item.x > leftSpace) {
  26622. context.moveTo(item.x, item.y);
  26623. startPoint = 1;
  26624. }
  26625. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26626. var ctrlPoint = createCurveControlPoints(_points, j - 1);
  26627. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26628. }
  26629. }
  26630. context.moveTo(_points[0].x, _points[0].y);
  26631. }
  26632. context.closePath();
  26633. context.stroke();
  26634. }
  26635. });
  26636. }
  26637. //画K线
  26638. series.forEach(function (eachSeries, seriesIndex) {
  26639. var ranges, minRange, maxRange;
  26640. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26641. minRange = ranges.pop();
  26642. maxRange = ranges.shift();
  26643. var data = eachSeries.data;
  26644. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26645. calPoints.push(points);
  26646. var splitPointList = splitPoints(points, eachSeries);
  26647. for (var i = 0; i < splitPointList[0].length; i++) {
  26648. if (i > leftNum && i < rightNum) {
  26649. var item = splitPointList[0][i];
  26650. context.beginPath();
  26651. //如果上涨
  26652. if (data[i][1] - data[i][0] > 0) {
  26653. context.setStrokeStyle(candleOption.color.upLine);
  26654. context.setFillStyle(candleOption.color.upFill);
  26655. context.setLineWidth(1 * opts.pix);
  26656. context.moveTo(item[3].x, item[3].y); //顶点
  26657. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26658. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26659. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26660. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26661. context.lineTo(item[2].x, item[2].y); //底点
  26662. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26663. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26664. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26665. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26666. context.moveTo(item[3].x, item[3].y); //顶点
  26667. } else {
  26668. context.setStrokeStyle(candleOption.color.downLine);
  26669. context.setFillStyle(candleOption.color.downFill);
  26670. context.setLineWidth(1 * opts.pix);
  26671. context.moveTo(item[3].x, item[3].y); //顶点
  26672. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26673. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26674. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26675. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26676. context.lineTo(item[2].x, item[2].y); //底点
  26677. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26678. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26679. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26680. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26681. context.moveTo(item[3].x, item[3].y); //顶点
  26682. }
  26683. context.closePath();
  26684. context.fill();
  26685. context.stroke();
  26686. }
  26687. }
  26688. });
  26689. context.restore();
  26690. return {
  26691. xAxisPoints: xAxisPoints,
  26692. calPoints: calPoints,
  26693. eachSpacing: eachSpacing
  26694. };
  26695. }
  26696. function drawAreaDataPoints(series, opts, config, context) {
  26697. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26698. var areaOption = assign({}, {
  26699. type: 'straight',
  26700. opacity: 0.2,
  26701. addLine: false,
  26702. width: 2,
  26703. gradient: false,
  26704. activeType: 'none'
  26705. }, opts.extra.area);
  26706. var xAxisData = opts.chartData.xAxisData,
  26707. xAxisPoints = xAxisData.xAxisPoints,
  26708. eachSpacing = xAxisData.eachSpacing;
  26709. var endY = opts.height - opts.area[2];
  26710. var calPoints = [];
  26711. context.save();
  26712. var leftSpace = 0;
  26713. var rightSpace = opts.width + eachSpacing;
  26714. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26715. context.translate(opts._scrollDistance_, 0);
  26716. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26717. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26718. }
  26719. series.forEach(function (eachSeries, seriesIndex) {
  26720. var ranges, minRange, maxRange;
  26721. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26722. minRange = ranges.pop();
  26723. maxRange = ranges.shift();
  26724. var data = eachSeries.data;
  26725. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26726. calPoints.push(points);
  26727. var splitPointList = splitPoints(points, eachSeries);
  26728. for (var i = 0; i < splitPointList.length; i++) {
  26729. var _points2 = splitPointList[i];
  26730. // 绘制区域数
  26731. context.beginPath();
  26732. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26733. if (areaOption.gradient) {
  26734. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  26735. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  26736. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  26737. context.setFillStyle(gradient);
  26738. } else {
  26739. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26740. }
  26741. context.setLineWidth(areaOption.width * opts.pix);
  26742. if (_points2.length > 1) {
  26743. var firstPoint = _points2[0];
  26744. var lastPoint = _points2[_points2.length - 1];
  26745. context.moveTo(firstPoint.x, firstPoint.y);
  26746. var startPoint = 0;
  26747. if (areaOption.type === 'curve') {
  26748. for (var j = 0; j < _points2.length; j++) {
  26749. var item = _points2[j];
  26750. if (startPoint == 0 && item.x > leftSpace) {
  26751. context.moveTo(item.x, item.y);
  26752. startPoint = 1;
  26753. }
  26754. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26755. var ctrlPoint = createCurveControlPoints(_points2, j - 1);
  26756. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26757. }
  26758. }
  26759. ;
  26760. }
  26761. if (areaOption.type === 'straight') {
  26762. for (var _j = 0; _j < _points2.length; _j++) {
  26763. var _item13 = _points2[_j];
  26764. if (startPoint == 0 && _item13.x > leftSpace) {
  26765. context.moveTo(_item13.x, _item13.y);
  26766. startPoint = 1;
  26767. }
  26768. if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
  26769. context.lineTo(_item13.x, _item13.y);
  26770. }
  26771. }
  26772. ;
  26773. }
  26774. if (areaOption.type === 'step') {
  26775. for (var _j2 = 0; _j2 < _points2.length; _j2++) {
  26776. var _item14 = _points2[_j2];
  26777. if (startPoint == 0 && _item14.x > leftSpace) {
  26778. context.moveTo(_item14.x, _item14.y);
  26779. startPoint = 1;
  26780. }
  26781. if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
  26782. context.lineTo(_item14.x, _points2[_j2 - 1].y);
  26783. context.lineTo(_item14.x, _item14.y);
  26784. }
  26785. }
  26786. ;
  26787. }
  26788. context.lineTo(lastPoint.x, endY);
  26789. context.lineTo(firstPoint.x, endY);
  26790. context.lineTo(firstPoint.x, firstPoint.y);
  26791. } else {
  26792. var _item15 = _points2[0];
  26793. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  26794. // context.lineTo(item.x + eachSpacing / 2, item.y);
  26795. // context.lineTo(item.x + eachSpacing / 2, endY);
  26796. // context.lineTo(item.x - eachSpacing / 2, endY);
  26797. // context.moveTo(item.x - eachSpacing / 2, item.y);
  26798. }
  26799. context.closePath();
  26800. context.fill();
  26801. //画连线
  26802. if (areaOption.addLine) {
  26803. if (eachSeries.lineType == 'dash') {
  26804. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  26805. dashLength *= opts.pix;
  26806. context.setLineDash([dashLength, dashLength]);
  26807. }
  26808. context.beginPath();
  26809. context.setStrokeStyle(eachSeries.color);
  26810. context.setLineWidth(areaOption.width * opts.pix);
  26811. if (_points2.length === 1) {
  26812. context.moveTo(_points2[0].x, _points2[0].y);
  26813. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  26814. } else {
  26815. context.moveTo(_points2[0].x, _points2[0].y);
  26816. var _startPoint = 0;
  26817. if (areaOption.type === 'curve') {
  26818. for (var _j3 = 0; _j3 < _points2.length; _j3++) {
  26819. var _item16 = _points2[_j3];
  26820. if (_startPoint == 0 && _item16.x > leftSpace) {
  26821. context.moveTo(_item16.x, _item16.y);
  26822. _startPoint = 1;
  26823. }
  26824. if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
  26825. var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
  26826. context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
  26827. }
  26828. }
  26829. ;
  26830. }
  26831. if (areaOption.type === 'straight') {
  26832. for (var _j4 = 0; _j4 < _points2.length; _j4++) {
  26833. var _item17 = _points2[_j4];
  26834. if (_startPoint == 0 && _item17.x > leftSpace) {
  26835. context.moveTo(_item17.x, _item17.y);
  26836. _startPoint = 1;
  26837. }
  26838. if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
  26839. context.lineTo(_item17.x, _item17.y);
  26840. }
  26841. }
  26842. ;
  26843. }
  26844. if (areaOption.type === 'step') {
  26845. for (var _j5 = 0; _j5 < _points2.length; _j5++) {
  26846. var _item18 = _points2[_j5];
  26847. if (_startPoint == 0 && _item18.x > leftSpace) {
  26848. context.moveTo(_item18.x, _item18.y);
  26849. _startPoint = 1;
  26850. }
  26851. if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
  26852. context.lineTo(_item18.x, _points2[_j5 - 1].y);
  26853. context.lineTo(_item18.x, _item18.y);
  26854. }
  26855. }
  26856. ;
  26857. }
  26858. context.moveTo(_points2[0].x, _points2[0].y);
  26859. }
  26860. context.stroke();
  26861. context.setLineDash([]);
  26862. }
  26863. }
  26864. //画点
  26865. if (opts.dataPointShape !== false) {
  26866. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  26867. }
  26868. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, areaOption, seriesIndex);
  26869. });
  26870. if (opts.dataLabel !== false && process === 1) {
  26871. series.forEach(function (eachSeries, seriesIndex) {
  26872. var ranges, minRange, maxRange;
  26873. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26874. minRange = ranges.pop();
  26875. maxRange = ranges.shift();
  26876. var data = eachSeries.data;
  26877. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26878. drawPointText(points, eachSeries, config, context, opts);
  26879. });
  26880. }
  26881. context.restore();
  26882. return {
  26883. xAxisPoints: xAxisPoints,
  26884. calPoints: calPoints,
  26885. eachSpacing: eachSpacing
  26886. };
  26887. }
  26888. function drawScatterDataPoints(series, opts, config, context) {
  26889. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26890. var scatterOption = assign({}, {
  26891. type: 'circle'
  26892. }, opts.extra.scatter);
  26893. var xAxisData = opts.chartData.xAxisData,
  26894. xAxisPoints = xAxisData.xAxisPoints,
  26895. eachSpacing = xAxisData.eachSpacing;
  26896. var calPoints = [];
  26897. context.save();
  26898. var leftSpace = 0;
  26899. var rightSpace = opts.width + eachSpacing;
  26900. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26901. context.translate(opts._scrollDistance_, 0);
  26902. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26903. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26904. }
  26905. series.forEach(function (eachSeries, seriesIndex) {
  26906. var ranges, minRange, maxRange;
  26907. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26908. minRange = ranges.pop();
  26909. maxRange = ranges.shift();
  26910. var data = eachSeries.data;
  26911. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26912. context.beginPath();
  26913. context.setStrokeStyle(eachSeries.color);
  26914. context.setFillStyle(eachSeries.color);
  26915. context.setLineWidth(1 * opts.pix);
  26916. var shape = eachSeries.pointShape;
  26917. if (shape === 'diamond') {
  26918. points.forEach(function (item, index) {
  26919. if (item !== null) {
  26920. context.moveTo(item.x, item.y - 4.5);
  26921. context.lineTo(item.x - 4.5, item.y);
  26922. context.lineTo(item.x, item.y + 4.5);
  26923. context.lineTo(item.x + 4.5, item.y);
  26924. context.lineTo(item.x, item.y - 4.5);
  26925. }
  26926. });
  26927. } else if (shape === 'circle') {
  26928. points.forEach(function (item, index) {
  26929. if (item !== null) {
  26930. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  26931. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  26932. }
  26933. });
  26934. } else if (shape === 'square') {
  26935. points.forEach(function (item, index) {
  26936. if (item !== null) {
  26937. context.moveTo(item.x - 3.5, item.y - 3.5);
  26938. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  26939. }
  26940. });
  26941. } else if (shape === 'triangle') {
  26942. points.forEach(function (item, index) {
  26943. if (item !== null) {
  26944. context.moveTo(item.x, item.y - 4.5);
  26945. context.lineTo(item.x - 4.5, item.y + 4.5);
  26946. context.lineTo(item.x + 4.5, item.y + 4.5);
  26947. context.lineTo(item.x, item.y - 4.5);
  26948. }
  26949. });
  26950. } else if (shape === 'triangle') {
  26951. return;
  26952. }
  26953. context.closePath();
  26954. context.fill();
  26955. context.stroke();
  26956. });
  26957. if (opts.dataLabel !== false && process === 1) {
  26958. series.forEach(function (eachSeries, seriesIndex) {
  26959. var ranges, minRange, maxRange;
  26960. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26961. minRange = ranges.pop();
  26962. maxRange = ranges.shift();
  26963. var data = eachSeries.data;
  26964. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26965. drawPointText(points, eachSeries, config, context, opts);
  26966. });
  26967. }
  26968. context.restore();
  26969. return {
  26970. xAxisPoints: xAxisPoints,
  26971. calPoints: calPoints,
  26972. eachSpacing: eachSpacing
  26973. };
  26974. }
  26975. function drawBubbleDataPoints(series, opts, config, context) {
  26976. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26977. var bubbleOption = assign({}, {
  26978. opacity: 1,
  26979. border: 2
  26980. }, opts.extra.bubble);
  26981. var xAxisData = opts.chartData.xAxisData,
  26982. xAxisPoints = xAxisData.xAxisPoints,
  26983. eachSpacing = xAxisData.eachSpacing;
  26984. var calPoints = [];
  26985. context.save();
  26986. var leftSpace = 0;
  26987. var rightSpace = opts.width + eachSpacing;
  26988. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26989. context.translate(opts._scrollDistance_, 0);
  26990. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26991. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26992. }
  26993. series.forEach(function (eachSeries, seriesIndex) {
  26994. var ranges, minRange, maxRange;
  26995. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26996. minRange = ranges.pop();
  26997. maxRange = ranges.shift();
  26998. var data = eachSeries.data;
  26999. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27000. context.beginPath();
  27001. context.setStrokeStyle(eachSeries.color);
  27002. context.setLineWidth(bubbleOption.border * opts.pix);
  27003. context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
  27004. points.forEach(function (item, index) {
  27005. context.moveTo(item.x + item.r, item.y);
  27006. context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
  27007. });
  27008. context.closePath();
  27009. context.fill();
  27010. context.stroke();
  27011. if (opts.dataLabel !== false && process === 1) {
  27012. points.forEach(function (item, index) {
  27013. context.beginPath();
  27014. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  27015. context.setFontSize(fontSize);
  27016. context.setFillStyle(eachSeries.textColor || "#FFFFFF");
  27017. context.setTextAlign('center');
  27018. context.fillText(String(item.t), item.x, item.y + fontSize / 2);
  27019. context.closePath();
  27020. context.stroke();
  27021. context.setTextAlign('left');
  27022. });
  27023. }
  27024. });
  27025. context.restore();
  27026. return {
  27027. xAxisPoints: xAxisPoints,
  27028. calPoints: calPoints,
  27029. eachSpacing: eachSpacing
  27030. };
  27031. }
  27032. function drawLineDataPoints(series, opts, config, context) {
  27033. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27034. var lineOption = assign({}, {
  27035. type: 'straight',
  27036. width: 2,
  27037. activeType: 'none',
  27038. linearType: 'none',
  27039. onShadow: false,
  27040. animation: 'vertical'
  27041. }, opts.extra.line);
  27042. lineOption.width *= opts.pix;
  27043. var xAxisData = opts.chartData.xAxisData,
  27044. xAxisPoints = xAxisData.xAxisPoints,
  27045. eachSpacing = xAxisData.eachSpacing;
  27046. var calPoints = [];
  27047. context.save();
  27048. var leftSpace = 0;
  27049. var rightSpace = opts.width + eachSpacing;
  27050. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27051. context.translate(opts._scrollDistance_, 0);
  27052. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27053. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27054. }
  27055. series.forEach(function (eachSeries, seriesIndex) {
  27056. // 这段很神奇的代码用于解决ios16的setStrokeStyle失效的bug
  27057. context.beginPath();
  27058. context.setStrokeStyle(eachSeries.color);
  27059. context.moveTo(-10000, -10000);
  27060. context.lineTo(-10001, -10001);
  27061. context.stroke();
  27062. var ranges, minRange, maxRange;
  27063. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27064. minRange = ranges.pop();
  27065. maxRange = ranges.shift();
  27066. var data = eachSeries.data;
  27067. var points = getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process);
  27068. calPoints.push(points);
  27069. var splitPointList = splitPoints(points, eachSeries);
  27070. if (eachSeries.lineType == 'dash') {
  27071. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27072. dashLength *= opts.pix;
  27073. context.setLineDash([dashLength, dashLength]);
  27074. }
  27075. context.beginPath();
  27076. var strokeColor = eachSeries.color;
  27077. if (lineOption.linearType !== 'none' && eachSeries.linearColor && eachSeries.linearColor.length > 0) {
  27078. var grd = context.createLinearGradient(opts.chartData.xAxisData.startX, opts.height / 2, opts.chartData.xAxisData.endX, opts.height / 2);
  27079. for (var i = 0; i < eachSeries.linearColor.length; i++) {
  27080. grd.addColorStop(eachSeries.linearColor[i][0], hexToRgb(eachSeries.linearColor[i][1], 1));
  27081. }
  27082. strokeColor = grd;
  27083. }
  27084. context.setStrokeStyle(strokeColor);
  27085. if (lineOption.onShadow == true && eachSeries.setShadow && eachSeries.setShadow.length > 0) {
  27086. context.setShadow(eachSeries.setShadow[0], eachSeries.setShadow[1], eachSeries.setShadow[2], eachSeries.setShadow[3]);
  27087. } else {
  27088. context.setShadow(0, 0, 0, 'rgba(0,0,0,0)');
  27089. }
  27090. context.setLineWidth(lineOption.width);
  27091. splitPointList.forEach(function (points, index) {
  27092. if (points.length === 1) {
  27093. context.moveTo(points[0].x, points[0].y);
  27094. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27095. } else {
  27096. context.moveTo(points[0].x, points[0].y);
  27097. var startPoint = 0;
  27098. if (lineOption.type === 'curve') {
  27099. for (var j = 0; j < points.length; j++) {
  27100. var item = points[j];
  27101. if (startPoint == 0 && item.x > leftSpace) {
  27102. context.moveTo(item.x, item.y);
  27103. startPoint = 1;
  27104. }
  27105. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  27106. var ctrlPoint = createCurveControlPoints(points, j - 1);
  27107. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  27108. }
  27109. }
  27110. ;
  27111. }
  27112. if (lineOption.type === 'straight') {
  27113. for (var _j6 = 0; _j6 < points.length; _j6++) {
  27114. var _item19 = points[_j6];
  27115. if (startPoint == 0 && _item19.x > leftSpace) {
  27116. context.moveTo(_item19.x, _item19.y);
  27117. startPoint = 1;
  27118. }
  27119. if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
  27120. context.lineTo(_item19.x, _item19.y);
  27121. }
  27122. }
  27123. ;
  27124. }
  27125. if (lineOption.type === 'step') {
  27126. for (var _j7 = 0; _j7 < points.length; _j7++) {
  27127. var _item20 = points[_j7];
  27128. if (startPoint == 0 && _item20.x > leftSpace) {
  27129. context.moveTo(_item20.x, _item20.y);
  27130. startPoint = 1;
  27131. }
  27132. if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
  27133. context.lineTo(_item20.x, points[_j7 - 1].y);
  27134. context.lineTo(_item20.x, _item20.y);
  27135. }
  27136. }
  27137. ;
  27138. }
  27139. context.moveTo(points[0].x, points[0].y);
  27140. }
  27141. });
  27142. context.stroke();
  27143. context.setLineDash([]);
  27144. if (opts.dataPointShape !== false) {
  27145. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27146. }
  27147. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, lineOption);
  27148. });
  27149. if (opts.dataLabel !== false && process === 1) {
  27150. series.forEach(function (eachSeries, seriesIndex) {
  27151. var ranges, minRange, maxRange;
  27152. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27153. minRange = ranges.pop();
  27154. maxRange = ranges.shift();
  27155. var data = eachSeries.data;
  27156. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27157. drawPointText(points, eachSeries, config, context, opts);
  27158. });
  27159. }
  27160. context.restore();
  27161. return {
  27162. xAxisPoints: xAxisPoints,
  27163. calPoints: calPoints,
  27164. eachSpacing: eachSpacing
  27165. };
  27166. }
  27167. function drawMixDataPoints(series, opts, config, context) {
  27168. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27169. var xAxisData = opts.chartData.xAxisData,
  27170. xAxisPoints = xAxisData.xAxisPoints,
  27171. eachSpacing = xAxisData.eachSpacing;
  27172. var columnOption = assign({}, {
  27173. width: eachSpacing / 2,
  27174. barBorderCircle: false,
  27175. barBorderRadius: [],
  27176. seriesGap: 2,
  27177. linearType: 'none',
  27178. linearOpacity: 1,
  27179. customColor: [],
  27180. colorStop: 0
  27181. }, opts.extra.mix.column);
  27182. var areaOption = assign({}, {
  27183. opacity: 0.2,
  27184. gradient: false
  27185. }, opts.extra.mix.area);
  27186. var lineOption = assign({}, {
  27187. width: 2
  27188. }, opts.extra.mix.line);
  27189. var endY = opts.height - opts.area[2];
  27190. var calPoints = [];
  27191. var columnIndex = 0;
  27192. var columnLength = 0;
  27193. series.forEach(function (eachSeries, seriesIndex) {
  27194. if (eachSeries.type == 'column') {
  27195. columnLength += 1;
  27196. }
  27197. });
  27198. context.save();
  27199. var leftNum = -2;
  27200. var rightNum = xAxisPoints.length + 2;
  27201. var leftSpace = 0;
  27202. var rightSpace = opts.width + eachSpacing;
  27203. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27204. context.translate(opts._scrollDistance_, 0);
  27205. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  27206. rightNum = leftNum + opts.xAxis.itemCount + 4;
  27207. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27208. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27209. }
  27210. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  27211. series.forEach(function (eachSeries, seriesIndex) {
  27212. var ranges, minRange, maxRange;
  27213. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27214. minRange = ranges.pop();
  27215. maxRange = ranges.shift();
  27216. var data = eachSeries.data;
  27217. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27218. calPoints.push(points);
  27219. // 绘制柱状数据图
  27220. if (eachSeries.type == 'column') {
  27221. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27222. for (var i = 0; i < points.length; i++) {
  27223. var item = points[i];
  27224. if (item !== null && i > leftNum && i < rightNum) {
  27225. var startX = item.x - item.width / 2;
  27226. var height = opts.height - item.y - opts.area[2];
  27227. context.beginPath();
  27228. var fillColor = item.color || eachSeries.color;
  27229. var strokeColor = item.color || eachSeries.color;
  27230. if (columnOption.linearType !== 'none') {
  27231. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  27232. //透明渐变
  27233. if (columnOption.linearType == 'opacity') {
  27234. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  27235. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27236. } else {
  27237. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27238. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27239. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27240. }
  27241. fillColor = grd;
  27242. }
  27243. // 圆角边框
  27244. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
  27245. var left = startX;
  27246. var top = item.y;
  27247. var width = item.width;
  27248. var _height5 = opts.height - opts.area[2] - item.y;
  27249. if (columnOption.barBorderCircle) {
  27250. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  27251. }
  27252. var _columnOption$barBord4 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  27253. r0 = _columnOption$barBord4[0],
  27254. r1 = _columnOption$barBord4[1],
  27255. r2 = _columnOption$barBord4[2],
  27256. r3 = _columnOption$barBord4[3];
  27257. var minRadius = Math.min(width / 2, _height5 / 2);
  27258. r0 = r0 > minRadius ? minRadius : r0;
  27259. r1 = r1 > minRadius ? minRadius : r1;
  27260. r2 = r2 > minRadius ? minRadius : r2;
  27261. r3 = r3 > minRadius ? minRadius : r3;
  27262. r0 = r0 < 0 ? 0 : r0;
  27263. r1 = r1 < 0 ? 0 : r1;
  27264. r2 = r2 < 0 ? 0 : r2;
  27265. r3 = r3 < 0 ? 0 : r3;
  27266. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  27267. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  27268. context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
  27269. context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
  27270. } else {
  27271. context.moveTo(startX, item.y);
  27272. context.lineTo(startX + item.width, item.y);
  27273. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  27274. context.lineTo(startX, opts.height - opts.area[2]);
  27275. context.lineTo(startX, item.y);
  27276. context.setLineWidth(1);
  27277. context.setStrokeStyle(strokeColor);
  27278. }
  27279. context.setFillStyle(fillColor);
  27280. context.closePath();
  27281. context.fill();
  27282. }
  27283. }
  27284. columnIndex += 1;
  27285. }
  27286. //绘制区域图数据
  27287. if (eachSeries.type == 'area') {
  27288. var _splitPointList = splitPoints(points, eachSeries);
  27289. for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
  27290. var _points3 = _splitPointList[_i23];
  27291. // 绘制区域数据
  27292. context.beginPath();
  27293. context.setStrokeStyle(eachSeries.color);
  27294. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27295. if (areaOption.gradient) {
  27296. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  27297. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  27298. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  27299. context.setFillStyle(gradient);
  27300. } else {
  27301. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27302. }
  27303. context.setLineWidth(2 * opts.pix);
  27304. if (_points3.length > 1) {
  27305. var firstPoint = _points3[0];
  27306. var lastPoint = _points3[_points3.length - 1];
  27307. context.moveTo(firstPoint.x, firstPoint.y);
  27308. var startPoint = 0;
  27309. if (eachSeries.style === 'curve') {
  27310. for (var j = 0; j < _points3.length; j++) {
  27311. var _item21 = _points3[j];
  27312. if (startPoint == 0 && _item21.x > leftSpace) {
  27313. context.moveTo(_item21.x, _item21.y);
  27314. startPoint = 1;
  27315. }
  27316. if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
  27317. var ctrlPoint = createCurveControlPoints(_points3, j - 1);
  27318. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
  27319. }
  27320. }
  27321. ;
  27322. } else {
  27323. for (var _j8 = 0; _j8 < _points3.length; _j8++) {
  27324. var _item22 = _points3[_j8];
  27325. if (startPoint == 0 && _item22.x > leftSpace) {
  27326. context.moveTo(_item22.x, _item22.y);
  27327. startPoint = 1;
  27328. }
  27329. if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
  27330. context.lineTo(_item22.x, _item22.y);
  27331. }
  27332. }
  27333. ;
  27334. }
  27335. context.lineTo(lastPoint.x, endY);
  27336. context.lineTo(firstPoint.x, endY);
  27337. context.lineTo(firstPoint.x, firstPoint.y);
  27338. } else {
  27339. var _item23 = _points3[0];
  27340. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  27341. // context.lineTo(item.x + eachSpacing / 2, item.y);
  27342. // context.lineTo(item.x + eachSpacing / 2, endY);
  27343. // context.lineTo(item.x - eachSpacing / 2, endY);
  27344. // context.moveTo(item.x - eachSpacing / 2, item.y);
  27345. }
  27346. context.closePath();
  27347. context.fill();
  27348. }
  27349. }
  27350. // 绘制折线数据图
  27351. if (eachSeries.type == 'line') {
  27352. var splitPointList = splitPoints(points, eachSeries);
  27353. splitPointList.forEach(function (points, index) {
  27354. if (eachSeries.lineType == 'dash') {
  27355. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27356. dashLength *= opts.pix;
  27357. context.setLineDash([dashLength, dashLength]);
  27358. }
  27359. context.beginPath();
  27360. context.setStrokeStyle(eachSeries.color);
  27361. context.setLineWidth(lineOption.width * opts.pix);
  27362. if (points.length === 1) {
  27363. context.moveTo(points[0].x, points[0].y);
  27364. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27365. } else {
  27366. context.moveTo(points[0].x, points[0].y);
  27367. var _startPoint2 = 0;
  27368. if (eachSeries.style == 'curve') {
  27369. for (var _j9 = 0; _j9 < points.length; _j9++) {
  27370. var _item24 = points[_j9];
  27371. if (_startPoint2 == 0 && _item24.x > leftSpace) {
  27372. context.moveTo(_item24.x, _item24.y);
  27373. _startPoint2 = 1;
  27374. }
  27375. if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
  27376. var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
  27377. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item24.x, _item24.y);
  27378. }
  27379. }
  27380. } else {
  27381. for (var _j10 = 0; _j10 < points.length; _j10++) {
  27382. var _item25 = points[_j10];
  27383. if (_startPoint2 == 0 && _item25.x > leftSpace) {
  27384. context.moveTo(_item25.x, _item25.y);
  27385. _startPoint2 = 1;
  27386. }
  27387. if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
  27388. context.lineTo(_item25.x, _item25.y);
  27389. }
  27390. }
  27391. }
  27392. context.moveTo(points[0].x, points[0].y);
  27393. }
  27394. context.stroke();
  27395. context.setLineDash([]);
  27396. });
  27397. }
  27398. // 绘制点数据图
  27399. if (eachSeries.type == 'point') {
  27400. eachSeries.addPoint = true;
  27401. }
  27402. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  27403. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27404. }
  27405. });
  27406. if (opts.dataLabel !== false && process === 1) {
  27407. var columnIndex = 0;
  27408. series.forEach(function (eachSeries, seriesIndex) {
  27409. var ranges, minRange, maxRange;
  27410. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27411. minRange = ranges.pop();
  27412. maxRange = ranges.shift();
  27413. var data = eachSeries.data;
  27414. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27415. if (eachSeries.type !== 'column') {
  27416. drawPointText(points, eachSeries, config, context, opts);
  27417. } else {
  27418. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27419. drawPointText(points, eachSeries, config, context, opts);
  27420. columnIndex += 1;
  27421. }
  27422. });
  27423. }
  27424. context.restore();
  27425. return {
  27426. xAxisPoints: xAxisPoints,
  27427. calPoints: calPoints,
  27428. eachSpacing: eachSpacing
  27429. };
  27430. }
  27431. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  27432. var toolTipOption = opts.extra.tooltip || {};
  27433. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) {
  27434. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  27435. }
  27436. context.save();
  27437. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27438. context.translate(opts._scrollDistance_, 0);
  27439. }
  27440. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  27441. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  27442. }
  27443. context.restore();
  27444. }
  27445. function drawXAxis(categories, opts, config, context) {
  27446. var xAxisData = opts.chartData.xAxisData,
  27447. xAxisPoints = xAxisData.xAxisPoints,
  27448. startX = xAxisData.startX,
  27449. endX = xAxisData.endX,
  27450. eachSpacing = xAxisData.eachSpacing;
  27451. var boundaryGap = 'center';
  27452. if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  27453. boundaryGap = opts.xAxis.boundaryGap;
  27454. }
  27455. var startY = opts.height - opts.area[2];
  27456. var endY = opts.area[0];
  27457. //绘制滚动条
  27458. if (opts.enableScroll && opts.xAxis.scrollShow) {
  27459. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  27460. var scrollScreenWidth = endX - startX;
  27461. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  27462. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27463. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27464. scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
  27465. }
  27466. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  27467. var scrollLeft = 0;
  27468. if (opts._scrollDistance_) {
  27469. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  27470. }
  27471. context.beginPath();
  27472. context.setLineCap('round');
  27473. context.setLineWidth(6 * opts.pix);
  27474. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  27475. context.moveTo(startX, scrollY);
  27476. context.lineTo(endX, scrollY);
  27477. context.stroke();
  27478. context.closePath();
  27479. context.beginPath();
  27480. context.setLineCap('round');
  27481. context.setLineWidth(6 * opts.pix);
  27482. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  27483. context.moveTo(startX + scrollLeft, scrollY);
  27484. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  27485. context.stroke();
  27486. context.closePath();
  27487. context.setLineCap('butt');
  27488. }
  27489. context.save();
  27490. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27491. context.translate(opts._scrollDistance_, 0);
  27492. }
  27493. //绘制X轴刻度线
  27494. if (opts.xAxis.calibration === true) {
  27495. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27496. context.setLineCap('butt');
  27497. context.setLineWidth(1 * opts.pix);
  27498. xAxisPoints.forEach(function (item, index) {
  27499. if (index > 0) {
  27500. context.beginPath();
  27501. context.moveTo(item - eachSpacing / 2, startY);
  27502. context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
  27503. context.closePath();
  27504. context.stroke();
  27505. }
  27506. });
  27507. }
  27508. //绘制X轴网格
  27509. if (opts.xAxis.disableGrid !== true) {
  27510. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27511. context.setLineCap('butt');
  27512. context.setLineWidth(1 * opts.pix);
  27513. if (opts.xAxis.gridType == 'dash') {
  27514. context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
  27515. }
  27516. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  27517. xAxisPoints.forEach(function (item, index) {
  27518. if (index % opts.xAxis.gridEval == 0) {
  27519. context.beginPath();
  27520. context.moveTo(item, startY);
  27521. context.lineTo(item, endY);
  27522. context.stroke();
  27523. }
  27524. });
  27525. context.setLineDash([]);
  27526. }
  27527. //绘制X轴文案
  27528. if (opts.xAxis.disabled !== true) {
  27529. // 对X轴列表做抽稀处理
  27530. //默认全部显示X轴标签
  27531. var maxXAxisListLength = categories.length;
  27532. //如果设置了X轴单屏数量
  27533. if (opts.xAxis.labelCount) {
  27534. //如果设置X轴密度
  27535. if (opts.xAxis.itemCount) {
  27536. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  27537. } else {
  27538. maxXAxisListLength = opts.xAxis.labelCount;
  27539. }
  27540. maxXAxisListLength -= 1;
  27541. }
  27542. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  27543. var newCategories = [];
  27544. var cgLength = categories.length;
  27545. for (var i = 0; i < cgLength; i++) {
  27546. if (i % ratio !== 0) {
  27547. newCategories.push("");
  27548. } else {
  27549. newCategories.push(categories[i]);
  27550. }
  27551. }
  27552. newCategories[cgLength - 1] = categories[cgLength - 1];
  27553. var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  27554. if (config._xAxisTextAngle_ === 0) {
  27555. newCategories.forEach(function (item, index) {
  27556. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  27557. var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
  27558. if (boundaryGap == 'center') {
  27559. offset += eachSpacing / 2;
  27560. }
  27561. var scrollHeight = 0;
  27562. if (opts.xAxis.scrollShow) {
  27563. scrollHeight = 6 * opts.pix;
  27564. }
  27565. // 如果在主视图区域内
  27566. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27567. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27568. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27569. context.beginPath();
  27570. context.setFontSize(xAxisFontSize);
  27571. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27572. context.fillText(String(xitem), xAxisPoints[index] + offset, startY + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.fontSize) * opts.pix / 2 + opts.xAxis.fontSize * opts.pix);
  27573. context.closePath();
  27574. context.stroke();
  27575. }
  27576. });
  27577. } else {
  27578. newCategories.forEach(function (item, index) {
  27579. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
  27580. // 如果在主视图区域内
  27581. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27582. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27583. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27584. context.save();
  27585. context.beginPath();
  27586. context.setFontSize(xAxisFontSize);
  27587. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27588. var textWidth = measureText(String(xitem), xAxisFontSize, context);
  27589. var offsetX = xAxisPoints[index];
  27590. if (boundaryGap == 'center') {
  27591. offsetX = xAxisPoints[index] + eachSpacing / 2;
  27592. }
  27593. var scrollHeight = 0;
  27594. if (opts.xAxis.scrollShow) {
  27595. scrollHeight = 6 * opts.pix;
  27596. }
  27597. var offsetY = startY + opts.xAxis.marginTop * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
  27598. if (opts.xAxis.rotateAngle < 0) {
  27599. offsetX -= xAxisFontSize / 2;
  27600. textWidth = 0;
  27601. } else {
  27602. offsetX += xAxisFontSize / 2;
  27603. textWidth = -textWidth;
  27604. }
  27605. context.translate(offsetX, offsetY);
  27606. context.rotate(-1 * config._xAxisTextAngle_);
  27607. context.fillText(String(xitem), textWidth, 0);
  27608. context.closePath();
  27609. context.stroke();
  27610. context.restore();
  27611. }
  27612. });
  27613. }
  27614. }
  27615. context.restore();
  27616. //画X轴标题
  27617. if (opts.xAxis.title) {
  27618. context.beginPath();
  27619. context.setFontSize(opts.xAxis.titleFontSize * opts.pix);
  27620. context.setFillStyle(opts.xAxis.titleFontColor);
  27621. context.fillText(String(opts.xAxis.title), opts.width - opts.area[1] + opts.xAxis.titleOffsetX * opts.pix, opts.height - opts.area[2] + opts.xAxis.marginTop * opts.pix + (opts.xAxis.lineHeight - opts.xAxis.titleFontSize) * opts.pix / 2 + (opts.xAxis.titleFontSize + opts.xAxis.titleOffsetY) * opts.pix);
  27622. context.closePath();
  27623. context.stroke();
  27624. }
  27625. //绘制X轴轴线
  27626. if (opts.xAxis.axisLine) {
  27627. context.beginPath();
  27628. context.setStrokeStyle(opts.xAxis.axisLineColor);
  27629. context.setLineWidth(1 * opts.pix);
  27630. context.moveTo(startX, opts.height - opts.area[2]);
  27631. context.lineTo(endX, opts.height - opts.area[2]);
  27632. context.stroke();
  27633. }
  27634. }
  27635. function drawYAxisGrid(categories, opts, config, context) {
  27636. if (opts.yAxis.disableGrid === true) {
  27637. return;
  27638. }
  27639. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27640. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27641. var startX = opts.area[3];
  27642. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  27643. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  27644. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  27645. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27646. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27647. TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
  27648. }
  27649. var endX = startX + TotalWidth;
  27650. var points = [];
  27651. var startY = 1;
  27652. if (opts.xAxis.axisLine === false) {
  27653. startY = 0;
  27654. }
  27655. for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
  27656. points.push(opts.height - opts.area[2] - eachSpacing * i);
  27657. }
  27658. context.save();
  27659. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27660. context.translate(opts._scrollDistance_, 0);
  27661. }
  27662. if (opts.yAxis.gridType == 'dash') {
  27663. context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
  27664. }
  27665. context.setStrokeStyle(opts.yAxis.gridColor);
  27666. context.setLineWidth(1 * opts.pix);
  27667. points.forEach(function (item, index) {
  27668. context.beginPath();
  27669. context.moveTo(startX, item);
  27670. context.lineTo(endX, item);
  27671. context.stroke();
  27672. });
  27673. context.setLineDash([]);
  27674. context.restore();
  27675. }
  27676. function drawYAxis(series, opts, config, context) {
  27677. if (opts.yAxis.disabled === true) {
  27678. return;
  27679. }
  27680. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27681. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27682. var startX = opts.area[3];
  27683. var endX = opts.width - opts.area[1];
  27684. var endY = opts.height - opts.area[2];
  27685. // set YAxis background
  27686. context.beginPath();
  27687. context.setFillStyle(opts.background);
  27688. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
  27689. context.fillRect(0, 0, startX, endY + 2 * opts.pix);
  27690. }
  27691. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
  27692. context.fillRect(endX, 0, opts.width, endY + 2 * opts.pix);
  27693. }
  27694. context.closePath();
  27695. context.stroke();
  27696. var tStartLeft = opts.area[3];
  27697. var tStartRight = opts.width - opts.area[1];
  27698. var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
  27699. if (opts.yAxis.data) {
  27700. var _loop4 = function _loop4(i) {
  27701. var yData = opts.yAxis.data[i];
  27702. points = [];
  27703. if (yData.type === 'categories') {
  27704. for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
  27705. points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
  27706. }
  27707. } else {
  27708. for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
  27709. points.push(opts.area[0] + eachSpacing * _i25);
  27710. }
  27711. }
  27712. if (yData.disabled !== true) {
  27713. var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
  27714. var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
  27715. var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
  27716. var textAlign = yData.textAlign || "right";
  27717. //画Y轴刻度及文案
  27718. rangesFormat.forEach(function (item, index) {
  27719. var pos = points[index];
  27720. context.beginPath();
  27721. context.setFontSize(yAxisFontSize);
  27722. context.setLineWidth(1 * opts.pix);
  27723. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27724. context.setFillStyle(yData.fontColor || opts.fontColor);
  27725. var tmpstrat = 0;
  27726. var gapwidth = 4 * opts.pix;
  27727. if (yAxisWidth.position == 'left') {
  27728. //画刻度线
  27729. if (yData.calibration == true) {
  27730. context.moveTo(tStartLeft, pos);
  27731. context.lineTo(tStartLeft - 3 * opts.pix, pos);
  27732. gapwidth += 3 * opts.pix;
  27733. }
  27734. //画文字
  27735. switch (textAlign) {
  27736. case "left":
  27737. context.setTextAlign('left');
  27738. tmpstrat = tStartLeft - yAxisWidth.width;
  27739. break;
  27740. case "right":
  27741. context.setTextAlign('right');
  27742. tmpstrat = tStartLeft - gapwidth;
  27743. break;
  27744. default:
  27745. context.setTextAlign('center');
  27746. tmpstrat = tStartLeft - yAxisWidth.width / 2;
  27747. }
  27748. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27749. } else if (yAxisWidth.position == 'right') {
  27750. //画刻度线
  27751. if (yData.calibration == true) {
  27752. context.moveTo(tStartRight, pos);
  27753. context.lineTo(tStartRight + 3 * opts.pix, pos);
  27754. gapwidth += 3 * opts.pix;
  27755. }
  27756. switch (textAlign) {
  27757. case "left":
  27758. context.setTextAlign('left');
  27759. tmpstrat = tStartRight + gapwidth;
  27760. break;
  27761. case "right":
  27762. context.setTextAlign('right');
  27763. tmpstrat = tStartRight + yAxisWidth.width;
  27764. break;
  27765. default:
  27766. context.setTextAlign('center');
  27767. tmpstrat = tStartRight + yAxisWidth.width / 2;
  27768. }
  27769. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27770. } else if (yAxisWidth.position == 'center') {
  27771. //画刻度线
  27772. if (yData.calibration == true) {
  27773. context.moveTo(tStartCenter, pos);
  27774. context.lineTo(tStartCenter - 3 * opts.pix, pos);
  27775. gapwidth += 3 * opts.pix;
  27776. }
  27777. //画文字
  27778. switch (textAlign) {
  27779. case "left":
  27780. context.setTextAlign('left');
  27781. tmpstrat = tStartCenter - yAxisWidth.width;
  27782. break;
  27783. case "right":
  27784. context.setTextAlign('right');
  27785. tmpstrat = tStartCenter - gapwidth;
  27786. break;
  27787. default:
  27788. context.setTextAlign('center');
  27789. tmpstrat = tStartCenter - yAxisWidth.width / 2;
  27790. }
  27791. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27792. }
  27793. context.closePath();
  27794. context.stroke();
  27795. context.setTextAlign('left');
  27796. });
  27797. //画Y轴轴线
  27798. if (yData.axisLine !== false) {
  27799. context.beginPath();
  27800. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27801. context.setLineWidth(1 * opts.pix);
  27802. if (yAxisWidth.position == 'left') {
  27803. context.moveTo(tStartLeft, opts.height - opts.area[2]);
  27804. context.lineTo(tStartLeft, opts.area[0]);
  27805. } else if (yAxisWidth.position == 'right') {
  27806. context.moveTo(tStartRight, opts.height - opts.area[2]);
  27807. context.lineTo(tStartRight, opts.area[0]);
  27808. } else if (yAxisWidth.position == 'center') {
  27809. context.moveTo(tStartCenter, opts.height - opts.area[2]);
  27810. context.lineTo(tStartCenter, opts.area[0]);
  27811. }
  27812. context.stroke();
  27813. }
  27814. //画Y轴标题
  27815. if (opts.yAxis.showTitle) {
  27816. var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
  27817. var title = yData.title;
  27818. context.beginPath();
  27819. context.setFontSize(titleFontSize);
  27820. context.setFillStyle(yData.titleFontColor || opts.fontColor);
  27821. if (yAxisWidth.position == 'left') {
  27822. context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27823. } else if (yAxisWidth.position == 'right') {
  27824. context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27825. } else if (yAxisWidth.position == 'center') {
  27826. context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27827. }
  27828. context.closePath();
  27829. context.stroke();
  27830. }
  27831. if (yAxisWidth.position == 'left') {
  27832. tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27833. } else {
  27834. tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27835. }
  27836. }
  27837. };
  27838. for (var i = 0; i < opts.yAxis.data.length; i++) {
  27839. var points;
  27840. _loop4(i);
  27841. }
  27842. }
  27843. }
  27844. function drawLegend(series, opts, config, context, chartData) {
  27845. if (opts.legend.show === false) {
  27846. return;
  27847. }
  27848. var legendData = chartData.legendData;
  27849. var legendList = legendData.points;
  27850. var legendArea = legendData.area;
  27851. var padding = opts.legend.padding * opts.pix;
  27852. var fontSize = opts.legend.fontSize * opts.pix;
  27853. var shapeWidth = 15 * opts.pix;
  27854. var shapeRight = 5 * opts.pix;
  27855. var itemGap = opts.legend.itemGap * opts.pix;
  27856. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  27857. //画背景及边框
  27858. context.beginPath();
  27859. context.setLineWidth(opts.legend.borderWidth * opts.pix);
  27860. context.setStrokeStyle(opts.legend.borderColor);
  27861. context.setFillStyle(opts.legend.backgroundColor);
  27862. context.moveTo(legendArea.start.x, legendArea.start.y);
  27863. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  27864. context.closePath();
  27865. context.fill();
  27866. context.stroke();
  27867. legendList.forEach(function (itemList, listIndex) {
  27868. var width = 0;
  27869. var height = 0;
  27870. width = legendData.widthArr[listIndex];
  27871. height = legendData.heightArr[listIndex];
  27872. var startX = 0;
  27873. var startY = 0;
  27874. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  27875. switch (opts.legend.float) {
  27876. case 'left':
  27877. startX = legendArea.start.x + padding;
  27878. break;
  27879. case 'right':
  27880. startX = legendArea.start.x + legendArea.width - width;
  27881. break;
  27882. default:
  27883. startX = legendArea.start.x + (legendArea.width - width) / 2;
  27884. }
  27885. startY = legendArea.start.y + padding + listIndex * lineHeight;
  27886. } else {
  27887. if (listIndex == 0) {
  27888. width = 0;
  27889. } else {
  27890. width = legendData.widthArr[listIndex - 1];
  27891. }
  27892. startX = legendArea.start.x + padding + width;
  27893. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  27894. }
  27895. context.setFontSize(config.fontSize);
  27896. for (var i = 0; i < itemList.length; i++) {
  27897. var item = itemList[i];
  27898. item.area = [0, 0, 0, 0];
  27899. item.area[0] = startX;
  27900. item.area[1] = startY;
  27901. item.area[3] = startY + lineHeight;
  27902. context.beginPath();
  27903. context.setLineWidth(1 * opts.pix);
  27904. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  27905. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  27906. switch (item.legendShape) {
  27907. case 'line':
  27908. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
  27909. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
  27910. break;
  27911. case 'triangle':
  27912. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27913. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27914. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27915. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27916. break;
  27917. case 'diamond':
  27918. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27919. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
  27920. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27921. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
  27922. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27923. break;
  27924. case 'circle':
  27925. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
  27926. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
  27927. break;
  27928. case 'rect':
  27929. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  27930. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  27931. break;
  27932. case 'square':
  27933. context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27934. context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  27935. break;
  27936. case 'none':
  27937. break;
  27938. default:
  27939. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  27940. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  27941. }
  27942. context.closePath();
  27943. context.fill();
  27944. context.stroke();
  27945. startX += shapeWidth + shapeRight;
  27946. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  27947. var legendText = item.legendText ? item.legendText : item.name;
  27948. context.beginPath();
  27949. context.setFontSize(fontSize);
  27950. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  27951. context.fillText(legendText, startX, startY + fontTrans);
  27952. context.closePath();
  27953. context.stroke();
  27954. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  27955. startX += measureText(legendText, fontSize, context) + itemGap;
  27956. item.area[2] = startX;
  27957. } else {
  27958. item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;
  27959. ;
  27960. startX -= shapeWidth + shapeRight;
  27961. startY += lineHeight;
  27962. }
  27963. }
  27964. });
  27965. }
  27966. function drawPieDataPoints(series, opts, config, context) {
  27967. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27968. var pieOption = assign({}, {
  27969. activeOpacity: 0.5,
  27970. activeRadius: 10,
  27971. offsetAngle: 0,
  27972. labelWidth: 15,
  27973. ringWidth: 30,
  27974. customRadius: 0,
  27975. border: false,
  27976. borderWidth: 2,
  27977. borderColor: '#FFFFFF',
  27978. centerColor: '#FFFFFF',
  27979. linearType: 'none',
  27980. customColor: []
  27981. }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
  27982. var centerPosition = {
  27983. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  27984. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  27985. };
  27986. if (config.pieChartLinePadding == 0) {
  27987. config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
  27988. }
  27989. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  27990. radius = radius < 10 ? 10 : radius;
  27991. if (pieOption.customRadius > 0) {
  27992. radius = pieOption.customRadius * opts.pix;
  27993. }
  27994. series = getPieDataPoints(series, radius, process);
  27995. var activeRadius = pieOption.activeRadius * opts.pix;
  27996. pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
  27997. series = series.map(function (eachSeries) {
  27998. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  27999. return eachSeries;
  28000. });
  28001. series.forEach(function (eachSeries, seriesIndex) {
  28002. if (opts.tooltip) {
  28003. if (opts.tooltip.index == seriesIndex) {
  28004. context.beginPath();
  28005. context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
  28006. context.moveTo(centerPosition.x, centerPosition.y);
  28007. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28008. context.closePath();
  28009. context.fill();
  28010. }
  28011. }
  28012. context.beginPath();
  28013. context.setLineWidth(pieOption.borderWidth * opts.pix);
  28014. context.lineJoin = "round";
  28015. context.setStrokeStyle(pieOption.borderColor);
  28016. var fillcolor = eachSeries.color;
  28017. if (pieOption.linearType == 'custom') {
  28018. var grd;
  28019. if (context.createCircularGradient) {
  28020. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28021. } else {
  28022. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28023. }
  28024. grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
  28025. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28026. fillcolor = grd;
  28027. }
  28028. context.setFillStyle(fillcolor);
  28029. context.moveTo(centerPosition.x, centerPosition.y);
  28030. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28031. context.closePath();
  28032. context.fill();
  28033. if (pieOption.border == true) {
  28034. context.stroke();
  28035. }
  28036. });
  28037. if (opts.type === 'ring') {
  28038. var innerPieWidth = radius * 0.6;
  28039. if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
  28040. innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
  28041. }
  28042. context.beginPath();
  28043. context.setFillStyle(pieOption.centerColor);
  28044. context.moveTo(centerPosition.x, centerPosition.y);
  28045. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  28046. context.closePath();
  28047. context.fill();
  28048. }
  28049. if (opts.dataLabel !== false && process === 1) {
  28050. drawPieText(series, opts, config, context, radius, centerPosition);
  28051. }
  28052. if (process === 1 && opts.type === 'ring') {
  28053. drawRingTitle(opts, config, context, centerPosition);
  28054. }
  28055. return {
  28056. center: centerPosition,
  28057. radius: radius,
  28058. series: series
  28059. };
  28060. }
  28061. function drawRoseDataPoints(series, opts, config, context) {
  28062. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28063. var roseOption = assign({}, {
  28064. type: 'area',
  28065. activeOpacity: 0.5,
  28066. activeRadius: 10,
  28067. offsetAngle: 0,
  28068. labelWidth: 15,
  28069. border: false,
  28070. borderWidth: 2,
  28071. borderColor: '#FFFFFF',
  28072. linearType: 'none',
  28073. customColor: []
  28074. }, opts.extra.rose);
  28075. if (config.pieChartLinePadding == 0) {
  28076. config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
  28077. }
  28078. var centerPosition = {
  28079. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28080. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28081. };
  28082. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config.pieChartLinePadding - config.pieChartTextPadding);
  28083. radius = radius < 10 ? 10 : radius;
  28084. var minRadius = roseOption.minRadius || radius * 0.5;
  28085. if (radius < minRadius) {
  28086. radius = minRadius + 10;
  28087. }
  28088. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  28089. var activeRadius = roseOption.activeRadius * opts.pix;
  28090. roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
  28091. series = series.map(function (eachSeries) {
  28092. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  28093. return eachSeries;
  28094. });
  28095. series.forEach(function (eachSeries, seriesIndex) {
  28096. if (opts.tooltip) {
  28097. if (opts.tooltip.index == seriesIndex) {
  28098. context.beginPath();
  28099. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  28100. context.moveTo(centerPosition.x, centerPosition.y);
  28101. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28102. context.closePath();
  28103. context.fill();
  28104. }
  28105. }
  28106. context.beginPath();
  28107. context.setLineWidth(roseOption.borderWidth * opts.pix);
  28108. context.lineJoin = "round";
  28109. context.setStrokeStyle(roseOption.borderColor);
  28110. var fillcolor = eachSeries.color;
  28111. if (roseOption.linearType == 'custom') {
  28112. var grd;
  28113. if (context.createCircularGradient) {
  28114. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28115. } else {
  28116. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28117. }
  28118. grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
  28119. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28120. fillcolor = grd;
  28121. }
  28122. context.setFillStyle(fillcolor);
  28123. context.moveTo(centerPosition.x, centerPosition.y);
  28124. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28125. context.closePath();
  28126. context.fill();
  28127. if (roseOption.border == true) {
  28128. context.stroke();
  28129. }
  28130. });
  28131. if (opts.dataLabel !== false && process === 1) {
  28132. drawPieText(series, opts, config, context, radius, centerPosition);
  28133. }
  28134. return {
  28135. center: centerPosition,
  28136. radius: radius,
  28137. series: series
  28138. };
  28139. }
  28140. function drawArcbarDataPoints(series, opts, config, context) {
  28141. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28142. var arcbarOption = assign({}, {
  28143. startAngle: 0.75,
  28144. endAngle: 0.25,
  28145. type: 'default',
  28146. direction: 'cw',
  28147. lineCap: 'round',
  28148. width: 12,
  28149. gap: 2,
  28150. linearType: 'none',
  28151. customColor: []
  28152. }, opts.extra.arcbar);
  28153. series = getArcbarDataPoints(series, arcbarOption, process);
  28154. var centerPosition;
  28155. if (arcbarOption.centerX || arcbarOption.centerY) {
  28156. centerPosition = {
  28157. x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
  28158. y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2
  28159. };
  28160. } else {
  28161. centerPosition = {
  28162. x: opts.width / 2,
  28163. y: opts.height / 2
  28164. };
  28165. }
  28166. var radius;
  28167. if (arcbarOption.radius) {
  28168. radius = arcbarOption.radius;
  28169. } else {
  28170. radius = Math.min(centerPosition.x, centerPosition.y);
  28171. radius -= 5 * opts.pix;
  28172. radius -= arcbarOption.width / 2;
  28173. }
  28174. radius = radius < 10 ? 10 : radius;
  28175. arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
  28176. for (var i = 0; i < series.length; i++) {
  28177. var eachSeries = series[i];
  28178. //背景颜色
  28179. context.setLineWidth(arcbarOption.width * opts.pix);
  28180. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  28181. context.setLineCap(arcbarOption.lineCap);
  28182. context.beginPath();
  28183. if (arcbarOption.type == 'default') {
  28184. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, arcbarOption.direction == 'ccw');
  28185. } else {
  28186. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, arcbarOption.direction == 'ccw');
  28187. }
  28188. context.stroke();
  28189. //进度条
  28190. var fillColor = eachSeries.color;
  28191. if (arcbarOption.linearType == 'custom') {
  28192. var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
  28193. grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
  28194. grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
  28195. fillColor = grd;
  28196. }
  28197. context.setLineWidth(arcbarOption.width * opts.pix);
  28198. context.setStrokeStyle(fillColor);
  28199. context.setLineCap(arcbarOption.lineCap);
  28200. context.beginPath();
  28201. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, arcbarOption.direction == 'ccw');
  28202. context.stroke();
  28203. }
  28204. drawRingTitle(opts, config, context, centerPosition);
  28205. return {
  28206. center: centerPosition,
  28207. radius: radius,
  28208. series: series
  28209. };
  28210. }
  28211. function drawGaugeDataPoints(categories, series, opts, config, context) {
  28212. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  28213. var gaugeOption = assign({}, {
  28214. type: 'default',
  28215. startAngle: 0.75,
  28216. endAngle: 0.25,
  28217. width: 15,
  28218. labelOffset: 13,
  28219. splitLine: {
  28220. fixRadius: 0,
  28221. splitNumber: 10,
  28222. width: 15,
  28223. color: '#FFFFFF',
  28224. childNumber: 5,
  28225. childWidth: 5
  28226. },
  28227. pointer: {
  28228. width: 15,
  28229. color: 'auto'
  28230. }
  28231. }, opts.extra.gauge);
  28232. if (gaugeOption.oldAngle == undefined) {
  28233. gaugeOption.oldAngle = gaugeOption.startAngle;
  28234. }
  28235. if (gaugeOption.oldData == undefined) {
  28236. gaugeOption.oldData = 0;
  28237. }
  28238. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  28239. var centerPosition = {
  28240. x: opts.width / 2,
  28241. y: opts.height / 2
  28242. };
  28243. var radius = Math.min(centerPosition.x, centerPosition.y);
  28244. radius -= 5 * opts.pix;
  28245. radius -= gaugeOption.width / 2;
  28246. radius = radius < 10 ? 10 : radius;
  28247. var innerRadius = radius - gaugeOption.width;
  28248. var totalAngle = 0;
  28249. //判断仪表盘的样式:default百度样式,progress新样式
  28250. if (gaugeOption.type == 'progress') {
  28251. //## 第一步画中心圆形背景和进度条背景
  28252. //中心圆形背景
  28253. var pieRadius = radius - gaugeOption.width * 3;
  28254. context.beginPath();
  28255. var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
  28256. //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
  28257. gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
  28258. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  28259. context.setFillStyle(gradient);
  28260. context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
  28261. context.fill();
  28262. //画进度条背景
  28263. context.setLineWidth(gaugeOption.width);
  28264. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28265. context.setLineCap('round');
  28266. context.beginPath();
  28267. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
  28268. context.stroke();
  28269. //## 第二步画刻度线
  28270. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28271. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28272. } else {
  28273. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28274. }
  28275. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28276. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28277. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28278. var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28279. context.save();
  28280. context.translate(centerPosition.x, centerPosition.y);
  28281. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28282. var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
  28283. var proc = series[0].data * process;
  28284. for (var i = 0; i < len; i++) {
  28285. context.beginPath();
  28286. //刻度线随进度变色
  28287. if (proc > i / len) {
  28288. context.setStrokeStyle(hexToRgb(series[0].color, 1));
  28289. } else {
  28290. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28291. }
  28292. context.setLineWidth(3 * opts.pix);
  28293. context.moveTo(startX, 0);
  28294. context.lineTo(endX, 0);
  28295. context.stroke();
  28296. context.rotate(childAngle * Math.PI);
  28297. }
  28298. context.restore();
  28299. //## 第三步画进度条
  28300. series = getGaugeArcbarDataPoints(series, gaugeOption, process);
  28301. context.setLineWidth(gaugeOption.width);
  28302. context.setStrokeStyle(series[0].color);
  28303. context.setLineCap('round');
  28304. context.beginPath();
  28305. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
  28306. context.stroke();
  28307. //## 第四步画指针
  28308. var pointerRadius = radius - gaugeOption.width * 2.5;
  28309. context.save();
  28310. context.translate(centerPosition.x, centerPosition.y);
  28311. context.rotate((series[0]._proportion_ - 1) * Math.PI);
  28312. context.beginPath();
  28313. context.setLineWidth(gaugeOption.width / 3);
  28314. var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
  28315. gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
  28316. gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
  28317. gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
  28318. context.setStrokeStyle(gradient3);
  28319. context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
  28320. context.stroke();
  28321. context.beginPath();
  28322. context.setLineWidth(1);
  28323. context.setStrokeStyle(series[0].color);
  28324. context.setFillStyle(series[0].color);
  28325. context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28326. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
  28327. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
  28328. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28329. context.stroke();
  28330. context.fill();
  28331. context.restore();
  28332. //default百度样式
  28333. } else {
  28334. //画背景
  28335. context.setLineWidth(gaugeOption.width);
  28336. context.setLineCap('butt');
  28337. for (var _i26 = 0; _i26 < categories.length; _i26++) {
  28338. var eachCategories = categories[_i26];
  28339. context.beginPath();
  28340. context.setStrokeStyle(eachCategories.color);
  28341. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
  28342. context.stroke();
  28343. }
  28344. context.save();
  28345. //画刻度线
  28346. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28347. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28348. } else {
  28349. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28350. }
  28351. var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28352. var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28353. var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28354. var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28355. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  28356. context.translate(centerPosition.x, centerPosition.y);
  28357. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28358. for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
  28359. context.beginPath();
  28360. context.setStrokeStyle(gaugeOption.splitLine.color);
  28361. context.setLineWidth(2 * opts.pix);
  28362. context.moveTo(_startX2, 0);
  28363. context.lineTo(_endX, 0);
  28364. context.stroke();
  28365. context.rotate(_splitAngle * Math.PI);
  28366. }
  28367. context.restore();
  28368. context.save();
  28369. context.translate(centerPosition.x, centerPosition.y);
  28370. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28371. for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
  28372. context.beginPath();
  28373. context.setStrokeStyle(gaugeOption.splitLine.color);
  28374. context.setLineWidth(1 * opts.pix);
  28375. context.moveTo(_startX2, 0);
  28376. context.lineTo(childendX, 0);
  28377. context.stroke();
  28378. context.rotate(_childAngle * Math.PI);
  28379. }
  28380. context.restore();
  28381. //画指针
  28382. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  28383. for (var _i29 = 0; _i29 < series.length; _i29++) {
  28384. var eachSeries = series[_i29];
  28385. context.save();
  28386. context.translate(centerPosition.x, centerPosition.y);
  28387. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  28388. context.beginPath();
  28389. context.setFillStyle(eachSeries.color);
  28390. context.moveTo(gaugeOption.pointer.width, 0);
  28391. context.lineTo(0, -gaugeOption.pointer.width / 2);
  28392. context.lineTo(-innerRadius, 0);
  28393. context.lineTo(0, gaugeOption.pointer.width / 2);
  28394. context.lineTo(gaugeOption.pointer.width, 0);
  28395. context.closePath();
  28396. context.fill();
  28397. context.beginPath();
  28398. context.setFillStyle('#FFFFFF');
  28399. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  28400. context.fill();
  28401. context.restore();
  28402. }
  28403. if (opts.dataLabel !== false) {
  28404. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  28405. }
  28406. }
  28407. //画仪表盘标题,副标题
  28408. drawRingTitle(opts, config, context, centerPosition);
  28409. if (process === 1 && opts.type === 'gauge') {
  28410. opts.extra.gauge.oldAngle = series[0]._proportion_;
  28411. opts.extra.gauge.oldData = series[0].data;
  28412. }
  28413. return {
  28414. center: centerPosition,
  28415. radius: radius,
  28416. innerRadius: innerRadius,
  28417. categories: categories,
  28418. totalAngle: totalAngle
  28419. };
  28420. }
  28421. function drawRadarDataPoints(series, opts, config, context) {
  28422. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28423. var radarOption = assign({}, {
  28424. gridColor: '#cccccc',
  28425. gridType: 'radar',
  28426. gridEval: 1,
  28427. axisLabel: false,
  28428. axisLabelTofix: 0,
  28429. labelShow: true,
  28430. labelColor: '#666666',
  28431. labelPointShow: false,
  28432. labelPointRadius: 3,
  28433. labelPointColor: '#cccccc',
  28434. opacity: 0.2,
  28435. gridCount: 3,
  28436. border: false,
  28437. borderWidth: 2,
  28438. linearType: 'none',
  28439. customColor: []
  28440. }, opts.extra.radar);
  28441. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  28442. var centerPosition = {
  28443. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28444. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28445. };
  28446. var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
  28447. var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
  28448. var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
  28449. radius -= config.radarLabelTextMargin * opts.pix;
  28450. radius = radius < 10 ? 10 : radius;
  28451. radius = radarOption.radius ? radarOption.radius : radius;
  28452. // 画分割线
  28453. context.beginPath();
  28454. context.setLineWidth(1 * opts.pix);
  28455. context.setStrokeStyle(radarOption.gridColor);
  28456. coordinateAngle.forEach(function (angle, index) {
  28457. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  28458. context.moveTo(centerPosition.x, centerPosition.y);
  28459. if (index % radarOption.gridEval == 0) {
  28460. context.lineTo(pos.x, pos.y);
  28461. }
  28462. });
  28463. context.stroke();
  28464. context.closePath();
  28465. // 画背景网格
  28466. var _loop = function _loop(i) {
  28467. var startPos = {};
  28468. context.beginPath();
  28469. context.setLineWidth(1 * opts.pix);
  28470. context.setStrokeStyle(radarOption.gridColor);
  28471. if (radarOption.gridType == 'radar') {
  28472. coordinateAngle.forEach(function (angle, index) {
  28473. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
  28474. if (index === 0) {
  28475. startPos = pos;
  28476. context.moveTo(pos.x, pos.y);
  28477. } else {
  28478. context.lineTo(pos.x, pos.y);
  28479. }
  28480. });
  28481. context.lineTo(startPos.x, startPos.y);
  28482. } else {
  28483. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
  28484. context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
  28485. }
  28486. context.stroke();
  28487. context.closePath();
  28488. };
  28489. for (var i = 1; i <= radarOption.gridCount; i++) {
  28490. _loop(i);
  28491. }
  28492. radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
  28493. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  28494. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28495. // 绘制区域数据
  28496. context.beginPath();
  28497. context.setLineWidth(radarOption.borderWidth * opts.pix);
  28498. context.setStrokeStyle(eachSeries.color);
  28499. var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
  28500. if (radarOption.linearType == 'custom') {
  28501. var grd;
  28502. if (context.createCircularGradient) {
  28503. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
  28504. } else {
  28505. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
  28506. }
  28507. grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
  28508. grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
  28509. fillcolor = grd;
  28510. }
  28511. context.setFillStyle(fillcolor);
  28512. eachSeries.data.forEach(function (item, index) {
  28513. if (index === 0) {
  28514. context.moveTo(item.position.x, item.position.y);
  28515. } else {
  28516. context.lineTo(item.position.x, item.position.y);
  28517. }
  28518. });
  28519. context.closePath();
  28520. context.fill();
  28521. if (radarOption.border === true) {
  28522. context.stroke();
  28523. }
  28524. context.closePath();
  28525. if (opts.dataPointShape !== false) {
  28526. var points = eachSeries.data.map(function (item) {
  28527. return item.position;
  28528. });
  28529. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  28530. }
  28531. });
  28532. // 画刻度值
  28533. if (radarOption.axisLabel === true) {
  28534. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  28535. var stepLength = radius / radarOption.gridCount;
  28536. var fontSize = opts.fontSize * opts.pix;
  28537. context.setFontSize(fontSize);
  28538. context.setFillStyle(opts.fontColor);
  28539. context.setTextAlign('left');
  28540. for (var i = 0; i < radarOption.gridCount + 1; i++) {
  28541. var label = i * maxData / radarOption.gridCount;
  28542. label = label.toFixed(radarOption.axisLabelTofix);
  28543. context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
  28544. }
  28545. }
  28546. // draw label text
  28547. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  28548. // draw dataLabel
  28549. if (opts.dataLabel !== false && process === 1) {
  28550. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28551. context.beginPath();
  28552. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  28553. context.setFontSize(fontSize);
  28554. context.setFillStyle(eachSeries.textColor || opts.fontColor);
  28555. eachSeries.data.forEach(function (item, index) {
  28556. //如果是中心点垂直的上下点位
  28557. if (Math.abs(item.position.x - centerPosition.x) < 2) {
  28558. //如果在上面
  28559. if (item.position.y < centerPosition.y) {
  28560. context.setTextAlign('center');
  28561. context.fillText(item.value, item.position.x, item.position.y - 4);
  28562. } else {
  28563. context.setTextAlign('center');
  28564. context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
  28565. }
  28566. } else {
  28567. //如果在左侧
  28568. if (item.position.x < centerPosition.x) {
  28569. context.setTextAlign('right');
  28570. context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
  28571. } else {
  28572. context.setTextAlign('left');
  28573. context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
  28574. }
  28575. }
  28576. });
  28577. context.closePath();
  28578. context.stroke();
  28579. });
  28580. context.setTextAlign('left');
  28581. }
  28582. return {
  28583. center: centerPosition,
  28584. radius: radius,
  28585. angleList: coordinateAngle
  28586. };
  28587. }
  28588. // 经纬度转墨卡托
  28589. function lonlat2mercator(longitude, latitude) {
  28590. var mercator = Array(2);
  28591. var x = longitude * 20037508.34 / 180;
  28592. var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
  28593. y = y * 20037508.34 / 180;
  28594. mercator[0] = x;
  28595. mercator[1] = y;
  28596. return mercator;
  28597. }
  28598. // 墨卡托转经纬度
  28599. function mercator2lonlat(longitude, latitude) {
  28600. var lonlat = Array(2);
  28601. var x = longitude / 20037508.34 * 180;
  28602. var y = latitude / 20037508.34 * 180;
  28603. y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
  28604. lonlat[0] = x;
  28605. lonlat[1] = y;
  28606. return lonlat;
  28607. }
  28608. function getBoundingBox(data) {
  28609. var bounds = {},
  28610. coords;
  28611. bounds.xMin = 180;
  28612. bounds.xMax = 0;
  28613. bounds.yMin = 90;
  28614. bounds.yMax = 0;
  28615. for (var i = 0; i < data.length; i++) {
  28616. var coorda = data[i].geometry.coordinates;
  28617. for (var k = 0; k < coorda.length; k++) {
  28618. coords = coorda[k];
  28619. if (coords.length == 1) {
  28620. coords = coords[0];
  28621. }
  28622. for (var j = 0; j < coords.length; j++) {
  28623. var longitude = coords[j][0];
  28624. var latitude = coords[j][1];
  28625. var point = {
  28626. x: longitude,
  28627. y: latitude
  28628. };
  28629. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  28630. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  28631. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  28632. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  28633. }
  28634. }
  28635. }
  28636. return bounds;
  28637. }
  28638. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  28639. return {
  28640. x: (longitude - bounds.xMin) * scale + xoffset,
  28641. y: (bounds.yMax - latitude) * scale + yoffset
  28642. };
  28643. }
  28644. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  28645. return {
  28646. x: (pointX - xoffset) / scale + bounds.xMin,
  28647. y: bounds.yMax - (pointY - yoffset) / scale
  28648. };
  28649. }
  28650. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  28651. if (s_poi[1] == e_poi[1]) {
  28652. return false;
  28653. }
  28654. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
  28655. return false;
  28656. }
  28657. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
  28658. return false;
  28659. }
  28660. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
  28661. return false;
  28662. }
  28663. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
  28664. return false;
  28665. }
  28666. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
  28667. return false;
  28668. }
  28669. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  28670. if (xseg < poi[0]) {
  28671. return false;
  28672. } else {
  28673. return true;
  28674. }
  28675. }
  28676. function isPoiWithinPoly(poi, poly, mercator) {
  28677. var sinsc = 0;
  28678. for (var i = 0; i < poly.length; i++) {
  28679. var epoly = poly[i][0];
  28680. if (poly.length == 1) {
  28681. epoly = poly[i][0];
  28682. }
  28683. for (var j = 0; j < epoly.length - 1; j++) {
  28684. var s_poi = epoly[j];
  28685. var e_poi = epoly[j + 1];
  28686. if (mercator) {
  28687. s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
  28688. e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
  28689. }
  28690. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  28691. sinsc += 1;
  28692. }
  28693. }
  28694. }
  28695. if (sinsc % 2 == 1) {
  28696. return true;
  28697. } else {
  28698. return false;
  28699. }
  28700. }
  28701. function drawMapDataPoints(series, opts, config, context) {
  28702. var mapOption = assign({}, {
  28703. border: true,
  28704. mercator: false,
  28705. borderWidth: 1,
  28706. active: true,
  28707. borderColor: '#666666',
  28708. fillOpacity: 0.6,
  28709. activeBorderColor: '#f04864',
  28710. activeFillColor: '#facc14',
  28711. activeFillOpacity: 1
  28712. }, opts.extra.map);
  28713. var coords, point;
  28714. var data = series;
  28715. var bounds = getBoundingBox(data);
  28716. if (mapOption.mercator) {
  28717. var max = lonlat2mercator(bounds.xMax, bounds.yMax);
  28718. var min = lonlat2mercator(bounds.xMin, bounds.yMin);
  28719. bounds.xMax = max[0];
  28720. bounds.yMax = max[1];
  28721. bounds.xMin = min[0];
  28722. bounds.yMin = min[1];
  28723. }
  28724. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  28725. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  28726. var scale = xScale < yScale ? xScale : yScale;
  28727. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  28728. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  28729. for (var i = 0; i < data.length; i++) {
  28730. context.beginPath();
  28731. context.setLineWidth(mapOption.borderWidth * opts.pix);
  28732. context.setStrokeStyle(mapOption.borderColor);
  28733. context.setFillStyle(hexToRgb(series[i].color, series[i].fillOpacity || mapOption.fillOpacity));
  28734. if (mapOption.active == true && opts.tooltip) {
  28735. if (opts.tooltip.index == i) {
  28736. context.setStrokeStyle(mapOption.activeBorderColor);
  28737. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  28738. }
  28739. }
  28740. var coorda = data[i].geometry.coordinates;
  28741. for (var k = 0; k < coorda.length; k++) {
  28742. coords = coorda[k];
  28743. if (coords.length == 1) {
  28744. coords = coords[0];
  28745. }
  28746. for (var j = 0; j < coords.length; j++) {
  28747. var gaosi = Array(2);
  28748. if (mapOption.mercator) {
  28749. gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
  28750. } else {
  28751. gaosi = coords[j];
  28752. }
  28753. point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
  28754. if (j === 0) {
  28755. context.beginPath();
  28756. context.moveTo(point.x, point.y);
  28757. } else {
  28758. context.lineTo(point.x, point.y);
  28759. }
  28760. }
  28761. context.fill();
  28762. if (mapOption.border == true) {
  28763. context.stroke();
  28764. }
  28765. }
  28766. }
  28767. if (opts.dataLabel == true) {
  28768. for (var i = 0; i < data.length; i++) {
  28769. var centerPoint = data[i].properties.centroid;
  28770. if (centerPoint) {
  28771. if (mapOption.mercator) {
  28772. centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
  28773. }
  28774. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  28775. var fontSize = data[i].textSize * opts.pix || config.fontSize;
  28776. var fontColor = data[i].textColor || opts.fontColor;
  28777. if (mapOption.active && mapOption.activeTextColor && opts.tooltip && opts.tooltip.index == i) {
  28778. fontColor = mapOption.activeTextColor;
  28779. }
  28780. var text = data[i].properties.name;
  28781. context.beginPath();
  28782. context.setFontSize(fontSize);
  28783. context.setFillStyle(fontColor);
  28784. context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
  28785. context.closePath();
  28786. context.stroke();
  28787. }
  28788. }
  28789. }
  28790. opts.chartData.mapData = {
  28791. bounds: bounds,
  28792. scale: scale,
  28793. xoffset: xoffset,
  28794. yoffset: yoffset,
  28795. mercator: mapOption.mercator
  28796. };
  28797. drawToolTipBridge(opts, config, context, 1);
  28798. context.draw();
  28799. }
  28800. function normalInt(min, max, iter) {
  28801. iter = iter == 0 ? 1 : iter;
  28802. var arr = [];
  28803. for (var i = 0; i < iter; i++) {
  28804. arr[i] = Math.random();
  28805. }
  28806. ;
  28807. return Math.floor(arr.reduce(function (i, j) {
  28808. return i + j;
  28809. }) / iter * (max - min)) + min;
  28810. }
  28811. ;
  28812. function collisionNew(area, points, width, height) {
  28813. var isIn = false;
  28814. for (var i = 0; i < points.length; i++) {
  28815. if (points[i].area) {
  28816. if (area[3] < points[i].area[1] || area[0] > points[i].area[2] || area[1] > points[i].area[3] || area[2] < points[i].area[0]) {
  28817. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  28818. isIn = true;
  28819. break;
  28820. } else {
  28821. isIn = false;
  28822. }
  28823. } else {
  28824. isIn = true;
  28825. break;
  28826. }
  28827. }
  28828. }
  28829. return isIn;
  28830. }
  28831. ;
  28832. function getWordCloudPoint(opts, type, context) {
  28833. var points = opts.series;
  28834. switch (type) {
  28835. case 'normal':
  28836. for (var i = 0; i < points.length; i++) {
  28837. var text = points[i].name;
  28838. var tHeight = points[i].textSize * opts.pix;
  28839. var tWidth = measureText(text, tHeight, context);
  28840. var x = void 0,
  28841. y = void 0;
  28842. var area = void 0;
  28843. var breaknum = 0;
  28844. while (true) {
  28845. breaknum++;
  28846. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  28847. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  28848. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  28849. var isCollision = collisionNew(area, points, opts.width, opts.height);
  28850. if (!isCollision) break;
  28851. if (breaknum == 1000) {
  28852. area = [-100, -100, -100, -100];
  28853. break;
  28854. }
  28855. }
  28856. ;
  28857. points[i].area = area;
  28858. }
  28859. break;
  28860. case 'vertical':
  28861. var Spin = function Spin() {
  28862. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  28863. if (Math.random() > 0.7) {
  28864. return true;
  28865. } else {
  28866. return false;
  28867. }
  28868. ;
  28869. };
  28870. ;
  28871. for (var _i30 = 0; _i30 < points.length; _i30++) {
  28872. var _text = points[_i30].name;
  28873. var _tHeight = points[_i30].textSize * opts.pix;
  28874. var _tWidth = measureText(_text, _tHeight, context);
  28875. var isSpin = Spin();
  28876. var _x = void 0,
  28877. _y = void 0,
  28878. _area = void 0,
  28879. areav = void 0;
  28880. var _breaknum = 0;
  28881. while (true) {
  28882. _breaknum++;
  28883. var _isCollision = void 0;
  28884. if (isSpin) {
  28885. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  28886. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  28887. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  28888. areav = [opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) - 5, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) - 5, opts.width - (opts.width / 2 - opts.height / 2) - (-_x + _tHeight + 5 + opts.height / 2) + _tHeight, opts.height / 2 - opts.width / 2 + (_y - 5 - _tWidth + opts.width / 2) + _tWidth + 5];
  28889. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  28890. } else {
  28891. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  28892. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  28893. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  28894. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  28895. }
  28896. if (!_isCollision) break;
  28897. if (_breaknum == 1000) {
  28898. _area = [-1000, -1000, -1000, -1000];
  28899. break;
  28900. }
  28901. }
  28902. ;
  28903. if (isSpin) {
  28904. points[_i30].area = areav;
  28905. points[_i30].areav = _area;
  28906. } else {
  28907. points[_i30].area = _area;
  28908. }
  28909. points[_i30].rotate = isSpin;
  28910. }
  28911. ;
  28912. break;
  28913. }
  28914. return points;
  28915. }
  28916. function drawWordCloudDataPoints(series, opts, config, context) {
  28917. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28918. var wordOption = assign({}, {
  28919. type: 'normal',
  28920. autoColors: true
  28921. }, opts.extra.word);
  28922. if (!opts.chartData.wordCloudData) {
  28923. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
  28924. }
  28925. context.beginPath();
  28926. context.setFillStyle(opts.background);
  28927. context.rect(0, 0, opts.width, opts.height);
  28928. context.fill();
  28929. context.save();
  28930. var points = opts.chartData.wordCloudData;
  28931. context.translate(opts.width / 2, opts.height / 2);
  28932. for (var i = 0; i < points.length; i++) {
  28933. context.save();
  28934. if (points[i].rotate) {
  28935. context.rotate(90 * Math.PI / 180);
  28936. }
  28937. var text = points[i].name;
  28938. var tHeight = points[i].textSize * opts.pix;
  28939. var tWidth = measureText(text, tHeight, context);
  28940. context.beginPath();
  28941. context.setStrokeStyle(points[i].color);
  28942. context.setFillStyle(points[i].color);
  28943. context.setFontSize(tHeight);
  28944. if (points[i].rotate) {
  28945. if (points[i].areav[0] > 0) {
  28946. if (opts.tooltip) {
  28947. if (opts.tooltip.index == i) {
  28948. context.strokeText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  28949. } else {
  28950. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  28951. }
  28952. } else {
  28953. context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process);
  28954. }
  28955. }
  28956. } else {
  28957. if (points[i].area[0] > 0) {
  28958. if (opts.tooltip) {
  28959. if (opts.tooltip.index == i) {
  28960. context.strokeText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  28961. } else {
  28962. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  28963. }
  28964. } else {
  28965. context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process);
  28966. }
  28967. }
  28968. }
  28969. context.stroke();
  28970. context.restore();
  28971. }
  28972. context.restore();
  28973. }
  28974. function drawFunnelDataPoints(series, opts, config, context) {
  28975. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28976. var funnelOption = assign({}, {
  28977. type: 'funnel',
  28978. activeWidth: 10,
  28979. activeOpacity: 0.3,
  28980. border: false,
  28981. borderWidth: 2,
  28982. borderColor: '#FFFFFF',
  28983. fillOpacity: 1,
  28984. minSize: 0,
  28985. labelAlign: 'right',
  28986. linearType: 'none',
  28987. customColor: []
  28988. }, opts.extra.funnel);
  28989. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  28990. var centerPosition = {
  28991. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28992. y: opts.height - opts.area[2]
  28993. };
  28994. var activeWidth = funnelOption.activeWidth * opts.pix;
  28995. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  28996. var seriesNew = getFunnelDataPoints(series, radius, funnelOption, eachSpacing, process);
  28997. context.save();
  28998. context.translate(centerPosition.x, centerPosition.y);
  28999. funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
  29000. if (funnelOption.type == 'pyramid') {
  29001. for (var i = 0; i < seriesNew.length; i++) {
  29002. if (i == seriesNew.length - 1) {
  29003. if (opts.tooltip) {
  29004. if (opts.tooltip.index == i) {
  29005. context.beginPath();
  29006. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29007. context.moveTo(-activeWidth, -eachSpacing);
  29008. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29009. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29010. context.lineTo(activeWidth, -eachSpacing);
  29011. context.lineTo(-activeWidth, -eachSpacing);
  29012. context.closePath();
  29013. context.fill();
  29014. }
  29015. }
  29016. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29017. context.beginPath();
  29018. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29019. context.setStrokeStyle(funnelOption.borderColor);
  29020. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29021. if (funnelOption.linearType == 'custom') {
  29022. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29023. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29024. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29025. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29026. fillColor = grd;
  29027. }
  29028. context.setFillStyle(fillColor);
  29029. context.moveTo(0, -eachSpacing);
  29030. context.lineTo(-seriesNew[i].radius, 0);
  29031. context.lineTo(seriesNew[i].radius, 0);
  29032. context.lineTo(0, -eachSpacing);
  29033. context.closePath();
  29034. context.fill();
  29035. if (funnelOption.border == true) {
  29036. context.stroke();
  29037. }
  29038. } else {
  29039. if (opts.tooltip) {
  29040. if (opts.tooltip.index == i) {
  29041. context.beginPath();
  29042. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29043. context.moveTo(0, 0);
  29044. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29045. context.lineTo(-seriesNew[i + 1].radius - activeWidth, -eachSpacing);
  29046. context.lineTo(seriesNew[i + 1].radius + activeWidth, -eachSpacing);
  29047. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29048. context.lineTo(0, 0);
  29049. context.closePath();
  29050. context.fill();
  29051. }
  29052. }
  29053. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29054. context.beginPath();
  29055. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29056. context.setStrokeStyle(funnelOption.borderColor);
  29057. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29058. if (funnelOption.linearType == 'custom') {
  29059. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29060. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29061. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29062. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29063. fillColor = grd;
  29064. }
  29065. context.setFillStyle(fillColor);
  29066. context.moveTo(0, 0);
  29067. context.lineTo(-seriesNew[i].radius, 0);
  29068. context.lineTo(-seriesNew[i + 1].radius, -eachSpacing);
  29069. context.lineTo(seriesNew[i + 1].radius, -eachSpacing);
  29070. context.lineTo(seriesNew[i].radius, 0);
  29071. context.lineTo(0, 0);
  29072. context.closePath();
  29073. context.fill();
  29074. if (funnelOption.border == true) {
  29075. context.stroke();
  29076. }
  29077. }
  29078. context.translate(0, -eachSpacing);
  29079. }
  29080. } else {
  29081. context.translate(0, -(seriesNew.length - 1) * eachSpacing);
  29082. for (var _i31 = 0; _i31 < seriesNew.length; _i31++) {
  29083. if (_i31 == seriesNew.length - 1) {
  29084. if (opts.tooltip) {
  29085. if (opts.tooltip.index == _i31) {
  29086. context.beginPath();
  29087. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29088. context.moveTo(-activeWidth - funnelOption.minSize / 2, 0);
  29089. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29090. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29091. context.lineTo(activeWidth + funnelOption.minSize / 2, 0);
  29092. context.lineTo(-activeWidth - funnelOption.minSize / 2, 0);
  29093. context.closePath();
  29094. context.fill();
  29095. }
  29096. }
  29097. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + seriesNew[_i31].radius, centerPosition.y];
  29098. context.beginPath();
  29099. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29100. context.setStrokeStyle(funnelOption.borderColor);
  29101. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29102. if (funnelOption.linearType == 'custom') {
  29103. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29104. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29105. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29106. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29107. fillColor = grd;
  29108. }
  29109. context.setFillStyle(fillColor);
  29110. context.moveTo(0, 0);
  29111. context.lineTo(-funnelOption.minSize / 2, 0);
  29112. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29113. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29114. context.lineTo(funnelOption.minSize / 2, 0);
  29115. context.lineTo(0, 0);
  29116. context.closePath();
  29117. context.fill();
  29118. if (funnelOption.border == true) {
  29119. context.stroke();
  29120. }
  29121. } else {
  29122. if (opts.tooltip) {
  29123. if (opts.tooltip.index == _i31) {
  29124. context.beginPath();
  29125. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29126. context.moveTo(0, 0);
  29127. context.lineTo(-seriesNew[_i31 + 1].radius - activeWidth, 0);
  29128. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29129. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29130. context.lineTo(seriesNew[_i31 + 1].radius + activeWidth, 0);
  29131. context.lineTo(0, 0);
  29132. context.closePath();
  29133. context.fill();
  29134. }
  29135. }
  29136. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31), centerPosition.x + seriesNew[_i31].radius, centerPosition.y - eachSpacing * (seriesNew.length - _i31 - 1)];
  29137. context.beginPath();
  29138. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29139. context.setStrokeStyle(funnelOption.borderColor);
  29140. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29141. if (funnelOption.linearType == 'custom') {
  29142. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29143. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29144. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29145. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29146. fillColor = grd;
  29147. }
  29148. context.setFillStyle(fillColor);
  29149. context.moveTo(0, 0);
  29150. context.lineTo(-seriesNew[_i31 + 1].radius, 0);
  29151. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29152. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29153. context.lineTo(seriesNew[_i31 + 1].radius, 0);
  29154. context.lineTo(0, 0);
  29155. context.closePath();
  29156. context.fill();
  29157. if (funnelOption.border == true) {
  29158. context.stroke();
  29159. }
  29160. }
  29161. context.translate(0, eachSpacing);
  29162. }
  29163. }
  29164. context.restore();
  29165. if (opts.dataLabel !== false && process === 1) {
  29166. drawFunnelText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29167. }
  29168. if (process === 1) {
  29169. drawFunnelCenterText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29170. }
  29171. return {
  29172. center: centerPosition,
  29173. radius: radius,
  29174. series: seriesNew
  29175. };
  29176. }
  29177. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29178. for (var i = 0; i < series.length; i++) {
  29179. var item = series[i];
  29180. if (item.labelShow === false) {
  29181. continue;
  29182. }
  29183. var startX = void 0,
  29184. endX = void 0,
  29185. startY = void 0,
  29186. fontSize = void 0;
  29187. var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
  29188. text = item.labelText ? item.labelText : text;
  29189. if (labelAlign == 'right') {
  29190. if (i == series.length - 1) {
  29191. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  29192. } else {
  29193. startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
  29194. }
  29195. endX = startX + activeWidth * 2;
  29196. startY = item.funnelArea[1] + eachSpacing / 2;
  29197. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29198. context.setLineWidth(1 * opts.pix);
  29199. context.setStrokeStyle(item.color);
  29200. context.setFillStyle(item.color);
  29201. context.beginPath();
  29202. context.moveTo(startX, startY);
  29203. context.lineTo(endX, startY);
  29204. context.stroke();
  29205. context.closePath();
  29206. context.beginPath();
  29207. context.moveTo(endX, startY);
  29208. context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
  29209. context.closePath();
  29210. context.fill();
  29211. context.beginPath();
  29212. context.setFontSize(fontSize);
  29213. context.setFillStyle(item.textColor || opts.fontColor);
  29214. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  29215. context.closePath();
  29216. context.stroke();
  29217. context.closePath();
  29218. }
  29219. if (labelAlign == 'left') {
  29220. if (i == series.length - 1) {
  29221. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  29222. } else {
  29223. startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
  29224. }
  29225. endX = startX - activeWidth * 2;
  29226. startY = item.funnelArea[1] + eachSpacing / 2;
  29227. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29228. context.setLineWidth(1 * opts.pix);
  29229. context.setStrokeStyle(item.color);
  29230. context.setFillStyle(item.color);
  29231. context.beginPath();
  29232. context.moveTo(startX, startY);
  29233. context.lineTo(endX, startY);
  29234. context.stroke();
  29235. context.closePath();
  29236. context.beginPath();
  29237. context.moveTo(endX, startY);
  29238. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  29239. context.closePath();
  29240. context.fill();
  29241. context.beginPath();
  29242. context.setFontSize(fontSize);
  29243. context.setFillStyle(item.textColor || opts.fontColor);
  29244. context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
  29245. context.closePath();
  29246. context.stroke();
  29247. context.closePath();
  29248. }
  29249. }
  29250. }
  29251. function drawFunnelCenterText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29252. for (var i = 0; i < series.length; i++) {
  29253. var item = series[i];
  29254. var startY = void 0,
  29255. fontSize = void 0;
  29256. if (item.centerText) {
  29257. startY = item.funnelArea[1] + eachSpacing / 2;
  29258. fontSize = item.centerTextSize * opts.pix || opts.fontSize * opts.pix;
  29259. context.beginPath();
  29260. context.setFontSize(fontSize);
  29261. context.setFillStyle(item.centerTextColor || "#FFFFFF");
  29262. context.fillText(item.centerText, centerPosition.x - measureText(item.centerText, fontSize, context) / 2, startY + fontSize / 2 - 2);
  29263. context.closePath();
  29264. context.stroke();
  29265. context.closePath();
  29266. }
  29267. }
  29268. }
  29269. function drawCanvas(opts, context) {
  29270. context.save();
  29271. context.translate(0, 0.5);
  29272. context.restore();
  29273. context.draw();
  29274. }
  29275. var Timing = {
  29276. easeIn: function easeIn(pos) {
  29277. return Math.pow(pos, 3);
  29278. },
  29279. easeOut: function easeOut(pos) {
  29280. return Math.pow(pos - 1, 3) + 1;
  29281. },
  29282. easeInOut: function easeInOut(pos) {
  29283. if ((pos /= 0.5) < 1) {
  29284. return 0.5 * Math.pow(pos, 3);
  29285. } else {
  29286. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  29287. }
  29288. },
  29289. linear: function linear(pos) {
  29290. return pos;
  29291. }
  29292. };
  29293. function Animation(opts) {
  29294. this.isStop = false;
  29295. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  29296. opts.timing = opts.timing || 'easeInOut';
  29297. var delay = 17;
  29298. function createAnimationFrame() {
  29299. if (typeof setTimeout !== 'undefined') {
  29300. return function (step, delay) {
  29301. setTimeout(function () {
  29302. var timeStamp = +new Date();
  29303. step(timeStamp);
  29304. }, delay);
  29305. };
  29306. } else if (typeof requestAnimationFrame !== 'undefined') {
  29307. return requestAnimationFrame;
  29308. } else {
  29309. return function (step) {
  29310. step(null);
  29311. };
  29312. }
  29313. }
  29314. ;
  29315. var animationFrame = createAnimationFrame();
  29316. var startTimeStamp = null;
  29317. var _step = function step(timestamp) {
  29318. if (timestamp === null || this.isStop === true) {
  29319. opts.onProcess && opts.onProcess(1);
  29320. opts.onAnimationFinish && opts.onAnimationFinish();
  29321. return;
  29322. }
  29323. if (startTimeStamp === null) {
  29324. startTimeStamp = timestamp;
  29325. }
  29326. if (timestamp - startTimeStamp < opts.duration) {
  29327. var process = (timestamp - startTimeStamp) / opts.duration;
  29328. var timingFunction = Timing[opts.timing];
  29329. process = timingFunction(process);
  29330. opts.onProcess && opts.onProcess(process);
  29331. animationFrame(_step, delay);
  29332. } else {
  29333. opts.onProcess && opts.onProcess(1);
  29334. opts.onAnimationFinish && opts.onAnimationFinish();
  29335. }
  29336. };
  29337. _step = _step.bind(this);
  29338. animationFrame(_step, delay);
  29339. }
  29340. Animation.prototype.stop = function () {
  29341. this.isStop = true;
  29342. };
  29343. function drawCharts(type, opts, config, context) {
  29344. var _this2 = this;
  29345. var _this = this;
  29346. var series = opts.series;
  29347. //兼容ECharts饼图类数据格式
  29348. if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
  29349. series = fixPieSeries(series, opts, config);
  29350. }
  29351. var categories = opts.categories;
  29352. if (type === 'mount') {
  29353. categories = [];
  29354. for (var j = 0; j < series.length; j++) {
  29355. if (series[j].show !== false) categories.push(series[j].name);
  29356. }
  29357. opts.categories = categories;
  29358. }
  29359. series = fillSeries(series, opts, config);
  29360. var duration = opts.animation ? opts.duration : 0;
  29361. _this.animationInstance && _this.animationInstance.stop();
  29362. var seriesMA = null;
  29363. if (type == 'candle') {
  29364. var average = assign({}, opts.extra.candle.average);
  29365. if (average.show) {
  29366. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  29367. seriesMA = fillSeries(seriesMA, opts, config);
  29368. opts.seriesMA = seriesMA;
  29369. } else if (opts.seriesMA) {
  29370. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  29371. } else {
  29372. seriesMA = series;
  29373. }
  29374. } else {
  29375. seriesMA = series;
  29376. }
  29377. /* 过滤掉show=false的series */
  29378. opts._series_ = series = filterSeries(series);
  29379. //重新计算图表区域
  29380. opts.area = new Array(4);
  29381. //复位绘图区域
  29382. for (var _j11 = 0; _j11 < 4; _j11++) {
  29383. opts.area[_j11] = opts.padding[_j11] * opts.pix;
  29384. }
  29385. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  29386. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
  29387. legendHeight = _calLegendData.area.wholeHeight,
  29388. legendWidth = _calLegendData.area.wholeWidth;
  29389. switch (opts.legend.position) {
  29390. case 'top':
  29391. opts.area[0] += legendHeight;
  29392. break;
  29393. case 'bottom':
  29394. opts.area[2] += legendHeight;
  29395. break;
  29396. case 'left':
  29397. opts.area[3] += legendWidth;
  29398. break;
  29399. case 'right':
  29400. opts.area[1] += legendWidth;
  29401. break;
  29402. }
  29403. var _calYAxisData = {},
  29404. yAxisWidth = 0;
  29405. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  29406. _calYAxisData = calYAxisData(series, opts, config, context);
  29407. yAxisWidth = _calYAxisData.yAxisWidth;
  29408. //如果显示Y轴标题
  29409. if (opts.yAxis.showTitle) {
  29410. var maxTitleHeight = 0;
  29411. for (var i = 0; i < opts.yAxis.data.length; i++) {
  29412. maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
  29413. }
  29414. opts.area[0] += maxTitleHeight;
  29415. }
  29416. var rightIndex = 0,
  29417. leftIndex = 0;
  29418. //计算主绘图区域左右位置
  29419. for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
  29420. if (yAxisWidth[_i32].position == 'left') {
  29421. if (leftIndex > 0) {
  29422. opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29423. } else {
  29424. opts.area[3] += yAxisWidth[_i32].width;
  29425. }
  29426. leftIndex += 1;
  29427. } else if (yAxisWidth[_i32].position == 'right') {
  29428. if (rightIndex > 0) {
  29429. opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29430. } else {
  29431. opts.area[1] += yAxisWidth[_i32].width;
  29432. }
  29433. rightIndex += 1;
  29434. }
  29435. }
  29436. } else {
  29437. config.yAxisWidth = yAxisWidth;
  29438. }
  29439. opts.chartData.yAxisData = _calYAxisData;
  29440. if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
  29441. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  29442. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29443. xAxisHeight = _calCategoriesData.xAxisHeight,
  29444. angle = _calCategoriesData.angle;
  29445. config.xAxisHeight = xAxisHeight;
  29446. config._xAxisTextAngle_ = angle;
  29447. opts.area[2] += xAxisHeight;
  29448. opts.chartData.categoriesData = _calCategoriesData;
  29449. } else {
  29450. if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  29451. opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
  29452. categories = opts.chartData.xAxisData.rangesFormat;
  29453. var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29454. _xAxisHeight = _calCategoriesData2.xAxisHeight,
  29455. _angle = _calCategoriesData2.angle;
  29456. config.xAxisHeight = _xAxisHeight;
  29457. config._xAxisTextAngle_ = _angle;
  29458. opts.area[2] += _xAxisHeight;
  29459. opts.chartData.categoriesData = _calCategoriesData2;
  29460. } else {
  29461. opts.chartData.xAxisData = {
  29462. xAxisPoints: []
  29463. };
  29464. }
  29465. }
  29466. //计算右对齐偏移距离
  29467. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  29468. var offsetLeft = 0,
  29469. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  29470. startX = opts.chartData.xAxisData.startX,
  29471. endX = opts.chartData.xAxisData.endX,
  29472. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  29473. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  29474. var screenWidth = endX - startX;
  29475. offsetLeft = screenWidth - totalWidth;
  29476. _this.scrollOption.currentOffset = offsetLeft;
  29477. _this.scrollOption.startTouchX = offsetLeft;
  29478. _this.scrollOption.distance = 0;
  29479. _this.scrollOption.lastMoveTime = 0;
  29480. opts._scrollDistance_ = offsetLeft;
  29481. }
  29482. if (type === 'pie' || type === 'ring' || type === 'rose') {
  29483. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
  29484. }
  29485. switch (type) {
  29486. case 'word':
  29487. this.animationInstance = new Animation({
  29488. timing: opts.timing,
  29489. duration: duration,
  29490. onProcess: function onProcess(process) {
  29491. context.clearRect(0, 0, opts.width, opts.height);
  29492. if (opts.rotate) {
  29493. contextRotate(context, opts);
  29494. }
  29495. drawWordCloudDataPoints(series, opts, config, context, process);
  29496. drawCanvas(opts, context);
  29497. },
  29498. onAnimationFinish: function onAnimationFinish() {
  29499. _this.uevent.trigger('renderComplete');
  29500. }
  29501. });
  29502. break;
  29503. case 'map':
  29504. context.clearRect(0, 0, opts.width, opts.height);
  29505. drawMapDataPoints(series, opts, config, context);
  29506. setTimeout(function () {
  29507. _this2.uevent.trigger('renderComplete');
  29508. }, 50);
  29509. break;
  29510. case 'funnel':
  29511. this.animationInstance = new Animation({
  29512. timing: opts.timing,
  29513. duration: duration,
  29514. onProcess: function onProcess(process) {
  29515. context.clearRect(0, 0, opts.width, opts.height);
  29516. if (opts.rotate) {
  29517. contextRotate(context, opts);
  29518. }
  29519. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  29520. drawLegend(opts.series, opts, config, context, opts.chartData);
  29521. drawToolTipBridge(opts, config, context, process);
  29522. drawCanvas(opts, context);
  29523. },
  29524. onAnimationFinish: function onAnimationFinish() {
  29525. _this.uevent.trigger('renderComplete');
  29526. }
  29527. });
  29528. break;
  29529. case 'line':
  29530. this.animationInstance = new Animation({
  29531. timing: opts.timing,
  29532. duration: duration,
  29533. onProcess: function onProcess(process) {
  29534. context.clearRect(0, 0, opts.width, opts.height);
  29535. if (opts.rotate) {
  29536. contextRotate(context, opts);
  29537. }
  29538. drawYAxisGrid(categories, opts, config, context);
  29539. drawXAxis(categories, opts, config, context);
  29540. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  29541. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  29542. calPoints = _drawLineDataPoints.calPoints,
  29543. eachSpacing = _drawLineDataPoints.eachSpacing;
  29544. opts.chartData.xAxisPoints = xAxisPoints;
  29545. opts.chartData.calPoints = calPoints;
  29546. opts.chartData.eachSpacing = eachSpacing;
  29547. drawYAxis(series, opts, config, context);
  29548. if (opts.enableMarkLine !== false && process === 1) {
  29549. drawMarkLine(opts, config, context);
  29550. }
  29551. drawLegend(opts.series, opts, config, context, opts.chartData);
  29552. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29553. drawCanvas(opts, context);
  29554. },
  29555. onAnimationFinish: function onAnimationFinish() {
  29556. _this.uevent.trigger('renderComplete');
  29557. }
  29558. });
  29559. break;
  29560. case 'scatter':
  29561. this.animationInstance = new Animation({
  29562. timing: opts.timing,
  29563. duration: duration,
  29564. onProcess: function onProcess(process) {
  29565. context.clearRect(0, 0, opts.width, opts.height);
  29566. if (opts.rotate) {
  29567. contextRotate(context, opts);
  29568. }
  29569. drawYAxisGrid(categories, opts, config, context);
  29570. drawXAxis(categories, opts, config, context);
  29571. var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
  29572. xAxisPoints = _drawScatterDataPoints.xAxisPoints,
  29573. calPoints = _drawScatterDataPoints.calPoints,
  29574. eachSpacing = _drawScatterDataPoints.eachSpacing;
  29575. opts.chartData.xAxisPoints = xAxisPoints;
  29576. opts.chartData.calPoints = calPoints;
  29577. opts.chartData.eachSpacing = eachSpacing;
  29578. drawYAxis(series, opts, config, context);
  29579. if (opts.enableMarkLine !== false && process === 1) {
  29580. drawMarkLine(opts, config, context);
  29581. }
  29582. drawLegend(opts.series, opts, config, context, opts.chartData);
  29583. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29584. drawCanvas(opts, context);
  29585. },
  29586. onAnimationFinish: function onAnimationFinish() {
  29587. _this.uevent.trigger('renderComplete');
  29588. }
  29589. });
  29590. break;
  29591. case 'bubble':
  29592. this.animationInstance = new Animation({
  29593. timing: opts.timing,
  29594. duration: duration,
  29595. onProcess: function onProcess(process) {
  29596. context.clearRect(0, 0, opts.width, opts.height);
  29597. if (opts.rotate) {
  29598. contextRotate(context, opts);
  29599. }
  29600. drawYAxisGrid(categories, opts, config, context);
  29601. drawXAxis(categories, opts, config, context);
  29602. var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
  29603. xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
  29604. calPoints = _drawBubbleDataPoints.calPoints,
  29605. eachSpacing = _drawBubbleDataPoints.eachSpacing;
  29606. opts.chartData.xAxisPoints = xAxisPoints;
  29607. opts.chartData.calPoints = calPoints;
  29608. opts.chartData.eachSpacing = eachSpacing;
  29609. drawYAxis(series, opts, config, context);
  29610. if (opts.enableMarkLine !== false && process === 1) {
  29611. drawMarkLine(opts, config, context);
  29612. }
  29613. drawLegend(opts.series, opts, config, context, opts.chartData);
  29614. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29615. drawCanvas(opts, context);
  29616. },
  29617. onAnimationFinish: function onAnimationFinish() {
  29618. _this.uevent.trigger('renderComplete');
  29619. }
  29620. });
  29621. break;
  29622. case 'mix':
  29623. this.animationInstance = new Animation({
  29624. timing: opts.timing,
  29625. duration: duration,
  29626. onProcess: function onProcess(process) {
  29627. context.clearRect(0, 0, opts.width, opts.height);
  29628. if (opts.rotate) {
  29629. contextRotate(context, opts);
  29630. }
  29631. drawYAxisGrid(categories, opts, config, context);
  29632. drawXAxis(categories, opts, config, context);
  29633. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  29634. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  29635. calPoints = _drawMixDataPoints.calPoints,
  29636. eachSpacing = _drawMixDataPoints.eachSpacing;
  29637. opts.chartData.xAxisPoints = xAxisPoints;
  29638. opts.chartData.calPoints = calPoints;
  29639. opts.chartData.eachSpacing = eachSpacing;
  29640. drawYAxis(series, opts, config, context);
  29641. if (opts.enableMarkLine !== false && process === 1) {
  29642. drawMarkLine(opts, config, context);
  29643. }
  29644. drawLegend(opts.series, opts, config, context, opts.chartData);
  29645. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29646. drawCanvas(opts, context);
  29647. },
  29648. onAnimationFinish: function onAnimationFinish() {
  29649. _this.uevent.trigger('renderComplete');
  29650. }
  29651. });
  29652. break;
  29653. case 'column':
  29654. this.animationInstance = new Animation({
  29655. timing: opts.timing,
  29656. duration: duration,
  29657. onProcess: function onProcess(process) {
  29658. context.clearRect(0, 0, opts.width, opts.height);
  29659. if (opts.rotate) {
  29660. contextRotate(context, opts);
  29661. }
  29662. drawYAxisGrid(categories, opts, config, context);
  29663. drawXAxis(categories, opts, config, context);
  29664. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  29665. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  29666. calPoints = _drawColumnDataPoints.calPoints,
  29667. eachSpacing = _drawColumnDataPoints.eachSpacing;
  29668. opts.chartData.xAxisPoints = xAxisPoints;
  29669. opts.chartData.calPoints = calPoints;
  29670. opts.chartData.eachSpacing = eachSpacing;
  29671. drawYAxis(series, opts, config, context);
  29672. if (opts.enableMarkLine !== false && process === 1) {
  29673. drawMarkLine(opts, config, context);
  29674. }
  29675. drawLegend(opts.series, opts, config, context, opts.chartData);
  29676. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29677. drawCanvas(opts, context);
  29678. },
  29679. onAnimationFinish: function onAnimationFinish() {
  29680. _this.uevent.trigger('renderComplete');
  29681. }
  29682. });
  29683. break;
  29684. case 'mount':
  29685. this.animationInstance = new Animation({
  29686. timing: opts.timing,
  29687. duration: duration,
  29688. onProcess: function onProcess(process) {
  29689. context.clearRect(0, 0, opts.width, opts.height);
  29690. if (opts.rotate) {
  29691. contextRotate(context, opts);
  29692. }
  29693. drawYAxisGrid(categories, opts, config, context);
  29694. drawXAxis(categories, opts, config, context);
  29695. var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
  29696. xAxisPoints = _drawMountDataPoints.xAxisPoints,
  29697. calPoints = _drawMountDataPoints.calPoints,
  29698. eachSpacing = _drawMountDataPoints.eachSpacing;
  29699. opts.chartData.xAxisPoints = xAxisPoints;
  29700. opts.chartData.calPoints = calPoints;
  29701. opts.chartData.eachSpacing = eachSpacing;
  29702. drawYAxis(series, opts, config, context);
  29703. if (opts.enableMarkLine !== false && process === 1) {
  29704. drawMarkLine(opts, config, context);
  29705. }
  29706. drawLegend(opts.series, opts, config, context, opts.chartData);
  29707. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29708. drawCanvas(opts, context);
  29709. },
  29710. onAnimationFinish: function onAnimationFinish() {
  29711. _this.uevent.trigger('renderComplete');
  29712. }
  29713. });
  29714. break;
  29715. case 'bar':
  29716. this.animationInstance = new Animation({
  29717. timing: opts.timing,
  29718. duration: duration,
  29719. onProcess: function onProcess(process) {
  29720. context.clearRect(0, 0, opts.width, opts.height);
  29721. if (opts.rotate) {
  29722. contextRotate(context, opts);
  29723. }
  29724. drawXAxis(categories, opts, config, context);
  29725. var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
  29726. yAxisPoints = _drawBarDataPoints.yAxisPoints,
  29727. calPoints = _drawBarDataPoints.calPoints,
  29728. eachSpacing = _drawBarDataPoints.eachSpacing;
  29729. opts.chartData.yAxisPoints = yAxisPoints;
  29730. opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
  29731. opts.chartData.calPoints = calPoints;
  29732. opts.chartData.eachSpacing = eachSpacing;
  29733. drawYAxis(series, opts, config, context);
  29734. if (opts.enableMarkLine !== false && process === 1) {
  29735. drawMarkLine(opts, config, context);
  29736. }
  29737. drawLegend(opts.series, opts, config, context, opts.chartData);
  29738. drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
  29739. drawCanvas(opts, context);
  29740. },
  29741. onAnimationFinish: function onAnimationFinish() {
  29742. _this.uevent.trigger('renderComplete');
  29743. }
  29744. });
  29745. break;
  29746. case 'area':
  29747. this.animationInstance = new Animation({
  29748. timing: opts.timing,
  29749. duration: duration,
  29750. onProcess: function onProcess(process) {
  29751. context.clearRect(0, 0, opts.width, opts.height);
  29752. if (opts.rotate) {
  29753. contextRotate(context, opts);
  29754. }
  29755. drawYAxisGrid(categories, opts, config, context);
  29756. drawXAxis(categories, opts, config, context);
  29757. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  29758. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  29759. calPoints = _drawAreaDataPoints.calPoints,
  29760. eachSpacing = _drawAreaDataPoints.eachSpacing;
  29761. opts.chartData.xAxisPoints = xAxisPoints;
  29762. opts.chartData.calPoints = calPoints;
  29763. opts.chartData.eachSpacing = eachSpacing;
  29764. drawYAxis(series, opts, config, context);
  29765. if (opts.enableMarkLine !== false && process === 1) {
  29766. drawMarkLine(opts, config, context);
  29767. }
  29768. drawLegend(opts.series, opts, config, context, opts.chartData);
  29769. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29770. drawCanvas(opts, context);
  29771. },
  29772. onAnimationFinish: function onAnimationFinish() {
  29773. _this.uevent.trigger('renderComplete');
  29774. }
  29775. });
  29776. break;
  29777. case 'ring':
  29778. this.animationInstance = new Animation({
  29779. timing: opts.timing,
  29780. duration: duration,
  29781. onProcess: function onProcess(process) {
  29782. context.clearRect(0, 0, opts.width, opts.height);
  29783. if (opts.rotate) {
  29784. contextRotate(context, opts);
  29785. }
  29786. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29787. drawLegend(opts.series, opts, config, context, opts.chartData);
  29788. drawToolTipBridge(opts, config, context, process);
  29789. drawCanvas(opts, context);
  29790. },
  29791. onAnimationFinish: function onAnimationFinish() {
  29792. _this.uevent.trigger('renderComplete');
  29793. }
  29794. });
  29795. break;
  29796. case 'pie':
  29797. this.animationInstance = new Animation({
  29798. timing: opts.timing,
  29799. duration: duration,
  29800. onProcess: function onProcess(process) {
  29801. context.clearRect(0, 0, opts.width, opts.height);
  29802. if (opts.rotate) {
  29803. contextRotate(context, opts);
  29804. }
  29805. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29806. drawLegend(opts.series, opts, config, context, opts.chartData);
  29807. drawToolTipBridge(opts, config, context, process);
  29808. drawCanvas(opts, context);
  29809. },
  29810. onAnimationFinish: function onAnimationFinish() {
  29811. _this.uevent.trigger('renderComplete');
  29812. }
  29813. });
  29814. break;
  29815. case 'rose':
  29816. this.animationInstance = new Animation({
  29817. timing: opts.timing,
  29818. duration: duration,
  29819. onProcess: function onProcess(process) {
  29820. context.clearRect(0, 0, opts.width, opts.height);
  29821. if (opts.rotate) {
  29822. contextRotate(context, opts);
  29823. }
  29824. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  29825. drawLegend(opts.series, opts, config, context, opts.chartData);
  29826. drawToolTipBridge(opts, config, context, process);
  29827. drawCanvas(opts, context);
  29828. },
  29829. onAnimationFinish: function onAnimationFinish() {
  29830. _this.uevent.trigger('renderComplete');
  29831. }
  29832. });
  29833. break;
  29834. case 'radar':
  29835. this.animationInstance = new Animation({
  29836. timing: opts.timing,
  29837. duration: duration,
  29838. onProcess: function onProcess(process) {
  29839. context.clearRect(0, 0, opts.width, opts.height);
  29840. if (opts.rotate) {
  29841. contextRotate(context, opts);
  29842. }
  29843. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  29844. drawLegend(opts.series, opts, config, context, opts.chartData);
  29845. drawToolTipBridge(opts, config, context, process);
  29846. drawCanvas(opts, context);
  29847. },
  29848. onAnimationFinish: function onAnimationFinish() {
  29849. _this.uevent.trigger('renderComplete');
  29850. }
  29851. });
  29852. break;
  29853. case 'arcbar':
  29854. this.animationInstance = new Animation({
  29855. timing: opts.timing,
  29856. duration: duration,
  29857. onProcess: function onProcess(process) {
  29858. context.clearRect(0, 0, opts.width, opts.height);
  29859. if (opts.rotate) {
  29860. contextRotate(context, opts);
  29861. }
  29862. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  29863. drawCanvas(opts, context);
  29864. },
  29865. onAnimationFinish: function onAnimationFinish() {
  29866. _this.uevent.trigger('renderComplete');
  29867. }
  29868. });
  29869. break;
  29870. case 'gauge':
  29871. this.animationInstance = new Animation({
  29872. timing: opts.timing,
  29873. duration: duration,
  29874. onProcess: function onProcess(process) {
  29875. context.clearRect(0, 0, opts.width, opts.height);
  29876. if (opts.rotate) {
  29877. contextRotate(context, opts);
  29878. }
  29879. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  29880. drawCanvas(opts, context);
  29881. },
  29882. onAnimationFinish: function onAnimationFinish() {
  29883. _this.uevent.trigger('renderComplete');
  29884. }
  29885. });
  29886. break;
  29887. case 'candle':
  29888. this.animationInstance = new Animation({
  29889. timing: opts.timing,
  29890. duration: duration,
  29891. onProcess: function onProcess(process) {
  29892. context.clearRect(0, 0, opts.width, opts.height);
  29893. if (opts.rotate) {
  29894. contextRotate(context, opts);
  29895. }
  29896. drawYAxisGrid(categories, opts, config, context);
  29897. drawXAxis(categories, opts, config, context);
  29898. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  29899. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  29900. calPoints = _drawCandleDataPoints.calPoints,
  29901. eachSpacing = _drawCandleDataPoints.eachSpacing;
  29902. opts.chartData.xAxisPoints = xAxisPoints;
  29903. opts.chartData.calPoints = calPoints;
  29904. opts.chartData.eachSpacing = eachSpacing;
  29905. drawYAxis(series, opts, config, context);
  29906. if (opts.enableMarkLine !== false && process === 1) {
  29907. drawMarkLine(opts, config, context);
  29908. }
  29909. if (seriesMA) {
  29910. drawLegend(seriesMA, opts, config, context, opts.chartData);
  29911. } else {
  29912. drawLegend(opts.series, opts, config, context, opts.chartData);
  29913. }
  29914. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29915. drawCanvas(opts, context);
  29916. },
  29917. onAnimationFinish: function onAnimationFinish() {
  29918. _this.uevent.trigger('renderComplete');
  29919. }
  29920. });
  29921. break;
  29922. }
  29923. }
  29924. function uChartsEvent() {
  29925. this.events = {};
  29926. }
  29927. uChartsEvent.prototype.addEventListener = function (type, listener) {
  29928. this.events[type] = this.events[type] || [];
  29929. this.events[type].push(listener);
  29930. };
  29931. uChartsEvent.prototype.delEventListener = function (type) {
  29932. this.events[type] = [];
  29933. };
  29934. uChartsEvent.prototype.trigger = function () {
  29935. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  29936. args[_key] = arguments[_key];
  29937. }
  29938. var type = args[0];
  29939. var params = args.slice(1);
  29940. if (!!this.events[type]) {
  29941. this.events[type].forEach(function (listener) {
  29942. try {
  29943. listener.apply(null, params);
  29944. } catch (e) {
  29945. //console.log('[uCharts] '+e);
  29946. }
  29947. });
  29948. }
  29949. };
  29950. var uCharts = function uCharts(opts) {
  29951. opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
  29952. opts.fontSize = opts.fontSize ? opts.fontSize : 13;
  29953. opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
  29954. if (opts.background == "" || opts.background == "none") {
  29955. opts.background = "#FFFFFF";
  29956. }
  29957. opts.title = assign({}, opts.title);
  29958. opts.subtitle = assign({}, opts.subtitle);
  29959. opts.duration = opts.duration ? opts.duration : 1000;
  29960. opts.yAxis = assign({}, {
  29961. data: [],
  29962. showTitle: false,
  29963. disabled: false,
  29964. disableGrid: false,
  29965. gridSet: 'number',
  29966. splitNumber: 5,
  29967. gridType: 'solid',
  29968. dashLength: 4 * opts.pix,
  29969. gridColor: '#cccccc',
  29970. padding: 10,
  29971. fontColor: '#666666'
  29972. }, opts.yAxis);
  29973. opts.xAxis = assign({}, {
  29974. rotateLabel: false,
  29975. rotateAngle: 45,
  29976. disabled: false,
  29977. disableGrid: false,
  29978. splitNumber: 5,
  29979. calibration: false,
  29980. fontColor: '#666666',
  29981. fontSize: 13,
  29982. lineHeight: 20,
  29983. marginTop: 0,
  29984. gridType: 'solid',
  29985. dashLength: 4,
  29986. scrollAlign: 'left',
  29987. boundaryGap: 'center',
  29988. axisLine: true,
  29989. axisLineColor: '#cccccc',
  29990. titleFontSize: 13,
  29991. titleOffsetY: 0,
  29992. titleOffsetX: 0,
  29993. titleFontColor: '#666666'
  29994. }, opts.xAxis);
  29995. opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
  29996. opts.legend = assign({}, {
  29997. show: true,
  29998. position: 'bottom',
  29999. float: 'center',
  30000. backgroundColor: 'rgba(0,0,0,0)',
  30001. borderColor: 'rgba(0,0,0,0)',
  30002. borderWidth: 0,
  30003. padding: 5,
  30004. margin: 5,
  30005. itemGap: 10,
  30006. fontSize: opts.fontSize,
  30007. lineHeight: opts.fontSize,
  30008. fontColor: opts.fontColor,
  30009. formatter: {},
  30010. hiddenColor: '#CECECE'
  30011. }, opts.legend);
  30012. opts.extra = assign({
  30013. tooltip: {
  30014. legendShape: 'auto'
  30015. }
  30016. }, opts.extra);
  30017. opts.rotate = opts.rotate ? true : false;
  30018. opts.animation = opts.animation ? true : false;
  30019. opts.rotate = opts.rotate ? true : false;
  30020. opts.canvas2d = opts.canvas2d ? true : false;
  30021. var config$$1 = assign({}, config);
  30022. config$$1.color = opts.color ? opts.color : config$$1.color;
  30023. if (opts.type == 'pie') {
  30024. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30025. }
  30026. if (opts.type == 'ring') {
  30027. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30028. }
  30029. if (opts.type == 'rose') {
  30030. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30031. }
  30032. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
  30033. //屏幕旋转
  30034. config$$1.rotate = opts.rotate;
  30035. if (opts.rotate) {
  30036. var tempWidth = opts.width;
  30037. var tempHeight = opts.height;
  30038. opts.width = tempHeight;
  30039. opts.height = tempWidth;
  30040. }
  30041. //适配高分屏
  30042. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  30043. config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
  30044. config$$1.fontSize = opts.fontSize * opts.pix;
  30045. config$$1.titleFontSize = config.titleFontSize * opts.pix;
  30046. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
  30047. if (!opts.context) {
  30048. throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
  30049. }
  30050. this.context = opts.context;
  30051. if (!this.context.setTextAlign) {
  30052. this.context.setStrokeStyle = function (e) {
  30053. return this.strokeStyle = e;
  30054. };
  30055. this.context.setLineWidth = function (e) {
  30056. return this.lineWidth = e;
  30057. };
  30058. this.context.setLineCap = function (e) {
  30059. return this.lineCap = e;
  30060. };
  30061. this.context.setFontSize = function (e) {
  30062. return this.font = e + "px sans-serif";
  30063. };
  30064. this.context.setFillStyle = function (e) {
  30065. return this.fillStyle = e;
  30066. };
  30067. this.context.setTextAlign = function (e) {
  30068. return this.textAlign = e;
  30069. };
  30070. this.context.setTextBaseline = function (e) {
  30071. return this.textBaseline = e;
  30072. };
  30073. this.context.setShadow = function (offsetX, offsetY, blur, color) {
  30074. this.shadowColor = color;
  30075. this.shadowOffsetX = offsetX;
  30076. this.shadowOffsetY = offsetY;
  30077. this.shadowBlur = blur;
  30078. };
  30079. this.context.draw = function () {};
  30080. }
  30081. //兼容NVUEsetLineDash
  30082. if (!this.context.setLineDash) {
  30083. this.context.setLineDash = function (e) {};
  30084. }
  30085. opts.chartData = {};
  30086. this.uevent = new uChartsEvent();
  30087. this.scrollOption = {
  30088. currentOffset: 0,
  30089. startTouchX: 0,
  30090. distance: 0,
  30091. lastMoveTime: 0
  30092. };
  30093. this.opts = opts;
  30094. this.config = config$$1;
  30095. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  30096. };
  30097. uCharts.prototype.updateData = function () {
  30098. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  30099. this.opts = assign({}, this.opts, data);
  30100. this.opts.updateData = true;
  30101. var scrollPosition = data.scrollPosition || 'current';
  30102. switch (scrollPosition) {
  30103. case 'current':
  30104. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30105. break;
  30106. case 'left':
  30107. this.opts._scrollDistance_ = 0;
  30108. this.scrollOption = {
  30109. currentOffset: 0,
  30110. startTouchX: 0,
  30111. distance: 0,
  30112. lastMoveTime: 0
  30113. };
  30114. break;
  30115. case 'right':
  30116. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30117. yAxisWidth = _calYAxisData.yAxisWidth;
  30118. this.config.yAxisWidth = yAxisWidth;
  30119. var offsetLeft = 0;
  30120. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30121. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30122. startX = _getXAxisPoints0.startX,
  30123. endX = _getXAxisPoints0.endX,
  30124. eachSpacing = _getXAxisPoints0.eachSpacing;
  30125. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  30126. var screenWidth = endX - startX;
  30127. offsetLeft = screenWidth - totalWidth;
  30128. this.scrollOption = {
  30129. currentOffset: offsetLeft,
  30130. startTouchX: offsetLeft,
  30131. distance: 0,
  30132. lastMoveTime: 0
  30133. };
  30134. this.opts._scrollDistance_ = offsetLeft;
  30135. break;
  30136. }
  30137. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30138. };
  30139. uCharts.prototype.zoom = function () {
  30140. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  30141. if (this.opts.enableScroll !== true) {
  30142. console.log('[uCharts] 请启用滚动条后使用');
  30143. return;
  30144. }
  30145. //当前屏幕中间点
  30146. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
  30147. this.opts.animation = false;
  30148. this.opts.xAxis.itemCount = val.itemCount;
  30149. //重新计算x轴偏移距离
  30150. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30151. yAxisWidth = _calYAxisData.yAxisWidth;
  30152. this.config.yAxisWidth = yAxisWidth;
  30153. var offsetLeft = 0;
  30154. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30155. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30156. startX = _getXAxisPoints0.startX,
  30157. endX = _getXAxisPoints0.endX,
  30158. eachSpacing = _getXAxisPoints0.eachSpacing;
  30159. var centerLeft = eachSpacing * centerPoint;
  30160. var screenWidth = endX - startX;
  30161. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30162. offsetLeft = screenWidth / 2 - centerLeft;
  30163. if (offsetLeft > 0) {
  30164. offsetLeft = 0;
  30165. }
  30166. if (offsetLeft < MaxLeft) {
  30167. offsetLeft = MaxLeft;
  30168. }
  30169. this.scrollOption = {
  30170. currentOffset: offsetLeft,
  30171. startTouchX: 0,
  30172. distance: 0,
  30173. lastMoveTime: 0
  30174. };
  30175. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30176. this.opts._scrollDistance_ = offsetLeft;
  30177. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30178. };
  30179. uCharts.prototype.dobuleZoom = function (e) {
  30180. if (this.opts.enableScroll !== true) {
  30181. console.log('[uCharts] 请启用滚动条后使用');
  30182. return;
  30183. }
  30184. var tcs = e.changedTouches;
  30185. if (tcs.length < 2) {
  30186. return;
  30187. }
  30188. for (var i = 0; i < tcs.length; i++) {
  30189. tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
  30190. tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
  30191. }
  30192. var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
  30193. var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
  30194. // 记录初始的两指之间的数据
  30195. if (!this.scrollOption.moveCount) {
  30196. var cts0 = {
  30197. changedTouches: [{
  30198. x: tcs[0].x,
  30199. y: this.opts.area[0] / this.opts.pix + 2
  30200. }]
  30201. };
  30202. var cts1 = {
  30203. changedTouches: [{
  30204. x: tcs[1].x,
  30205. y: this.opts.area[0] / this.opts.pix + 2
  30206. }]
  30207. };
  30208. if (this.opts.rotate) {
  30209. cts0 = {
  30210. changedTouches: [{
  30211. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30212. y: tcs[0].y
  30213. }]
  30214. };
  30215. cts1 = {
  30216. changedTouches: [{
  30217. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30218. y: tcs[1].y
  30219. }]
  30220. };
  30221. }
  30222. var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
  30223. var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
  30224. var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
  30225. this.scrollOption.moveCount = moveCount;
  30226. this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
  30227. this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
  30228. return;
  30229. }
  30230. var currentEachSpacing = xlength / this.scrollOption.moveCount;
  30231. var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
  30232. itemCount = itemCount <= 2 ? 2 : itemCount;
  30233. itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
  30234. this.opts.animation = false;
  30235. this.opts.xAxis.itemCount = itemCount;
  30236. // 重新计算滚动条偏移距离
  30237. var offsetLeft = 0;
  30238. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30239. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30240. startX = _getXAxisPoints0.startX,
  30241. endX = _getXAxisPoints0.endX,
  30242. eachSpacing = _getXAxisPoints0.eachSpacing;
  30243. var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
  30244. var screenWidth = endX - startX;
  30245. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30246. offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
  30247. if (offsetLeft > 0) {
  30248. offsetLeft = 0;
  30249. }
  30250. if (offsetLeft < MaxLeft) {
  30251. offsetLeft = MaxLeft;
  30252. }
  30253. this.scrollOption.currentOffset = offsetLeft;
  30254. this.scrollOption.startTouchX = 0;
  30255. this.scrollOption.distance = 0;
  30256. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30257. this.opts._scrollDistance_ = offsetLeft;
  30258. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30259. };
  30260. uCharts.prototype.stopAnimation = function () {
  30261. this.animationInstance && this.animationInstance.stop();
  30262. };
  30263. uCharts.prototype.addEventListener = function (type, listener) {
  30264. this.uevent.addEventListener(type, listener);
  30265. };
  30266. uCharts.prototype.delEventListener = function (type) {
  30267. this.uevent.delEventListener(type);
  30268. };
  30269. uCharts.prototype.getCurrentDataIndex = function (e) {
  30270. var touches = null;
  30271. if (e.changedTouches) {
  30272. touches = e.changedTouches[0];
  30273. } else {
  30274. touches = e.mp.changedTouches[0];
  30275. }
  30276. if (touches) {
  30277. var _touches$ = getTouches(touches, this.opts, e);
  30278. if (this.opts.type === 'pie' || this.opts.type === 'ring') {
  30279. return findPieChartCurrentIndex({
  30280. x: _touches$.x,
  30281. y: _touches$.y
  30282. }, this.opts.chartData.pieData, this.opts);
  30283. } else if (this.opts.type === 'rose') {
  30284. return findRoseChartCurrentIndex({
  30285. x: _touches$.x,
  30286. y: _touches$.y
  30287. }, this.opts.chartData.pieData, this.opts);
  30288. } else if (this.opts.type === 'radar') {
  30289. return findRadarChartCurrentIndex({
  30290. x: _touches$.x,
  30291. y: _touches$.y
  30292. }, this.opts.chartData.radarData, this.opts.categories.length);
  30293. } else if (this.opts.type === 'funnel') {
  30294. return findFunnelChartCurrentIndex({
  30295. x: _touches$.x,
  30296. y: _touches$.y
  30297. }, this.opts.chartData.funnelData);
  30298. } else if (this.opts.type === 'map') {
  30299. return findMapChartCurrentIndex({
  30300. x: _touches$.x,
  30301. y: _touches$.y
  30302. }, this.opts);
  30303. } else if (this.opts.type === 'word') {
  30304. return findWordChartCurrentIndex({
  30305. x: _touches$.x,
  30306. y: _touches$.y
  30307. }, this.opts.chartData.wordCloudData);
  30308. } else if (this.opts.type === 'bar') {
  30309. return findBarChartCurrentIndex({
  30310. x: _touches$.x,
  30311. y: _touches$.y
  30312. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30313. } else {
  30314. return findCurrentIndex({
  30315. x: _touches$.x,
  30316. y: _touches$.y
  30317. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30318. }
  30319. }
  30320. return -1;
  30321. };
  30322. uCharts.prototype.getLegendDataIndex = function (e) {
  30323. var touches = null;
  30324. if (e.changedTouches) {
  30325. touches = e.changedTouches[0];
  30326. } else {
  30327. touches = e.mp.changedTouches[0];
  30328. }
  30329. if (touches) {
  30330. var _touches$ = getTouches(touches, this.opts, e);
  30331. return findLegendIndex({
  30332. x: _touches$.x,
  30333. y: _touches$.y
  30334. }, this.opts.chartData.legendData);
  30335. }
  30336. return -1;
  30337. };
  30338. uCharts.prototype.touchLegend = function (e) {
  30339. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30340. var touches = null;
  30341. if (e.changedTouches) {
  30342. touches = e.changedTouches[0];
  30343. } else {
  30344. touches = e.mp.changedTouches[0];
  30345. }
  30346. if (touches) {
  30347. var _touches$ = getTouches(touches, this.opts, e);
  30348. var index = this.getLegendDataIndex(e);
  30349. if (index >= 0) {
  30350. if (this.opts.type == 'candle') {
  30351. this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
  30352. } else {
  30353. this.opts.series[index].show = !this.opts.series[index].show;
  30354. }
  30355. this.opts.animation = option.animation ? true : false;
  30356. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30357. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30358. }
  30359. }
  30360. };
  30361. uCharts.prototype.showToolTip = function (e) {
  30362. var _this3 = this;
  30363. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30364. var touches = null;
  30365. if (e.changedTouches) {
  30366. touches = e.changedTouches[0];
  30367. } else {
  30368. touches = e.mp.changedTouches[0];
  30369. }
  30370. if (!touches) {
  30371. console.log("[uCharts] 未获取到event坐标信息");
  30372. }
  30373. var _touches$ = getTouches(touches, this.opts, e);
  30374. var currentOffset = this.scrollOption.currentOffset;
  30375. var opts = assign({}, this.opts, {
  30376. _scrollDistance_: currentOffset,
  30377. animation: false
  30378. });
  30379. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
  30380. var current = this.getCurrentDataIndex(e);
  30381. var index = option.index == undefined ? current.index : option.index;
  30382. if (index > -1 || index.length > 0) {
  30383. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30384. if (seriesData.length !== 0) {
  30385. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30386. textList = _getToolTipData.textList,
  30387. offset = _getToolTipData.offset;
  30388. offset.y = _touches$.y;
  30389. opts.tooltip = {
  30390. textList: option.textList !== undefined ? option.textList : textList,
  30391. offset: option.offset !== undefined ? option.offset : offset,
  30392. option: option,
  30393. index: index,
  30394. group: current.group
  30395. };
  30396. }
  30397. }
  30398. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30399. }
  30400. if (this.opts.type === 'mount') {
  30401. var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
  30402. if (index > -1) {
  30403. var opts = assign({}, this.opts, {
  30404. animation: false
  30405. });
  30406. var seriesData = assign({}, opts._series_[index]);
  30407. var textList = [{
  30408. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30409. color: seriesData.color,
  30410. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30411. }];
  30412. var offset = {
  30413. x: opts.chartData.calPoints[index].x,
  30414. y: _touches$.y
  30415. };
  30416. opts.tooltip = {
  30417. textList: option.textList ? option.textList : textList,
  30418. offset: option.offset !== undefined ? option.offset : offset,
  30419. option: option,
  30420. index: index
  30421. };
  30422. }
  30423. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30424. }
  30425. if (this.opts.type === 'bar') {
  30426. var current = this.getCurrentDataIndex(e);
  30427. var index = option.index == undefined ? current.index : option.index;
  30428. if (index > -1 || index.length > 0) {
  30429. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30430. if (seriesData.length !== 0) {
  30431. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30432. textList = _getToolTipData.textList,
  30433. offset = _getToolTipData.offset;
  30434. offset.x = _touches$.x;
  30435. opts.tooltip = {
  30436. textList: option.textList !== undefined ? option.textList : textList,
  30437. offset: option.offset !== undefined ? option.offset : offset,
  30438. option: option,
  30439. index: index
  30440. };
  30441. }
  30442. }
  30443. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30444. }
  30445. if (this.opts.type === 'mix') {
  30446. var current = this.getCurrentDataIndex(e);
  30447. var index = option.index == undefined ? current.index : option.index;
  30448. if (index > -1) {
  30449. var currentOffset = this.scrollOption.currentOffset;
  30450. var opts = assign({}, this.opts, {
  30451. _scrollDistance_: currentOffset,
  30452. animation: false
  30453. });
  30454. var seriesData = getSeriesDataItem(this.opts.series, index);
  30455. if (seriesData.length !== 0) {
  30456. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
  30457. textList = _getMixToolTipData.textList,
  30458. offset = _getMixToolTipData.offset;
  30459. offset.y = _touches$.y;
  30460. opts.tooltip = {
  30461. textList: option.textList ? option.textList : textList,
  30462. offset: option.offset !== undefined ? option.offset : offset,
  30463. option: option,
  30464. index: index
  30465. };
  30466. }
  30467. }
  30468. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30469. }
  30470. if (this.opts.type === 'candle') {
  30471. var current = this.getCurrentDataIndex(e);
  30472. var index = option.index == undefined ? current.index : option.index;
  30473. if (index > -1) {
  30474. var currentOffset = this.scrollOption.currentOffset;
  30475. var opts = assign({}, this.opts, {
  30476. _scrollDistance_: currentOffset,
  30477. animation: false
  30478. });
  30479. var seriesData = getSeriesDataItem(this.opts.series, index);
  30480. if (seriesData.length !== 0) {
  30481. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
  30482. textList = _getToolTipData.textList,
  30483. offset = _getToolTipData.offset;
  30484. offset.y = _touches$.y;
  30485. opts.tooltip = {
  30486. textList: option.textList ? option.textList : textList,
  30487. offset: option.offset !== undefined ? option.offset : offset,
  30488. option: option,
  30489. index: index
  30490. };
  30491. }
  30492. }
  30493. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30494. }
  30495. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  30496. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30497. if (index > -1) {
  30498. var opts = assign({}, this.opts, {
  30499. animation: false
  30500. });
  30501. var seriesData = assign({}, opts._series_[index]);
  30502. var textList = [{
  30503. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30504. color: seriesData.color,
  30505. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30506. }];
  30507. var offset = {
  30508. x: _touches$.x,
  30509. y: _touches$.y
  30510. };
  30511. opts.tooltip = {
  30512. textList: option.textList ? option.textList : textList,
  30513. offset: option.offset !== undefined ? option.offset : offset,
  30514. option: option,
  30515. index: index
  30516. };
  30517. }
  30518. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30519. }
  30520. if (this.opts.type === 'map') {
  30521. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30522. if (index > -1) {
  30523. var opts = assign({}, this.opts, {
  30524. animation: false
  30525. });
  30526. var seriesData = assign({}, this.opts.series[index]);
  30527. seriesData.name = seriesData.properties.name;
  30528. var textList = [{
  30529. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30530. color: seriesData.color,
  30531. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30532. }];
  30533. var offset = {
  30534. x: _touches$.x,
  30535. y: _touches$.y
  30536. };
  30537. opts.tooltip = {
  30538. textList: option.textList ? option.textList : textList,
  30539. offset: option.offset !== undefined ? option.offset : offset,
  30540. option: option,
  30541. index: index
  30542. };
  30543. }
  30544. opts.updateData = false;
  30545. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30546. }
  30547. if (this.opts.type === 'word') {
  30548. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30549. if (index > -1) {
  30550. var opts = assign({}, this.opts, {
  30551. animation: false
  30552. });
  30553. var seriesData = assign({}, this.opts.series[index]);
  30554. var textList = [{
  30555. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30556. color: seriesData.color,
  30557. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30558. }];
  30559. var offset = {
  30560. x: _touches$.x,
  30561. y: _touches$.y
  30562. };
  30563. opts.tooltip = {
  30564. textList: option.textList ? option.textList : textList,
  30565. offset: option.offset !== undefined ? option.offset : offset,
  30566. option: option,
  30567. index: index
  30568. };
  30569. }
  30570. opts.updateData = false;
  30571. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30572. }
  30573. if (this.opts.type === 'radar') {
  30574. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30575. if (index > -1) {
  30576. var opts = assign({}, this.opts, {
  30577. animation: false
  30578. });
  30579. var seriesData = getSeriesDataItem(this.opts.series, index);
  30580. if (seriesData.length !== 0) {
  30581. var textList = seriesData.map(function (item) {
  30582. return {
  30583. text: option.formatter ? option.formatter(item, _this3.opts.categories[index], index, _this3.opts) : item.name + ': ' + item.data,
  30584. color: item.color,
  30585. legendShape: _this3.opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : _this3.opts.extra.tooltip.legendShape
  30586. };
  30587. });
  30588. var offset = {
  30589. x: _touches$.x,
  30590. y: _touches$.y
  30591. };
  30592. opts.tooltip = {
  30593. textList: option.textList ? option.textList : textList,
  30594. offset: option.offset !== undefined ? option.offset : offset,
  30595. option: option,
  30596. index: index
  30597. };
  30598. }
  30599. }
  30600. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30601. }
  30602. };
  30603. uCharts.prototype.translate = function (distance) {
  30604. this.scrollOption = {
  30605. currentOffset: distance,
  30606. startTouchX: distance,
  30607. distance: 0,
  30608. lastMoveTime: 0
  30609. };
  30610. var opts = assign({}, this.opts, {
  30611. _scrollDistance_: distance,
  30612. animation: false
  30613. });
  30614. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  30615. };
  30616. uCharts.prototype.scrollStart = function (e) {
  30617. var touches = null;
  30618. if (e.changedTouches) {
  30619. touches = e.changedTouches[0];
  30620. } else {
  30621. touches = e.mp.changedTouches[0];
  30622. }
  30623. var _touches$ = getTouches(touches, this.opts, e);
  30624. if (touches && this.opts.enableScroll === true) {
  30625. this.scrollOption.startTouchX = _touches$.x;
  30626. }
  30627. };
  30628. uCharts.prototype.scroll = function (e) {
  30629. if (this.scrollOption.lastMoveTime === 0) {
  30630. this.scrollOption.lastMoveTime = Date.now();
  30631. }
  30632. var Limit = this.opts.touchMoveLimit || 60;
  30633. var currMoveTime = Date.now();
  30634. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  30635. if (duration < Math.floor(1000 / Limit)) return;
  30636. if (this.scrollOption.startTouchX == 0) return;
  30637. this.scrollOption.lastMoveTime = currMoveTime;
  30638. var touches = null;
  30639. if (e.changedTouches) {
  30640. touches = e.changedTouches[0];
  30641. } else {
  30642. touches = e.mp.changedTouches[0];
  30643. }
  30644. if (touches && this.opts.enableScroll === true) {
  30645. var _touches$ = getTouches(touches, this.opts, e);
  30646. var _distance;
  30647. _distance = _touches$.x - this.scrollOption.startTouchX;
  30648. var currentOffset = this.scrollOption.currentOffset;
  30649. var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  30650. this.scrollOption.distance = _distance = validDistance - currentOffset;
  30651. var opts = assign({}, this.opts, {
  30652. _scrollDistance_: currentOffset + _distance,
  30653. animation: false
  30654. });
  30655. this.opts = opts;
  30656. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30657. return currentOffset + _distance;
  30658. }
  30659. };
  30660. uCharts.prototype.scrollEnd = function (e) {
  30661. if (this.opts.enableScroll === true) {
  30662. var _scrollOption = this.scrollOption,
  30663. currentOffset = _scrollOption.currentOffset,
  30664. distance = _scrollOption.distance;
  30665. this.scrollOption.currentOffset = currentOffset + distance;
  30666. this.scrollOption.distance = 0;
  30667. this.scrollOption.moveCount = 0;
  30668. }
  30669. };
  30670. var _default = uCharts;
  30671. exports.default = _default;
  30672. /***/ }),
  30673. /***/ 683:
  30674. /*!************************************************************************************!*\
  30675. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
  30676. \************************************************************************************/
  30677. /*! no static exports found */
  30678. /***/ (function(module, exports, __webpack_require__) {
  30679. "use strict";
  30680. Object.defineProperty(exports, "__esModule", {
  30681. value: true
  30682. });
  30683. exports.default = void 0;
  30684. /*
  30685. * uCharts®
  30686. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  30687. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  30688. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  30689. * 复制使用请保留本段注释,感谢支持开源!
  30690. *
  30691. * uCharts®官方网站
  30692. * https://www.uCharts.cn
  30693. *
  30694. * 开源地址:
  30695. * https://gitee.com/uCharts/uCharts
  30696. *
  30697. * uni-app插件市场地址:
  30698. * http://ext.dcloud.net.cn/plugin?id=271
  30699. *
  30700. */
  30701. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  30702. var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  30703. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  30704. var formatDateTime = function formatDateTime(timeStamp, returnType) {
  30705. var date = new Date();
  30706. date.setTime(timeStamp * 1000);
  30707. var y = date.getFullYear();
  30708. var m = date.getMonth() + 1;
  30709. m = m < 10 ? '0' + m : m;
  30710. var d = date.getDate();
  30711. d = d < 10 ? '0' + d : d;
  30712. var h = date.getHours();
  30713. h = h < 10 ? '0' + h : h;
  30714. var minute = date.getMinutes();
  30715. var second = date.getSeconds();
  30716. minute = minute < 10 ? '0' + minute : minute;
  30717. second = second < 10 ? '0' + second : second;
  30718. if (returnType == 'full') {
  30719. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  30720. }
  30721. if (returnType == 'y-m-d') {
  30722. return y + '-' + m + '-' + d;
  30723. }
  30724. if (returnType == 'h:m') {
  30725. return h + ':' + minute;
  30726. }
  30727. if (returnType == 'h:m:s') {
  30728. return h + ':' + minute + ':' + second;
  30729. }
  30730. return [y, m, d, h, minute, second];
  30731. };
  30732. var cfu = {
  30733. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  30734. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
  30735. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
  30736. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  30737. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  30738. "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
  30739. //instance为实例变量承载属性,不要删除
  30740. "instance": {},
  30741. //option为opts及eopts承载属性,不要删除
  30742. "option": {},
  30743. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  30744. "formatter": {
  30745. "yAxisDemo1": function yAxisDemo1(val, index, opts) {
  30746. return val + '元';
  30747. },
  30748. "yAxisDemo2": function yAxisDemo2(val, index, opts) {
  30749. return val.toFixed(2);
  30750. },
  30751. "xAxisDemo1": function xAxisDemo1(val, index, opts) {
  30752. return val + '年';
  30753. },
  30754. "xAxisDemo2": function xAxisDemo2(val, index, opts) {
  30755. return formatDateTime(val, 'h:m');
  30756. },
  30757. "seriesDemo1": function seriesDemo1(val, index, series, opts) {
  30758. return val + '元';
  30759. },
  30760. "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
  30761. if (index == 0) {
  30762. return '随便用' + item.data + '年';
  30763. } else {
  30764. return '其他我没改' + item.data + '天';
  30765. }
  30766. },
  30767. "pieDemo": function pieDemo(val, index, series, opts) {
  30768. if (index !== undefined) {
  30769. return series[index].name + ':' + series[index].data + '元';
  30770. }
  30771. }
  30772. },
  30773. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  30774. "demotype": {
  30775. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  30776. "type": "line",
  30777. "color": color,
  30778. "padding": [15, 10, 0, 15],
  30779. "xAxis": {
  30780. "disableGrid": true
  30781. },
  30782. "yAxis": {
  30783. "gridType": "dash",
  30784. "dashLength": 2
  30785. },
  30786. "legend": {},
  30787. "extra": {
  30788. "line": {
  30789. "type": "curve",
  30790. "width": 2
  30791. }
  30792. }
  30793. },
  30794. //下面是自定义配置,请添加项目所需的通用配置
  30795. "pie": {
  30796. "type": "pie",
  30797. "color": color,
  30798. "padding": [5, 5, 5, 5],
  30799. "extra": {
  30800. "pie": {
  30801. "activeOpacity": 0.5,
  30802. "activeRadius": 10,
  30803. "offsetAngle": 0,
  30804. "labelWidth": 15,
  30805. "border": true,
  30806. "borderWidth": 3,
  30807. "borderColor": "#FFFFFF"
  30808. }
  30809. }
  30810. },
  30811. "ring": {
  30812. "type": "ring",
  30813. "color": color,
  30814. "padding": [5, 5, 5, 5],
  30815. "rotate": false,
  30816. "dataLabel": true,
  30817. "legend": {
  30818. "show": true,
  30819. "position": "right",
  30820. "lineHeight": 25
  30821. },
  30822. "title": {
  30823. "name": "收益率",
  30824. "fontSize": 15,
  30825. "color": "#666666"
  30826. },
  30827. "subtitle": {
  30828. "name": "70%",
  30829. "fontSize": 25,
  30830. "color": "#7cb5ec"
  30831. },
  30832. "extra": {
  30833. "ring": {
  30834. "ringWidth": 30,
  30835. "activeOpacity": 0.5,
  30836. "activeRadius": 10,
  30837. "offsetAngle": 0,
  30838. "labelWidth": 15,
  30839. "border": true,
  30840. "borderWidth": 3,
  30841. "borderColor": "#FFFFFF"
  30842. }
  30843. }
  30844. },
  30845. "rose": {
  30846. "type": "rose",
  30847. "color": color,
  30848. "padding": [5, 5, 5, 5],
  30849. "legend": {
  30850. "show": true,
  30851. "position": "left",
  30852. "lineHeight": 25
  30853. },
  30854. "extra": {
  30855. "rose": {
  30856. "type": "area",
  30857. "minRadius": 50,
  30858. "activeOpacity": 0.5,
  30859. "activeRadius": 10,
  30860. "offsetAngle": 0,
  30861. "labelWidth": 15,
  30862. "border": false,
  30863. "borderWidth": 2,
  30864. "borderColor": "#FFFFFF"
  30865. }
  30866. }
  30867. },
  30868. "word": {
  30869. "type": "word",
  30870. "color": color,
  30871. "extra": {
  30872. "word": {
  30873. "type": "normal",
  30874. "autoColors": false
  30875. }
  30876. }
  30877. },
  30878. "funnel": {
  30879. "type": "funnel",
  30880. "color": color,
  30881. "padding": [15, 15, 0, 15],
  30882. "extra": {
  30883. "funnel": {
  30884. "activeOpacity": 0.3,
  30885. "activeWidth": 10,
  30886. "border": true,
  30887. "borderWidth": 2,
  30888. "borderColor": "#FFFFFF",
  30889. "fillOpacity": 1,
  30890. "labelAlign": "right"
  30891. }
  30892. }
  30893. },
  30894. "map": {
  30895. "type": "map",
  30896. "color": color,
  30897. "padding": [0, 0, 0, 0],
  30898. "dataLabel": true,
  30899. "extra": {
  30900. "map": {
  30901. "border": true,
  30902. "borderWidth": 1,
  30903. "borderColor": "#666666",
  30904. "fillOpacity": 0.6,
  30905. "activeBorderColor": "#F04864",
  30906. "activeFillColor": "#FACC14",
  30907. "activeFillOpacity": 1
  30908. }
  30909. }
  30910. },
  30911. "arcbar": {
  30912. "type": "arcbar",
  30913. "color": color,
  30914. "title": {
  30915. "name": "百分比",
  30916. "fontSize": 25,
  30917. "color": "#00FF00"
  30918. },
  30919. "subtitle": {
  30920. "name": "默认标题",
  30921. "fontSize": 15,
  30922. "color": "#666666"
  30923. },
  30924. "extra": {
  30925. "arcbar": {
  30926. "type": "default",
  30927. "width": 12,
  30928. "backgroundColor": "#E9E9E9",
  30929. "startAngle": 0.75,
  30930. "endAngle": 0.25,
  30931. "gap": 2
  30932. }
  30933. }
  30934. },
  30935. "line": {
  30936. "type": "line",
  30937. "color": color,
  30938. "padding": [15, 10, 0, 15],
  30939. "xAxis": {
  30940. "disableGrid": true
  30941. },
  30942. "yAxis": {
  30943. "gridType": "dash",
  30944. "dashLength": 2
  30945. },
  30946. "legend": {},
  30947. "extra": {
  30948. "line": {
  30949. "type": "straight",
  30950. "width": 2,
  30951. "activeType": "hollow"
  30952. }
  30953. }
  30954. },
  30955. "tline": {
  30956. "type": "line",
  30957. "color": color,
  30958. "padding": [15, 10, 0, 15],
  30959. "xAxis": {
  30960. "disableGrid": false,
  30961. "boundaryGap": "justify"
  30962. },
  30963. "yAxis": {
  30964. "gridType": "dash",
  30965. "dashLength": 2,
  30966. "data": [{
  30967. "min": 0,
  30968. "max": 80
  30969. }]
  30970. },
  30971. "legend": {},
  30972. "extra": {
  30973. "line": {
  30974. "type": "curve",
  30975. "width": 2,
  30976. "activeType": "hollow"
  30977. }
  30978. }
  30979. },
  30980. "tarea": {
  30981. "type": "area",
  30982. "color": color,
  30983. "padding": [15, 10, 0, 15],
  30984. "xAxis": {
  30985. "disableGrid": true,
  30986. "boundaryGap": "justify"
  30987. },
  30988. "yAxis": {
  30989. "gridType": "dash",
  30990. "dashLength": 2,
  30991. "data": [{
  30992. "min": 0,
  30993. "max": 80
  30994. }]
  30995. },
  30996. "legend": {},
  30997. "extra": {
  30998. "area": {
  30999. "type": "curve",
  31000. "opacity": 0.2,
  31001. "addLine": true,
  31002. "width": 2,
  31003. "gradient": true,
  31004. "activeType": "hollow"
  31005. }
  31006. }
  31007. },
  31008. "column": {
  31009. "type": "column",
  31010. "color": color,
  31011. "padding": [15, 15, 0, 5],
  31012. "xAxis": {
  31013. "disableGrid": true
  31014. },
  31015. "yAxis": {
  31016. "data": [{
  31017. "min": 0
  31018. }]
  31019. },
  31020. "legend": {},
  31021. "extra": {
  31022. "column": {
  31023. "type": "group",
  31024. "width": 30,
  31025. "activeBgColor": "#000000",
  31026. "activeBgOpacity": 0.08
  31027. }
  31028. }
  31029. },
  31030. "mount": {
  31031. "type": "mount",
  31032. "color": color,
  31033. "padding": [15, 15, 0, 5],
  31034. "xAxis": {
  31035. "disableGrid": true
  31036. },
  31037. "yAxis": {
  31038. "data": [{
  31039. "min": 0
  31040. }]
  31041. },
  31042. "legend": {},
  31043. "extra": {
  31044. "mount": {
  31045. "type": "mount",
  31046. "widthRatio": 1.5
  31047. }
  31048. }
  31049. },
  31050. "bar": {
  31051. "type": "bar",
  31052. "color": color,
  31053. "padding": [15, 30, 0, 5],
  31054. "xAxis": {
  31055. "boundaryGap": "justify",
  31056. "disableGrid": false,
  31057. "min": 0,
  31058. "axisLine": false
  31059. },
  31060. "yAxis": {},
  31061. "legend": {},
  31062. "extra": {
  31063. "bar": {
  31064. "type": "group",
  31065. "width": 30,
  31066. "meterBorde": 1,
  31067. "meterFillColor": "#FFFFFF",
  31068. "activeBgColor": "#000000",
  31069. "activeBgOpacity": 0.08
  31070. }
  31071. }
  31072. },
  31073. "area": {
  31074. "type": "area",
  31075. "color": color,
  31076. "padding": [15, 15, 0, 15],
  31077. "xAxis": {
  31078. "disableGrid": true
  31079. },
  31080. "yAxis": {
  31081. "gridType": "dash",
  31082. "dashLength": 2
  31083. },
  31084. "legend": {},
  31085. "extra": {
  31086. "area": {
  31087. "type": "straight",
  31088. "opacity": 0.2,
  31089. "addLine": true,
  31090. "width": 2,
  31091. "gradient": false,
  31092. "activeType": "hollow"
  31093. }
  31094. }
  31095. },
  31096. "radar": {
  31097. "type": "radar",
  31098. "color": color,
  31099. "padding": [5, 5, 5, 5],
  31100. "dataLabel": false,
  31101. "legend": {
  31102. "show": true,
  31103. "position": "right",
  31104. "lineHeight": 25
  31105. },
  31106. "extra": {
  31107. "radar": {
  31108. "gridType": "radar",
  31109. "gridColor": "#CCCCCC",
  31110. "gridCount": 3,
  31111. "opacity": 0.2,
  31112. "max": 200,
  31113. "labelShow": true
  31114. }
  31115. }
  31116. },
  31117. "gauge": {
  31118. "type": "gauge",
  31119. "color": color,
  31120. "title": {
  31121. "name": "66Km/H",
  31122. "fontSize": 25,
  31123. "color": "#2fc25b",
  31124. "offsetY": 50
  31125. },
  31126. "subtitle": {
  31127. "name": "实时速度",
  31128. "fontSize": 15,
  31129. "color": "#1890ff",
  31130. "offsetY": -50
  31131. },
  31132. "extra": {
  31133. "gauge": {
  31134. "type": "default",
  31135. "width": 30,
  31136. "labelColor": "#666666",
  31137. "startAngle": 0.75,
  31138. "endAngle": 0.25,
  31139. "startNumber": 0,
  31140. "endNumber": 100,
  31141. "labelFormat": "",
  31142. "splitLine": {
  31143. "fixRadius": 0,
  31144. "splitNumber": 10,
  31145. "width": 30,
  31146. "color": "#FFFFFF",
  31147. "childNumber": 5,
  31148. "childWidth": 12
  31149. },
  31150. "pointer": {
  31151. "width": 24,
  31152. "color": "auto"
  31153. }
  31154. }
  31155. }
  31156. },
  31157. "candle": {
  31158. "type": "candle",
  31159. "color": color,
  31160. "padding": [15, 15, 0, 15],
  31161. "enableScroll": true,
  31162. "enableMarkLine": true,
  31163. "dataLabel": false,
  31164. "xAxis": {
  31165. "labelCount": 4,
  31166. "itemCount": 40,
  31167. "disableGrid": true,
  31168. "gridColor": "#CCCCCC",
  31169. "gridType": "solid",
  31170. "dashLength": 4,
  31171. "scrollShow": true,
  31172. "scrollAlign": "left",
  31173. "scrollColor": "#A6A6A6",
  31174. "scrollBackgroundColor": "#EFEBEF"
  31175. },
  31176. "yAxis": {},
  31177. "legend": {},
  31178. "extra": {
  31179. "candle": {
  31180. "color": {
  31181. "upLine": "#f04864",
  31182. "upFill": "#f04864",
  31183. "downLine": "#2fc25b",
  31184. "downFill": "#2fc25b"
  31185. },
  31186. "average": {
  31187. "show": true,
  31188. "name": ["MA5", "MA10", "MA30"],
  31189. "day": [5, 10, 20],
  31190. "color": ["#1890ff", "#2fc25b", "#facc14"]
  31191. }
  31192. },
  31193. "markLine": {
  31194. "type": "dash",
  31195. "dashLength": 5,
  31196. "data": [{
  31197. "value": 2150,
  31198. "lineColor": "#f04864",
  31199. "showLabel": true
  31200. }, {
  31201. "value": 2350,
  31202. "lineColor": "#f04864",
  31203. "showLabel": true
  31204. }]
  31205. }
  31206. }
  31207. },
  31208. "mix": {
  31209. "type": "mix",
  31210. "color": color,
  31211. "padding": [15, 15, 0, 15],
  31212. "xAxis": {
  31213. "disableGrid": true
  31214. },
  31215. "yAxis": {
  31216. "disabled": false,
  31217. "disableGrid": false,
  31218. "splitNumber": 5,
  31219. "gridType": "dash",
  31220. "dashLength": 4,
  31221. "gridColor": "#CCCCCC",
  31222. "padding": 10,
  31223. "showTitle": true,
  31224. "data": []
  31225. },
  31226. "legend": {},
  31227. "extra": {
  31228. "mix": {
  31229. "column": {
  31230. "width": 20
  31231. }
  31232. }
  31233. }
  31234. },
  31235. "scatter": {
  31236. "type": "scatter",
  31237. "color": color,
  31238. "padding": [15, 15, 0, 15],
  31239. "dataLabel": false,
  31240. "xAxis": {
  31241. "disableGrid": false,
  31242. "gridType": "dash",
  31243. "splitNumber": 5,
  31244. "boundaryGap": "justify",
  31245. "min": 0
  31246. },
  31247. "yAxis": {
  31248. "disableGrid": false,
  31249. "gridType": "dash"
  31250. },
  31251. "legend": {},
  31252. "extra": {
  31253. "scatter": {}
  31254. }
  31255. },
  31256. "bubble": {
  31257. "type": "bubble",
  31258. "color": color,
  31259. "padding": [15, 15, 0, 15],
  31260. "xAxis": {
  31261. "disableGrid": false,
  31262. "gridType": "dash",
  31263. "splitNumber": 5,
  31264. "boundaryGap": "justify",
  31265. "min": 0,
  31266. "max": 250
  31267. },
  31268. "yAxis": {
  31269. "disableGrid": false,
  31270. "gridType": "dash",
  31271. "data": [{
  31272. "min": 0,
  31273. "max": 150
  31274. }]
  31275. },
  31276. "legend": {},
  31277. "extra": {
  31278. "bubble": {
  31279. "border": 2,
  31280. "opacity": 0.5
  31281. }
  31282. }
  31283. }
  31284. };
  31285. var _default = cfu;
  31286. exports.default = _default;
  31287. /***/ }),
  31288. /***/ 69:
  31289. /*!***********************************!*\
  31290. !*** E:/work/mdapp/utils/tool.js ***!
  31291. \***********************************/
  31292. /*! no static exports found */
  31293. /***/ (function(module, exports, __webpack_require__) {
  31294. "use strict";
  31295. /* WEBPACK VAR INJECTION */(function(uni) {
  31296. Object.defineProperty(exports, "__esModule", {
  31297. value: true
  31298. });
  31299. exports.msgBase = exports.getRandomNum = exports.confirmMsgFn = void 0;
  31300. var getRandomNum = function getRandomNum(len, radix) {
  31301. // getRandomNum(24, 16)
  31302. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  31303. var uuid = [];
  31304. radix = radix || chars.length;
  31305. if (len) {
  31306. // Compact form
  31307. for (var i = 0; i < len; i++) {
  31308. uuid[i] = chars[0 | Math.random() * radix];
  31309. }
  31310. } else {
  31311. // rfc4122, version 4 form
  31312. var r;
  31313. // rfc4122 requires these characters
  31314. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  31315. uuid[14] = '4';
  31316. // Fill in random data.  At i==19 set the high bits of clock sequence as
  31317. // per rfc4122, sec. 4.1.5
  31318. for (var _i = 0; _i < 36; _i++) {
  31319. if (!uuid[_i]) {
  31320. r = 0 | Math.random() * 16;
  31321. uuid[_i] = chars[_i === 19 ? r & 0x3 | 0x8 : r];
  31322. }
  31323. }
  31324. }
  31325. return uuid.join('') + new Date().getTime();
  31326. };
  31327. exports.getRandomNum = getRandomNum;
  31328. var msgBase = function msgBase(msgText, bc) {
  31329. uni.showToast({
  31330. title: msgText,
  31331. icon: 'none',
  31332. duration: 2000
  31333. }).then(function () {
  31334. if (bc) bc();
  31335. });
  31336. };
  31337. exports.msgBase = msgBase;
  31338. var confirmMsgFn = function confirmMsgFn(msgText, successBc, errorBc) {
  31339. var title = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '提示';
  31340. uni.showModal({
  31341. title: title,
  31342. content: msgText,
  31343. success: function success(res) {
  31344. if (res.confirm) {
  31345. if (successBc) successBc();
  31346. } else if (res.cancel) {
  31347. if (errorBc) errorBc();
  31348. }
  31349. }
  31350. });
  31351. };
  31352. exports.confirmMsgFn = confirmMsgFn;
  31353. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  31354. /***/ }),
  31355. /***/ 7:
  31356. /*!*********************************************************************!*\
  31357. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  31358. \*********************************************************************/
  31359. /*! no static exports found */
  31360. /***/ (function(module, exports) {
  31361. function _iterableToArrayLimit(arr, i) {
  31362. var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
  31363. if (null != _i) {
  31364. var _s,
  31365. _e,
  31366. _x,
  31367. _r,
  31368. _arr = [],
  31369. _n = !0,
  31370. _d = !1;
  31371. try {
  31372. if (_x = (_i = _i.call(arr)).next, 0 === i) {
  31373. if (Object(_i) !== _i) return;
  31374. _n = !1;
  31375. } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
  31376. ;
  31377. }
  31378. } catch (err) {
  31379. _d = !0, _e = err;
  31380. } finally {
  31381. try {
  31382. if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
  31383. } finally {
  31384. if (_d) throw _e;
  31385. }
  31386. }
  31387. return _arr;
  31388. }
  31389. }
  31390. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31391. /***/ }),
  31392. /***/ 8:
  31393. /*!***************************************************************************!*\
  31394. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  31395. \***************************************************************************/
  31396. /*! no static exports found */
  31397. /***/ (function(module, exports, __webpack_require__) {
  31398. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  31399. function _unsupportedIterableToArray(o, minLen) {
  31400. if (!o) return;
  31401. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  31402. var n = Object.prototype.toString.call(o).slice(8, -1);
  31403. if (n === "Object" && o.constructor) n = o.constructor.name;
  31404. if (n === "Map" || n === "Set") return Array.from(o);
  31405. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  31406. }
  31407. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31408. /***/ }),
  31409. /***/ 9:
  31410. /*!*****************************************************************!*\
  31411. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  31412. \*****************************************************************/
  31413. /*! no static exports found */
  31414. /***/ (function(module, exports) {
  31415. function _arrayLikeToArray(arr, len) {
  31416. if (len == null || len > arr.length) len = arr.length;
  31417. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  31418. arr2[i] = arr[i];
  31419. }
  31420. return arr2;
  31421. }
  31422. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31423. /***/ })
  31424. }]);
  31425. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map