vendor.js 1.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581
  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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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({"VUE_APP_DARK_MODE":"false","VUE_APP_NAME":"房票科技","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","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. apitradehouselist: function apitradehouselist(params) {
  22722. // 二手房 洪楼plus 房源列表
  22723. return (0, _http.request)('api/trade/house/list', params, 'loading');
  22724. }
  22725. };
  22726. exports.default = _default;
  22727. /***/ }),
  22728. /***/ 680:
  22729. /*!*************************************************************!*\
  22730. !*** E:/work/mdapp/pages.json?{"type":"origin-pages-json"} ***!
  22731. \*************************************************************/
  22732. /*! no static exports found */
  22733. /***/ (function(module, exports, __webpack_require__) {
  22734. "use strict";
  22735. Object.defineProperty(exports, "__esModule", {
  22736. value: true
  22737. });
  22738. exports.default = void 0;
  22739. var _default = {
  22740. "pages": [{
  22741. "path": "pages/index/index",
  22742. "style": {
  22743. "navigationBarTitleText": "首页"
  22744. }
  22745. }, {
  22746. "path": "pages/index/web",
  22747. "style": {
  22748. "navigationBarTitleText": "小程序使用说明",
  22749. "enablePullDownRefresh": false
  22750. }
  22751. }, {
  22752. "path": "pages/user/login/login",
  22753. "style": {
  22754. "navigationBarTitleText": "登录",
  22755. "enablePullDownRefresh": false
  22756. }
  22757. }, {
  22758. "path": "pages/user/login/register",
  22759. "style": {
  22760. "navigationBarTitleText": "注册",
  22761. "enablePullDownRefresh": false
  22762. }
  22763. }, {
  22764. "path": "pages/agent/recommend/create",
  22765. "style": {
  22766. "navigationBarTitleText": "客户推荐",
  22767. "enablePullDownRefresh": false
  22768. }
  22769. }, {
  22770. "path": "pages/agent/activity/list",
  22771. "style": {
  22772. "navigationBarTitleText": "活动列表",
  22773. "enablePullDownRefresh": false
  22774. }
  22775. }, {
  22776. "path": "pages/agent/activity/join",
  22777. "style": {
  22778. "navigationBarTitleText": "活动报名",
  22779. "enablePullDownRefresh": false
  22780. }
  22781. }, {
  22782. "path": "pages/agent/activity/join2",
  22783. "style": {
  22784. "navigationBarTitleText": "踩盘报名",
  22785. "enablePullDownRefresh": false
  22786. }
  22787. }, {
  22788. "path": "pages/agent/recommend/createin",
  22789. "style": {
  22790. "navigationBarTitleText": "内部报备",
  22791. "enablePullDownRefresh": false
  22792. }
  22793. }, {
  22794. "path": "pages/agent/recommend/list",
  22795. "style": {
  22796. "navigationStyle": "custom",
  22797. "enablePullDownRefresh": true
  22798. }
  22799. }, {
  22800. "path": "pages/agent/recommend/estate",
  22801. "style": {
  22802. "navigationStyle": "custom",
  22803. "enablePullDownRefresh": true
  22804. }
  22805. }, {
  22806. "path": "pages/agent/recommend/check",
  22807. "style": {
  22808. "navigationBarTitleText": "报备审核",
  22809. "enablePullDownRefresh": false
  22810. }
  22811. }, {
  22812. "path": "pages/agent/recommend/detail",
  22813. "style": {
  22814. "navigationBarTitleText": "报备详情",
  22815. "enablePullDownRefresh": false
  22816. }
  22817. }, {
  22818. "path": "pages/agent/recommend/detailGovern",
  22819. "style": {
  22820. "navigationBarTitleText": "报备详情",
  22821. "enablePullDownRefresh": false
  22822. }
  22823. }, {
  22824. "path": "pages/agent/recommend/visitimg",
  22825. "style": {
  22826. "navigationBarTitleText": "到访凭证和认购资料",
  22827. "enablePullDownRefresh": false
  22828. }
  22829. }, {
  22830. "path": "pages/agent/recommend/detail2",
  22831. "style": {
  22832. "navigationBarTitleText": "客户详情-案场",
  22833. "enablePullDownRefresh": false
  22834. }
  22835. }, {
  22836. "path": "pages/cust/create",
  22837. "style": {
  22838. "navigationBarTitleText": "添加客户",
  22839. "enablePullDownRefresh": false
  22840. }
  22841. }, {
  22842. "path": "pages/cust/list",
  22843. "style": {
  22844. "navigationBarTitleText": "客户列表",
  22845. "enablePullDownRefresh": true
  22846. }
  22847. }, {
  22848. "path": "pages/cust/mycreate",
  22849. "style": {
  22850. "navigationBarTitleText": "添加我的客户",
  22851. "enablePullDownRefresh": false
  22852. }
  22853. }, {
  22854. "path": "pages/cust/myrecord",
  22855. "style": {
  22856. "navigationBarTitleText": "客户跟进记录",
  22857. "enablePullDownRefresh": false
  22858. }
  22859. }, {
  22860. "path": "pages/cust/myrecordedit",
  22861. "style": {
  22862. "navigationBarTitleText": "客户跟进记录添加",
  22863. "enablePullDownRefresh": false
  22864. }
  22865. }, {
  22866. "path": "pages/cust/my",
  22867. "style": {
  22868. "navigationBarTitleText": "我的客户列表",
  22869. "enablePullDownRefresh": true
  22870. }
  22871. }, {
  22872. "path": "pages/user/setting/setting",
  22873. "style": {
  22874. "navigationBarTitleText": "设置",
  22875. "enablePullDownRefresh": false
  22876. }
  22877. }, {
  22878. "path": "pages/user/setting/profile",
  22879. "style": {
  22880. "navigationBarTitleText": "个人信息",
  22881. "enablePullDownRefresh": false
  22882. }
  22883. }, {
  22884. "path": "pages/user/setting/bank",
  22885. "style": {
  22886. "navigationBarTitleText": "认证身份信息",
  22887. "enablePullDownRefresh": false
  22888. }
  22889. }, {
  22890. "path": "pages/saler/list",
  22891. "style": {
  22892. "navigationBarTitleText": "我的门店",
  22893. "enablePullDownRefresh": false
  22894. }
  22895. }, {
  22896. "path": "pages/saler/check",
  22897. "style": {
  22898. "navigationBarTitleText": "认证审核列表",
  22899. "enablePullDownRefresh": false
  22900. }
  22901. }, {
  22902. "path": "pages/saler/deal",
  22903. "style": {
  22904. "navigationBarTitleText": "认证审核",
  22905. "enablePullDownRefresh": false
  22906. }
  22907. }, {
  22908. "path": "pages/agreement/agreement",
  22909. "style": {
  22910. "navigationBarTitleText": "用户协议",
  22911. "enablePullDownRefresh": false
  22912. }
  22913. }, {
  22914. "path": "pages/agreement/agreement2",
  22915. "style": {
  22916. "navigationBarTitleText": "隐私协议",
  22917. "enablePullDownRefresh": false
  22918. }
  22919. }, {
  22920. "path": "pages/estate/list",
  22921. "style": {
  22922. "navigationBarTitleText": "楼盘列表",
  22923. "enablePullDownRefresh": false
  22924. }
  22925. }, {
  22926. "path": "pages/estate/dtl",
  22927. "style": {
  22928. "navigationBarTitleText": "楼盘详情",
  22929. "enablePullDownRefresh": false
  22930. }
  22931. }, {
  22932. "path": "pages/estate/libPre",
  22933. "style": {
  22934. "navigationBarTitleText": "选择区域",
  22935. "enablePullDownRefresh": false
  22936. }
  22937. }, {
  22938. "path": "pages/estate/lib",
  22939. "style": {
  22940. "navigationBarTitleText": "内部各楼盘各平台佣金汇集(请勿外传)",
  22941. "enablePullDownRefresh": false
  22942. }
  22943. }, {
  22944. "path": "pages/agent/report/buycheck",
  22945. "style": {
  22946. "navigationBarTitleText": "认购审核列表",
  22947. "enablePullDownRefresh": false
  22948. }
  22949. }, {
  22950. "path": "pages/agent/report/deal",
  22951. "style": {
  22952. "navigationBarTitleText": "认购审核操作",
  22953. "enablePullDownRefresh": false
  22954. }
  22955. }, {
  22956. "path": "pages/user/setting/avatar",
  22957. "style": {
  22958. "navigationBarTitleText": "头像",
  22959. "enablePullDownRefresh": false
  22960. }
  22961. }, {
  22962. "path": "pages/trade/list",
  22963. "style": {
  22964. "navigationBarTitleText": "成交单列表",
  22965. "enablePullDownRefresh": false
  22966. }
  22967. }, {
  22968. "path": "pages/trade/create",
  22969. "style": {
  22970. "navigationBarTitleText": "添加成交单",
  22971. "enablePullDownRefresh": false
  22972. }
  22973. }, {
  22974. "path": "pages/trade/record",
  22975. "style": {
  22976. "navigationBarTitleText": "成交单详情",
  22977. "enablePullDownRefresh": false
  22978. }
  22979. }, {
  22980. "path": "pages/trade/check",
  22981. "style": {
  22982. "navigationBarTitleText": "成交单审核",
  22983. "enablePullDownRefresh": false
  22984. }
  22985. }, {
  22986. "path": "pages/trade/recordedit",
  22987. "style": {
  22988. "navigationBarTitleText": "成交单详情编辑",
  22989. "enablePullDownRefresh": false
  22990. }
  22991. }, {
  22992. "path": "pages/trade/recordTrade1",
  22993. "style": {
  22994. "navigationBarTitleText": "签订合同",
  22995. "enablePullDownRefresh": false
  22996. }
  22997. }, {
  22998. "path": "pages/trade/recordTrade2",
  22999. "style": {
  23000. "navigationBarTitleText": "合同流程",
  23001. "enablePullDownRefresh": false
  23002. }
  23003. }, {
  23004. "path": "pages/shop/chart",
  23005. "style": {
  23006. "navigationBarTitleText": "门店统计",
  23007. "enablePullDownRefresh": false
  23008. }
  23009. }, {
  23010. "path": "pages/shop/map",
  23011. "style": {
  23012. "navigationBarTitleText": "门店地图",
  23013. "enablePullDownRefresh": false
  23014. }
  23015. }],
  23016. "globalStyle": {
  23017. "navigationBarTextStyle": "white",
  23018. "navigationBarBackgroundColor": "#2080f0",
  23019. "navigationBarTitleText": "",
  23020. "backgroundColor": "#F8F8F8"
  23021. }
  23022. };
  23023. exports.default = _default;
  23024. /***/ }),
  23025. /***/ 681:
  23026. /*!************************************************!*\
  23027. !*** E:/work/mdapp/pages.json?{"type":"stat"} ***!
  23028. \************************************************/
  23029. /*! no static exports found */
  23030. /***/ (function(module, exports, __webpack_require__) {
  23031. "use strict";
  23032. Object.defineProperty(exports, "__esModule", {
  23033. value: true
  23034. });
  23035. exports.default = void 0;
  23036. var _default = {
  23037. "appid": "__UNI__1C40FB4"
  23038. };
  23039. exports.default = _default;
  23040. /***/ }),
  23041. /***/ 682:
  23042. /*!******************************************************************************!*\
  23043. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js ***!
  23044. \******************************************************************************/
  23045. /*! no static exports found */
  23046. /***/ (function(module, exports, __webpack_require__) {
  23047. "use strict";
  23048. /*
  23049. * uCharts (R)
  23050. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台
  23051. * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved.
  23052. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  23053. * 复制使用请保留本段注释,感谢支持开源!
  23054. *
  23055. * uCharts (R) 官方网站
  23056. * https://www.uCharts.cn
  23057. *
  23058. * 开源地址:
  23059. * https://gitee.com/uCharts/uCharts
  23060. *
  23061. * uni-app插件市场地址:
  23062. * http://ext.dcloud.net.cn/plugin?id=271
  23063. *
  23064. */
  23065. var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
  23066. Object.defineProperty(exports, "__esModule", {
  23067. value: true
  23068. });
  23069. exports.default = void 0;
  23070. var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ 5));
  23071. var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ 13));
  23072. var config = {
  23073. version: 'v2.5.0-20230101',
  23074. yAxisWidth: 15,
  23075. xAxisHeight: 22,
  23076. padding: [10, 10, 10, 10],
  23077. rotate: false,
  23078. fontSize: 13,
  23079. fontColor: '#666666',
  23080. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  23081. color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'],
  23082. linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', '#F78A85'],
  23083. pieChartLinePadding: 15,
  23084. pieChartTextPadding: 5,
  23085. titleFontSize: 20,
  23086. subtitleFontSize: 15,
  23087. radarLabelTextMargin: 13
  23088. };
  23089. var assign = function assign(target) {
  23090. for (var _len2 = arguments.length, varArgs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  23091. varArgs[_key2 - 1] = arguments[_key2];
  23092. }
  23093. if (target == null) {
  23094. throw new TypeError('[uCharts] Cannot convert undefined or null to object');
  23095. }
  23096. if (!varArgs || varArgs.length <= 0) {
  23097. return target;
  23098. }
  23099. // 深度合并对象
  23100. function deepAssign(obj1, obj2) {
  23101. for (var key in obj2) {
  23102. obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key];
  23103. }
  23104. return obj1;
  23105. }
  23106. varArgs.forEach(function (val) {
  23107. target = deepAssign(target, val);
  23108. });
  23109. return target;
  23110. };
  23111. var util = {
  23112. toFixed: function toFixed(num, limit) {
  23113. limit = limit || 2;
  23114. if (this.isFloat(num)) {
  23115. num = num.toFixed(limit);
  23116. }
  23117. return num;
  23118. },
  23119. isFloat: function isFloat(num) {
  23120. return num % 1 !== 0;
  23121. },
  23122. approximatelyEqual: function approximatelyEqual(num1, num2) {
  23123. return Math.abs(num1 - num2) < 1e-10;
  23124. },
  23125. isSameSign: function isSameSign(num1, num2) {
  23126. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  23127. },
  23128. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  23129. return this.isSameSign(p1.x, p2.x);
  23130. },
  23131. isCollision: function isCollision(obj1, obj2) {
  23132. obj1.end = {};
  23133. obj1.end.x = obj1.start.x + obj1.width;
  23134. obj1.end.y = obj1.start.y - obj1.height;
  23135. obj2.end = {};
  23136. obj2.end.x = obj2.start.x + obj2.width;
  23137. obj2.end.y = obj2.start.y - obj2.height;
  23138. 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;
  23139. return !flag;
  23140. }
  23141. };
  23142. //兼容H5点击事件
  23143. function getH5Offset(e) {
  23144. e.mp = {
  23145. changedTouches: []
  23146. };
  23147. e.mp.changedTouches.push({
  23148. x: e.offsetX,
  23149. y: e.offsetY
  23150. });
  23151. return e;
  23152. }
  23153. // hex 转 rgba
  23154. function hexToRgb(hexValue, opc) {
  23155. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  23156. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  23157. return r + r + g + g + b + b;
  23158. });
  23159. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  23160. var r = parseInt(rgb[1], 16);
  23161. var g = parseInt(rgb[2], 16);
  23162. var b = parseInt(rgb[3], 16);
  23163. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  23164. }
  23165. function findRange(num, type, limit) {
  23166. if (isNaN(num)) {
  23167. throw new Error('[uCharts] series数据需为Number格式');
  23168. }
  23169. limit = limit || 10;
  23170. type = type ? type : 'upper';
  23171. var multiple = 1;
  23172. while (limit < 1) {
  23173. limit *= 10;
  23174. multiple *= 10;
  23175. }
  23176. if (type === 'upper') {
  23177. num = Math.ceil(num * multiple);
  23178. } else {
  23179. num = Math.floor(num * multiple);
  23180. }
  23181. while (num % limit !== 0) {
  23182. if (type === 'upper') {
  23183. if (num == num + 1) {
  23184. //修复数据值过大num++无效的bug by 向日葵 @xrk_jy
  23185. break;
  23186. }
  23187. num++;
  23188. } else {
  23189. num--;
  23190. }
  23191. }
  23192. return num / multiple;
  23193. }
  23194. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  23195. var seriesTemp = [];
  23196. for (var k = 0; k < dayArr.length; k++) {
  23197. var seriesItem = {
  23198. data: [],
  23199. name: nameArr[k],
  23200. color: colorArr[k]
  23201. };
  23202. for (var i = 0, len = kdata.length; i < len; i++) {
  23203. if (i < dayArr[k]) {
  23204. seriesItem.data.push(null);
  23205. continue;
  23206. }
  23207. var sum = 0;
  23208. for (var j = 0; j < dayArr[k]; j++) {
  23209. sum += kdata[i - j][1];
  23210. }
  23211. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  23212. }
  23213. seriesTemp.push(seriesItem);
  23214. }
  23215. return seriesTemp;
  23216. }
  23217. function calValidDistance(self, distance, chartData, config, opts) {
  23218. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  23219. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  23220. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  23221. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  23222. dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing;
  23223. }
  23224. var validDistance = distance;
  23225. if (distance >= 0) {
  23226. validDistance = 0;
  23227. self.uevent.trigger('scrollLeft');
  23228. self.scrollOption.position = 'left';
  23229. opts.xAxis.scrollPosition = 'left';
  23230. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  23231. validDistance = dataChartAreaWidth - dataChartWidth;
  23232. self.uevent.trigger('scrollRight');
  23233. self.scrollOption.position = 'right';
  23234. opts.xAxis.scrollPosition = 'right';
  23235. } else {
  23236. self.scrollOption.position = distance;
  23237. opts.xAxis.scrollPosition = distance;
  23238. }
  23239. return validDistance;
  23240. }
  23241. function isInAngleRange(angle, startAngle, endAngle) {
  23242. function adjust(angle) {
  23243. while (angle < 0) {
  23244. angle += 2 * Math.PI;
  23245. }
  23246. while (angle > 2 * Math.PI) {
  23247. angle -= 2 * Math.PI;
  23248. }
  23249. return angle;
  23250. }
  23251. angle = adjust(angle);
  23252. startAngle = adjust(startAngle);
  23253. endAngle = adjust(endAngle);
  23254. if (startAngle > endAngle) {
  23255. endAngle += 2 * Math.PI;
  23256. if (angle < startAngle) {
  23257. angle += 2 * Math.PI;
  23258. }
  23259. }
  23260. return angle >= startAngle && angle <= endAngle;
  23261. }
  23262. function createCurveControlPoints(points, i) {
  23263. function isNotMiddlePoint(points, i) {
  23264. if (points[i - 1] && points[i + 1]) {
  23265. 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);
  23266. } else {
  23267. return false;
  23268. }
  23269. }
  23270. function isNotMiddlePointX(points, i) {
  23271. if (points[i - 1] && points[i + 1]) {
  23272. 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);
  23273. } else {
  23274. return false;
  23275. }
  23276. }
  23277. var a = 0.2;
  23278. var b = 0.2;
  23279. var pAx = null;
  23280. var pAy = null;
  23281. var pBx = null;
  23282. var pBy = null;
  23283. if (i < 1) {
  23284. pAx = points[0].x + (points[1].x - points[0].x) * a;
  23285. pAy = points[0].y + (points[1].y - points[0].y) * a;
  23286. } else {
  23287. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  23288. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  23289. }
  23290. if (i > points.length - 3) {
  23291. var last = points.length - 1;
  23292. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  23293. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  23294. } else {
  23295. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  23296. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  23297. }
  23298. if (isNotMiddlePoint(points, i + 1)) {
  23299. pBy = points[i + 1].y;
  23300. }
  23301. if (isNotMiddlePoint(points, i)) {
  23302. pAy = points[i].y;
  23303. }
  23304. if (isNotMiddlePointX(points, i + 1)) {
  23305. pBx = points[i + 1].x;
  23306. }
  23307. if (isNotMiddlePointX(points, i)) {
  23308. pAx = points[i].x;
  23309. }
  23310. if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) {
  23311. pAy = points[i].y;
  23312. }
  23313. if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) {
  23314. pBy = points[i + 1].y;
  23315. }
  23316. if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) {
  23317. pAx = points[i].x;
  23318. }
  23319. if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) {
  23320. pBx = points[i + 1].x;
  23321. }
  23322. return {
  23323. ctrA: {
  23324. x: pAx,
  23325. y: pAy
  23326. },
  23327. ctrB: {
  23328. x: pBx,
  23329. y: pBy
  23330. }
  23331. };
  23332. }
  23333. function convertCoordinateOrigin(x, y, center) {
  23334. return {
  23335. x: center.x + x,
  23336. y: center.y - y
  23337. };
  23338. }
  23339. function avoidCollision(obj, target) {
  23340. if (target) {
  23341. // is collision test
  23342. while (util.isCollision(obj, target)) {
  23343. if (obj.start.x > 0) {
  23344. obj.start.y--;
  23345. } else if (obj.start.x < 0) {
  23346. obj.start.y++;
  23347. } else {
  23348. if (obj.start.y > 0) {
  23349. obj.start.y++;
  23350. } else {
  23351. obj.start.y--;
  23352. }
  23353. }
  23354. }
  23355. }
  23356. return obj;
  23357. }
  23358. function fixPieSeries(series, opts, config) {
  23359. var pieSeriesArr = [];
  23360. if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) {
  23361. opts._pieSeries_ = series;
  23362. var oldseries = series[0].data;
  23363. for (var i = 0; i < oldseries.length; i++) {
  23364. oldseries[i].formatter = series[0].formatter;
  23365. oldseries[i].data = oldseries[i].value;
  23366. pieSeriesArr.push(oldseries[i]);
  23367. }
  23368. opts.series = pieSeriesArr;
  23369. } else {
  23370. pieSeriesArr = series;
  23371. }
  23372. return pieSeriesArr;
  23373. }
  23374. function fillSeries(series, opts, config) {
  23375. var index = 0;
  23376. for (var i = 0; i < series.length; i++) {
  23377. var item = series[i];
  23378. if (!item.color) {
  23379. item.color = config.color[index];
  23380. index = (index + 1) % config.color.length;
  23381. }
  23382. if (!item.linearIndex) {
  23383. item.linearIndex = i;
  23384. }
  23385. if (!item.index) {
  23386. item.index = 0;
  23387. }
  23388. if (!item.type) {
  23389. item.type = opts.type;
  23390. }
  23391. if (typeof item.show == "undefined") {
  23392. item.show = true;
  23393. }
  23394. if (!item.type) {
  23395. item.type = opts.type;
  23396. }
  23397. if (!item.pointShape) {
  23398. item.pointShape = "circle";
  23399. }
  23400. if (!item.legendShape) {
  23401. switch (item.type) {
  23402. case 'line':
  23403. item.legendShape = "line";
  23404. break;
  23405. case 'column':
  23406. case 'bar':
  23407. item.legendShape = "rect";
  23408. break;
  23409. case 'area':
  23410. case 'mount':
  23411. item.legendShape = "triangle";
  23412. break;
  23413. default:
  23414. item.legendShape = "circle";
  23415. }
  23416. }
  23417. }
  23418. return series;
  23419. }
  23420. function fillCustomColor(linearType, customColor, series, config) {
  23421. var newcolor = customColor || [];
  23422. if (linearType == 'custom' && newcolor.length == 0) {
  23423. newcolor = config.linearColor;
  23424. }
  23425. if (linearType == 'custom' && newcolor.length < series.length) {
  23426. var chazhi = series.length - newcolor.length;
  23427. for (var i = 0; i < chazhi; i++) {
  23428. newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]);
  23429. }
  23430. }
  23431. return newcolor;
  23432. }
  23433. function getDataRange(minData, maxData) {
  23434. var limit = 0;
  23435. var range = maxData - minData;
  23436. if (range >= 10000) {
  23437. limit = 1000;
  23438. } else if (range >= 1000) {
  23439. limit = 100;
  23440. } else if (range >= 100) {
  23441. limit = 10;
  23442. } else if (range >= 10) {
  23443. limit = 5;
  23444. } else if (range >= 1) {
  23445. limit = 1;
  23446. } else if (range >= 0.1) {
  23447. limit = 0.1;
  23448. } else if (range >= 0.01) {
  23449. limit = 0.01;
  23450. } else if (range >= 0.001) {
  23451. limit = 0.001;
  23452. } else if (range >= 0.0001) {
  23453. limit = 0.0001;
  23454. } else if (range >= 0.00001) {
  23455. limit = 0.00001;
  23456. } else {
  23457. limit = 0.000001;
  23458. }
  23459. return {
  23460. minRange: findRange(minData, 'lower', limit),
  23461. maxRange: findRange(maxData, 'upper', limit)
  23462. };
  23463. }
  23464. function measureText(text, fontSize, context) {
  23465. var width = 0;
  23466. text = String(text);
  23467. if (context !== false && context !== undefined && context.setFontSize && context.measureText) {
  23468. context.setFontSize(fontSize);
  23469. return context.measureText(text).width;
  23470. } else {
  23471. var text = text.split('');
  23472. for (var i = 0; i < text.length; i++) {
  23473. var item = text[i];
  23474. if (/[a-zA-Z]/.test(item)) {
  23475. width += 7;
  23476. } else if (/[0-9]/.test(item)) {
  23477. width += 5.5;
  23478. } else if (/\./.test(item)) {
  23479. width += 2.7;
  23480. } else if (/-/.test(item)) {
  23481. width += 3.25;
  23482. } else if (/:/.test(item)) {
  23483. width += 2.5;
  23484. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  23485. width += 10;
  23486. } else if (/\(|\)/.test(item)) {
  23487. width += 3.73;
  23488. } else if (/\s/.test(item)) {
  23489. width += 2.5;
  23490. } else if (/%/.test(item)) {
  23491. width += 8;
  23492. } else {
  23493. width += 10;
  23494. }
  23495. }
  23496. return width * fontSize / 10;
  23497. }
  23498. }
  23499. function dataCombine(series) {
  23500. return series.reduce(function (a, b) {
  23501. return (a.data ? a.data : a).concat(b.data);
  23502. }, []);
  23503. }
  23504. function dataCombineStack(series, len) {
  23505. var sum = new Array(len);
  23506. for (var j = 0; j < sum.length; j++) {
  23507. sum[j] = 0;
  23508. }
  23509. for (var i = 0; i < series.length; i++) {
  23510. for (var j = 0; j < sum.length; j++) {
  23511. sum[j] += series[i].data[j];
  23512. }
  23513. }
  23514. return series.reduce(function (a, b) {
  23515. return (a.data ? a.data : a).concat(b.data).concat(sum);
  23516. }, []);
  23517. }
  23518. function getTouches(touches, opts, e) {
  23519. var x, y;
  23520. if (touches.clientX) {
  23521. if (opts.rotate) {
  23522. y = opts.height - touches.clientX * opts.pix;
  23523. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23524. } else {
  23525. x = touches.clientX * opts.pix;
  23526. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pix / 2 * (opts.pix - 1)) * opts.pix;
  23527. }
  23528. } else {
  23529. if (opts.rotate) {
  23530. y = opts.height - touches.x * opts.pix;
  23531. x = touches.y * opts.pix;
  23532. } else {
  23533. x = touches.x * opts.pix;
  23534. y = touches.y * opts.pix;
  23535. }
  23536. }
  23537. return {
  23538. x: x,
  23539. y: y
  23540. };
  23541. }
  23542. function getSeriesDataItem(series, index, group) {
  23543. var data = [];
  23544. var newSeries = [];
  23545. var indexIsArr = index.constructor.toString().indexOf('Array') > -1;
  23546. if (indexIsArr) {
  23547. var tempSeries = filterSeries(series);
  23548. for (var i = 0; i < group.length; i++) {
  23549. newSeries.push(tempSeries[group[i]]);
  23550. }
  23551. } else {
  23552. newSeries = series;
  23553. }
  23554. ;
  23555. for (var _i = 0; _i < newSeries.length; _i++) {
  23556. var item = newSeries[_i];
  23557. var tmpindex = -1;
  23558. if (indexIsArr) {
  23559. tmpindex = index[_i];
  23560. } else {
  23561. tmpindex = index;
  23562. }
  23563. if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) {
  23564. var seriesItem = {};
  23565. seriesItem.color = item.color;
  23566. seriesItem.type = item.type;
  23567. seriesItem.style = item.style;
  23568. seriesItem.pointShape = item.pointShape;
  23569. seriesItem.disableLegend = item.disableLegend;
  23570. seriesItem.legendShape = item.legendShape;
  23571. seriesItem.name = item.name;
  23572. seriesItem.show = item.show;
  23573. seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex];
  23574. data.push(seriesItem);
  23575. }
  23576. }
  23577. return data;
  23578. }
  23579. function getMaxTextListLength(list, fontSize, context) {
  23580. var lengthList = list.map(function (item) {
  23581. return measureText(item, fontSize, context);
  23582. });
  23583. return Math.max.apply(null, lengthList);
  23584. }
  23585. function getRadarCoordinateSeries(length) {
  23586. var eachAngle = 2 * Math.PI / length;
  23587. var CoordinateSeries = [];
  23588. for (var i = 0; i < length; i++) {
  23589. CoordinateSeries.push(eachAngle * i);
  23590. }
  23591. return CoordinateSeries.map(function (item) {
  23592. return -1 * item + Math.PI / 2;
  23593. });
  23594. }
  23595. function getToolTipData(seriesData, opts, index, group, categories) {
  23596. var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
  23597. var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : [];
  23598. var points = {};
  23599. if (group.length > 0) {
  23600. var filterPoints = [];
  23601. for (var i = 0; i < group.length; i++) {
  23602. filterPoints.push(calPoints[group[i]]);
  23603. }
  23604. points = filterPoints[0][index[0]];
  23605. } else {
  23606. for (var _i2 = 0; _i2 < calPoints.length; _i2++) {
  23607. if (calPoints[_i2][index]) {
  23608. points = calPoints[_i2][index];
  23609. break;
  23610. }
  23611. }
  23612. }
  23613. ;
  23614. var textList = seriesData.map(function (item) {
  23615. var titleText = null;
  23616. if (opts.categories && opts.categories.length > 0) {
  23617. titleText = categories[index];
  23618. }
  23619. ;
  23620. return {
  23621. text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item.data,
  23622. color: item.color,
  23623. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23624. };
  23625. });
  23626. var offset = {
  23627. x: Math.round(points.x),
  23628. y: Math.round(points.y)
  23629. };
  23630. return {
  23631. textList: textList,
  23632. offset: offset
  23633. };
  23634. }
  23635. function getMixToolTipData(seriesData, opts, index, categories) {
  23636. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  23637. var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2;
  23638. var textList = seriesData.map(function (item) {
  23639. return {
  23640. text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + item.data,
  23641. color: item.color,
  23642. disableLegend: item.disableLegend ? true : false,
  23643. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23644. };
  23645. });
  23646. textList = textList.filter(function (item) {
  23647. if (item.disableLegend !== true) {
  23648. return item;
  23649. }
  23650. });
  23651. var offset = {
  23652. x: Math.round(points),
  23653. y: 0
  23654. };
  23655. return {
  23656. textList: textList,
  23657. offset: offset
  23658. };
  23659. }
  23660. function getCandleToolTipData(series, seriesData, opts, index, categories, extra) {
  23661. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  23662. var calPoints = opts.chartData.calPoints;
  23663. var upColor = extra.color.upFill;
  23664. var downColor = extra.color.downFill;
  23665. //颜色顺序为开盘,收盘,最低,最高
  23666. var color = [upColor, upColor, downColor, upColor];
  23667. var textList = [];
  23668. seriesData.map(function (item) {
  23669. if (index == 0) {
  23670. if (item.data[1] - item.data[0] < 0) {
  23671. color[1] = downColor;
  23672. } else {
  23673. color[1] = upColor;
  23674. }
  23675. } else {
  23676. if (item.data[0] < series[index - 1][1]) {
  23677. color[0] = downColor;
  23678. }
  23679. if (item.data[1] < item.data[0]) {
  23680. color[1] = downColor;
  23681. }
  23682. if (item.data[2] > series[index - 1][1]) {
  23683. color[2] = upColor;
  23684. }
  23685. if (item.data[3] < series[index - 1][1]) {
  23686. color[3] = downColor;
  23687. }
  23688. }
  23689. var text1 = {
  23690. text: '开盘:' + item.data[0],
  23691. color: color[0],
  23692. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23693. };
  23694. var text2 = {
  23695. text: '收盘:' + item.data[1],
  23696. color: color[1],
  23697. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23698. };
  23699. var text3 = {
  23700. text: '最低:' + item.data[2],
  23701. color: color[2],
  23702. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23703. };
  23704. var text4 = {
  23705. text: '最高:' + item.data[3],
  23706. color: color[3],
  23707. legendShape: opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : opts.extra.tooltip.legendShape
  23708. };
  23709. textList.push(text1, text2, text3, text4);
  23710. });
  23711. var validCalPoints = [];
  23712. var offset = {
  23713. x: 0,
  23714. y: 0
  23715. };
  23716. for (var i = 0; i < calPoints.length; i++) {
  23717. var points = calPoints[i];
  23718. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  23719. validCalPoints.push(points[index]);
  23720. }
  23721. }
  23722. offset.x = Math.round(validCalPoints[0][0].x);
  23723. return {
  23724. textList: textList,
  23725. offset: offset
  23726. };
  23727. }
  23728. function filterSeries(series) {
  23729. var tempSeries = [];
  23730. for (var i = 0; i < series.length; i++) {
  23731. if (series[i].show == true) {
  23732. tempSeries.push(series[i]);
  23733. }
  23734. }
  23735. return tempSeries;
  23736. }
  23737. function findCurrentIndex(currentPoints, calPoints, opts, config) {
  23738. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23739. var current = {
  23740. index: -1,
  23741. group: []
  23742. };
  23743. var spacing = opts.chartData.eachSpacing / 2;
  23744. var xAxisPoints = [];
  23745. if (calPoints && calPoints.length > 0) {
  23746. if (!opts.categories) {
  23747. spacing = 0;
  23748. } else {
  23749. for (var i = 1; i < opts.chartData.xAxisPoints.length; i++) {
  23750. xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing);
  23751. }
  23752. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  23753. xAxisPoints = opts.chartData.xAxisPoints;
  23754. }
  23755. }
  23756. if (isInExactChartArea(currentPoints, opts, config)) {
  23757. if (!opts.categories) {
  23758. var timePoints = Array(calPoints.length);
  23759. for (var _i3 = 0; _i3 < calPoints.length; _i3++) {
  23760. timePoints[_i3] = Array(calPoints[_i3].length);
  23761. for (var j = 0; j < calPoints[_i3].length; j++) {
  23762. timePoints[_i3][j] = Math.abs(calPoints[_i3][j].x - currentPoints.x);
  23763. }
  23764. }
  23765. ;
  23766. var pointValue = Array(timePoints.length);
  23767. var pointIndex = Array(timePoints.length);
  23768. for (var _i4 = 0; _i4 < timePoints.length; _i4++) {
  23769. pointValue[_i4] = Math.min.apply(null, timePoints[_i4]);
  23770. pointIndex[_i4] = timePoints[_i4].indexOf(pointValue[_i4]);
  23771. }
  23772. var minValue = Math.min.apply(null, pointValue);
  23773. current.index = [];
  23774. for (var _i5 = 0; _i5 < pointValue.length; _i5++) {
  23775. if (pointValue[_i5] == minValue) {
  23776. current.group.push(_i5);
  23777. current.index.push(pointIndex[_i5]);
  23778. }
  23779. }
  23780. ;
  23781. } else {
  23782. xAxisPoints.forEach(function (item, index) {
  23783. if (currentPoints.x + offset + spacing > item) {
  23784. current.index = index;
  23785. }
  23786. });
  23787. }
  23788. }
  23789. }
  23790. return current;
  23791. }
  23792. function findBarChartCurrentIndex(currentPoints, calPoints, opts, config) {
  23793. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  23794. var current = {
  23795. index: -1,
  23796. group: []
  23797. };
  23798. var spacing = opts.chartData.eachSpacing / 2;
  23799. var yAxisPoints = opts.chartData.yAxisPoints;
  23800. if (calPoints && calPoints.length > 0) {
  23801. if (isInExactChartArea(currentPoints, opts, config)) {
  23802. yAxisPoints.forEach(function (item, index) {
  23803. if (currentPoints.y + offset + spacing > item) {
  23804. current.index = index;
  23805. }
  23806. });
  23807. }
  23808. }
  23809. return current;
  23810. }
  23811. function findLegendIndex(currentPoints, legendData, opts) {
  23812. var currentIndex = -1;
  23813. var gap = 0;
  23814. if (isInExactLegendArea(currentPoints, legendData.area)) {
  23815. var points = legendData.points;
  23816. var index = -1;
  23817. for (var i = 0, len = points.length; i < len; i++) {
  23818. var item = points[i];
  23819. for (var j = 0; j < item.length; j++) {
  23820. index += 1;
  23821. var area = item[j]['area'];
  23822. if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > area[1] - gap && currentPoints.y < area[3] + gap) {
  23823. currentIndex = index;
  23824. break;
  23825. }
  23826. }
  23827. }
  23828. return currentIndex;
  23829. }
  23830. return currentIndex;
  23831. }
  23832. function isInExactLegendArea(currentPoints, area) {
  23833. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && currentPoints.y < area.end.y;
  23834. }
  23835. function isInExactChartArea(currentPoints, opts, config) {
  23836. 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];
  23837. }
  23838. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  23839. var eachAngleArea = 2 * Math.PI / count;
  23840. var currentIndex = -1;
  23841. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  23842. var fixAngle = function fixAngle(angle) {
  23843. if (angle < 0) {
  23844. angle += 2 * Math.PI;
  23845. }
  23846. if (angle > 2 * Math.PI) {
  23847. angle -= 2 * Math.PI;
  23848. }
  23849. return angle;
  23850. };
  23851. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  23852. angle = -1 * angle;
  23853. if (angle < 0) {
  23854. angle += 2 * Math.PI;
  23855. }
  23856. var angleList = radarData.angleList.map(function (item) {
  23857. item = fixAngle(-1 * item);
  23858. return item;
  23859. });
  23860. angleList.forEach(function (item, index) {
  23861. var rangeStart = fixAngle(item - eachAngleArea / 2);
  23862. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  23863. if (rangeEnd < rangeStart) {
  23864. rangeEnd += 2 * Math.PI;
  23865. }
  23866. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <= rangeEnd) {
  23867. currentIndex = index;
  23868. }
  23869. });
  23870. }
  23871. return currentIndex;
  23872. }
  23873. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  23874. var currentIndex = -1;
  23875. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  23876. var item = funnelData.series[i];
  23877. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  23878. currentIndex = i;
  23879. break;
  23880. }
  23881. }
  23882. return currentIndex;
  23883. }
  23884. function findWordChartCurrentIndex(currentPoints, wordData) {
  23885. var currentIndex = -1;
  23886. for (var i = 0, len = wordData.length; i < len; i++) {
  23887. var item = wordData[i];
  23888. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  23889. currentIndex = i;
  23890. break;
  23891. }
  23892. }
  23893. return currentIndex;
  23894. }
  23895. function findMapChartCurrentIndex(currentPoints, opts) {
  23896. var currentIndex = -1;
  23897. var cData = opts.chartData.mapData;
  23898. var data = opts.series;
  23899. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  23900. var poi = [tmp.x, tmp.y];
  23901. for (var i = 0, len = data.length; i < len; i++) {
  23902. var item = data[i].geometry.coordinates;
  23903. if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) {
  23904. currentIndex = i;
  23905. break;
  23906. }
  23907. }
  23908. return currentIndex;
  23909. }
  23910. function findRoseChartCurrentIndex(currentPoints, pieData, opts) {
  23911. var currentIndex = -1;
  23912. var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius);
  23913. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  23914. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  23915. angle = -angle;
  23916. if (opts.extra.rose && opts.extra.rose.offsetAngle) {
  23917. angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180;
  23918. }
  23919. for (var i = 0, len = series.length; i < len; i++) {
  23920. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math.PI)) {
  23921. currentIndex = i;
  23922. break;
  23923. }
  23924. }
  23925. }
  23926. return currentIndex;
  23927. }
  23928. function findPieChartCurrentIndex(currentPoints, pieData, opts) {
  23929. var currentIndex = -1;
  23930. var series = getPieDataPoints(pieData.series);
  23931. if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  23932. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  23933. angle = -angle;
  23934. if (opts.extra.pie && opts.extra.pie.offsetAngle) {
  23935. angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180;
  23936. }
  23937. if (opts.extra.ring && opts.extra.ring.offsetAngle) {
  23938. angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180;
  23939. }
  23940. for (var i = 0, len = series.length; i < len; i++) {
  23941. if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) {
  23942. currentIndex = i;
  23943. break;
  23944. }
  23945. }
  23946. }
  23947. return currentIndex;
  23948. }
  23949. function isInExactPieChartArea(currentPoints, center, radius) {
  23950. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  23951. }
  23952. function splitPoints(points, eachSeries) {
  23953. var newPoints = [];
  23954. var items = [];
  23955. points.forEach(function (item, index) {
  23956. if (eachSeries.connectNulls) {
  23957. if (item !== null) {
  23958. items.push(item);
  23959. }
  23960. } else {
  23961. if (item !== null) {
  23962. items.push(item);
  23963. } else {
  23964. if (items.length) {
  23965. newPoints.push(items);
  23966. }
  23967. items = [];
  23968. }
  23969. }
  23970. });
  23971. if (items.length) {
  23972. newPoints.push(items);
  23973. }
  23974. return newPoints;
  23975. }
  23976. function calLegendData(series, opts, config, chartData, context) {
  23977. var legendData = {
  23978. area: {
  23979. start: {
  23980. x: 0,
  23981. y: 0
  23982. },
  23983. end: {
  23984. x: 0,
  23985. y: 0
  23986. },
  23987. width: 0,
  23988. height: 0,
  23989. wholeWidth: 0,
  23990. wholeHeight: 0
  23991. },
  23992. points: [],
  23993. widthArr: [],
  23994. heightArr: []
  23995. };
  23996. if (opts.legend.show === false) {
  23997. chartData.legendData = legendData;
  23998. return legendData;
  23999. }
  24000. var padding = opts.legend.padding * opts.pix;
  24001. var margin = opts.legend.margin * opts.pix;
  24002. var fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize;
  24003. var shapeWidth = 15 * opts.pix;
  24004. var shapeRight = 5 * opts.pix;
  24005. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  24006. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  24007. var legendList = [];
  24008. var widthCount = 0;
  24009. var widthCountArr = [];
  24010. var currentRow = [];
  24011. for (var i = 0; i < series.length; i++) {
  24012. var item = series[i];
  24013. var legendText = item.legendText ? item.legendText : item.name;
  24014. var itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24015. if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) {
  24016. legendList.push(currentRow);
  24017. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24018. widthCount = itemWidth;
  24019. currentRow = [item];
  24020. } else {
  24021. widthCount += itemWidth;
  24022. currentRow.push(item);
  24023. }
  24024. }
  24025. if (currentRow.length) {
  24026. legendList.push(currentRow);
  24027. widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix);
  24028. legendData.widthArr = widthCountArr;
  24029. var legendWidth = Math.max.apply(null, widthCountArr);
  24030. switch (opts.legend.float) {
  24031. case 'left':
  24032. legendData.area.start.x = opts.area[3];
  24033. legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding;
  24034. break;
  24035. case 'right':
  24036. legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding;
  24037. legendData.area.end.x = opts.width - opts.area[1];
  24038. break;
  24039. default:
  24040. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  24041. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;
  24042. }
  24043. legendData.area.width = legendWidth + 2 * padding;
  24044. legendData.area.wholeWidth = legendWidth + 2 * padding;
  24045. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  24046. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  24047. legendData.points = legendList;
  24048. }
  24049. } else {
  24050. var len = series.length;
  24051. var maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding;
  24052. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  24053. legendData.area.height = maxLength * lineHeight + padding * 2;
  24054. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  24055. switch (opts.legend.float) {
  24056. case 'top':
  24057. legendData.area.start.y = opts.area[0] + margin;
  24058. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24059. break;
  24060. case 'bottom':
  24061. legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height;
  24062. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24063. break;
  24064. default:
  24065. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  24066. legendData.area.end.y = (opts.height + legendData.area.height) / 2;
  24067. }
  24068. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  24069. var _currentRow = [];
  24070. for (var _i6 = 0; _i6 < lineNum; _i6++) {
  24071. var temp = series.slice(_i6 * maxLength, _i6 * maxLength + maxLength);
  24072. _currentRow.push(temp);
  24073. }
  24074. legendData.points = _currentRow;
  24075. if (_currentRow.length) {
  24076. for (var _i7 = 0; _i7 < _currentRow.length; _i7++) {
  24077. var _item = _currentRow[_i7];
  24078. var maxWidth = 0;
  24079. for (var j = 0; j < _item.length; j++) {
  24080. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize, context) + opts.legend.itemGap * opts.pix;
  24081. if (_itemWidth > maxWidth) {
  24082. maxWidth = _itemWidth;
  24083. }
  24084. }
  24085. legendData.widthArr.push(maxWidth);
  24086. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  24087. }
  24088. var _legendWidth = 0;
  24089. for (var _i8 = 0; _i8 < legendData.widthArr.length; _i8++) {
  24090. _legendWidth += legendData.widthArr[_i8];
  24091. }
  24092. legendData.area.width = _legendWidth - opts.legend.itemGap * opts.pix + 2 * padding;
  24093. legendData.area.wholeWidth = legendData.area.width + padding;
  24094. }
  24095. }
  24096. switch (opts.legend.position) {
  24097. case 'top':
  24098. legendData.area.start.y = opts.area[0] + margin;
  24099. legendData.area.end.y = opts.area[0] + margin + legendData.area.height;
  24100. break;
  24101. case 'bottom':
  24102. legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin;
  24103. legendData.area.end.y = opts.height - opts.area[2] - margin;
  24104. break;
  24105. case 'left':
  24106. legendData.area.start.x = opts.area[3];
  24107. legendData.area.end.x = opts.area[3] + legendData.area.width;
  24108. break;
  24109. case 'right':
  24110. legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width;
  24111. legendData.area.end.x = opts.width - opts.area[1];
  24112. break;
  24113. }
  24114. chartData.legendData = legendData;
  24115. return legendData;
  24116. }
  24117. function calCategoriesData(categories, opts, config, eachSpacing, context) {
  24118. var result = {
  24119. angle: 0,
  24120. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24121. };
  24122. var fontSize = opts.xAxis.fontSize * opts.pix;
  24123. var categoriesTextLenth = categories.map(function (item, index) {
  24124. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  24125. return measureText(String(xitem), fontSize, context);
  24126. });
  24127. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  24128. if (opts.xAxis.rotateLabel == true) {
  24129. result.angle = opts.xAxis.rotateAngle * Math.PI / 180;
  24130. var tempHeight = opts.xAxis.marginTop * opts.pix * 2 + Math.abs(maxTextLength * Math.sin(result.angle));
  24131. tempHeight = tempHeight < fontSize + opts.xAxis.marginTop * opts.pix * 2 ? tempHeight + opts.xAxis.marginTop * opts.pix * 2 : tempHeight;
  24132. result.xAxisHeight = tempHeight;
  24133. }
  24134. if (opts.enableScroll && opts.xAxis.scrollShow) {
  24135. result.xAxisHeight += 6 * opts.pix;
  24136. }
  24137. if (opts.xAxis.disabled) {
  24138. result.xAxisHeight = 0;
  24139. }
  24140. return result;
  24141. }
  24142. function getXAxisTextList(series, opts, config, stack) {
  24143. var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1;
  24144. var data;
  24145. if (stack == 'stack') {
  24146. data = dataCombineStack(series, opts.categories.length);
  24147. } else {
  24148. data = dataCombine(series);
  24149. }
  24150. var sorted = [];
  24151. // remove null from data
  24152. data = data.filter(function (item) {
  24153. //return item !== null;
  24154. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24155. if (item.constructor.toString().indexOf('Array') > -1) {
  24156. return item !== null;
  24157. } else {
  24158. return item.value !== null;
  24159. }
  24160. } else {
  24161. return item !== null;
  24162. }
  24163. });
  24164. data.map(function (item) {
  24165. if ((0, _typeof2.default)(item) === 'object') {
  24166. if (item.constructor.toString().indexOf('Array') > -1) {
  24167. if (opts.type == 'candle') {
  24168. item.map(function (subitem) {
  24169. sorted.push(subitem);
  24170. });
  24171. } else {
  24172. sorted.push(item[0]);
  24173. }
  24174. } else {
  24175. sorted.push(item.value);
  24176. }
  24177. } else {
  24178. sorted.push(item);
  24179. }
  24180. });
  24181. var minData = 0;
  24182. var maxData = 0;
  24183. if (sorted.length > 0) {
  24184. minData = Math.min.apply(this, sorted);
  24185. maxData = Math.max.apply(this, sorted);
  24186. }
  24187. //为了兼容v1.9.0之前的项目
  24188. if (index > -1) {
  24189. if (typeof opts.xAxis.data[index].min === 'number') {
  24190. minData = Math.min(opts.xAxis.data[index].min, minData);
  24191. }
  24192. if (typeof opts.xAxis.data[index].max === 'number') {
  24193. maxData = Math.max(opts.xAxis.data[index].max, maxData);
  24194. }
  24195. } else {
  24196. if (typeof opts.xAxis.min === 'number') {
  24197. minData = Math.min(opts.xAxis.min, minData);
  24198. }
  24199. if (typeof opts.xAxis.max === 'number') {
  24200. maxData = Math.max(opts.xAxis.max, maxData);
  24201. }
  24202. }
  24203. if (minData === maxData) {
  24204. var rangeSpan = maxData || 10;
  24205. maxData += rangeSpan;
  24206. }
  24207. //var dataRange = getDataRange(minData, maxData);
  24208. var minRange = minData;
  24209. var maxRange = maxData;
  24210. var range = [];
  24211. var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber;
  24212. for (var i = 0; i <= opts.xAxis.splitNumber; i++) {
  24213. range.push(minRange + eachRange * i);
  24214. }
  24215. return range;
  24216. }
  24217. function calXAxisData(series, opts, config, context) {
  24218. //堆叠图重算Y轴
  24219. var columnstyle = assign({}, {
  24220. type: ""
  24221. }, opts.extra.bar);
  24222. var result = {
  24223. angle: 0,
  24224. xAxisHeight: opts.xAxis.lineHeight * opts.pix + opts.xAxis.marginTop * opts.pix
  24225. };
  24226. result.ranges = getXAxisTextList(series, opts, config, columnstyle.type);
  24227. result.rangesFormat = result.ranges.map(function (item) {
  24228. //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2);
  24229. item = util.toFixed(item, 2);
  24230. return item;
  24231. });
  24232. var xAxisScaleValues = result.ranges.map(function (item) {
  24233. // 如果刻度值是浮点数,则保留两位小数
  24234. item = util.toFixed(item, 2);
  24235. // 若有自定义格式则调用自定义的格式化函数
  24236. //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item;
  24237. return item;
  24238. });
  24239. result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config));
  24240. // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长
  24241. var eachSpacing = result.eachSpacing;
  24242. var textLength = xAxisScaleValues.map(function (item) {
  24243. return measureText(item, opts.xAxis.fontSize * opts.pix, context);
  24244. });
  24245. if (opts.xAxis.disabled === true) {
  24246. result.xAxisHeight = 0;
  24247. }
  24248. return result;
  24249. }
  24250. function getRadarDataPoints(angleList, center, radius, series, opts) {
  24251. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  24252. var radarOption = opts.extra.radar || {};
  24253. radarOption.max = radarOption.max || 0;
  24254. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  24255. var data = [];
  24256. var _loop2 = function _loop2(i) {
  24257. var each = series[i];
  24258. var listItem = {};
  24259. listItem.color = each.color;
  24260. listItem.legendShape = each.legendShape;
  24261. listItem.pointShape = each.pointShape;
  24262. listItem.data = [];
  24263. each.data.forEach(function (item, index) {
  24264. var tmp = {};
  24265. tmp.angle = angleList[index];
  24266. tmp.proportion = item / maxData;
  24267. tmp.value = item;
  24268. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion * process * Math.sin(tmp.angle), center);
  24269. listItem.data.push(tmp);
  24270. });
  24271. data.push(listItem);
  24272. };
  24273. for (var i = 0; i < series.length; i++) {
  24274. _loop2(i);
  24275. }
  24276. return data;
  24277. }
  24278. function getPieDataPoints(series, radius) {
  24279. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24280. var count = 0;
  24281. var _start_ = 0;
  24282. for (var i = 0; i < series.length; i++) {
  24283. var item = series[i];
  24284. item.data = item.data === null ? 0 : item.data;
  24285. count += item.data;
  24286. }
  24287. for (var _i9 = 0; _i9 < series.length; _i9++) {
  24288. var _item2 = series[_i9];
  24289. _item2.data = _item2.data === null ? 0 : _item2.data;
  24290. if (count === 0) {
  24291. _item2._proportion_ = 1 / series.length * process;
  24292. } else {
  24293. _item2._proportion_ = _item2.data / count * process;
  24294. }
  24295. _item2._radius_ = radius;
  24296. }
  24297. for (var _i10 = 0; _i10 < series.length; _i10++) {
  24298. var _item3 = series[_i10];
  24299. _item3._start_ = _start_;
  24300. _start_ += 2 * _item3._proportion_ * Math.PI;
  24301. }
  24302. return series;
  24303. }
  24304. function getFunnelDataPoints(series, radius, option, eachSpacing) {
  24305. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24306. for (var i = 0; i < series.length; i++) {
  24307. if (option.type == 'funnel') {
  24308. series[i].radius = series[i].data / series[0].data * radius * process;
  24309. } else {
  24310. series[i].radius = eachSpacing * (series.length - i) / (eachSpacing * series.length) * radius * process;
  24311. }
  24312. series[i]._proportion_ = series[i].data / series[0].data;
  24313. }
  24314. // if(option.type !== 'pyramid'){
  24315. // series.reverse();
  24316. // }
  24317. return series;
  24318. }
  24319. function getRoseDataPoints(series, type, minRadius, radius) {
  24320. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  24321. var count = 0;
  24322. var _start_ = 0;
  24323. var dataArr = [];
  24324. for (var i = 0; i < series.length; i++) {
  24325. var item = series[i];
  24326. item.data = item.data === null ? 0 : item.data;
  24327. count += item.data;
  24328. dataArr.push(item.data);
  24329. }
  24330. var minData = Math.min.apply(null, dataArr);
  24331. var maxData = Math.max.apply(null, dataArr);
  24332. var radiusLength = radius - minRadius;
  24333. for (var _i11 = 0; _i11 < series.length; _i11++) {
  24334. var _item4 = series[_i11];
  24335. _item4.data = _item4.data === null ? 0 : _item4.data;
  24336. if (count === 0) {
  24337. _item4._proportion_ = 1 / series.length * process;
  24338. _item4._rose_proportion_ = 1 / series.length * process;
  24339. } else {
  24340. _item4._proportion_ = _item4.data / count * process;
  24341. if (type == 'area') {
  24342. _item4._rose_proportion_ = 1 / series.length * process;
  24343. } else {
  24344. _item4._rose_proportion_ = _item4.data / count * process;
  24345. }
  24346. }
  24347. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData)) || radius;
  24348. }
  24349. for (var _i12 = 0; _i12 < series.length; _i12++) {
  24350. var _item5 = series[_i12];
  24351. _item5._start_ = _start_;
  24352. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  24353. }
  24354. return series;
  24355. }
  24356. function getArcbarDataPoints(series, arcbarOption) {
  24357. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24358. if (process == 1) {
  24359. process = 0.999999;
  24360. }
  24361. for (var i = 0; i < series.length; i++) {
  24362. var item = series[i];
  24363. item.data = item.data === null ? 0 : item.data;
  24364. var totalAngle = void 0;
  24365. if (arcbarOption.type == 'circle') {
  24366. totalAngle = 2;
  24367. } else {
  24368. if (arcbarOption.direction == 'ccw') {
  24369. if (arcbarOption.startAngle < arcbarOption.endAngle) {
  24370. totalAngle = 2 + arcbarOption.startAngle - arcbarOption.endAngle;
  24371. } else {
  24372. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24373. }
  24374. } else {
  24375. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24376. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24377. } else {
  24378. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24379. }
  24380. }
  24381. }
  24382. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24383. if (arcbarOption.direction == 'ccw') {
  24384. item._proportion_ = arcbarOption.startAngle - totalAngle * item.data * process;
  24385. }
  24386. if (item._proportion_ >= 2) {
  24387. item._proportion_ = item._proportion_ % 2;
  24388. }
  24389. }
  24390. return series;
  24391. }
  24392. function getGaugeArcbarDataPoints(series, arcbarOption) {
  24393. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  24394. if (process == 1) {
  24395. process = 0.999999;
  24396. }
  24397. for (var i = 0; i < series.length; i++) {
  24398. var item = series[i];
  24399. item.data = item.data === null ? 0 : item.data;
  24400. var totalAngle = void 0;
  24401. if (arcbarOption.type == 'circle') {
  24402. totalAngle = 2;
  24403. } else {
  24404. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  24405. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  24406. } else {
  24407. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  24408. }
  24409. }
  24410. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  24411. if (item._proportion_ >= 2) {
  24412. item._proportion_ = item._proportion_ % 2;
  24413. }
  24414. }
  24415. return series;
  24416. }
  24417. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  24418. var totalAngle;
  24419. if (endAngle < startAngle) {
  24420. totalAngle = 2 + endAngle - startAngle;
  24421. } else {
  24422. totalAngle = startAngle - endAngle;
  24423. }
  24424. var tempStartAngle = startAngle;
  24425. for (var i = 0; i < categories.length; i++) {
  24426. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  24427. categories[i]._startAngle_ = tempStartAngle;
  24428. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  24429. if (categories[i]._endAngle_ >= 2) {
  24430. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  24431. }
  24432. tempStartAngle = categories[i]._endAngle_;
  24433. }
  24434. return categories;
  24435. }
  24436. function getGaugeDataPoints(series, categories, gaugeOption) {
  24437. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  24438. for (var i = 0; i < series.length; i++) {
  24439. var item = series[i];
  24440. item.data = item.data === null ? 0 : item.data;
  24441. if (gaugeOption.pointer.color == 'auto') {
  24442. for (var _i13 = 0; _i13 < categories.length; _i13++) {
  24443. if (item.data <= categories[_i13].value) {
  24444. item.color = categories[_i13].color;
  24445. break;
  24446. }
  24447. }
  24448. } else {
  24449. item.color = gaugeOption.pointer.color;
  24450. }
  24451. var totalAngle = void 0;
  24452. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  24453. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  24454. } else {
  24455. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  24456. }
  24457. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  24458. item._oldAngle_ = gaugeOption.oldAngle;
  24459. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  24460. item._oldAngle_ += 2;
  24461. }
  24462. if (item.data >= gaugeOption.oldData) {
  24463. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  24464. } else {
  24465. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  24466. }
  24467. if (item._proportion_ >= 2) {
  24468. item._proportion_ = item._proportion_ % 2;
  24469. }
  24470. }
  24471. return series;
  24472. }
  24473. function getPieTextMaxLength(series, config, context, opts) {
  24474. series = getPieDataPoints(series);
  24475. var maxLength = 0;
  24476. for (var i = 0; i < series.length; i++) {
  24477. var item = series[i];
  24478. var text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  24479. maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context));
  24480. }
  24481. return maxLength;
  24482. }
  24483. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  24484. return points.map(function (item) {
  24485. if (item === null) {
  24486. return null;
  24487. }
  24488. var seriesGap = 0;
  24489. var categoryGap = 0;
  24490. if (opts.type == 'mix') {
  24491. seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0;
  24492. categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0;
  24493. } else {
  24494. seriesGap = opts.extra.column.seriesGap * opts.pix || 0;
  24495. categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24496. }
  24497. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24498. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24499. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24500. if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) {
  24501. item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix);
  24502. }
  24503. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24504. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24505. }
  24506. if (item.width <= 0) {
  24507. item.width = 1;
  24508. }
  24509. item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24510. return item;
  24511. });
  24512. }
  24513. function fixBarData(points, eachSpacing, columnLen, index, config, opts) {
  24514. return points.map(function (item) {
  24515. if (item === null) {
  24516. return null;
  24517. }
  24518. var seriesGap = 0;
  24519. var categoryGap = 0;
  24520. seriesGap = opts.extra.bar.seriesGap * opts.pix || 0;
  24521. categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24522. seriesGap = Math.min(seriesGap, eachSpacing / columnLen);
  24523. categoryGap = Math.min(categoryGap, eachSpacing / columnLen);
  24524. item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen);
  24525. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24526. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24527. }
  24528. if (item.width <= 0) {
  24529. item.width = 1;
  24530. }
  24531. item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap);
  24532. return item;
  24533. });
  24534. }
  24535. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  24536. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24537. return points.map(function (item) {
  24538. if (item === null) {
  24539. return null;
  24540. }
  24541. item.width = eachSpacing - 2 * categoryGap;
  24542. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24543. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24544. }
  24545. if (index > 0) {
  24546. item.width -= border;
  24547. }
  24548. return item;
  24549. });
  24550. }
  24551. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24552. var categoryGap = opts.extra.column.categoryGap * opts.pix || 0;
  24553. return points.map(function (item, indexn) {
  24554. if (item === null) {
  24555. return null;
  24556. }
  24557. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24558. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  24559. item.width = Math.min(item.width, +opts.extra.column.width * opts.pix);
  24560. }
  24561. if (item.width <= 0) {
  24562. item.width = 1;
  24563. }
  24564. return item;
  24565. });
  24566. }
  24567. function fixBarStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  24568. var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0;
  24569. return points.map(function (item, indexn) {
  24570. if (item === null) {
  24571. return null;
  24572. }
  24573. item.width = Math.ceil(eachSpacing - 2 * categoryGap);
  24574. if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) {
  24575. item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix);
  24576. }
  24577. if (item.width <= 0) {
  24578. item.width = 1;
  24579. }
  24580. return item;
  24581. });
  24582. }
  24583. function getXAxisPoints(categories, opts, config) {
  24584. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  24585. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  24586. if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  24587. dataCount -= 1;
  24588. }
  24589. var widthRatio = 0;
  24590. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  24591. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  24592. widthRatio = opts.extra.mount.widthRatio - 1;
  24593. dataCount += widthRatio;
  24594. }
  24595. var eachSpacing = spacingValid / dataCount;
  24596. var xAxisPoints = [];
  24597. var startX = opts.area[3];
  24598. var endX = opts.width - opts.area[1];
  24599. categories.forEach(function (item, index) {
  24600. xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing);
  24601. });
  24602. if (opts.xAxis.boundaryGap !== 'justify') {
  24603. if (opts.enableScroll === true) {
  24604. xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing);
  24605. } else {
  24606. xAxisPoints.push(endX);
  24607. }
  24608. }
  24609. return {
  24610. xAxisPoints: xAxisPoints,
  24611. startX: startX,
  24612. endX: endX,
  24613. eachSpacing: eachSpacing
  24614. };
  24615. }
  24616. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24617. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24618. var points = [];
  24619. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24620. data.forEach(function (item, index) {
  24621. if (item === null) {
  24622. points.push(null);
  24623. } else {
  24624. var cPoints = [];
  24625. item.forEach(function (items, indexs) {
  24626. var point = {};
  24627. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24628. var value = items.value || items;
  24629. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24630. height *= process;
  24631. point.y = opts.height - Math.round(height) - opts.area[2];
  24632. cPoints.push(point);
  24633. });
  24634. points.push(cPoints);
  24635. }
  24636. });
  24637. return points;
  24638. }
  24639. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  24640. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24641. var boundaryGap = 'center';
  24642. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  24643. boundaryGap = opts.xAxis.boundaryGap;
  24644. }
  24645. var points = [];
  24646. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24647. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24648. data.forEach(function (item, index) {
  24649. if (item === null) {
  24650. points.push(null);
  24651. } else {
  24652. var point = {};
  24653. point.color = item.color;
  24654. point.x = xAxisPoints[index];
  24655. var value = item;
  24656. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24657. if (item.constructor.toString().indexOf('Array') > -1) {
  24658. var xranges, xminRange, xmaxRange;
  24659. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24660. xminRange = xranges.shift();
  24661. xmaxRange = xranges.pop();
  24662. value = item[1];
  24663. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24664. if (opts.type == 'bubble') {
  24665. point.r = item[2];
  24666. point.t = item[3];
  24667. }
  24668. } else {
  24669. value = item.value;
  24670. }
  24671. }
  24672. if (boundaryGap == 'center') {
  24673. point.x += eachSpacing / 2;
  24674. }
  24675. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24676. height *= process;
  24677. point.y = opts.height - height - opts.area[2];
  24678. points.push(point);
  24679. }
  24680. });
  24681. return points;
  24682. }
  24683. function getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process) {
  24684. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24685. var boundaryGap = opts.xAxis.boundaryGap;
  24686. var points = [];
  24687. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24688. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24689. data.forEach(function (item, index) {
  24690. if (item === null) {
  24691. points.push(null);
  24692. } else {
  24693. var point = {};
  24694. point.color = item.color;
  24695. if (lineOption.animation == 'vertical') {
  24696. point.x = xAxisPoints[index];
  24697. var value = item;
  24698. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24699. if (item.constructor.toString().indexOf('Array') > -1) {
  24700. var xranges, xminRange, xmaxRange;
  24701. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24702. xminRange = xranges.shift();
  24703. xmaxRange = xranges.pop();
  24704. value = item[1];
  24705. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24706. } else {
  24707. value = item.value;
  24708. }
  24709. }
  24710. if (boundaryGap == 'center') {
  24711. point.x += eachSpacing / 2;
  24712. }
  24713. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24714. height *= process;
  24715. point.y = opts.height - height - opts.area[2];
  24716. points.push(point);
  24717. } else {
  24718. point.x = xAxisPoints[0] + eachSpacing * index * process;
  24719. var value = item;
  24720. if (boundaryGap == 'center') {
  24721. point.x += eachSpacing / 2;
  24722. }
  24723. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24724. point.y = opts.height - height - opts.area[2];
  24725. points.push(point);
  24726. }
  24727. }
  24728. });
  24729. return points;
  24730. }
  24731. function getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process) {
  24732. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24733. var points = [];
  24734. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24735. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24736. data.forEach(function (item, index) {
  24737. if (item === null) {
  24738. points.push(null);
  24739. } else {
  24740. var point = {};
  24741. point.color = item.color;
  24742. point.x = xAxisPoints[index];
  24743. var value = item;
  24744. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24745. if (item.constructor.toString().indexOf('Array') > -1) {
  24746. var xranges, xminRange, xmaxRange;
  24747. xranges = [].concat(opts.chartData.xAxisData.ranges);
  24748. xminRange = xranges.shift();
  24749. xmaxRange = xranges.pop();
  24750. value = item[1];
  24751. point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange);
  24752. } else {
  24753. value = item.value;
  24754. }
  24755. }
  24756. point.x += eachSpacing / 2;
  24757. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24758. point.y = opts.height - height - opts.area[2];
  24759. points.push(point);
  24760. }
  24761. });
  24762. return points;
  24763. }
  24764. function getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints) {
  24765. var process = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 1;
  24766. var points = [];
  24767. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24768. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24769. var mountWidth = eachSpacing * mountOption.widthRatio;
  24770. series.forEach(function (item, index) {
  24771. if (item === null) {
  24772. points.push(null);
  24773. } else {
  24774. var point = {};
  24775. point.color = item.color;
  24776. point.x = xAxisPoints[index];
  24777. point.x += eachSpacing / 2;
  24778. var value = item.data;
  24779. var height = validHeight * (value * process - minRange) / (maxRange - minRange);
  24780. point.y = opts.height - height - opts.area[2];
  24781. point.value = value;
  24782. point.width = mountWidth;
  24783. points.push(point);
  24784. }
  24785. });
  24786. return points;
  24787. }
  24788. function getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) {
  24789. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  24790. var points = [];
  24791. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24792. var validWidth = opts.width - opts.area[1] - opts.area[3];
  24793. data.forEach(function (item, index) {
  24794. if (item === null) {
  24795. points.push(null);
  24796. } else {
  24797. var point = {};
  24798. point.color = item.color;
  24799. point.y = yAxisPoints[index];
  24800. var value = item;
  24801. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24802. value = item.value;
  24803. }
  24804. var height = validWidth * (value - minRange) / (maxRange - minRange);
  24805. height *= process;
  24806. point.height = height;
  24807. point.value = value;
  24808. point.x = height + opts.area[3];
  24809. points.push(point);
  24810. }
  24811. });
  24812. return points;
  24813. }
  24814. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24815. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24816. var points = [];
  24817. var validHeight = opts.height - opts.area[0] - opts.area[2];
  24818. data.forEach(function (item, index) {
  24819. if (item === null) {
  24820. points.push(null);
  24821. } else {
  24822. var point = {};
  24823. point.color = item.color;
  24824. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  24825. if (seriesIndex > 0) {
  24826. var value = 0;
  24827. for (var i = 0; i <= seriesIndex; i++) {
  24828. value += stackSeries[i].data[index];
  24829. }
  24830. var value0 = value - item;
  24831. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24832. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  24833. } else {
  24834. var value = item;
  24835. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24836. value = item.value;
  24837. }
  24838. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24839. var height0 = 0;
  24840. }
  24841. var heightc = height0;
  24842. height *= process;
  24843. heightc *= process;
  24844. point.y = opts.height - Math.round(height) - opts.area[2];
  24845. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  24846. points.push(point);
  24847. }
  24848. });
  24849. return points;
  24850. }
  24851. function getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  24852. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  24853. var points = [];
  24854. var validHeight = opts.width - opts.area[1] - opts.area[3];
  24855. data.forEach(function (item, index) {
  24856. if (item === null) {
  24857. points.push(null);
  24858. } else {
  24859. var point = {};
  24860. point.color = item.color;
  24861. point.y = yAxisPoints[index];
  24862. if (seriesIndex > 0) {
  24863. var value = 0;
  24864. for (var i = 0; i <= seriesIndex; i++) {
  24865. value += stackSeries[i].data[index];
  24866. }
  24867. var value0 = value - item;
  24868. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24869. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  24870. } else {
  24871. var value = item;
  24872. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24873. value = item.value;
  24874. }
  24875. var height = validHeight * (value - minRange) / (maxRange - minRange);
  24876. var height0 = 0;
  24877. }
  24878. var heightc = height0;
  24879. height *= process;
  24880. heightc *= process;
  24881. point.height = height - heightc;
  24882. point.x = opts.area[3] + height;
  24883. point.x0 = opts.area[3] + heightc;
  24884. points.push(point);
  24885. }
  24886. });
  24887. return points;
  24888. }
  24889. function getYAxisTextList(series, opts, config, stack, yData) {
  24890. var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1;
  24891. var data;
  24892. if (stack == 'stack') {
  24893. data = dataCombineStack(series, opts.categories.length);
  24894. } else {
  24895. data = dataCombine(series);
  24896. }
  24897. var sorted = [];
  24898. // remove null from data
  24899. data = data.filter(function (item) {
  24900. //return item !== null;
  24901. if ((0, _typeof2.default)(item) === 'object' && item !== null) {
  24902. if (item.constructor.toString().indexOf('Array') > -1) {
  24903. return item !== null;
  24904. } else {
  24905. return item.value !== null;
  24906. }
  24907. } else {
  24908. return item !== null;
  24909. }
  24910. });
  24911. data.map(function (item) {
  24912. if ((0, _typeof2.default)(item) === 'object') {
  24913. if (item.constructor.toString().indexOf('Array') > -1) {
  24914. if (opts.type == 'candle') {
  24915. item.map(function (subitem) {
  24916. sorted.push(subitem);
  24917. });
  24918. } else {
  24919. sorted.push(item[1]);
  24920. }
  24921. } else {
  24922. sorted.push(item.value);
  24923. }
  24924. } else {
  24925. sorted.push(item);
  24926. }
  24927. });
  24928. var minData = yData.min || 0;
  24929. var maxData = yData.max || 0;
  24930. if (sorted.length > 0) {
  24931. minData = Math.min.apply(this, sorted);
  24932. maxData = Math.max.apply(this, sorted);
  24933. }
  24934. if (minData === maxData) {
  24935. if (maxData == 0) {
  24936. maxData = 10;
  24937. } else {
  24938. minData = 0;
  24939. }
  24940. }
  24941. var dataRange = getDataRange(minData, maxData);
  24942. var minRange = yData.min === undefined || yData.min === null ? dataRange.minRange : yData.min;
  24943. var maxRange = yData.max === undefined || yData.max === null ? dataRange.maxRange : yData.max;
  24944. var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber;
  24945. var range = [];
  24946. for (var i = 0; i <= opts.yAxis.splitNumber; i++) {
  24947. range.push(minRange + eachRange * i);
  24948. }
  24949. return range.reverse();
  24950. }
  24951. function calYAxisData(series, opts, config, context) {
  24952. //堆叠图重算Y轴
  24953. var columnstyle = assign({}, {
  24954. type: ""
  24955. }, opts.extra.column);
  24956. //如果是多Y轴,重新计算
  24957. var YLength = opts.yAxis.data.length;
  24958. var newSeries = new Array(YLength);
  24959. if (YLength > 0) {
  24960. for (var i = 0; i < YLength; i++) {
  24961. newSeries[i] = [];
  24962. for (var j = 0; j < series.length; j++) {
  24963. if (series[j].index == i) {
  24964. newSeries[i].push(series[j]);
  24965. }
  24966. }
  24967. }
  24968. var rangesArr = new Array(YLength);
  24969. var rangesFormatArr = new Array(YLength);
  24970. var yAxisWidthArr = new Array(YLength);
  24971. var _loop3 = function _loop3(_i14) {
  24972. var yData = opts.yAxis.data[_i14];
  24973. //如果总开关不显示,强制每个Y轴为不显示
  24974. if (opts.yAxis.disabled == true) {
  24975. yData.disabled = true;
  24976. }
  24977. if (yData.type === 'categories') {
  24978. if (!yData.formatter) {
  24979. yData.formatter = function (val, index, opts) {
  24980. return val + (yData.unit || '');
  24981. };
  24982. }
  24983. yData.categories = yData.categories || opts.categories;
  24984. rangesArr[_i14] = yData.categories;
  24985. } else {
  24986. if (!yData.formatter) {
  24987. yData.formatter = function (val, index, opts) {
  24988. return util.toFixed(val, yData.tofix || 0) + (yData.unit || '');
  24989. };
  24990. }
  24991. rangesArr[_i14] = getYAxisTextList(newSeries[_i14], opts, config, columnstyle.type, yData, _i14);
  24992. }
  24993. var yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize;
  24994. yAxisWidthArr[_i14] = {
  24995. position: yData.position ? yData.position : 'left',
  24996. width: 0
  24997. };
  24998. rangesFormatArr[_i14] = rangesArr[_i14].map(function (items, index) {
  24999. items = yData.formatter(items, index, opts);
  25000. yAxisWidthArr[_i14].width = Math.max(yAxisWidthArr[_i14].width, measureText(items, yAxisFontSizes, context) + 5);
  25001. return items;
  25002. });
  25003. var calibration = yData.calibration ? 4 * opts.pix : 0;
  25004. yAxisWidthArr[_i14].width += calibration + 3 * opts.pix;
  25005. if (yData.disabled === true) {
  25006. yAxisWidthArr[_i14].width = 0;
  25007. }
  25008. };
  25009. for (var _i14 = 0; _i14 < YLength; _i14++) {
  25010. _loop3(_i14);
  25011. }
  25012. } else {
  25013. var rangesArr = new Array(1);
  25014. var rangesFormatArr = new Array(1);
  25015. var yAxisWidthArr = new Array(1);
  25016. if (opts.type === 'bar') {
  25017. rangesArr[0] = opts.categories;
  25018. if (!opts.yAxis.formatter) {
  25019. opts.yAxis.formatter = function (val, index, opts) {
  25020. return val + (opts.yAxis.unit || '');
  25021. };
  25022. }
  25023. } else {
  25024. if (!opts.yAxis.formatter) {
  25025. opts.yAxis.formatter = function (val, index, opts) {
  25026. return val.toFixed(opts.yAxis.tofix) + (opts.yAxis.unit || '');
  25027. };
  25028. }
  25029. rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {});
  25030. }
  25031. yAxisWidthArr[0] = {
  25032. position: 'left',
  25033. width: 0
  25034. };
  25035. var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize;
  25036. rangesFormatArr[0] = rangesArr[0].map(function (item, index) {
  25037. item = opts.yAxis.formatter(item, index, opts);
  25038. yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, context) + 5);
  25039. return item;
  25040. });
  25041. yAxisWidthArr[0].width += 3 * opts.pix;
  25042. if (opts.yAxis.disabled === true) {
  25043. yAxisWidthArr[0] = {
  25044. position: 'left',
  25045. width: 0
  25046. };
  25047. opts.yAxis.data[0] = {
  25048. disabled: true
  25049. };
  25050. } else {
  25051. opts.yAxis.data[0] = {
  25052. disabled: false,
  25053. position: 'left',
  25054. max: opts.yAxis.max,
  25055. min: opts.yAxis.min,
  25056. formatter: opts.yAxis.formatter
  25057. };
  25058. if (opts.type === 'bar') {
  25059. opts.yAxis.data[0].categories = opts.categories;
  25060. opts.yAxis.data[0].type = 'categories';
  25061. }
  25062. }
  25063. }
  25064. return {
  25065. rangesFormat: rangesFormatArr,
  25066. ranges: rangesArr,
  25067. yAxisWidth: yAxisWidthArr
  25068. };
  25069. }
  25070. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  25071. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  25072. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25073. var minAxis = opts.area[0];
  25074. var items = [];
  25075. for (var i = 0; i < ranges.length; i++) {
  25076. var maxVal = Math.max.apply(this, ranges[i]);
  25077. var minVal = Math.min.apply(this, ranges[i]);
  25078. var item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid;
  25079. item = opts.yAxis.data && opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item, i, opts) : item.toFixed(0);
  25080. items.push(String(item));
  25081. }
  25082. return items;
  25083. }
  25084. function calMarkLineData(points, opts) {
  25085. var minRange, maxRange;
  25086. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25087. for (var i = 0; i < points.length; i++) {
  25088. points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0;
  25089. var range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]);
  25090. minRange = range.pop();
  25091. maxRange = range.shift();
  25092. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  25093. points[i].y = opts.height - Math.round(height) - opts.area[2];
  25094. }
  25095. return points;
  25096. }
  25097. function contextRotate(context, opts) {
  25098. if (opts.rotateLock !== true) {
  25099. context.translate(opts.height, 0);
  25100. context.rotate(90 * Math.PI / 180);
  25101. } else if (opts._rotate_ !== true) {
  25102. context.translate(opts.height, 0);
  25103. context.rotate(90 * Math.PI / 180);
  25104. opts._rotate_ = true;
  25105. }
  25106. }
  25107. function drawPointShape(points, color, shape, context, opts) {
  25108. context.beginPath();
  25109. if (opts.dataPointShapeType == 'hollow') {
  25110. context.setStrokeStyle(color);
  25111. context.setFillStyle(opts.background);
  25112. context.setLineWidth(2 * opts.pix);
  25113. } else {
  25114. context.setStrokeStyle("#ffffff");
  25115. context.setFillStyle(color);
  25116. context.setLineWidth(1 * opts.pix);
  25117. }
  25118. if (shape === 'diamond') {
  25119. points.forEach(function (item, index) {
  25120. if (item !== null) {
  25121. context.moveTo(item.x, item.y - 4.5);
  25122. context.lineTo(item.x - 4.5, item.y);
  25123. context.lineTo(item.x, item.y + 4.5);
  25124. context.lineTo(item.x + 4.5, item.y);
  25125. context.lineTo(item.x, item.y - 4.5);
  25126. }
  25127. });
  25128. } else if (shape === 'circle') {
  25129. points.forEach(function (item, index) {
  25130. if (item !== null) {
  25131. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25132. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25133. }
  25134. });
  25135. } else if (shape === 'square') {
  25136. points.forEach(function (item, index) {
  25137. if (item !== null) {
  25138. context.moveTo(item.x - 3.5, item.y - 3.5);
  25139. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25140. }
  25141. });
  25142. } else if (shape === 'triangle') {
  25143. points.forEach(function (item, index) {
  25144. if (item !== null) {
  25145. context.moveTo(item.x, item.y - 4.5);
  25146. context.lineTo(item.x - 4.5, item.y + 4.5);
  25147. context.lineTo(item.x + 4.5, item.y + 4.5);
  25148. context.lineTo(item.x, item.y - 4.5);
  25149. }
  25150. });
  25151. } else if (shape === 'none') {
  25152. return;
  25153. }
  25154. context.closePath();
  25155. context.fill();
  25156. context.stroke();
  25157. }
  25158. function drawActivePoint(points, color, shape, context, opts, option, seriesIndex) {
  25159. if (!opts.tooltip) {
  25160. return;
  25161. }
  25162. if (opts.tooltip.group.length > 0 && opts.tooltip.group.includes(seriesIndex) == false) {
  25163. return;
  25164. }
  25165. var pointIndex = typeof opts.tooltip.index === 'number' ? opts.tooltip.index : opts.tooltip.index[opts.tooltip.group.indexOf(seriesIndex)];
  25166. context.beginPath();
  25167. if (option.activeType == 'hollow') {
  25168. context.setStrokeStyle(color);
  25169. context.setFillStyle(opts.background);
  25170. context.setLineWidth(2 * opts.pix);
  25171. } else {
  25172. context.setStrokeStyle("#ffffff");
  25173. context.setFillStyle(color);
  25174. context.setLineWidth(1 * opts.pix);
  25175. }
  25176. if (shape === 'diamond') {
  25177. points.forEach(function (item, index) {
  25178. if (item !== null && pointIndex == index) {
  25179. context.moveTo(item.x, item.y - 4.5);
  25180. context.lineTo(item.x - 4.5, item.y);
  25181. context.lineTo(item.x, item.y + 4.5);
  25182. context.lineTo(item.x + 4.5, item.y);
  25183. context.lineTo(item.x, item.y - 4.5);
  25184. }
  25185. });
  25186. } else if (shape === 'circle') {
  25187. points.forEach(function (item, index) {
  25188. if (item !== null && pointIndex == index) {
  25189. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  25190. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  25191. }
  25192. });
  25193. } else if (shape === 'square') {
  25194. points.forEach(function (item, index) {
  25195. if (item !== null && pointIndex == index) {
  25196. context.moveTo(item.x - 3.5, item.y - 3.5);
  25197. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  25198. }
  25199. });
  25200. } else if (shape === 'triangle') {
  25201. points.forEach(function (item, index) {
  25202. if (item !== null && pointIndex == index) {
  25203. context.moveTo(item.x, item.y - 4.5);
  25204. context.lineTo(item.x - 4.5, item.y + 4.5);
  25205. context.lineTo(item.x + 4.5, item.y + 4.5);
  25206. context.lineTo(item.x, item.y - 4.5);
  25207. }
  25208. });
  25209. } else if (shape === 'none') {
  25210. return;
  25211. }
  25212. context.closePath();
  25213. context.fill();
  25214. context.stroke();
  25215. }
  25216. function drawRingTitle(opts, config, context, center) {
  25217. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  25218. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  25219. var title = opts.title.name || '';
  25220. var subtitle = opts.subtitle.name || '';
  25221. var titleFontColor = opts.title.color || opts.fontColor;
  25222. var subtitleFontColor = opts.subtitle.color || opts.fontColor;
  25223. var titleHeight = title ? titlefontSize : 0;
  25224. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  25225. var margin = 5;
  25226. if (subtitle) {
  25227. var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context);
  25228. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix;
  25229. var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix;
  25230. if (title) {
  25231. startY += (titleHeight * opts.pix + margin) / 2;
  25232. }
  25233. context.beginPath();
  25234. context.setFontSize(subtitlefontSize * opts.pix);
  25235. context.setFillStyle(subtitleFontColor);
  25236. context.fillText(subtitle, startX, startY);
  25237. context.closePath();
  25238. context.stroke();
  25239. }
  25240. if (title) {
  25241. var _textWidth = measureText(title, titlefontSize * opts.pix, context);
  25242. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  25243. var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix;
  25244. if (subtitle) {
  25245. _startY -= (subtitleHeight * opts.pix + margin) / 2;
  25246. }
  25247. context.beginPath();
  25248. context.setFontSize(titlefontSize * opts.pix);
  25249. context.setFillStyle(titleFontColor);
  25250. context.fillText(title, _startX, _startY);
  25251. context.closePath();
  25252. context.stroke();
  25253. }
  25254. }
  25255. function drawPointText(points, series, config, context, opts) {
  25256. // 绘制数据文案
  25257. var data = series.data;
  25258. var textOffset = series.textOffset ? series.textOffset : 0;
  25259. points.forEach(function (item, index) {
  25260. if (item !== null) {
  25261. context.beginPath();
  25262. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25263. context.setFontSize(fontSize);
  25264. context.setFillStyle(series.textColor || opts.fontColor);
  25265. var value = data[index];
  25266. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25267. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25268. value = data[index][1];
  25269. } else {
  25270. value = data[index].value;
  25271. }
  25272. }
  25273. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25274. context.setTextAlign('center');
  25275. context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix);
  25276. context.closePath();
  25277. context.stroke();
  25278. context.setTextAlign('left');
  25279. }
  25280. });
  25281. }
  25282. function drawColumePointText(points, series, config, context, opts) {
  25283. // 绘制数据文案
  25284. var data = series.data;
  25285. var textOffset = series.textOffset ? series.textOffset : 0;
  25286. var Position = opts.extra.column.labelPosition;
  25287. points.forEach(function (item, index) {
  25288. if (item !== null) {
  25289. context.beginPath();
  25290. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25291. context.setFontSize(fontSize);
  25292. context.setFillStyle(series.textColor || opts.fontColor);
  25293. var value = data[index];
  25294. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25295. if (data[index].constructor.toString().indexOf('Array') > -1) {
  25296. value = data[index][1];
  25297. } else {
  25298. value = data[index].value;
  25299. }
  25300. }
  25301. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25302. context.setTextAlign('center');
  25303. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25304. if (item.y > series.zeroPoints) {
  25305. startY = item.y + textOffset * opts.pix + fontSize;
  25306. }
  25307. if (Position == 'insideTop') {
  25308. startY = item.y + fontSize + textOffset * opts.pix;
  25309. if (item.y > series.zeroPoints) {
  25310. startY = item.y - textOffset * opts.pix - 4 * opts.pix;
  25311. }
  25312. }
  25313. if (Position == 'center') {
  25314. startY = item.y + textOffset * opts.pix + (opts.height - opts.area[2] - item.y + fontSize) / 2;
  25315. if (series.zeroPoints < opts.height - opts.area[2]) {
  25316. startY = item.y + textOffset * opts.pix + (series.zeroPoints - item.y + fontSize) / 2;
  25317. }
  25318. if (item.y > series.zeroPoints) {
  25319. startY = item.y - textOffset * opts.pix - (item.y - series.zeroPoints - fontSize) / 2;
  25320. }
  25321. if (opts.extra.column.type == 'stack') {
  25322. startY = item.y + textOffset * opts.pix + (item.y0 - item.y + fontSize) / 2;
  25323. }
  25324. }
  25325. if (Position == 'bottom') {
  25326. startY = opts.height - opts.area[2] + textOffset * opts.pix - 4 * opts.pix;
  25327. if (series.zeroPoints < opts.height - opts.area[2]) {
  25328. startY = series.zeroPoints + textOffset * opts.pix - 4 * opts.pix;
  25329. }
  25330. if (item.y > series.zeroPoints) {
  25331. startY = series.zeroPoints - textOffset * opts.pix + fontSize + 2 * opts.pix;
  25332. }
  25333. if (opts.extra.column.type == 'stack') {
  25334. startY = item.y0 + textOffset * opts.pix - 4 * opts.pix;
  25335. }
  25336. }
  25337. context.fillText(String(formatVal), item.x, startY);
  25338. context.closePath();
  25339. context.stroke();
  25340. context.setTextAlign('left');
  25341. }
  25342. });
  25343. }
  25344. function drawMountPointText(points, series, config, context, opts, zeroPoints) {
  25345. // 绘制数据文案
  25346. var data = series.data;
  25347. var textOffset = series.textOffset ? series.textOffset : 0;
  25348. var Position = opts.extra.mount.labelPosition;
  25349. points.forEach(function (item, index) {
  25350. if (item !== null) {
  25351. context.beginPath();
  25352. var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize;
  25353. context.setFontSize(fontSize);
  25354. context.setFillStyle(series[index].textColor || opts.fontColor);
  25355. var value = item.value;
  25356. var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : value;
  25357. context.setTextAlign('center');
  25358. var startY = item.y - 4 * opts.pix + textOffset * opts.pix;
  25359. if (item.y > zeroPoints) {
  25360. startY = item.y + textOffset * opts.pix + fontSize;
  25361. }
  25362. context.fillText(String(formatVal), item.x, startY);
  25363. context.closePath();
  25364. context.stroke();
  25365. context.setTextAlign('left');
  25366. }
  25367. });
  25368. }
  25369. function drawBarPointText(points, series, config, context, opts) {
  25370. // 绘制数据文案
  25371. var data = series.data;
  25372. var textOffset = series.textOffset ? series.textOffset : 0;
  25373. points.forEach(function (item, index) {
  25374. if (item !== null) {
  25375. context.beginPath();
  25376. var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize;
  25377. context.setFontSize(fontSize);
  25378. context.setFillStyle(series.textColor || opts.fontColor);
  25379. var value = data[index];
  25380. if ((0, _typeof2.default)(data[index]) === 'object' && data[index] !== null) {
  25381. value = data[index].value;
  25382. }
  25383. var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value;
  25384. context.setTextAlign('left');
  25385. context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3);
  25386. context.closePath();
  25387. context.stroke();
  25388. }
  25389. });
  25390. }
  25391. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  25392. radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix;
  25393. radius = radius < 10 ? 10 : radius;
  25394. var totalAngle;
  25395. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  25396. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  25397. } else {
  25398. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  25399. }
  25400. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  25401. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  25402. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  25403. var nowAngle = gaugeOption.startAngle;
  25404. var nowNumber = gaugeOption.startNumber;
  25405. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  25406. var pos = {
  25407. x: radius * Math.cos(nowAngle * Math.PI),
  25408. y: radius * Math.sin(nowAngle * Math.PI)
  25409. };
  25410. var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber;
  25411. pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2;
  25412. pos.y += centerPosition.y;
  25413. var startX = pos.x;
  25414. var startY = pos.y;
  25415. context.beginPath();
  25416. context.setFontSize(config.fontSize);
  25417. context.setFillStyle(gaugeOption.labelColor || opts.fontColor);
  25418. context.fillText(labelText, startX, startY + config.fontSize / 2);
  25419. context.closePath();
  25420. context.stroke();
  25421. nowAngle += splitAngle;
  25422. if (nowAngle >= 2) {
  25423. nowAngle = nowAngle % 2;
  25424. }
  25425. nowNumber += splitNumber;
  25426. }
  25427. }
  25428. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  25429. var radarOption = opts.extra.radar || {};
  25430. angleList.forEach(function (angle, index) {
  25431. if (radarOption.labelPointShow === true && opts.categories[index] !== '') {
  25432. var posPoint = {
  25433. x: radius * Math.cos(angle),
  25434. y: radius * Math.sin(angle)
  25435. };
  25436. var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition);
  25437. context.setFillStyle(radarOption.labelPointColor);
  25438. context.beginPath();
  25439. context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, false);
  25440. context.closePath();
  25441. context.fill();
  25442. }
  25443. if (radarOption.labelShow === true) {
  25444. var pos = {
  25445. x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle),
  25446. y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle)
  25447. };
  25448. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  25449. var startX = posRelativeCanvas.x;
  25450. var startY = posRelativeCanvas.y;
  25451. if (util.approximatelyEqual(pos.x, 0)) {
  25452. startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2;
  25453. } else if (pos.x < 0) {
  25454. startX -= measureText(opts.categories[index] || '', config.fontSize, context);
  25455. }
  25456. context.beginPath();
  25457. context.setFontSize(config.fontSize);
  25458. context.setFillStyle(radarOption.labelColor || opts.fontColor);
  25459. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  25460. context.closePath();
  25461. context.stroke();
  25462. }
  25463. });
  25464. }
  25465. function drawPieText(series, opts, config, context, radius, center) {
  25466. var lineRadius = config.pieChartLinePadding;
  25467. var textObjectCollection = [];
  25468. var lastTextObject = null;
  25469. var seriesConvert = series.map(function (item, index) {
  25470. var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  25471. text = item.labelText ? item.labelText : text;
  25472. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  25473. if (item._rose_proportion_) {
  25474. arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2);
  25475. }
  25476. var color = item.color;
  25477. var radius = item._radius_;
  25478. return {
  25479. arc: arc,
  25480. text: text,
  25481. color: color,
  25482. radius: radius,
  25483. textColor: item.textColor,
  25484. textSize: item.textSize,
  25485. labelShow: item.labelShow
  25486. };
  25487. });
  25488. for (var i = 0; i < seriesConvert.length; i++) {
  25489. var item = seriesConvert[i];
  25490. // line end
  25491. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  25492. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  25493. // line start
  25494. var orginX2 = Math.cos(item.arc) * item.radius;
  25495. var orginY2 = Math.sin(item.arc) * item.radius;
  25496. // text start
  25497. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  25498. var orginY3 = orginY1;
  25499. var textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context);
  25500. var startY = orginY3;
  25501. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  25502. x: orginX3
  25503. })) {
  25504. if (orginX3 > 0) {
  25505. startY = Math.min(orginY3, lastTextObject.start.y);
  25506. } else if (orginX1 < 0) {
  25507. startY = Math.max(orginY3, lastTextObject.start.y);
  25508. } else {
  25509. if (orginY3 > 0) {
  25510. startY = Math.max(orginY3, lastTextObject.start.y);
  25511. } else {
  25512. startY = Math.min(orginY3, lastTextObject.start.y);
  25513. }
  25514. }
  25515. }
  25516. if (orginX3 < 0) {
  25517. orginX3 -= textWidth;
  25518. }
  25519. var textObject = {
  25520. lineStart: {
  25521. x: orginX2,
  25522. y: orginY2
  25523. },
  25524. lineEnd: {
  25525. x: orginX1,
  25526. y: orginY1
  25527. },
  25528. start: {
  25529. x: orginX3,
  25530. y: startY
  25531. },
  25532. width: textWidth,
  25533. height: config.fontSize,
  25534. text: item.text,
  25535. color: item.color,
  25536. textColor: item.textColor,
  25537. textSize: item.textSize
  25538. };
  25539. lastTextObject = avoidCollision(textObject, lastTextObject);
  25540. textObjectCollection.push(lastTextObject);
  25541. }
  25542. for (var _i15 = 0; _i15 < textObjectCollection.length; _i15++) {
  25543. if (seriesConvert[_i15].labelShow === false) {
  25544. continue;
  25545. }
  25546. var _item6 = textObjectCollection[_i15];
  25547. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  25548. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  25549. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  25550. context.setLineWidth(1 * opts.pix);
  25551. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25552. context.beginPath();
  25553. context.setStrokeStyle(_item6.color);
  25554. context.setFillStyle(_item6.color);
  25555. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25556. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  25557. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  25558. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  25559. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  25560. context.stroke();
  25561. context.closePath();
  25562. context.beginPath();
  25563. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  25564. context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI);
  25565. context.closePath();
  25566. context.fill();
  25567. context.beginPath();
  25568. context.setFontSize(_item6.textSize * opts.pix || config.fontSize);
  25569. context.setFillStyle(_item6.textColor || opts.fontColor);
  25570. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  25571. context.closePath();
  25572. context.stroke();
  25573. context.closePath();
  25574. }
  25575. }
  25576. function drawToolTipSplitLine(offsetX, opts, config, context) {
  25577. var toolTipOption = opts.extra.tooltip || {};
  25578. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  25579. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  25580. var startY = opts.area[0];
  25581. var endY = opts.height - opts.area[2];
  25582. if (toolTipOption.gridType == 'dash') {
  25583. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25584. }
  25585. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25586. context.setLineWidth(1 * opts.pix);
  25587. context.beginPath();
  25588. context.moveTo(offsetX, startY);
  25589. context.lineTo(offsetX, endY);
  25590. context.stroke();
  25591. context.setLineDash([]);
  25592. if (toolTipOption.xAxisLabel) {
  25593. var labelText = opts.categories[opts.tooltip.index];
  25594. context.setFontSize(config.fontSize);
  25595. var textWidth = measureText(labelText, config.fontSize, context);
  25596. var textX = offsetX - 0.5 * textWidth;
  25597. var textY = endY + 2 * opts.pix;
  25598. context.beginPath();
  25599. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25600. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25601. context.setLineWidth(1 * opts.pix);
  25602. context.rect(textX - toolTipOption.boxPadding * opts.pix, textY, textWidth + 2 * toolTipOption.boxPadding * opts.pix, config.fontSize + 2 * toolTipOption.boxPadding * opts.pix);
  25603. context.closePath();
  25604. context.stroke();
  25605. context.fill();
  25606. context.beginPath();
  25607. context.setFontSize(config.fontSize);
  25608. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25609. context.fillText(String(labelText), textX, textY + toolTipOption.boxPadding * opts.pix + config.fontSize);
  25610. context.closePath();
  25611. context.stroke();
  25612. }
  25613. }
  25614. function drawMarkLine(opts, config, context) {
  25615. var markLineOption = assign({}, {
  25616. type: 'solid',
  25617. dashLength: 4,
  25618. data: []
  25619. }, opts.extra.markLine);
  25620. var startX = opts.area[3];
  25621. var endX = opts.width - opts.area[1];
  25622. var points = calMarkLineData(markLineOption.data, opts);
  25623. for (var i = 0; i < points.length; i++) {
  25624. var item = assign({}, {
  25625. lineColor: '#DE4A42',
  25626. showLabel: false,
  25627. labelFontSize: 13,
  25628. labelPadding: 6,
  25629. labelFontColor: '#666666',
  25630. labelBgColor: '#DFE8FF',
  25631. labelBgOpacity: 0.8,
  25632. labelAlign: 'left',
  25633. labelOffsetX: 0,
  25634. labelOffsetY: 0
  25635. }, points[i]);
  25636. if (markLineOption.type == 'dash') {
  25637. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  25638. }
  25639. context.setStrokeStyle(item.lineColor);
  25640. context.setLineWidth(1 * opts.pix);
  25641. context.beginPath();
  25642. context.moveTo(startX, item.y);
  25643. context.lineTo(endX, item.y);
  25644. context.stroke();
  25645. context.setLineDash([]);
  25646. if (item.showLabel) {
  25647. var fontSize = item.labelFontSize * opts.pix;
  25648. var labelText = item.labelText ? item.labelText : item.value;
  25649. context.setFontSize(fontSize);
  25650. var textWidth = measureText(labelText, fontSize, context);
  25651. var bgWidth = textWidth + item.labelPadding * opts.pix * 2;
  25652. var bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1];
  25653. bgStartX += item.labelOffsetX;
  25654. var bgStartY = item.y - 0.5 * fontSize - item.labelPadding * opts.pix;
  25655. bgStartY += item.labelOffsetY;
  25656. var textX = bgStartX + item.labelPadding * opts.pix;
  25657. var textY = item.y;
  25658. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  25659. context.setStrokeStyle(item.labelBgColor);
  25660. context.setLineWidth(1 * opts.pix);
  25661. context.beginPath();
  25662. context.rect(bgStartX, bgStartY, bgWidth, fontSize + 2 * item.labelPadding * opts.pix);
  25663. context.closePath();
  25664. context.stroke();
  25665. context.fill();
  25666. context.setFontSize(fontSize);
  25667. context.setTextAlign('left');
  25668. context.setFillStyle(item.labelFontColor);
  25669. context.fillText(String(labelText), textX, bgStartY + fontSize + item.labelPadding * opts.pix / 2);
  25670. context.stroke();
  25671. context.setTextAlign('left');
  25672. }
  25673. }
  25674. }
  25675. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  25676. var toolTipOption = assign({}, {
  25677. gridType: 'solid',
  25678. dashLength: 4
  25679. }, opts.extra.tooltip);
  25680. var startX = opts.area[3];
  25681. var endX = opts.width - opts.area[1];
  25682. if (toolTipOption.gridType == 'dash') {
  25683. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  25684. }
  25685. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  25686. context.setLineWidth(1 * opts.pix);
  25687. context.beginPath();
  25688. context.moveTo(startX, opts.tooltip.offset.y);
  25689. context.lineTo(endX, opts.tooltip.offset.y);
  25690. context.stroke();
  25691. context.setLineDash([]);
  25692. if (toolTipOption.yAxisLabel) {
  25693. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25694. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  25695. var widthArr = opts.chartData.yAxisData.yAxisWidth;
  25696. var tStartLeft = opts.area[3];
  25697. var tStartRight = opts.width - opts.area[1];
  25698. for (var i = 0; i < labelText.length; i++) {
  25699. context.setFontSize(toolTipOption.fontSize * opts.pix);
  25700. var textWidth = measureText(labelText[i], toolTipOption.fontSize * opts.pix, context);
  25701. var bgStartX = void 0,
  25702. bgEndX = void 0,
  25703. bgWidth = void 0;
  25704. if (widthArr[i].position == 'left') {
  25705. bgStartX = tStartLeft - (textWidth + boxPadding * 2) - 2 * opts.pix;
  25706. bgEndX = Math.max(bgStartX, bgStartX + textWidth + boxPadding * 2);
  25707. } else {
  25708. bgStartX = tStartRight + 2 * opts.pix;
  25709. bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + boxPadding * 2);
  25710. }
  25711. bgWidth = bgEndX - bgStartX;
  25712. var textX = bgStartX + (bgWidth - textWidth) / 2;
  25713. var textY = opts.tooltip.offset.y;
  25714. context.beginPath();
  25715. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  25716. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  25717. context.setLineWidth(1 * opts.pix);
  25718. context.rect(bgStartX, textY - 0.5 * config.fontSize - boxPadding, bgWidth, config.fontSize + 2 * boxPadding);
  25719. context.closePath();
  25720. context.stroke();
  25721. context.fill();
  25722. context.beginPath();
  25723. context.setFontSize(config.fontSize);
  25724. context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor);
  25725. context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize);
  25726. context.closePath();
  25727. context.stroke();
  25728. if (widthArr[i].position == 'left') {
  25729. tStartLeft -= widthArr[i].width + opts.yAxis.padding * opts.pix;
  25730. } else {
  25731. tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix;
  25732. }
  25733. }
  25734. }
  25735. }
  25736. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25737. var toolTipOption = assign({}, {
  25738. activeBgColor: '#000000',
  25739. activeBgOpacity: 0.08,
  25740. activeWidth: eachSpacing
  25741. }, opts.extra.column);
  25742. toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth;
  25743. var startY = opts.area[0];
  25744. var endY = opts.height - opts.area[2];
  25745. context.beginPath();
  25746. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25747. context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY);
  25748. context.closePath();
  25749. context.fill();
  25750. context.setFillStyle("#FFFFFF");
  25751. }
  25752. function drawBarToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  25753. var toolTipOption = assign({}, {
  25754. activeBgColor: '#000000',
  25755. activeBgOpacity: 0.08
  25756. }, opts.extra.bar);
  25757. var startX = opts.area[3];
  25758. var endX = opts.width - opts.area[1];
  25759. context.beginPath();
  25760. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  25761. context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing);
  25762. context.closePath();
  25763. context.fill();
  25764. context.setFillStyle("#FFFFFF");
  25765. }
  25766. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  25767. var toolTipOption = assign({}, {
  25768. showBox: true,
  25769. showArrow: true,
  25770. showCategory: false,
  25771. bgColor: '#000000',
  25772. bgOpacity: 0.7,
  25773. borderColor: '#000000',
  25774. borderWidth: 0,
  25775. borderRadius: 0,
  25776. borderOpacity: 0.7,
  25777. boxPadding: 3,
  25778. fontColor: '#FFFFFF',
  25779. fontSize: 13,
  25780. lineHeight: 20,
  25781. legendShow: true,
  25782. legendShape: 'auto',
  25783. splitLine: true
  25784. }, opts.extra.tooltip);
  25785. if (toolTipOption.showCategory == true && opts.categories) {
  25786. textList.unshift({
  25787. text: opts.categories[opts.tooltip.index],
  25788. color: null
  25789. });
  25790. }
  25791. var fontSize = toolTipOption.fontSize * opts.pix;
  25792. var lineHeight = toolTipOption.lineHeight * opts.pix;
  25793. var boxPadding = toolTipOption.boxPadding * opts.pix;
  25794. var legendWidth = fontSize;
  25795. var legendMarginRight = 5 * opts.pix;
  25796. if (toolTipOption.legendShow == false) {
  25797. legendWidth = 0;
  25798. legendMarginRight = 0;
  25799. }
  25800. var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0;
  25801. var isOverRightBorder = false;
  25802. if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  25803. if (toolTipOption.splitLine == true) {
  25804. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  25805. }
  25806. }
  25807. offset = assign({
  25808. x: 0,
  25809. y: 0
  25810. }, offset);
  25811. offset.y -= 8 * opts.pix;
  25812. var textWidth = textList.map(function (item) {
  25813. return measureText(item.text, fontSize, context);
  25814. });
  25815. var toolTipWidth = legendWidth + legendMarginRight + 4 * boxPadding + Math.max.apply(null, textWidth);
  25816. var toolTipHeight = 2 * boxPadding + textList.length * lineHeight;
  25817. if (toolTipOption.showBox == false) {
  25818. return;
  25819. }
  25820. // if beyond the right border
  25821. if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) {
  25822. isOverRightBorder = true;
  25823. }
  25824. if (toolTipHeight + offset.y > opts.height) {
  25825. offset.y = opts.height - toolTipHeight;
  25826. }
  25827. // draw background rect
  25828. context.beginPath();
  25829. context.setFillStyle(hexToRgb(toolTipOption.bgColor, toolTipOption.bgOpacity));
  25830. context.setLineWidth(toolTipOption.borderWidth * opts.pix);
  25831. context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity));
  25832. var radius = toolTipOption.borderRadius;
  25833. if (isOverRightBorder) {
  25834. // 增加左侧仍然超出的判断
  25835. if (toolTipWidth + arrowWidth > opts.width) {
  25836. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25837. }
  25838. if (toolTipWidth > offset.x) {
  25839. offset.x = opts.width + Math.abs(opts._scrollDistance_ || 0) + arrowWidth + (toolTipWidth - opts.width);
  25840. }
  25841. if (toolTipOption.showArrow) {
  25842. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25843. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  25844. }
  25845. context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  25846. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  25847. context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  25848. context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  25849. if (toolTipOption.showArrow) {
  25850. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25851. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  25852. }
  25853. } else {
  25854. if (toolTipOption.showArrow) {
  25855. context.moveTo(offset.x, offset.y + 10 * opts.pix);
  25856. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix);
  25857. }
  25858. context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false);
  25859. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, 0, false);
  25860. context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false);
  25861. context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, false);
  25862. if (toolTipOption.showArrow) {
  25863. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix);
  25864. context.lineTo(offset.x, offset.y + 10 * opts.pix);
  25865. }
  25866. }
  25867. context.closePath();
  25868. context.fill();
  25869. if (toolTipOption.borderWidth > 0) {
  25870. context.stroke();
  25871. }
  25872. // draw legend
  25873. if (toolTipOption.legendShow) {
  25874. textList.forEach(function (item, index) {
  25875. if (item.color !== null) {
  25876. context.beginPath();
  25877. context.setFillStyle(item.color);
  25878. var startX = offset.x + arrowWidth + 2 * boxPadding;
  25879. var startY = offset.y + (lineHeight - fontSize) / 2 + lineHeight * index + boxPadding + 1;
  25880. if (isOverRightBorder) {
  25881. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding;
  25882. }
  25883. switch (item.legendShape) {
  25884. case 'line':
  25885. context.moveTo(startX, startY + 0.5 * legendWidth - 2 * opts.pix);
  25886. context.fillRect(startX, startY + 0.5 * legendWidth - 2 * opts.pix, legendWidth, 4 * opts.pix);
  25887. break;
  25888. case 'triangle':
  25889. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25890. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25891. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25892. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25893. break;
  25894. case 'diamond':
  25895. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25896. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * legendWidth);
  25897. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth + 5 * opts.pix);
  25898. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * legendWidth);
  25899. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25900. break;
  25901. case 'circle':
  25902. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth);
  25903. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * legendWidth, 5 * opts.pix, 0, 2 * Math.PI);
  25904. break;
  25905. case 'rect':
  25906. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  25907. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  25908. break;
  25909. case 'square':
  25910. context.moveTo(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix);
  25911. context.fillRect(startX + 2 * opts.pix, startY + 0.5 * legendWidth - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  25912. break;
  25913. default:
  25914. context.moveTo(startX, startY + 0.5 * legendWidth - 5 * opts.pix);
  25915. context.fillRect(startX, startY + 0.5 * legendWidth - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  25916. }
  25917. context.closePath();
  25918. context.fill();
  25919. }
  25920. });
  25921. }
  25922. // draw text list
  25923. textList.forEach(function (item, index) {
  25924. var startX = offset.x + arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  25925. if (isOverRightBorder) {
  25926. startX = offset.x - toolTipWidth - arrowWidth + 2 * boxPadding + legendWidth + legendMarginRight;
  25927. }
  25928. var startY = offset.y + lineHeight * index + (lineHeight - fontSize) / 2 - 1 + boxPadding + fontSize;
  25929. context.beginPath();
  25930. context.setFontSize(fontSize);
  25931. context.setTextBaseline('normal');
  25932. context.setFillStyle(toolTipOption.fontColor);
  25933. context.fillText(item.text, startX, startY);
  25934. context.closePath();
  25935. context.stroke();
  25936. });
  25937. }
  25938. function drawColumnDataPoints(series, opts, config, context) {
  25939. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  25940. var xAxisData = opts.chartData.xAxisData,
  25941. xAxisPoints = xAxisData.xAxisPoints,
  25942. eachSpacing = xAxisData.eachSpacing;
  25943. var columnOption = assign({}, {
  25944. type: 'group',
  25945. width: eachSpacing / 2,
  25946. meterBorder: 4,
  25947. meterFillColor: '#FFFFFF',
  25948. barBorderCircle: false,
  25949. barBorderRadius: [],
  25950. seriesGap: 2,
  25951. linearType: 'none',
  25952. linearOpacity: 1,
  25953. customColor: [],
  25954. colorStop: 0,
  25955. labelPosition: 'outside'
  25956. }, opts.extra.column);
  25957. var calPoints = [];
  25958. context.save();
  25959. var leftNum = -2;
  25960. var rightNum = xAxisPoints.length + 2;
  25961. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  25962. context.translate(opts._scrollDistance_, 0);
  25963. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  25964. rightNum = leftNum + opts.xAxis.itemCount + 4;
  25965. }
  25966. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  25967. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  25968. }
  25969. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  25970. series.forEach(function (eachSeries, seriesIndex) {
  25971. var ranges, minRange, maxRange;
  25972. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  25973. minRange = ranges.pop();
  25974. maxRange = ranges.shift();
  25975. // 计算0轴坐标
  25976. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  25977. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  25978. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  25979. eachSeries.zeroPoints = zeroPoints;
  25980. var data = eachSeries.data;
  25981. switch (columnOption.type) {
  25982. case 'group':
  25983. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, zeroPoints, process);
  25984. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  25985. calPoints.push(tooltipPoints);
  25986. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  25987. for (var i = 0; i < points.length; i++) {
  25988. var item = points[i];
  25989. //fix issues/I27B1N yyoinge & Joeshu
  25990. if (item !== null && i > leftNum && i < rightNum) {
  25991. var startX = item.x - item.width / 2;
  25992. var height = opts.height - item.y - opts.area[2];
  25993. context.beginPath();
  25994. var fillColor = item.color || eachSeries.color;
  25995. var strokeColor = item.color || eachSeries.color;
  25996. if (columnOption.linearType !== 'none') {
  25997. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  25998. //透明渐变
  25999. if (columnOption.linearType == 'opacity') {
  26000. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  26001. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26002. } else {
  26003. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26004. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26005. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26006. }
  26007. fillColor = grd;
  26008. }
  26009. // 圆角边框
  26010. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26011. var left = startX;
  26012. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26013. var width = item.width;
  26014. var _height = Math.abs(zeroPoints - item.y);
  26015. if (columnOption.barBorderCircle) {
  26016. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26017. }
  26018. if (item.y > zeroPoints) {
  26019. columnOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26020. }
  26021. var _columnOption$barBord = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26022. r0 = _columnOption$barBord[0],
  26023. r1 = _columnOption$barBord[1],
  26024. r2 = _columnOption$barBord[2],
  26025. r3 = _columnOption$barBord[3];
  26026. var minRadius = Math.min(width / 2, _height / 2);
  26027. r0 = r0 > minRadius ? minRadius : r0;
  26028. r1 = r1 > minRadius ? minRadius : r1;
  26029. r2 = r2 > minRadius ? minRadius : r2;
  26030. r3 = r3 > minRadius ? minRadius : r3;
  26031. r0 = r0 < 0 ? 0 : r0;
  26032. r1 = r1 < 0 ? 0 : r1;
  26033. r2 = r2 < 0 ? 0 : r2;
  26034. r3 = r3 < 0 ? 0 : r3;
  26035. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26036. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26037. context.arc(left + width - r2, top + _height - r2, r2, 0, Math.PI / 2);
  26038. context.arc(left + r3, top + _height - r3, r3, Math.PI / 2, Math.PI);
  26039. } else {
  26040. context.moveTo(startX, item.y);
  26041. context.lineTo(startX + item.width, item.y);
  26042. context.lineTo(startX + item.width, zeroPoints);
  26043. context.lineTo(startX, zeroPoints);
  26044. context.lineTo(startX, item.y);
  26045. context.setLineWidth(1);
  26046. context.setStrokeStyle(strokeColor);
  26047. }
  26048. context.setFillStyle(fillColor);
  26049. context.closePath();
  26050. //context.stroke();
  26051. context.fill();
  26052. }
  26053. }
  26054. ;
  26055. break;
  26056. case 'stack':
  26057. // 绘制堆叠数据图
  26058. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26059. calPoints.push(points);
  26060. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26061. for (var _i16 = 0; _i16 < points.length; _i16++) {
  26062. var _item7 = points[_i16];
  26063. if (_item7 !== null && _i16 > leftNum && _i16 < rightNum) {
  26064. context.beginPath();
  26065. var fillColor = _item7.color || eachSeries.color;
  26066. var startX = _item7.x - _item7.width / 2 + 1;
  26067. var height = opts.height - _item7.y - opts.area[2];
  26068. var height0 = opts.height - _item7.y0 - opts.area[2];
  26069. if (seriesIndex > 0) {
  26070. height -= height0;
  26071. }
  26072. context.setFillStyle(fillColor);
  26073. context.moveTo(startX, _item7.y);
  26074. context.fillRect(startX, _item7.y, _item7.width, height);
  26075. context.closePath();
  26076. context.fill();
  26077. }
  26078. }
  26079. ;
  26080. break;
  26081. case 'meter':
  26082. // 绘制温度计数据图
  26083. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26084. calPoints.push(points);
  26085. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meterBorder);
  26086. for (var _i17 = 0; _i17 < points.length; _i17++) {
  26087. var _item8 = points[_i17];
  26088. if (_item8 !== null && _i17 > leftNum && _i17 < rightNum) {
  26089. //画背景颜色
  26090. context.beginPath();
  26091. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26092. context.setStrokeStyle(eachSeries.color);
  26093. context.setLineWidth(columnOption.meterBorder * opts.pix);
  26094. }
  26095. if (seriesIndex == 0) {
  26096. context.setFillStyle(columnOption.meterFillColor);
  26097. } else {
  26098. context.setFillStyle(_item8.color || eachSeries.color);
  26099. }
  26100. var startX = _item8.x - _item8.width / 2;
  26101. var height = opts.height - _item8.y - opts.area[2];
  26102. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26103. var _left = startX;
  26104. var _top = _item8.y;
  26105. var _width = _item8.width;
  26106. var _height2 = zeroPoints - _item8.y;
  26107. if (columnOption.barBorderCircle) {
  26108. columnOption.barBorderRadius = [_width / 2, _width / 2, 0, 0];
  26109. }
  26110. var _columnOption$barBord2 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26111. _r = _columnOption$barBord2[0],
  26112. _r2 = _columnOption$barBord2[1],
  26113. _r3 = _columnOption$barBord2[2],
  26114. _r4 = _columnOption$barBord2[3];
  26115. var _minRadius = Math.min(_width / 2, _height2 / 2);
  26116. _r = _r > _minRadius ? _minRadius : _r;
  26117. _r2 = _r2 > _minRadius ? _minRadius : _r2;
  26118. _r3 = _r3 > _minRadius ? _minRadius : _r3;
  26119. _r4 = _r4 > _minRadius ? _minRadius : _r4;
  26120. _r = _r < 0 ? 0 : _r;
  26121. _r2 = _r2 < 0 ? 0 : _r2;
  26122. _r3 = _r3 < 0 ? 0 : _r3;
  26123. _r4 = _r4 < 0 ? 0 : _r4;
  26124. context.arc(_left + _r, _top + _r, _r, -Math.PI, -Math.PI / 2);
  26125. context.arc(_left + _width - _r2, _top + _r2, _r2, -Math.PI / 2, 0);
  26126. context.arc(_left + _width - _r3, _top + _height2 - _r3, _r3, 0, Math.PI / 2);
  26127. context.arc(_left + _r4, _top + _height2 - _r4, _r4, Math.PI / 2, Math.PI);
  26128. context.fill();
  26129. } else {
  26130. context.moveTo(startX, _item8.y);
  26131. context.lineTo(startX + _item8.width, _item8.y);
  26132. context.lineTo(startX + _item8.width, zeroPoints);
  26133. context.lineTo(startX, zeroPoints);
  26134. context.lineTo(startX, _item8.y);
  26135. context.fill();
  26136. }
  26137. if (seriesIndex == 0 && columnOption.meterBorder > 0) {
  26138. context.closePath();
  26139. context.stroke();
  26140. }
  26141. }
  26142. }
  26143. break;
  26144. }
  26145. });
  26146. if (opts.dataLabel !== false && process === 1) {
  26147. series.forEach(function (eachSeries, seriesIndex) {
  26148. var ranges, minRange, maxRange;
  26149. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26150. minRange = ranges.pop();
  26151. maxRange = ranges.shift();
  26152. var data = eachSeries.data;
  26153. switch (columnOption.type) {
  26154. case 'group':
  26155. var points = getColumnDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26156. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26157. drawColumePointText(points, eachSeries, config, context, opts);
  26158. break;
  26159. case 'stack':
  26160. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26161. drawColumePointText(points, eachSeries, config, context, opts);
  26162. break;
  26163. case 'meter':
  26164. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26165. drawColumePointText(points, eachSeries, config, context, opts);
  26166. break;
  26167. }
  26168. });
  26169. }
  26170. context.restore();
  26171. return {
  26172. xAxisPoints: xAxisPoints,
  26173. calPoints: calPoints,
  26174. eachSpacing: eachSpacing
  26175. };
  26176. }
  26177. function drawMountDataPoints(series, opts, config, context) {
  26178. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26179. var xAxisData = opts.chartData.xAxisData,
  26180. xAxisPoints = xAxisData.xAxisPoints,
  26181. eachSpacing = xAxisData.eachSpacing;
  26182. var mountOption = assign({}, {
  26183. type: 'mount',
  26184. widthRatio: 1,
  26185. borderWidth: 1,
  26186. barBorderCircle: false,
  26187. barBorderRadius: [],
  26188. linearType: 'none',
  26189. linearOpacity: 1,
  26190. customColor: [],
  26191. colorStop: 0
  26192. }, opts.extra.mount);
  26193. mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio;
  26194. mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio;
  26195. var calPoints = [];
  26196. context.save();
  26197. var leftNum = -2;
  26198. var rightNum = xAxisPoints.length + 2;
  26199. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26200. context.translate(opts._scrollDistance_, 0);
  26201. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26202. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26203. }
  26204. mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config);
  26205. var ranges, minRange, maxRange;
  26206. ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26207. minRange = ranges.pop();
  26208. maxRange = ranges.shift();
  26209. // 计算0轴坐标
  26210. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  26211. var zeroHeight = spacingValid * (0 - minRange) / (maxRange - minRange);
  26212. var zeroPoints = opts.height - Math.round(zeroHeight) - opts.area[2];
  26213. var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26214. switch (mountOption.type) {
  26215. case 'bar':
  26216. for (var i = 0; i < points.length; i++) {
  26217. var item = points[i];
  26218. if (item !== null && i > leftNum && i < rightNum) {
  26219. var startX = item.x - eachSpacing * mountOption.widthRatio / 2;
  26220. var height = opts.height - item.y - opts.area[2];
  26221. context.beginPath();
  26222. var fillColor = item.color || series[i].color;
  26223. var strokeColor = item.color || series[i].color;
  26224. if (mountOption.linearType !== 'none') {
  26225. var grd = context.createLinearGradient(startX, item.y, startX, zeroPoints);
  26226. //透明渐变
  26227. if (mountOption.linearType == 'opacity') {
  26228. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26229. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26230. } else {
  26231. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26232. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption.linearOpacity));
  26233. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26234. }
  26235. fillColor = grd;
  26236. }
  26237. // 圆角边框
  26238. if (mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4 || mountOption.barBorderCircle === true) {
  26239. var left = startX;
  26240. var top = item.y > zeroPoints ? zeroPoints : item.y;
  26241. var width = item.width;
  26242. var _height3 = Math.abs(zeroPoints - item.y);
  26243. if (mountOption.barBorderCircle) {
  26244. mountOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26245. }
  26246. if (item.y > zeroPoints) {
  26247. mountOption.barBorderRadius = [0, 0, width / 2, width / 2];
  26248. }
  26249. var _mountOption$barBorde = (0, _slicedToArray2.default)(mountOption.barBorderRadius, 4),
  26250. r0 = _mountOption$barBorde[0],
  26251. r1 = _mountOption$barBorde[1],
  26252. r2 = _mountOption$barBorde[2],
  26253. r3 = _mountOption$barBorde[3];
  26254. var minRadius = Math.min(width / 2, _height3 / 2);
  26255. r0 = r0 > minRadius ? minRadius : r0;
  26256. r1 = r1 > minRadius ? minRadius : r1;
  26257. r2 = r2 > minRadius ? minRadius : r2;
  26258. r3 = r3 > minRadius ? minRadius : r3;
  26259. r0 = r0 < 0 ? 0 : r0;
  26260. r1 = r1 < 0 ? 0 : r1;
  26261. r2 = r2 < 0 ? 0 : r2;
  26262. r3 = r3 < 0 ? 0 : r3;
  26263. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  26264. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  26265. context.arc(left + width - r2, top + _height3 - r2, r2, 0, Math.PI / 2);
  26266. context.arc(left + r3, top + _height3 - r3, r3, Math.PI / 2, Math.PI);
  26267. } else {
  26268. context.moveTo(startX, item.y);
  26269. context.lineTo(startX + item.width, item.y);
  26270. context.lineTo(startX + item.width, zeroPoints);
  26271. context.lineTo(startX, zeroPoints);
  26272. context.lineTo(startX, item.y);
  26273. }
  26274. context.setStrokeStyle(strokeColor);
  26275. context.setFillStyle(fillColor);
  26276. if (mountOption.borderWidth > 0) {
  26277. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26278. context.closePath();
  26279. context.stroke();
  26280. }
  26281. context.fill();
  26282. }
  26283. }
  26284. ;
  26285. break;
  26286. case 'triangle':
  26287. for (var _i18 = 0; _i18 < points.length; _i18++) {
  26288. var _item9 = points[_i18];
  26289. if (_item9 !== null && _i18 > leftNum && _i18 < rightNum) {
  26290. var startX = _item9.x - eachSpacing * mountOption.widthRatio / 2;
  26291. var height = opts.height - _item9.y - opts.area[2];
  26292. context.beginPath();
  26293. var fillColor = _item9.color || series[_i18].color;
  26294. var strokeColor = _item9.color || series[_i18].color;
  26295. if (mountOption.linearType !== 'none') {
  26296. var grd = context.createLinearGradient(startX, _item9.y, startX, zeroPoints);
  26297. //透明渐变
  26298. if (mountOption.linearType == 'opacity') {
  26299. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26300. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26301. } else {
  26302. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26303. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i18].linearIndex], mountOption.linearOpacity));
  26304. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26305. }
  26306. fillColor = grd;
  26307. }
  26308. context.moveTo(startX, zeroPoints);
  26309. context.lineTo(_item9.x, _item9.y);
  26310. context.lineTo(startX + _item9.width, zeroPoints);
  26311. context.setStrokeStyle(strokeColor);
  26312. context.setFillStyle(fillColor);
  26313. if (mountOption.borderWidth > 0) {
  26314. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26315. context.stroke();
  26316. }
  26317. context.fill();
  26318. }
  26319. }
  26320. ;
  26321. break;
  26322. case 'mount':
  26323. for (var _i19 = 0; _i19 < points.length; _i19++) {
  26324. var _item10 = points[_i19];
  26325. if (_item10 !== null && _i19 > leftNum && _i19 < rightNum) {
  26326. var startX = _item10.x - eachSpacing * mountOption.widthRatio / 2;
  26327. var height = opts.height - _item10.y - opts.area[2];
  26328. context.beginPath();
  26329. var fillColor = _item10.color || series[_i19].color;
  26330. var strokeColor = _item10.color || series[_i19].color;
  26331. if (mountOption.linearType !== 'none') {
  26332. var grd = context.createLinearGradient(startX, _item10.y, startX, zeroPoints);
  26333. //透明渐变
  26334. if (mountOption.linearType == 'opacity') {
  26335. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26336. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26337. } else {
  26338. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26339. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i19].linearIndex], mountOption.linearOpacity));
  26340. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26341. }
  26342. fillColor = grd;
  26343. }
  26344. context.moveTo(startX, zeroPoints);
  26345. context.bezierCurveTo(_item10.x - _item10.width / 4, zeroPoints, _item10.x - _item10.width / 4, _item10.y, _item10.x, _item10.y);
  26346. context.bezierCurveTo(_item10.x + _item10.width / 4, _item10.y, _item10.x + _item10.width / 4, zeroPoints, startX + _item10.width, zeroPoints);
  26347. context.setStrokeStyle(strokeColor);
  26348. context.setFillStyle(fillColor);
  26349. if (mountOption.borderWidth > 0) {
  26350. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26351. context.stroke();
  26352. }
  26353. context.fill();
  26354. }
  26355. }
  26356. ;
  26357. break;
  26358. case 'sharp':
  26359. for (var _i20 = 0; _i20 < points.length; _i20++) {
  26360. var _item11 = points[_i20];
  26361. if (_item11 !== null && _i20 > leftNum && _i20 < rightNum) {
  26362. var startX = _item11.x - eachSpacing * mountOption.widthRatio / 2;
  26363. var height = opts.height - _item11.y - opts.area[2];
  26364. context.beginPath();
  26365. var fillColor = _item11.color || series[_i20].color;
  26366. var strokeColor = _item11.color || series[_i20].color;
  26367. if (mountOption.linearType !== 'none') {
  26368. var grd = context.createLinearGradient(startX, _item11.y, startX, zeroPoints);
  26369. //透明渐变
  26370. if (mountOption.linearType == 'opacity') {
  26371. grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity));
  26372. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26373. } else {
  26374. grd.addColorStop(0, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26375. grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[_i20].linearIndex], mountOption.linearOpacity));
  26376. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26377. }
  26378. fillColor = grd;
  26379. }
  26380. context.moveTo(startX, zeroPoints);
  26381. context.quadraticCurveTo(_item11.x - 0, zeroPoints - height / 4, _item11.x, _item11.y);
  26382. context.quadraticCurveTo(_item11.x + 0, zeroPoints - height / 4, startX + _item11.width, zeroPoints);
  26383. context.setStrokeStyle(strokeColor);
  26384. context.setFillStyle(fillColor);
  26385. if (mountOption.borderWidth > 0) {
  26386. context.setLineWidth(mountOption.borderWidth * opts.pix);
  26387. context.stroke();
  26388. }
  26389. context.fill();
  26390. }
  26391. }
  26392. ;
  26393. break;
  26394. }
  26395. if (opts.dataLabel !== false && process === 1) {
  26396. var _ranges, _minRange, _maxRange;
  26397. _ranges = [].concat(opts.chartData.yAxisData.ranges[0]);
  26398. _minRange = _ranges.pop();
  26399. _maxRange = _ranges.shift();
  26400. var points = getMountDataPoints(series, _minRange, _maxRange, xAxisPoints, eachSpacing, opts, mountOption, zeroPoints, process);
  26401. drawMountPointText(points, series, config, context, opts, zeroPoints);
  26402. }
  26403. context.restore();
  26404. return {
  26405. xAxisPoints: xAxisPoints,
  26406. calPoints: points,
  26407. eachSpacing: eachSpacing
  26408. };
  26409. }
  26410. function drawBarDataPoints(series, opts, config, context) {
  26411. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26412. var yAxisPoints = [];
  26413. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length;
  26414. for (var i = 0; i < opts.categories.length; i++) {
  26415. yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i);
  26416. }
  26417. var columnOption = assign({}, {
  26418. type: 'group',
  26419. width: eachSpacing / 2,
  26420. meterBorder: 4,
  26421. meterFillColor: '#FFFFFF',
  26422. barBorderCircle: false,
  26423. barBorderRadius: [],
  26424. seriesGap: 2,
  26425. linearType: 'none',
  26426. linearOpacity: 1,
  26427. customColor: [],
  26428. colorStop: 0
  26429. }, opts.extra.bar);
  26430. var calPoints = [];
  26431. context.save();
  26432. var leftNum = -2;
  26433. var rightNum = yAxisPoints.length + 2;
  26434. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  26435. drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing);
  26436. }
  26437. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  26438. series.forEach(function (eachSeries, seriesIndex) {
  26439. var ranges, minRange, maxRange;
  26440. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26441. maxRange = ranges.pop();
  26442. minRange = ranges.shift();
  26443. var data = eachSeries.data;
  26444. switch (columnOption.type) {
  26445. case 'group':
  26446. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26447. var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26448. calPoints.push(tooltipPoints);
  26449. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26450. for (var _i21 = 0; _i21 < points.length; _i21++) {
  26451. var item = points[_i21];
  26452. //fix issues/I27B1N yyoinge & Joeshu
  26453. if (item !== null && _i21 > leftNum && _i21 < rightNum) {
  26454. //var startX = item.x - item.width / 2;
  26455. var startX = opts.area[3];
  26456. var startY = item.y - item.width / 2;
  26457. var height = item.height;
  26458. context.beginPath();
  26459. var fillColor = item.color || eachSeries.color;
  26460. var strokeColor = item.color || eachSeries.color;
  26461. if (columnOption.linearType !== 'none') {
  26462. var grd = context.createLinearGradient(startX, item.y, item.x, item.y);
  26463. //透明渐变
  26464. if (columnOption.linearType == 'opacity') {
  26465. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  26466. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26467. } else {
  26468. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26469. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  26470. grd.addColorStop(1, hexToRgb(fillColor, 1));
  26471. }
  26472. fillColor = grd;
  26473. }
  26474. // 圆角边框
  26475. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle === true) {
  26476. var left = startX;
  26477. var width = item.width;
  26478. var top = item.y - item.width / 2;
  26479. var _height4 = item.height;
  26480. if (columnOption.barBorderCircle) {
  26481. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  26482. }
  26483. var _columnOption$barBord3 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  26484. r0 = _columnOption$barBord3[0],
  26485. r1 = _columnOption$barBord3[1],
  26486. r2 = _columnOption$barBord3[2],
  26487. r3 = _columnOption$barBord3[3];
  26488. var minRadius = Math.min(width / 2, _height4 / 2);
  26489. r0 = r0 > minRadius ? minRadius : r0;
  26490. r1 = r1 > minRadius ? minRadius : r1;
  26491. r2 = r2 > minRadius ? minRadius : r2;
  26492. r3 = r3 > minRadius ? minRadius : r3;
  26493. r0 = r0 < 0 ? 0 : r0;
  26494. r1 = r1 < 0 ? 0 : r1;
  26495. r2 = r2 < 0 ? 0 : r2;
  26496. r3 = r3 < 0 ? 0 : r3;
  26497. context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2);
  26498. context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0);
  26499. context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2);
  26500. context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI);
  26501. } else {
  26502. context.moveTo(startX, startY);
  26503. context.lineTo(item.x, startY);
  26504. context.lineTo(item.x, startY + item.width);
  26505. context.lineTo(startX, startY + item.width);
  26506. context.lineTo(startX, startY);
  26507. context.setLineWidth(1);
  26508. context.setStrokeStyle(strokeColor);
  26509. }
  26510. context.setFillStyle(fillColor);
  26511. context.closePath();
  26512. //context.stroke();
  26513. context.fill();
  26514. }
  26515. }
  26516. ;
  26517. break;
  26518. case 'stack':
  26519. // 绘制堆叠数据图
  26520. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26521. calPoints.push(points);
  26522. points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  26523. for (var _i22 = 0; _i22 < points.length; _i22++) {
  26524. var _item12 = points[_i22];
  26525. if (_item12 !== null && _i22 > leftNum && _i22 < rightNum) {
  26526. context.beginPath();
  26527. var fillColor = _item12.color || eachSeries.color;
  26528. var startX = _item12.x0;
  26529. context.setFillStyle(fillColor);
  26530. context.moveTo(startX, _item12.y - _item12.width / 2);
  26531. context.fillRect(startX, _item12.y - _item12.width / 2, _item12.height, _item12.width);
  26532. context.closePath();
  26533. context.fill();
  26534. }
  26535. }
  26536. ;
  26537. break;
  26538. }
  26539. });
  26540. if (opts.dataLabel !== false && process === 1) {
  26541. series.forEach(function (eachSeries, seriesIndex) {
  26542. var ranges, minRange, maxRange;
  26543. ranges = [].concat(opts.chartData.xAxisData.ranges);
  26544. maxRange = ranges.pop();
  26545. minRange = ranges.shift();
  26546. var data = eachSeries.data;
  26547. switch (columnOption.type) {
  26548. case 'group':
  26549. var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, process);
  26550. points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts);
  26551. drawBarPointText(points, eachSeries, config, context, opts);
  26552. break;
  26553. case 'stack':
  26554. var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  26555. drawBarPointText(points, eachSeries, config, context, opts);
  26556. break;
  26557. }
  26558. });
  26559. }
  26560. return {
  26561. yAxisPoints: yAxisPoints,
  26562. calPoints: calPoints,
  26563. eachSpacing: eachSpacing
  26564. };
  26565. }
  26566. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  26567. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  26568. var candleOption = assign({}, {
  26569. color: {},
  26570. average: {}
  26571. }, opts.extra.candle);
  26572. candleOption.color = assign({}, {
  26573. upLine: '#f04864',
  26574. upFill: '#f04864',
  26575. downLine: '#2fc25b',
  26576. downFill: '#2fc25b'
  26577. }, candleOption.color);
  26578. candleOption.average = assign({}, {
  26579. show: false,
  26580. name: [],
  26581. day: [],
  26582. color: config.color
  26583. }, candleOption.average);
  26584. opts.extra.candle = candleOption;
  26585. var xAxisData = opts.chartData.xAxisData,
  26586. xAxisPoints = xAxisData.xAxisPoints,
  26587. eachSpacing = xAxisData.eachSpacing;
  26588. var calPoints = [];
  26589. context.save();
  26590. var leftNum = -2;
  26591. var rightNum = xAxisPoints.length + 2;
  26592. var leftSpace = 0;
  26593. var rightSpace = opts.width + eachSpacing;
  26594. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26595. context.translate(opts._scrollDistance_, 0);
  26596. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  26597. rightNum = leftNum + opts.xAxis.itemCount + 4;
  26598. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26599. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26600. }
  26601. //画均线
  26602. if (candleOption.average.show || seriesMA) {
  26603. //Merge pull request !12 from 邱贵翔
  26604. seriesMA.forEach(function (eachSeries, seriesIndex) {
  26605. var ranges, minRange, maxRange;
  26606. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26607. minRange = ranges.pop();
  26608. maxRange = ranges.shift();
  26609. var data = eachSeries.data;
  26610. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26611. var splitPointList = splitPoints(points, eachSeries);
  26612. for (var i = 0; i < splitPointList.length; i++) {
  26613. var _points = splitPointList[i];
  26614. context.beginPath();
  26615. context.setStrokeStyle(eachSeries.color);
  26616. context.setLineWidth(1);
  26617. if (_points.length === 1) {
  26618. context.moveTo(_points[0].x, _points[0].y);
  26619. context.arc(_points[0].x, _points[0].y, 1, 0, 2 * Math.PI);
  26620. } else {
  26621. context.moveTo(_points[0].x, _points[0].y);
  26622. var startPoint = 0;
  26623. for (var j = 0; j < _points.length; j++) {
  26624. var item = _points[j];
  26625. if (startPoint == 0 && item.x > leftSpace) {
  26626. context.moveTo(item.x, item.y);
  26627. startPoint = 1;
  26628. }
  26629. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26630. var ctrlPoint = createCurveControlPoints(_points, j - 1);
  26631. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26632. }
  26633. }
  26634. context.moveTo(_points[0].x, _points[0].y);
  26635. }
  26636. context.closePath();
  26637. context.stroke();
  26638. }
  26639. });
  26640. }
  26641. //画K线
  26642. series.forEach(function (eachSeries, seriesIndex) {
  26643. var ranges, minRange, maxRange;
  26644. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26645. minRange = ranges.pop();
  26646. maxRange = ranges.shift();
  26647. var data = eachSeries.data;
  26648. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26649. calPoints.push(points);
  26650. var splitPointList = splitPoints(points, eachSeries);
  26651. for (var i = 0; i < splitPointList[0].length; i++) {
  26652. if (i > leftNum && i < rightNum) {
  26653. var item = splitPointList[0][i];
  26654. context.beginPath();
  26655. //如果上涨
  26656. if (data[i][1] - data[i][0] > 0) {
  26657. context.setStrokeStyle(candleOption.color.upLine);
  26658. context.setFillStyle(candleOption.color.upFill);
  26659. context.setLineWidth(1 * opts.pix);
  26660. context.moveTo(item[3].x, item[3].y); //顶点
  26661. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26662. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26663. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26664. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26665. context.lineTo(item[2].x, item[2].y); //底点
  26666. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26667. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26668. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26669. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26670. context.moveTo(item[3].x, item[3].y); //顶点
  26671. } else {
  26672. context.setStrokeStyle(candleOption.color.downLine);
  26673. context.setFillStyle(candleOption.color.downFill);
  26674. context.setLineWidth(1 * opts.pix);
  26675. context.moveTo(item[3].x, item[3].y); //顶点
  26676. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26677. context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点
  26678. context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点
  26679. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26680. context.lineTo(item[2].x, item[2].y); //底点
  26681. context.lineTo(item[1].x, item[1].y); //收盘中间点
  26682. context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点
  26683. context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点
  26684. context.lineTo(item[0].x, item[0].y); //开盘中间点
  26685. context.moveTo(item[3].x, item[3].y); //顶点
  26686. }
  26687. context.closePath();
  26688. context.fill();
  26689. context.stroke();
  26690. }
  26691. }
  26692. });
  26693. context.restore();
  26694. return {
  26695. xAxisPoints: xAxisPoints,
  26696. calPoints: calPoints,
  26697. eachSpacing: eachSpacing
  26698. };
  26699. }
  26700. function drawAreaDataPoints(series, opts, config, context) {
  26701. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26702. var areaOption = assign({}, {
  26703. type: 'straight',
  26704. opacity: 0.2,
  26705. addLine: false,
  26706. width: 2,
  26707. gradient: false,
  26708. activeType: 'none'
  26709. }, opts.extra.area);
  26710. var xAxisData = opts.chartData.xAxisData,
  26711. xAxisPoints = xAxisData.xAxisPoints,
  26712. eachSpacing = xAxisData.eachSpacing;
  26713. var endY = opts.height - opts.area[2];
  26714. var calPoints = [];
  26715. context.save();
  26716. var leftSpace = 0;
  26717. var rightSpace = opts.width + eachSpacing;
  26718. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26719. context.translate(opts._scrollDistance_, 0);
  26720. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26721. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26722. }
  26723. series.forEach(function (eachSeries, seriesIndex) {
  26724. var ranges, minRange, maxRange;
  26725. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26726. minRange = ranges.pop();
  26727. maxRange = ranges.shift();
  26728. var data = eachSeries.data;
  26729. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26730. calPoints.push(points);
  26731. var splitPointList = splitPoints(points, eachSeries);
  26732. for (var i = 0; i < splitPointList.length; i++) {
  26733. var _points2 = splitPointList[i];
  26734. // 绘制区域数
  26735. context.beginPath();
  26736. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26737. if (areaOption.gradient) {
  26738. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  26739. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  26740. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  26741. context.setFillStyle(gradient);
  26742. } else {
  26743. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  26744. }
  26745. context.setLineWidth(areaOption.width * opts.pix);
  26746. if (_points2.length > 1) {
  26747. var firstPoint = _points2[0];
  26748. var lastPoint = _points2[_points2.length - 1];
  26749. context.moveTo(firstPoint.x, firstPoint.y);
  26750. var startPoint = 0;
  26751. if (areaOption.type === 'curve') {
  26752. for (var j = 0; j < _points2.length; j++) {
  26753. var item = _points2[j];
  26754. if (startPoint == 0 && item.x > leftSpace) {
  26755. context.moveTo(item.x, item.y);
  26756. startPoint = 1;
  26757. }
  26758. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  26759. var ctrlPoint = createCurveControlPoints(_points2, j - 1);
  26760. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  26761. }
  26762. }
  26763. ;
  26764. }
  26765. if (areaOption.type === 'straight') {
  26766. for (var _j = 0; _j < _points2.length; _j++) {
  26767. var _item13 = _points2[_j];
  26768. if (startPoint == 0 && _item13.x > leftSpace) {
  26769. context.moveTo(_item13.x, _item13.y);
  26770. startPoint = 1;
  26771. }
  26772. if (_j > 0 && _item13.x > leftSpace && _item13.x < rightSpace) {
  26773. context.lineTo(_item13.x, _item13.y);
  26774. }
  26775. }
  26776. ;
  26777. }
  26778. if (areaOption.type === 'step') {
  26779. for (var _j2 = 0; _j2 < _points2.length; _j2++) {
  26780. var _item14 = _points2[_j2];
  26781. if (startPoint == 0 && _item14.x > leftSpace) {
  26782. context.moveTo(_item14.x, _item14.y);
  26783. startPoint = 1;
  26784. }
  26785. if (_j2 > 0 && _item14.x > leftSpace && _item14.x < rightSpace) {
  26786. context.lineTo(_item14.x, _points2[_j2 - 1].y);
  26787. context.lineTo(_item14.x, _item14.y);
  26788. }
  26789. }
  26790. ;
  26791. }
  26792. context.lineTo(lastPoint.x, endY);
  26793. context.lineTo(firstPoint.x, endY);
  26794. context.lineTo(firstPoint.x, firstPoint.y);
  26795. } else {
  26796. var _item15 = _points2[0];
  26797. context.moveTo(_item15.x - eachSpacing / 2, _item15.y);
  26798. // context.lineTo(item.x + eachSpacing / 2, item.y);
  26799. // context.lineTo(item.x + eachSpacing / 2, endY);
  26800. // context.lineTo(item.x - eachSpacing / 2, endY);
  26801. // context.moveTo(item.x - eachSpacing / 2, item.y);
  26802. }
  26803. context.closePath();
  26804. context.fill();
  26805. //画连线
  26806. if (areaOption.addLine) {
  26807. if (eachSeries.lineType == 'dash') {
  26808. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  26809. dashLength *= opts.pix;
  26810. context.setLineDash([dashLength, dashLength]);
  26811. }
  26812. context.beginPath();
  26813. context.setStrokeStyle(eachSeries.color);
  26814. context.setLineWidth(areaOption.width * opts.pix);
  26815. if (_points2.length === 1) {
  26816. context.moveTo(_points2[0].x, _points2[0].y);
  26817. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  26818. } else {
  26819. context.moveTo(_points2[0].x, _points2[0].y);
  26820. var _startPoint = 0;
  26821. if (areaOption.type === 'curve') {
  26822. for (var _j3 = 0; _j3 < _points2.length; _j3++) {
  26823. var _item16 = _points2[_j3];
  26824. if (_startPoint == 0 && _item16.x > leftSpace) {
  26825. context.moveTo(_item16.x, _item16.y);
  26826. _startPoint = 1;
  26827. }
  26828. if (_j3 > 0 && _item16.x > leftSpace && _item16.x < rightSpace) {
  26829. var _ctrlPoint = createCurveControlPoints(_points2, _j3 - 1);
  26830. context.bezierCurveTo(_ctrlPoint.ctrA.x, _ctrlPoint.ctrA.y, _ctrlPoint.ctrB.x, _ctrlPoint.ctrB.y, _item16.x, _item16.y);
  26831. }
  26832. }
  26833. ;
  26834. }
  26835. if (areaOption.type === 'straight') {
  26836. for (var _j4 = 0; _j4 < _points2.length; _j4++) {
  26837. var _item17 = _points2[_j4];
  26838. if (_startPoint == 0 && _item17.x > leftSpace) {
  26839. context.moveTo(_item17.x, _item17.y);
  26840. _startPoint = 1;
  26841. }
  26842. if (_j4 > 0 && _item17.x > leftSpace && _item17.x < rightSpace) {
  26843. context.lineTo(_item17.x, _item17.y);
  26844. }
  26845. }
  26846. ;
  26847. }
  26848. if (areaOption.type === 'step') {
  26849. for (var _j5 = 0; _j5 < _points2.length; _j5++) {
  26850. var _item18 = _points2[_j5];
  26851. if (_startPoint == 0 && _item18.x > leftSpace) {
  26852. context.moveTo(_item18.x, _item18.y);
  26853. _startPoint = 1;
  26854. }
  26855. if (_j5 > 0 && _item18.x > leftSpace && _item18.x < rightSpace) {
  26856. context.lineTo(_item18.x, _points2[_j5 - 1].y);
  26857. context.lineTo(_item18.x, _item18.y);
  26858. }
  26859. }
  26860. ;
  26861. }
  26862. context.moveTo(_points2[0].x, _points2[0].y);
  26863. }
  26864. context.stroke();
  26865. context.setLineDash([]);
  26866. }
  26867. }
  26868. //画点
  26869. if (opts.dataPointShape !== false) {
  26870. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  26871. }
  26872. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, areaOption, seriesIndex);
  26873. });
  26874. if (opts.dataLabel !== false && process === 1) {
  26875. series.forEach(function (eachSeries, seriesIndex) {
  26876. var ranges, minRange, maxRange;
  26877. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26878. minRange = ranges.pop();
  26879. maxRange = ranges.shift();
  26880. var data = eachSeries.data;
  26881. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26882. drawPointText(points, eachSeries, config, context, opts);
  26883. });
  26884. }
  26885. context.restore();
  26886. return {
  26887. xAxisPoints: xAxisPoints,
  26888. calPoints: calPoints,
  26889. eachSpacing: eachSpacing
  26890. };
  26891. }
  26892. function drawScatterDataPoints(series, opts, config, context) {
  26893. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26894. var scatterOption = assign({}, {
  26895. type: 'circle'
  26896. }, opts.extra.scatter);
  26897. var xAxisData = opts.chartData.xAxisData,
  26898. xAxisPoints = xAxisData.xAxisPoints,
  26899. eachSpacing = xAxisData.eachSpacing;
  26900. var calPoints = [];
  26901. context.save();
  26902. var leftSpace = 0;
  26903. var rightSpace = opts.width + eachSpacing;
  26904. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26905. context.translate(opts._scrollDistance_, 0);
  26906. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26907. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26908. }
  26909. series.forEach(function (eachSeries, seriesIndex) {
  26910. var ranges, minRange, maxRange;
  26911. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26912. minRange = ranges.pop();
  26913. maxRange = ranges.shift();
  26914. var data = eachSeries.data;
  26915. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26916. context.beginPath();
  26917. context.setStrokeStyle(eachSeries.color);
  26918. context.setFillStyle(eachSeries.color);
  26919. context.setLineWidth(1 * opts.pix);
  26920. var shape = eachSeries.pointShape;
  26921. if (shape === 'diamond') {
  26922. points.forEach(function (item, index) {
  26923. if (item !== null) {
  26924. context.moveTo(item.x, item.y - 4.5);
  26925. context.lineTo(item.x - 4.5, item.y);
  26926. context.lineTo(item.x, item.y + 4.5);
  26927. context.lineTo(item.x + 4.5, item.y);
  26928. context.lineTo(item.x, item.y - 4.5);
  26929. }
  26930. });
  26931. } else if (shape === 'circle') {
  26932. points.forEach(function (item, index) {
  26933. if (item !== null) {
  26934. context.moveTo(item.x + 2.5 * opts.pix, item.y);
  26935. context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false);
  26936. }
  26937. });
  26938. } else if (shape === 'square') {
  26939. points.forEach(function (item, index) {
  26940. if (item !== null) {
  26941. context.moveTo(item.x - 3.5, item.y - 3.5);
  26942. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  26943. }
  26944. });
  26945. } else if (shape === 'triangle') {
  26946. points.forEach(function (item, index) {
  26947. if (item !== null) {
  26948. context.moveTo(item.x, item.y - 4.5);
  26949. context.lineTo(item.x - 4.5, item.y + 4.5);
  26950. context.lineTo(item.x + 4.5, item.y + 4.5);
  26951. context.lineTo(item.x, item.y - 4.5);
  26952. }
  26953. });
  26954. } else if (shape === 'triangle') {
  26955. return;
  26956. }
  26957. context.closePath();
  26958. context.fill();
  26959. context.stroke();
  26960. });
  26961. if (opts.dataLabel !== false && process === 1) {
  26962. series.forEach(function (eachSeries, seriesIndex) {
  26963. var ranges, minRange, maxRange;
  26964. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  26965. minRange = ranges.pop();
  26966. maxRange = ranges.shift();
  26967. var data = eachSeries.data;
  26968. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  26969. drawPointText(points, eachSeries, config, context, opts);
  26970. });
  26971. }
  26972. context.restore();
  26973. return {
  26974. xAxisPoints: xAxisPoints,
  26975. calPoints: calPoints,
  26976. eachSpacing: eachSpacing
  26977. };
  26978. }
  26979. function drawBubbleDataPoints(series, opts, config, context) {
  26980. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  26981. var bubbleOption = assign({}, {
  26982. opacity: 1,
  26983. border: 2
  26984. }, opts.extra.bubble);
  26985. var xAxisData = opts.chartData.xAxisData,
  26986. xAxisPoints = xAxisData.xAxisPoints,
  26987. eachSpacing = xAxisData.eachSpacing;
  26988. var calPoints = [];
  26989. context.save();
  26990. var leftSpace = 0;
  26991. var rightSpace = opts.width + eachSpacing;
  26992. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  26993. context.translate(opts._scrollDistance_, 0);
  26994. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  26995. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  26996. }
  26997. series.forEach(function (eachSeries, seriesIndex) {
  26998. var ranges, minRange, maxRange;
  26999. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27000. minRange = ranges.pop();
  27001. maxRange = ranges.shift();
  27002. var data = eachSeries.data;
  27003. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27004. context.beginPath();
  27005. context.setStrokeStyle(eachSeries.color);
  27006. context.setLineWidth(bubbleOption.border * opts.pix);
  27007. context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity));
  27008. points.forEach(function (item, index) {
  27009. context.moveTo(item.x + item.r, item.y);
  27010. context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false);
  27011. });
  27012. context.closePath();
  27013. context.fill();
  27014. context.stroke();
  27015. if (opts.dataLabel !== false && process === 1) {
  27016. points.forEach(function (item, index) {
  27017. context.beginPath();
  27018. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  27019. context.setFontSize(fontSize);
  27020. context.setFillStyle(eachSeries.textColor || "#FFFFFF");
  27021. context.setTextAlign('center');
  27022. context.fillText(String(item.t), item.x, item.y + fontSize / 2);
  27023. context.closePath();
  27024. context.stroke();
  27025. context.setTextAlign('left');
  27026. });
  27027. }
  27028. });
  27029. context.restore();
  27030. return {
  27031. xAxisPoints: xAxisPoints,
  27032. calPoints: calPoints,
  27033. eachSpacing: eachSpacing
  27034. };
  27035. }
  27036. function drawLineDataPoints(series, opts, config, context) {
  27037. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27038. var lineOption = assign({}, {
  27039. type: 'straight',
  27040. width: 2,
  27041. activeType: 'none',
  27042. linearType: 'none',
  27043. onShadow: false,
  27044. animation: 'vertical'
  27045. }, opts.extra.line);
  27046. lineOption.width *= opts.pix;
  27047. var xAxisData = opts.chartData.xAxisData,
  27048. xAxisPoints = xAxisData.xAxisPoints,
  27049. eachSpacing = xAxisData.eachSpacing;
  27050. var calPoints = [];
  27051. context.save();
  27052. var leftSpace = 0;
  27053. var rightSpace = opts.width + eachSpacing;
  27054. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27055. context.translate(opts._scrollDistance_, 0);
  27056. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27057. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27058. }
  27059. series.forEach(function (eachSeries, seriesIndex) {
  27060. // 这段很神奇的代码用于解决ios16的setStrokeStyle失效的bug
  27061. context.beginPath();
  27062. context.setStrokeStyle(eachSeries.color);
  27063. context.moveTo(-10000, -10000);
  27064. context.lineTo(-10001, -10001);
  27065. context.stroke();
  27066. var ranges, minRange, maxRange;
  27067. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27068. minRange = ranges.pop();
  27069. maxRange = ranges.shift();
  27070. var data = eachSeries.data;
  27071. var points = getLineDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, lineOption, process);
  27072. calPoints.push(points);
  27073. var splitPointList = splitPoints(points, eachSeries);
  27074. if (eachSeries.lineType == 'dash') {
  27075. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27076. dashLength *= opts.pix;
  27077. context.setLineDash([dashLength, dashLength]);
  27078. }
  27079. context.beginPath();
  27080. var strokeColor = eachSeries.color;
  27081. if (lineOption.linearType !== 'none' && eachSeries.linearColor && eachSeries.linearColor.length > 0) {
  27082. var grd = context.createLinearGradient(opts.chartData.xAxisData.startX, opts.height / 2, opts.chartData.xAxisData.endX, opts.height / 2);
  27083. for (var i = 0; i < eachSeries.linearColor.length; i++) {
  27084. grd.addColorStop(eachSeries.linearColor[i][0], hexToRgb(eachSeries.linearColor[i][1], 1));
  27085. }
  27086. strokeColor = grd;
  27087. }
  27088. context.setStrokeStyle(strokeColor);
  27089. if (lineOption.onShadow == true && eachSeries.setShadow && eachSeries.setShadow.length > 0) {
  27090. context.setShadow(eachSeries.setShadow[0], eachSeries.setShadow[1], eachSeries.setShadow[2], eachSeries.setShadow[3]);
  27091. } else {
  27092. context.setShadow(0, 0, 0, 'rgba(0,0,0,0)');
  27093. }
  27094. context.setLineWidth(lineOption.width);
  27095. splitPointList.forEach(function (points, index) {
  27096. if (points.length === 1) {
  27097. context.moveTo(points[0].x, points[0].y);
  27098. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27099. } else {
  27100. context.moveTo(points[0].x, points[0].y);
  27101. var startPoint = 0;
  27102. if (lineOption.type === 'curve') {
  27103. for (var j = 0; j < points.length; j++) {
  27104. var item = points[j];
  27105. if (startPoint == 0 && item.x > leftSpace) {
  27106. context.moveTo(item.x, item.y);
  27107. startPoint = 1;
  27108. }
  27109. if (j > 0 && item.x > leftSpace && item.x < rightSpace) {
  27110. var ctrlPoint = createCurveControlPoints(points, j - 1);
  27111. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  27112. }
  27113. }
  27114. ;
  27115. }
  27116. if (lineOption.type === 'straight') {
  27117. for (var _j6 = 0; _j6 < points.length; _j6++) {
  27118. var _item19 = points[_j6];
  27119. if (startPoint == 0 && _item19.x > leftSpace) {
  27120. context.moveTo(_item19.x, _item19.y);
  27121. startPoint = 1;
  27122. }
  27123. if (_j6 > 0 && _item19.x > leftSpace && _item19.x < rightSpace) {
  27124. context.lineTo(_item19.x, _item19.y);
  27125. }
  27126. }
  27127. ;
  27128. }
  27129. if (lineOption.type === 'step') {
  27130. for (var _j7 = 0; _j7 < points.length; _j7++) {
  27131. var _item20 = points[_j7];
  27132. if (startPoint == 0 && _item20.x > leftSpace) {
  27133. context.moveTo(_item20.x, _item20.y);
  27134. startPoint = 1;
  27135. }
  27136. if (_j7 > 0 && _item20.x > leftSpace && _item20.x < rightSpace) {
  27137. context.lineTo(_item20.x, points[_j7 - 1].y);
  27138. context.lineTo(_item20.x, _item20.y);
  27139. }
  27140. }
  27141. ;
  27142. }
  27143. context.moveTo(points[0].x, points[0].y);
  27144. }
  27145. });
  27146. context.stroke();
  27147. context.setLineDash([]);
  27148. if (opts.dataPointShape !== false) {
  27149. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27150. }
  27151. drawActivePoint(points, eachSeries.color, eachSeries.pointShape, context, opts, lineOption);
  27152. });
  27153. if (opts.dataLabel !== false && process === 1) {
  27154. series.forEach(function (eachSeries, seriesIndex) {
  27155. var ranges, minRange, maxRange;
  27156. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27157. minRange = ranges.pop();
  27158. maxRange = ranges.shift();
  27159. var data = eachSeries.data;
  27160. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27161. drawPointText(points, eachSeries, config, context, opts);
  27162. });
  27163. }
  27164. context.restore();
  27165. return {
  27166. xAxisPoints: xAxisPoints,
  27167. calPoints: calPoints,
  27168. eachSpacing: eachSpacing
  27169. };
  27170. }
  27171. function drawMixDataPoints(series, opts, config, context) {
  27172. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27173. var xAxisData = opts.chartData.xAxisData,
  27174. xAxisPoints = xAxisData.xAxisPoints,
  27175. eachSpacing = xAxisData.eachSpacing;
  27176. var columnOption = assign({}, {
  27177. width: eachSpacing / 2,
  27178. barBorderCircle: false,
  27179. barBorderRadius: [],
  27180. seriesGap: 2,
  27181. linearType: 'none',
  27182. linearOpacity: 1,
  27183. customColor: [],
  27184. colorStop: 0
  27185. }, opts.extra.mix.column);
  27186. var areaOption = assign({}, {
  27187. opacity: 0.2,
  27188. gradient: false
  27189. }, opts.extra.mix.area);
  27190. var lineOption = assign({}, {
  27191. width: 2
  27192. }, opts.extra.mix.line);
  27193. var endY = opts.height - opts.area[2];
  27194. var calPoints = [];
  27195. var columnIndex = 0;
  27196. var columnLength = 0;
  27197. series.forEach(function (eachSeries, seriesIndex) {
  27198. if (eachSeries.type == 'column') {
  27199. columnLength += 1;
  27200. }
  27201. });
  27202. context.save();
  27203. var leftNum = -2;
  27204. var rightNum = xAxisPoints.length + 2;
  27205. var leftSpace = 0;
  27206. var rightSpace = opts.width + eachSpacing;
  27207. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27208. context.translate(opts._scrollDistance_, 0);
  27209. leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2;
  27210. rightNum = leftNum + opts.xAxis.itemCount + 4;
  27211. leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3];
  27212. rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing;
  27213. }
  27214. columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config);
  27215. series.forEach(function (eachSeries, seriesIndex) {
  27216. var ranges, minRange, maxRange;
  27217. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27218. minRange = ranges.pop();
  27219. maxRange = ranges.shift();
  27220. var data = eachSeries.data;
  27221. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27222. calPoints.push(points);
  27223. // 绘制柱状数据图
  27224. if (eachSeries.type == 'column') {
  27225. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27226. for (var i = 0; i < points.length; i++) {
  27227. var item = points[i];
  27228. if (item !== null && i > leftNum && i < rightNum) {
  27229. var startX = item.x - item.width / 2;
  27230. var height = opts.height - item.y - opts.area[2];
  27231. context.beginPath();
  27232. var fillColor = item.color || eachSeries.color;
  27233. var strokeColor = item.color || eachSeries.color;
  27234. if (columnOption.linearType !== 'none') {
  27235. var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]);
  27236. //透明渐变
  27237. if (columnOption.linearType == 'opacity') {
  27238. grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity));
  27239. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27240. } else {
  27241. grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27242. grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[eachSeries.linearIndex], columnOption.linearOpacity));
  27243. grd.addColorStop(1, hexToRgb(fillColor, 1));
  27244. }
  27245. fillColor = grd;
  27246. }
  27247. // 圆角边框
  27248. if (columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4 || columnOption.barBorderCircle) {
  27249. var left = startX;
  27250. var top = item.y;
  27251. var width = item.width;
  27252. var _height5 = opts.height - opts.area[2] - item.y;
  27253. if (columnOption.barBorderCircle) {
  27254. columnOption.barBorderRadius = [width / 2, width / 2, 0, 0];
  27255. }
  27256. var _columnOption$barBord4 = (0, _slicedToArray2.default)(columnOption.barBorderRadius, 4),
  27257. r0 = _columnOption$barBord4[0],
  27258. r1 = _columnOption$barBord4[1],
  27259. r2 = _columnOption$barBord4[2],
  27260. r3 = _columnOption$barBord4[3];
  27261. var minRadius = Math.min(width / 2, _height5 / 2);
  27262. r0 = r0 > minRadius ? minRadius : r0;
  27263. r1 = r1 > minRadius ? minRadius : r1;
  27264. r2 = r2 > minRadius ? minRadius : r2;
  27265. r3 = r3 > minRadius ? minRadius : r3;
  27266. r0 = r0 < 0 ? 0 : r0;
  27267. r1 = r1 < 0 ? 0 : r1;
  27268. r2 = r2 < 0 ? 0 : r2;
  27269. r3 = r3 < 0 ? 0 : r3;
  27270. context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2);
  27271. context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0);
  27272. context.arc(left + width - r2, top + _height5 - r2, r2, 0, Math.PI / 2);
  27273. context.arc(left + r3, top + _height5 - r3, r3, Math.PI / 2, Math.PI);
  27274. } else {
  27275. context.moveTo(startX, item.y);
  27276. context.lineTo(startX + item.width, item.y);
  27277. context.lineTo(startX + item.width, opts.height - opts.area[2]);
  27278. context.lineTo(startX, opts.height - opts.area[2]);
  27279. context.lineTo(startX, item.y);
  27280. context.setLineWidth(1);
  27281. context.setStrokeStyle(strokeColor);
  27282. }
  27283. context.setFillStyle(fillColor);
  27284. context.closePath();
  27285. context.fill();
  27286. }
  27287. }
  27288. columnIndex += 1;
  27289. }
  27290. //绘制区域图数据
  27291. if (eachSeries.type == 'area') {
  27292. var _splitPointList = splitPoints(points, eachSeries);
  27293. for (var _i23 = 0; _i23 < _splitPointList.length; _i23++) {
  27294. var _points3 = _splitPointList[_i23];
  27295. // 绘制区域数据
  27296. context.beginPath();
  27297. context.setStrokeStyle(eachSeries.color);
  27298. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27299. if (areaOption.gradient) {
  27300. var gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]);
  27301. gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity));
  27302. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  27303. context.setFillStyle(gradient);
  27304. } else {
  27305. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  27306. }
  27307. context.setLineWidth(2 * opts.pix);
  27308. if (_points3.length > 1) {
  27309. var firstPoint = _points3[0];
  27310. var lastPoint = _points3[_points3.length - 1];
  27311. context.moveTo(firstPoint.x, firstPoint.y);
  27312. var startPoint = 0;
  27313. if (eachSeries.style === 'curve') {
  27314. for (var j = 0; j < _points3.length; j++) {
  27315. var _item21 = _points3[j];
  27316. if (startPoint == 0 && _item21.x > leftSpace) {
  27317. context.moveTo(_item21.x, _item21.y);
  27318. startPoint = 1;
  27319. }
  27320. if (j > 0 && _item21.x > leftSpace && _item21.x < rightSpace) {
  27321. var ctrlPoint = createCurveControlPoints(_points3, j - 1);
  27322. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item21.x, _item21.y);
  27323. }
  27324. }
  27325. ;
  27326. } else {
  27327. for (var _j8 = 0; _j8 < _points3.length; _j8++) {
  27328. var _item22 = _points3[_j8];
  27329. if (startPoint == 0 && _item22.x > leftSpace) {
  27330. context.moveTo(_item22.x, _item22.y);
  27331. startPoint = 1;
  27332. }
  27333. if (_j8 > 0 && _item22.x > leftSpace && _item22.x < rightSpace) {
  27334. context.lineTo(_item22.x, _item22.y);
  27335. }
  27336. }
  27337. ;
  27338. }
  27339. context.lineTo(lastPoint.x, endY);
  27340. context.lineTo(firstPoint.x, endY);
  27341. context.lineTo(firstPoint.x, firstPoint.y);
  27342. } else {
  27343. var _item23 = _points3[0];
  27344. context.moveTo(_item23.x - eachSpacing / 2, _item23.y);
  27345. // context.lineTo(item.x + eachSpacing / 2, item.y);
  27346. // context.lineTo(item.x + eachSpacing / 2, endY);
  27347. // context.lineTo(item.x - eachSpacing / 2, endY);
  27348. // context.moveTo(item.x - eachSpacing / 2, item.y);
  27349. }
  27350. context.closePath();
  27351. context.fill();
  27352. }
  27353. }
  27354. // 绘制折线数据图
  27355. if (eachSeries.type == 'line') {
  27356. var splitPointList = splitPoints(points, eachSeries);
  27357. splitPointList.forEach(function (points, index) {
  27358. if (eachSeries.lineType == 'dash') {
  27359. var dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8;
  27360. dashLength *= opts.pix;
  27361. context.setLineDash([dashLength, dashLength]);
  27362. }
  27363. context.beginPath();
  27364. context.setStrokeStyle(eachSeries.color);
  27365. context.setLineWidth(lineOption.width * opts.pix);
  27366. if (points.length === 1) {
  27367. context.moveTo(points[0].x, points[0].y);
  27368. // context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  27369. } else {
  27370. context.moveTo(points[0].x, points[0].y);
  27371. var _startPoint2 = 0;
  27372. if (eachSeries.style == 'curve') {
  27373. for (var _j9 = 0; _j9 < points.length; _j9++) {
  27374. var _item24 = points[_j9];
  27375. if (_startPoint2 == 0 && _item24.x > leftSpace) {
  27376. context.moveTo(_item24.x, _item24.y);
  27377. _startPoint2 = 1;
  27378. }
  27379. if (_j9 > 0 && _item24.x > leftSpace && _item24.x < rightSpace) {
  27380. var ctrlPoint = createCurveControlPoints(points, _j9 - 1);
  27381. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, _item24.x, _item24.y);
  27382. }
  27383. }
  27384. } else {
  27385. for (var _j10 = 0; _j10 < points.length; _j10++) {
  27386. var _item25 = points[_j10];
  27387. if (_startPoint2 == 0 && _item25.x > leftSpace) {
  27388. context.moveTo(_item25.x, _item25.y);
  27389. _startPoint2 = 1;
  27390. }
  27391. if (_j10 > 0 && _item25.x > leftSpace && _item25.x < rightSpace) {
  27392. context.lineTo(_item25.x, _item25.y);
  27393. }
  27394. }
  27395. }
  27396. context.moveTo(points[0].x, points[0].y);
  27397. }
  27398. context.stroke();
  27399. context.setLineDash([]);
  27400. });
  27401. }
  27402. // 绘制点数据图
  27403. if (eachSeries.type == 'point') {
  27404. eachSeries.addPoint = true;
  27405. }
  27406. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  27407. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  27408. }
  27409. });
  27410. if (opts.dataLabel !== false && process === 1) {
  27411. var columnIndex = 0;
  27412. series.forEach(function (eachSeries, seriesIndex) {
  27413. var ranges, minRange, maxRange;
  27414. ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]);
  27415. minRange = ranges.pop();
  27416. maxRange = ranges.shift();
  27417. var data = eachSeries.data;
  27418. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  27419. if (eachSeries.type !== 'column') {
  27420. drawPointText(points, eachSeries, config, context, opts);
  27421. } else {
  27422. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  27423. drawPointText(points, eachSeries, config, context, opts);
  27424. columnIndex += 1;
  27425. }
  27426. });
  27427. }
  27428. context.restore();
  27429. return {
  27430. xAxisPoints: xAxisPoints,
  27431. calPoints: calPoints,
  27432. eachSpacing: eachSpacing
  27433. };
  27434. }
  27435. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  27436. var toolTipOption = opts.extra.tooltip || {};
  27437. 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')) {
  27438. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  27439. }
  27440. context.save();
  27441. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  27442. context.translate(opts._scrollDistance_, 0);
  27443. }
  27444. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  27445. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  27446. }
  27447. context.restore();
  27448. }
  27449. function drawXAxis(categories, opts, config, context) {
  27450. var xAxisData = opts.chartData.xAxisData,
  27451. xAxisPoints = xAxisData.xAxisPoints,
  27452. startX = xAxisData.startX,
  27453. endX = xAxisData.endX,
  27454. eachSpacing = xAxisData.eachSpacing;
  27455. var boundaryGap = 'center';
  27456. if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') {
  27457. boundaryGap = opts.xAxis.boundaryGap;
  27458. }
  27459. var startY = opts.height - opts.area[2];
  27460. var endY = opts.area[0];
  27461. //绘制滚动条
  27462. if (opts.enableScroll && opts.xAxis.scrollShow) {
  27463. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  27464. var scrollScreenWidth = endX - startX;
  27465. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  27466. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27467. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27468. scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing;
  27469. }
  27470. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  27471. var scrollLeft = 0;
  27472. if (opts._scrollDistance_) {
  27473. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  27474. }
  27475. context.beginPath();
  27476. context.setLineCap('round');
  27477. context.setLineWidth(6 * opts.pix);
  27478. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  27479. context.moveTo(startX, scrollY);
  27480. context.lineTo(endX, scrollY);
  27481. context.stroke();
  27482. context.closePath();
  27483. context.beginPath();
  27484. context.setLineCap('round');
  27485. context.setLineWidth(6 * opts.pix);
  27486. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  27487. context.moveTo(startX + scrollLeft, scrollY);
  27488. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  27489. context.stroke();
  27490. context.closePath();
  27491. context.setLineCap('butt');
  27492. }
  27493. context.save();
  27494. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27495. context.translate(opts._scrollDistance_, 0);
  27496. }
  27497. //绘制X轴刻度线
  27498. if (opts.xAxis.calibration === true) {
  27499. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27500. context.setLineCap('butt');
  27501. context.setLineWidth(1 * opts.pix);
  27502. xAxisPoints.forEach(function (item, index) {
  27503. if (index > 0) {
  27504. context.beginPath();
  27505. context.moveTo(item - eachSpacing / 2, startY);
  27506. context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix);
  27507. context.closePath();
  27508. context.stroke();
  27509. }
  27510. });
  27511. }
  27512. //绘制X轴网格
  27513. if (opts.xAxis.disableGrid !== true) {
  27514. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  27515. context.setLineCap('butt');
  27516. context.setLineWidth(1 * opts.pix);
  27517. if (opts.xAxis.gridType == 'dash') {
  27518. context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]);
  27519. }
  27520. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  27521. xAxisPoints.forEach(function (item, index) {
  27522. if (index % opts.xAxis.gridEval == 0) {
  27523. context.beginPath();
  27524. context.moveTo(item, startY);
  27525. context.lineTo(item, endY);
  27526. context.stroke();
  27527. }
  27528. });
  27529. context.setLineDash([]);
  27530. }
  27531. //绘制X轴文案
  27532. if (opts.xAxis.disabled !== true) {
  27533. // 对X轴列表做抽稀处理
  27534. //默认全部显示X轴标签
  27535. var maxXAxisListLength = categories.length;
  27536. //如果设置了X轴单屏数量
  27537. if (opts.xAxis.labelCount) {
  27538. //如果设置X轴密度
  27539. if (opts.xAxis.itemCount) {
  27540. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  27541. } else {
  27542. maxXAxisListLength = opts.xAxis.labelCount;
  27543. }
  27544. maxXAxisListLength -= 1;
  27545. }
  27546. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  27547. var newCategories = [];
  27548. var cgLength = categories.length;
  27549. for (var i = 0; i < cgLength; i++) {
  27550. if (i % ratio !== 0) {
  27551. newCategories.push("");
  27552. } else {
  27553. newCategories.push(categories[i]);
  27554. }
  27555. }
  27556. newCategories[cgLength - 1] = categories[cgLength - 1];
  27557. var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize;
  27558. if (config._xAxisTextAngle_ === 0) {
  27559. newCategories.forEach(function (item, index) {
  27560. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item;
  27561. var offset = -measureText(String(xitem), xAxisFontSize, context) / 2;
  27562. if (boundaryGap == 'center') {
  27563. offset += eachSpacing / 2;
  27564. }
  27565. var scrollHeight = 0;
  27566. if (opts.xAxis.scrollShow) {
  27567. scrollHeight = 6 * opts.pix;
  27568. }
  27569. // 如果在主视图区域内
  27570. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27571. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27572. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27573. context.beginPath();
  27574. context.setFontSize(xAxisFontSize);
  27575. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27576. 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);
  27577. context.closePath();
  27578. context.stroke();
  27579. }
  27580. });
  27581. } else {
  27582. newCategories.forEach(function (item, index) {
  27583. var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item;
  27584. // 如果在主视图区域内
  27585. var _scrollDistance_ = opts._scrollDistance_ || 0;
  27586. var truePoints = boundaryGap == 'center' ? xAxisPoints[index] + eachSpacing / 2 : xAxisPoints[index];
  27587. if (truePoints - Math.abs(_scrollDistance_) >= opts.area[3] - 1 && truePoints - Math.abs(_scrollDistance_) <= opts.width - opts.area[1] + 1) {
  27588. context.save();
  27589. context.beginPath();
  27590. context.setFontSize(xAxisFontSize);
  27591. context.setFillStyle(opts.xAxis.fontColor || opts.fontColor);
  27592. var textWidth = measureText(String(xitem), xAxisFontSize, context);
  27593. var offsetX = xAxisPoints[index];
  27594. if (boundaryGap == 'center') {
  27595. offsetX = xAxisPoints[index] + eachSpacing / 2;
  27596. }
  27597. var scrollHeight = 0;
  27598. if (opts.xAxis.scrollShow) {
  27599. scrollHeight = 6 * opts.pix;
  27600. }
  27601. var offsetY = startY + opts.xAxis.marginTop * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config._xAxisTextAngle_));
  27602. if (opts.xAxis.rotateAngle < 0) {
  27603. offsetX -= xAxisFontSize / 2;
  27604. textWidth = 0;
  27605. } else {
  27606. offsetX += xAxisFontSize / 2;
  27607. textWidth = -textWidth;
  27608. }
  27609. context.translate(offsetX, offsetY);
  27610. context.rotate(-1 * config._xAxisTextAngle_);
  27611. context.fillText(String(xitem), textWidth, 0);
  27612. context.closePath();
  27613. context.stroke();
  27614. context.restore();
  27615. }
  27616. });
  27617. }
  27618. }
  27619. context.restore();
  27620. //画X轴标题
  27621. if (opts.xAxis.title) {
  27622. context.beginPath();
  27623. context.setFontSize(opts.xAxis.titleFontSize * opts.pix);
  27624. context.setFillStyle(opts.xAxis.titleFontColor);
  27625. 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);
  27626. context.closePath();
  27627. context.stroke();
  27628. }
  27629. //绘制X轴轴线
  27630. if (opts.xAxis.axisLine) {
  27631. context.beginPath();
  27632. context.setStrokeStyle(opts.xAxis.axisLineColor);
  27633. context.setLineWidth(1 * opts.pix);
  27634. context.moveTo(startX, opts.height - opts.area[2]);
  27635. context.lineTo(endX, opts.height - opts.area[2]);
  27636. context.stroke();
  27637. }
  27638. }
  27639. function drawYAxisGrid(categories, opts, config, context) {
  27640. if (opts.yAxis.disableGrid === true) {
  27641. return;
  27642. }
  27643. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27644. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27645. var startX = opts.area[3];
  27646. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  27647. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  27648. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  27649. if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount.widthRatio > 1) {
  27650. if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2;
  27651. TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing;
  27652. }
  27653. var endX = startX + TotalWidth;
  27654. var points = [];
  27655. var startY = 1;
  27656. if (opts.xAxis.axisLine === false) {
  27657. startY = 0;
  27658. }
  27659. for (var i = startY; i < opts.yAxis.splitNumber + 1; i++) {
  27660. points.push(opts.height - opts.area[2] - eachSpacing * i);
  27661. }
  27662. context.save();
  27663. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  27664. context.translate(opts._scrollDistance_, 0);
  27665. }
  27666. if (opts.yAxis.gridType == 'dash') {
  27667. context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]);
  27668. }
  27669. context.setStrokeStyle(opts.yAxis.gridColor);
  27670. context.setLineWidth(1 * opts.pix);
  27671. points.forEach(function (item, index) {
  27672. context.beginPath();
  27673. context.moveTo(startX, item);
  27674. context.lineTo(endX, item);
  27675. context.stroke();
  27676. });
  27677. context.setLineDash([]);
  27678. context.restore();
  27679. }
  27680. function drawYAxis(series, opts, config, context) {
  27681. if (opts.yAxis.disabled === true) {
  27682. return;
  27683. }
  27684. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  27685. var eachSpacing = spacingValid / opts.yAxis.splitNumber;
  27686. var startX = opts.area[3];
  27687. var endX = opts.width - opts.area[1];
  27688. var endY = opts.height - opts.area[2];
  27689. // set YAxis background
  27690. context.beginPath();
  27691. context.setFillStyle(opts.background);
  27692. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') {
  27693. context.fillRect(0, 0, startX, endY + 2 * opts.pix);
  27694. }
  27695. if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') {
  27696. context.fillRect(endX, 0, opts.width, endY + 2 * opts.pix);
  27697. }
  27698. context.closePath();
  27699. context.stroke();
  27700. var tStartLeft = opts.area[3];
  27701. var tStartRight = opts.width - opts.area[1];
  27702. var tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2;
  27703. if (opts.yAxis.data) {
  27704. var _loop4 = function _loop4(i) {
  27705. var yData = opts.yAxis.data[i];
  27706. points = [];
  27707. if (yData.type === 'categories') {
  27708. for (var _i24 = 0; _i24 <= yData.categories.length; _i24++) {
  27709. points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData.categories.length * _i24);
  27710. }
  27711. } else {
  27712. for (var _i25 = 0; _i25 <= opts.yAxis.splitNumber; _i25++) {
  27713. points.push(opts.area[0] + eachSpacing * _i25);
  27714. }
  27715. }
  27716. if (yData.disabled !== true) {
  27717. var rangesFormat = opts.chartData.yAxisData.rangesFormat[i];
  27718. var yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize;
  27719. var yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i];
  27720. var textAlign = yData.textAlign || "right";
  27721. //画Y轴刻度及文案
  27722. rangesFormat.forEach(function (item, index) {
  27723. var pos = points[index];
  27724. context.beginPath();
  27725. context.setFontSize(yAxisFontSize);
  27726. context.setLineWidth(1 * opts.pix);
  27727. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27728. context.setFillStyle(yData.fontColor || opts.fontColor);
  27729. var tmpstrat = 0;
  27730. var gapwidth = 4 * opts.pix;
  27731. if (yAxisWidth.position == 'left') {
  27732. //画刻度线
  27733. if (yData.calibration == true) {
  27734. context.moveTo(tStartLeft, pos);
  27735. context.lineTo(tStartLeft - 3 * opts.pix, pos);
  27736. gapwidth += 3 * opts.pix;
  27737. }
  27738. //画文字
  27739. switch (textAlign) {
  27740. case "left":
  27741. context.setTextAlign('left');
  27742. tmpstrat = tStartLeft - yAxisWidth.width;
  27743. break;
  27744. case "right":
  27745. context.setTextAlign('right');
  27746. tmpstrat = tStartLeft - gapwidth;
  27747. break;
  27748. default:
  27749. context.setTextAlign('center');
  27750. tmpstrat = tStartLeft - yAxisWidth.width / 2;
  27751. }
  27752. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27753. } else if (yAxisWidth.position == 'right') {
  27754. //画刻度线
  27755. if (yData.calibration == true) {
  27756. context.moveTo(tStartRight, pos);
  27757. context.lineTo(tStartRight + 3 * opts.pix, pos);
  27758. gapwidth += 3 * opts.pix;
  27759. }
  27760. switch (textAlign) {
  27761. case "left":
  27762. context.setTextAlign('left');
  27763. tmpstrat = tStartRight + gapwidth;
  27764. break;
  27765. case "right":
  27766. context.setTextAlign('right');
  27767. tmpstrat = tStartRight + yAxisWidth.width;
  27768. break;
  27769. default:
  27770. context.setTextAlign('center');
  27771. tmpstrat = tStartRight + yAxisWidth.width / 2;
  27772. }
  27773. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27774. } else if (yAxisWidth.position == 'center') {
  27775. //画刻度线
  27776. if (yData.calibration == true) {
  27777. context.moveTo(tStartCenter, pos);
  27778. context.lineTo(tStartCenter - 3 * opts.pix, pos);
  27779. gapwidth += 3 * opts.pix;
  27780. }
  27781. //画文字
  27782. switch (textAlign) {
  27783. case "left":
  27784. context.setTextAlign('left');
  27785. tmpstrat = tStartCenter - yAxisWidth.width;
  27786. break;
  27787. case "right":
  27788. context.setTextAlign('right');
  27789. tmpstrat = tStartCenter - gapwidth;
  27790. break;
  27791. default:
  27792. context.setTextAlign('center');
  27793. tmpstrat = tStartCenter - yAxisWidth.width / 2;
  27794. }
  27795. context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix);
  27796. }
  27797. context.closePath();
  27798. context.stroke();
  27799. context.setTextAlign('left');
  27800. });
  27801. //画Y轴轴线
  27802. if (yData.axisLine !== false) {
  27803. context.beginPath();
  27804. context.setStrokeStyle(yData.axisLineColor || '#cccccc');
  27805. context.setLineWidth(1 * opts.pix);
  27806. if (yAxisWidth.position == 'left') {
  27807. context.moveTo(tStartLeft, opts.height - opts.area[2]);
  27808. context.lineTo(tStartLeft, opts.area[0]);
  27809. } else if (yAxisWidth.position == 'right') {
  27810. context.moveTo(tStartRight, opts.height - opts.area[2]);
  27811. context.lineTo(tStartRight, opts.area[0]);
  27812. } else if (yAxisWidth.position == 'center') {
  27813. context.moveTo(tStartCenter, opts.height - opts.area[2]);
  27814. context.lineTo(tStartCenter, opts.area[0]);
  27815. }
  27816. context.stroke();
  27817. }
  27818. //画Y轴标题
  27819. if (opts.yAxis.showTitle) {
  27820. var titleFontSize = yData.titleFontSize * opts.pix || config.fontSize;
  27821. var title = yData.title;
  27822. context.beginPath();
  27823. context.setFontSize(titleFontSize);
  27824. context.setFillStyle(yData.titleFontColor || opts.fontColor);
  27825. if (yAxisWidth.position == 'left') {
  27826. context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27827. } else if (yAxisWidth.position == 'right') {
  27828. context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27829. } else if (yAxisWidth.position == 'center') {
  27830. context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData.titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix);
  27831. }
  27832. context.closePath();
  27833. context.stroke();
  27834. }
  27835. if (yAxisWidth.position == 'left') {
  27836. tStartLeft -= yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27837. } else {
  27838. tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix;
  27839. }
  27840. }
  27841. };
  27842. for (var i = 0; i < opts.yAxis.data.length; i++) {
  27843. var points;
  27844. _loop4(i);
  27845. }
  27846. }
  27847. }
  27848. function drawLegend(series, opts, config, context, chartData) {
  27849. if (opts.legend.show === false) {
  27850. return;
  27851. }
  27852. var legendData = chartData.legendData;
  27853. var legendList = legendData.points;
  27854. var legendArea = legendData.area;
  27855. var padding = opts.legend.padding * opts.pix;
  27856. var fontSize = opts.legend.fontSize * opts.pix;
  27857. var shapeWidth = 15 * opts.pix;
  27858. var shapeRight = 5 * opts.pix;
  27859. var itemGap = opts.legend.itemGap * opts.pix;
  27860. var lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize);
  27861. //画背景及边框
  27862. context.beginPath();
  27863. context.setLineWidth(opts.legend.borderWidth * opts.pix);
  27864. context.setStrokeStyle(opts.legend.borderColor);
  27865. context.setFillStyle(opts.legend.backgroundColor);
  27866. context.moveTo(legendArea.start.x, legendArea.start.y);
  27867. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  27868. context.closePath();
  27869. context.fill();
  27870. context.stroke();
  27871. legendList.forEach(function (itemList, listIndex) {
  27872. var width = 0;
  27873. var height = 0;
  27874. width = legendData.widthArr[listIndex];
  27875. height = legendData.heightArr[listIndex];
  27876. var startX = 0;
  27877. var startY = 0;
  27878. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  27879. switch (opts.legend.float) {
  27880. case 'left':
  27881. startX = legendArea.start.x + padding;
  27882. break;
  27883. case 'right':
  27884. startX = legendArea.start.x + legendArea.width - width;
  27885. break;
  27886. default:
  27887. startX = legendArea.start.x + (legendArea.width - width) / 2;
  27888. }
  27889. startY = legendArea.start.y + padding + listIndex * lineHeight;
  27890. } else {
  27891. if (listIndex == 0) {
  27892. width = 0;
  27893. } else {
  27894. width = legendData.widthArr[listIndex - 1];
  27895. }
  27896. startX = legendArea.start.x + padding + width;
  27897. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  27898. }
  27899. context.setFontSize(config.fontSize);
  27900. for (var i = 0; i < itemList.length; i++) {
  27901. var item = itemList[i];
  27902. item.area = [0, 0, 0, 0];
  27903. item.area[0] = startX;
  27904. item.area[1] = startY;
  27905. item.area[3] = startY + lineHeight;
  27906. context.beginPath();
  27907. context.setLineWidth(1 * opts.pix);
  27908. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  27909. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  27910. switch (item.legendShape) {
  27911. case 'line':
  27912. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix);
  27913. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts.pix);
  27914. break;
  27915. case 'triangle':
  27916. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27917. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27918. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27919. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27920. break;
  27921. case 'diamond':
  27922. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27923. context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight);
  27924. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix);
  27925. context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight);
  27926. context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27927. break;
  27928. case 'circle':
  27929. context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight);
  27930. context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math.PI);
  27931. break;
  27932. case 'rect':
  27933. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  27934. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  27935. break;
  27936. case 'square':
  27937. context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix);
  27938. context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts.pix, 10 * opts.pix);
  27939. break;
  27940. case 'none':
  27941. break;
  27942. default:
  27943. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix);
  27944. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts.pix);
  27945. }
  27946. context.closePath();
  27947. context.fill();
  27948. context.stroke();
  27949. startX += shapeWidth + shapeRight;
  27950. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  27951. var legendText = item.legendText ? item.legendText : item.name;
  27952. context.beginPath();
  27953. context.setFontSize(fontSize);
  27954. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  27955. context.fillText(legendText, startX, startY + fontTrans);
  27956. context.closePath();
  27957. context.stroke();
  27958. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  27959. startX += measureText(legendText, fontSize, context) + itemGap;
  27960. item.area[2] = startX;
  27961. } else {
  27962. item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;
  27963. ;
  27964. startX -= shapeWidth + shapeRight;
  27965. startY += lineHeight;
  27966. }
  27967. }
  27968. });
  27969. }
  27970. function drawPieDataPoints(series, opts, config, context) {
  27971. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  27972. var pieOption = assign({}, {
  27973. activeOpacity: 0.5,
  27974. activeRadius: 10,
  27975. offsetAngle: 0,
  27976. labelWidth: 15,
  27977. ringWidth: 30,
  27978. customRadius: 0,
  27979. border: false,
  27980. borderWidth: 2,
  27981. borderColor: '#FFFFFF',
  27982. centerColor: '#FFFFFF',
  27983. linearType: 'none',
  27984. customColor: []
  27985. }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring);
  27986. var centerPosition = {
  27987. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  27988. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  27989. };
  27990. if (config.pieChartLinePadding == 0) {
  27991. config.pieChartLinePadding = pieOption.activeRadius * opts.pix;
  27992. }
  27993. 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);
  27994. radius = radius < 10 ? 10 : radius;
  27995. if (pieOption.customRadius > 0) {
  27996. radius = pieOption.customRadius * opts.pix;
  27997. }
  27998. series = getPieDataPoints(series, radius, process);
  27999. var activeRadius = pieOption.activeRadius * opts.pix;
  28000. pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config);
  28001. series = series.map(function (eachSeries) {
  28002. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  28003. return eachSeries;
  28004. });
  28005. series.forEach(function (eachSeries, seriesIndex) {
  28006. if (opts.tooltip) {
  28007. if (opts.tooltip.index == seriesIndex) {
  28008. context.beginPath();
  28009. context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5));
  28010. context.moveTo(centerPosition.x, centerPosition.y);
  28011. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28012. context.closePath();
  28013. context.fill();
  28014. }
  28015. }
  28016. context.beginPath();
  28017. context.setLineWidth(pieOption.borderWidth * opts.pix);
  28018. context.lineJoin = "round";
  28019. context.setStrokeStyle(pieOption.borderColor);
  28020. var fillcolor = eachSeries.color;
  28021. if (pieOption.linearType == 'custom') {
  28022. var grd;
  28023. if (context.createCircularGradient) {
  28024. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28025. } else {
  28026. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28027. }
  28028. grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1));
  28029. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28030. fillcolor = grd;
  28031. }
  28032. context.setFillStyle(fillcolor);
  28033. context.moveTo(centerPosition.x, centerPosition.y);
  28034. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  28035. context.closePath();
  28036. context.fill();
  28037. if (pieOption.border == true) {
  28038. context.stroke();
  28039. }
  28040. });
  28041. if (opts.type === 'ring') {
  28042. var innerPieWidth = radius * 0.6;
  28043. if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) {
  28044. innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix);
  28045. }
  28046. context.beginPath();
  28047. context.setFillStyle(pieOption.centerColor);
  28048. context.moveTo(centerPosition.x, centerPosition.y);
  28049. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  28050. context.closePath();
  28051. context.fill();
  28052. }
  28053. if (opts.dataLabel !== false && process === 1) {
  28054. drawPieText(series, opts, config, context, radius, centerPosition);
  28055. }
  28056. if (process === 1 && opts.type === 'ring') {
  28057. drawRingTitle(opts, config, context, centerPosition);
  28058. }
  28059. return {
  28060. center: centerPosition,
  28061. radius: radius,
  28062. series: series
  28063. };
  28064. }
  28065. function drawRoseDataPoints(series, opts, config, context) {
  28066. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28067. var roseOption = assign({}, {
  28068. type: 'area',
  28069. activeOpacity: 0.5,
  28070. activeRadius: 10,
  28071. offsetAngle: 0,
  28072. labelWidth: 15,
  28073. border: false,
  28074. borderWidth: 2,
  28075. borderColor: '#FFFFFF',
  28076. linearType: 'none',
  28077. customColor: []
  28078. }, opts.extra.rose);
  28079. if (config.pieChartLinePadding == 0) {
  28080. config.pieChartLinePadding = roseOption.activeRadius * opts.pix;
  28081. }
  28082. var centerPosition = {
  28083. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28084. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28085. };
  28086. 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);
  28087. radius = radius < 10 ? 10 : radius;
  28088. var minRadius = roseOption.minRadius || radius * 0.5;
  28089. if (radius < minRadius) {
  28090. radius = minRadius + 10;
  28091. }
  28092. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  28093. var activeRadius = roseOption.activeRadius * opts.pix;
  28094. roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config);
  28095. series = series.map(function (eachSeries) {
  28096. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  28097. return eachSeries;
  28098. });
  28099. series.forEach(function (eachSeries, seriesIndex) {
  28100. if (opts.tooltip) {
  28101. if (opts.tooltip.index == seriesIndex) {
  28102. context.beginPath();
  28103. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  28104. context.moveTo(centerPosition.x, centerPosition.y);
  28105. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28106. context.closePath();
  28107. context.fill();
  28108. }
  28109. }
  28110. context.beginPath();
  28111. context.setLineWidth(roseOption.borderWidth * opts.pix);
  28112. context.lineJoin = "round";
  28113. context.setStrokeStyle(roseOption.borderColor);
  28114. var fillcolor = eachSeries.color;
  28115. if (roseOption.linearType == 'custom') {
  28116. var grd;
  28117. if (context.createCircularGradient) {
  28118. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_);
  28119. } else {
  28120. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, eachSeries._radius_);
  28121. }
  28122. grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1));
  28123. grd.addColorStop(1, hexToRgb(eachSeries.color, 1));
  28124. fillcolor = grd;
  28125. }
  28126. context.setFillStyle(fillcolor);
  28127. context.moveTo(centerPosition.x, centerPosition.y);
  28128. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  28129. context.closePath();
  28130. context.fill();
  28131. if (roseOption.border == true) {
  28132. context.stroke();
  28133. }
  28134. });
  28135. if (opts.dataLabel !== false && process === 1) {
  28136. drawPieText(series, opts, config, context, radius, centerPosition);
  28137. }
  28138. return {
  28139. center: centerPosition,
  28140. radius: radius,
  28141. series: series
  28142. };
  28143. }
  28144. function drawArcbarDataPoints(series, opts, config, context) {
  28145. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28146. var arcbarOption = assign({}, {
  28147. startAngle: 0.75,
  28148. endAngle: 0.25,
  28149. type: 'default',
  28150. direction: 'cw',
  28151. lineCap: 'round',
  28152. width: 12,
  28153. gap: 2,
  28154. linearType: 'none',
  28155. customColor: []
  28156. }, opts.extra.arcbar);
  28157. series = getArcbarDataPoints(series, arcbarOption, process);
  28158. var centerPosition;
  28159. if (arcbarOption.centerX || arcbarOption.centerY) {
  28160. centerPosition = {
  28161. x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2,
  28162. y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2
  28163. };
  28164. } else {
  28165. centerPosition = {
  28166. x: opts.width / 2,
  28167. y: opts.height / 2
  28168. };
  28169. }
  28170. var radius;
  28171. if (arcbarOption.radius) {
  28172. radius = arcbarOption.radius;
  28173. } else {
  28174. radius = Math.min(centerPosition.x, centerPosition.y);
  28175. radius -= 5 * opts.pix;
  28176. radius -= arcbarOption.width / 2;
  28177. }
  28178. radius = radius < 10 ? 10 : radius;
  28179. arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config);
  28180. for (var i = 0; i < series.length; i++) {
  28181. var eachSeries = series[i];
  28182. //背景颜色
  28183. context.setLineWidth(arcbarOption.width * opts.pix);
  28184. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  28185. context.setLineCap(arcbarOption.lineCap);
  28186. context.beginPath();
  28187. if (arcbarOption.type == 'default') {
  28188. 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');
  28189. } else {
  28190. context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * opts.pix) * i, 0, 2 * Math.PI, arcbarOption.direction == 'ccw');
  28191. }
  28192. context.stroke();
  28193. //进度条
  28194. var fillColor = eachSeries.color;
  28195. if (arcbarOption.linearType == 'custom') {
  28196. var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + radius, centerPosition.y);
  28197. grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1));
  28198. grd.addColorStop(0, hexToRgb(eachSeries.color, 1));
  28199. fillColor = grd;
  28200. }
  28201. context.setLineWidth(arcbarOption.width * opts.pix);
  28202. context.setStrokeStyle(fillColor);
  28203. context.setLineCap(arcbarOption.lineCap);
  28204. context.beginPath();
  28205. 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');
  28206. context.stroke();
  28207. }
  28208. drawRingTitle(opts, config, context, centerPosition);
  28209. return {
  28210. center: centerPosition,
  28211. radius: radius,
  28212. series: series
  28213. };
  28214. }
  28215. function drawGaugeDataPoints(categories, series, opts, config, context) {
  28216. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  28217. var gaugeOption = assign({}, {
  28218. type: 'default',
  28219. startAngle: 0.75,
  28220. endAngle: 0.25,
  28221. width: 15,
  28222. labelOffset: 13,
  28223. splitLine: {
  28224. fixRadius: 0,
  28225. splitNumber: 10,
  28226. width: 15,
  28227. color: '#FFFFFF',
  28228. childNumber: 5,
  28229. childWidth: 5
  28230. },
  28231. pointer: {
  28232. width: 15,
  28233. color: 'auto'
  28234. }
  28235. }, opts.extra.gauge);
  28236. if (gaugeOption.oldAngle == undefined) {
  28237. gaugeOption.oldAngle = gaugeOption.startAngle;
  28238. }
  28239. if (gaugeOption.oldData == undefined) {
  28240. gaugeOption.oldData = 0;
  28241. }
  28242. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  28243. var centerPosition = {
  28244. x: opts.width / 2,
  28245. y: opts.height / 2
  28246. };
  28247. var radius = Math.min(centerPosition.x, centerPosition.y);
  28248. radius -= 5 * opts.pix;
  28249. radius -= gaugeOption.width / 2;
  28250. radius = radius < 10 ? 10 : radius;
  28251. var innerRadius = radius - gaugeOption.width;
  28252. var totalAngle = 0;
  28253. //判断仪表盘的样式:default百度样式,progress新样式
  28254. if (gaugeOption.type == 'progress') {
  28255. //## 第一步画中心圆形背景和进度条背景
  28256. //中心圆形背景
  28257. var pieRadius = radius - gaugeOption.width * 3;
  28258. context.beginPath();
  28259. var gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, centerPosition.y + pieRadius);
  28260. //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径)
  28261. gradient.addColorStop('0', hexToRgb(series[0].color, 0.3));
  28262. gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1));
  28263. context.setFillStyle(gradient);
  28264. context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false);
  28265. context.fill();
  28266. //画进度条背景
  28267. context.setLineWidth(gaugeOption.width);
  28268. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28269. context.setLineCap('round');
  28270. context.beginPath();
  28271. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption.endAngle * Math.PI, false);
  28272. context.stroke();
  28273. //## 第二步画刻度线
  28274. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28275. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28276. } else {
  28277. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28278. }
  28279. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28280. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28281. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28282. var endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28283. context.save();
  28284. context.translate(centerPosition.x, centerPosition.y);
  28285. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28286. var len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1;
  28287. var proc = series[0].data * process;
  28288. for (var i = 0; i < len; i++) {
  28289. context.beginPath();
  28290. //刻度线随进度变色
  28291. if (proc > i / len) {
  28292. context.setStrokeStyle(hexToRgb(series[0].color, 1));
  28293. } else {
  28294. context.setStrokeStyle(hexToRgb(series[0].color, 0.3));
  28295. }
  28296. context.setLineWidth(3 * opts.pix);
  28297. context.moveTo(startX, 0);
  28298. context.lineTo(endX, 0);
  28299. context.stroke();
  28300. context.rotate(childAngle * Math.PI);
  28301. }
  28302. context.restore();
  28303. //## 第三步画进度条
  28304. series = getGaugeArcbarDataPoints(series, gaugeOption, process);
  28305. context.setLineWidth(gaugeOption.width);
  28306. context.setStrokeStyle(series[0].color);
  28307. context.setLineCap('round');
  28308. context.beginPath();
  28309. context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0]._proportion_ * Math.PI, false);
  28310. context.stroke();
  28311. //## 第四步画指针
  28312. var pointerRadius = radius - gaugeOption.width * 2.5;
  28313. context.save();
  28314. context.translate(centerPosition.x, centerPosition.y);
  28315. context.rotate((series[0]._proportion_ - 1) * Math.PI);
  28316. context.beginPath();
  28317. context.setLineWidth(gaugeOption.width / 3);
  28318. var gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6);
  28319. gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0));
  28320. gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1));
  28321. gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0));
  28322. context.setStrokeStyle(gradient3);
  28323. context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false);
  28324. context.stroke();
  28325. context.beginPath();
  28326. context.setLineWidth(1);
  28327. context.setStrokeStyle(series[0].color);
  28328. context.setFillStyle(series[0].color);
  28329. context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28330. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0);
  28331. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4);
  28332. context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4);
  28333. context.stroke();
  28334. context.fill();
  28335. context.restore();
  28336. //default百度样式
  28337. } else {
  28338. //画背景
  28339. context.setLineWidth(gaugeOption.width);
  28340. context.setLineCap('butt');
  28341. for (var _i26 = 0; _i26 < categories.length; _i26++) {
  28342. var eachCategories = categories[_i26];
  28343. context.beginPath();
  28344. context.setStrokeStyle(eachCategories.color);
  28345. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ * Math.PI, false);
  28346. context.stroke();
  28347. }
  28348. context.save();
  28349. //画刻度线
  28350. if (gaugeOption.endAngle < gaugeOption.startAngle) {
  28351. totalAngle = 2 + gaugeOption.endAngle - gaugeOption.startAngle;
  28352. } else {
  28353. totalAngle = gaugeOption.startAngle - gaugeOption.endAngle;
  28354. }
  28355. var _splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  28356. var _childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  28357. var _startX2 = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  28358. var _endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  28359. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  28360. context.translate(centerPosition.x, centerPosition.y);
  28361. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28362. for (var _i27 = 0; _i27 < gaugeOption.splitLine.splitNumber + 1; _i27++) {
  28363. context.beginPath();
  28364. context.setStrokeStyle(gaugeOption.splitLine.color);
  28365. context.setLineWidth(2 * opts.pix);
  28366. context.moveTo(_startX2, 0);
  28367. context.lineTo(_endX, 0);
  28368. context.stroke();
  28369. context.rotate(_splitAngle * Math.PI);
  28370. }
  28371. context.restore();
  28372. context.save();
  28373. context.translate(centerPosition.x, centerPosition.y);
  28374. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  28375. for (var _i28 = 0; _i28 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i28++) {
  28376. context.beginPath();
  28377. context.setStrokeStyle(gaugeOption.splitLine.color);
  28378. context.setLineWidth(1 * opts.pix);
  28379. context.moveTo(_startX2, 0);
  28380. context.lineTo(childendX, 0);
  28381. context.stroke();
  28382. context.rotate(_childAngle * Math.PI);
  28383. }
  28384. context.restore();
  28385. //画指针
  28386. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  28387. for (var _i29 = 0; _i29 < series.length; _i29++) {
  28388. var eachSeries = series[_i29];
  28389. context.save();
  28390. context.translate(centerPosition.x, centerPosition.y);
  28391. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  28392. context.beginPath();
  28393. context.setFillStyle(eachSeries.color);
  28394. context.moveTo(gaugeOption.pointer.width, 0);
  28395. context.lineTo(0, -gaugeOption.pointer.width / 2);
  28396. context.lineTo(-innerRadius, 0);
  28397. context.lineTo(0, gaugeOption.pointer.width / 2);
  28398. context.lineTo(gaugeOption.pointer.width, 0);
  28399. context.closePath();
  28400. context.fill();
  28401. context.beginPath();
  28402. context.setFillStyle('#FFFFFF');
  28403. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  28404. context.fill();
  28405. context.restore();
  28406. }
  28407. if (opts.dataLabel !== false) {
  28408. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  28409. }
  28410. }
  28411. //画仪表盘标题,副标题
  28412. drawRingTitle(opts, config, context, centerPosition);
  28413. if (process === 1 && opts.type === 'gauge') {
  28414. opts.extra.gauge.oldAngle = series[0]._proportion_;
  28415. opts.extra.gauge.oldData = series[0].data;
  28416. }
  28417. return {
  28418. center: centerPosition,
  28419. radius: radius,
  28420. innerRadius: innerRadius,
  28421. categories: categories,
  28422. totalAngle: totalAngle
  28423. };
  28424. }
  28425. function drawRadarDataPoints(series, opts, config, context) {
  28426. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28427. var radarOption = assign({}, {
  28428. gridColor: '#cccccc',
  28429. gridType: 'radar',
  28430. gridEval: 1,
  28431. axisLabel: false,
  28432. axisLabelTofix: 0,
  28433. labelShow: true,
  28434. labelColor: '#666666',
  28435. labelPointShow: false,
  28436. labelPointRadius: 3,
  28437. labelPointColor: '#cccccc',
  28438. opacity: 0.2,
  28439. gridCount: 3,
  28440. border: false,
  28441. borderWidth: 2,
  28442. linearType: 'none',
  28443. customColor: []
  28444. }, opts.extra.radar);
  28445. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  28446. var centerPosition = {
  28447. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28448. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2
  28449. };
  28450. var xr = (opts.width - opts.area[1] - opts.area[3]) / 2;
  28451. var yr = (opts.height - opts.area[0] - opts.area[2]) / 2;
  28452. var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config.radarLabelTextMargin), yr - config.radarLabelTextMargin);
  28453. radius -= config.radarLabelTextMargin * opts.pix;
  28454. radius = radius < 10 ? 10 : radius;
  28455. radius = radarOption.radius ? radarOption.radius : radius;
  28456. // 画分割线
  28457. context.beginPath();
  28458. context.setLineWidth(1 * opts.pix);
  28459. context.setStrokeStyle(radarOption.gridColor);
  28460. coordinateAngle.forEach(function (angle, index) {
  28461. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  28462. context.moveTo(centerPosition.x, centerPosition.y);
  28463. if (index % radarOption.gridEval == 0) {
  28464. context.lineTo(pos.x, pos.y);
  28465. }
  28466. });
  28467. context.stroke();
  28468. context.closePath();
  28469. // 画背景网格
  28470. var _loop = function _loop(i) {
  28471. var startPos = {};
  28472. context.beginPath();
  28473. context.setLineWidth(1 * opts.pix);
  28474. context.setStrokeStyle(radarOption.gridColor);
  28475. if (radarOption.gridType == 'radar') {
  28476. coordinateAngle.forEach(function (angle, index) {
  28477. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), radius / radarOption.gridCount * i * Math.sin(angle), centerPosition);
  28478. if (index === 0) {
  28479. startPos = pos;
  28480. context.moveTo(pos.x, pos.y);
  28481. } else {
  28482. context.lineTo(pos.x, pos.y);
  28483. }
  28484. });
  28485. context.lineTo(startPos.x, startPos.y);
  28486. } else {
  28487. var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / radarOption.gridCount * i * Math.sin(1.5), centerPosition);
  28488. context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false);
  28489. }
  28490. context.stroke();
  28491. context.closePath();
  28492. };
  28493. for (var i = 1; i <= radarOption.gridCount; i++) {
  28494. _loop(i);
  28495. }
  28496. radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config);
  28497. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  28498. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28499. // 绘制区域数据
  28500. context.beginPath();
  28501. context.setLineWidth(radarOption.borderWidth * opts.pix);
  28502. context.setStrokeStyle(eachSeries.color);
  28503. var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity);
  28504. if (radarOption.linearType == 'custom') {
  28505. var grd;
  28506. if (context.createCircularGradient) {
  28507. grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius);
  28508. } else {
  28509. grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, centerPosition.y, radius);
  28510. }
  28511. grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption.opacity));
  28512. grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity));
  28513. fillcolor = grd;
  28514. }
  28515. context.setFillStyle(fillcolor);
  28516. eachSeries.data.forEach(function (item, index) {
  28517. if (index === 0) {
  28518. context.moveTo(item.position.x, item.position.y);
  28519. } else {
  28520. context.lineTo(item.position.x, item.position.y);
  28521. }
  28522. });
  28523. context.closePath();
  28524. context.fill();
  28525. if (radarOption.border === true) {
  28526. context.stroke();
  28527. }
  28528. context.closePath();
  28529. if (opts.dataPointShape !== false) {
  28530. var points = eachSeries.data.map(function (item) {
  28531. return item.position;
  28532. });
  28533. drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts);
  28534. }
  28535. });
  28536. // 画刻度值
  28537. if (radarOption.axisLabel === true) {
  28538. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  28539. var stepLength = radius / radarOption.gridCount;
  28540. var fontSize = opts.fontSize * opts.pix;
  28541. context.setFontSize(fontSize);
  28542. context.setFillStyle(opts.fontColor);
  28543. context.setTextAlign('left');
  28544. for (var i = 0; i < radarOption.gridCount + 1; i++) {
  28545. var label = i * maxData / radarOption.gridCount;
  28546. label = label.toFixed(radarOption.axisLabelTofix);
  28547. context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + fontSize / 2);
  28548. }
  28549. }
  28550. // draw label text
  28551. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  28552. // draw dataLabel
  28553. if (opts.dataLabel !== false && process === 1) {
  28554. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  28555. context.beginPath();
  28556. var fontSize = eachSeries.textSize * opts.pix || config.fontSize;
  28557. context.setFontSize(fontSize);
  28558. context.setFillStyle(eachSeries.textColor || opts.fontColor);
  28559. eachSeries.data.forEach(function (item, index) {
  28560. //如果是中心点垂直的上下点位
  28561. if (Math.abs(item.position.x - centerPosition.x) < 2) {
  28562. //如果在上面
  28563. if (item.position.y < centerPosition.y) {
  28564. context.setTextAlign('center');
  28565. context.fillText(item.value, item.position.x, item.position.y - 4);
  28566. } else {
  28567. context.setTextAlign('center');
  28568. context.fillText(item.value, item.position.x, item.position.y + fontSize + 2);
  28569. }
  28570. } else {
  28571. //如果在左侧
  28572. if (item.position.x < centerPosition.x) {
  28573. context.setTextAlign('right');
  28574. context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / 2 - 2);
  28575. } else {
  28576. context.setTextAlign('left');
  28577. context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / 2 - 2);
  28578. }
  28579. }
  28580. });
  28581. context.closePath();
  28582. context.stroke();
  28583. });
  28584. context.setTextAlign('left');
  28585. }
  28586. return {
  28587. center: centerPosition,
  28588. radius: radius,
  28589. angleList: coordinateAngle
  28590. };
  28591. }
  28592. // 经纬度转墨卡托
  28593. function lonlat2mercator(longitude, latitude) {
  28594. var mercator = Array(2);
  28595. var x = longitude * 20037508.34 / 180;
  28596. var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180);
  28597. y = y * 20037508.34 / 180;
  28598. mercator[0] = x;
  28599. mercator[1] = y;
  28600. return mercator;
  28601. }
  28602. // 墨卡托转经纬度
  28603. function mercator2lonlat(longitude, latitude) {
  28604. var lonlat = Array(2);
  28605. var x = longitude / 20037508.34 * 180;
  28606. var y = latitude / 20037508.34 * 180;
  28607. y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
  28608. lonlat[0] = x;
  28609. lonlat[1] = y;
  28610. return lonlat;
  28611. }
  28612. function getBoundingBox(data) {
  28613. var bounds = {},
  28614. coords;
  28615. bounds.xMin = 180;
  28616. bounds.xMax = 0;
  28617. bounds.yMin = 90;
  28618. bounds.yMax = 0;
  28619. for (var i = 0; i < data.length; i++) {
  28620. var coorda = data[i].geometry.coordinates;
  28621. for (var k = 0; k < coorda.length; k++) {
  28622. coords = coorda[k];
  28623. if (coords.length == 1) {
  28624. coords = coords[0];
  28625. }
  28626. for (var j = 0; j < coords.length; j++) {
  28627. var longitude = coords[j][0];
  28628. var latitude = coords[j][1];
  28629. var point = {
  28630. x: longitude,
  28631. y: latitude
  28632. };
  28633. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  28634. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  28635. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  28636. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  28637. }
  28638. }
  28639. }
  28640. return bounds;
  28641. }
  28642. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  28643. return {
  28644. x: (longitude - bounds.xMin) * scale + xoffset,
  28645. y: (bounds.yMax - latitude) * scale + yoffset
  28646. };
  28647. }
  28648. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  28649. return {
  28650. x: (pointX - xoffset) / scale + bounds.xMin,
  28651. y: bounds.yMax - (pointY - yoffset) / scale
  28652. };
  28653. }
  28654. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  28655. if (s_poi[1] == e_poi[1]) {
  28656. return false;
  28657. }
  28658. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {
  28659. return false;
  28660. }
  28661. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {
  28662. return false;
  28663. }
  28664. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {
  28665. return false;
  28666. }
  28667. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {
  28668. return false;
  28669. }
  28670. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {
  28671. return false;
  28672. }
  28673. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  28674. if (xseg < poi[0]) {
  28675. return false;
  28676. } else {
  28677. return true;
  28678. }
  28679. }
  28680. function isPoiWithinPoly(poi, poly, mercator) {
  28681. var sinsc = 0;
  28682. for (var i = 0; i < poly.length; i++) {
  28683. var epoly = poly[i][0];
  28684. if (poly.length == 1) {
  28685. epoly = poly[i][0];
  28686. }
  28687. for (var j = 0; j < epoly.length - 1; j++) {
  28688. var s_poi = epoly[j];
  28689. var e_poi = epoly[j + 1];
  28690. if (mercator) {
  28691. s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]);
  28692. e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]);
  28693. }
  28694. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  28695. sinsc += 1;
  28696. }
  28697. }
  28698. }
  28699. if (sinsc % 2 == 1) {
  28700. return true;
  28701. } else {
  28702. return false;
  28703. }
  28704. }
  28705. function drawMapDataPoints(series, opts, config, context) {
  28706. var mapOption = assign({}, {
  28707. border: true,
  28708. mercator: false,
  28709. borderWidth: 1,
  28710. active: true,
  28711. borderColor: '#666666',
  28712. fillOpacity: 0.6,
  28713. activeBorderColor: '#f04864',
  28714. activeFillColor: '#facc14',
  28715. activeFillOpacity: 1
  28716. }, opts.extra.map);
  28717. var coords, point;
  28718. var data = series;
  28719. var bounds = getBoundingBox(data);
  28720. if (mapOption.mercator) {
  28721. var max = lonlat2mercator(bounds.xMax, bounds.yMax);
  28722. var min = lonlat2mercator(bounds.xMin, bounds.yMin);
  28723. bounds.xMax = max[0];
  28724. bounds.yMax = max[1];
  28725. bounds.xMin = min[0];
  28726. bounds.yMin = min[1];
  28727. }
  28728. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  28729. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  28730. var scale = xScale < yScale ? xScale : yScale;
  28731. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  28732. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  28733. for (var i = 0; i < data.length; i++) {
  28734. context.beginPath();
  28735. context.setLineWidth(mapOption.borderWidth * opts.pix);
  28736. context.setStrokeStyle(mapOption.borderColor);
  28737. context.setFillStyle(hexToRgb(series[i].color, series[i].fillOpacity || mapOption.fillOpacity));
  28738. if (mapOption.active == true && opts.tooltip) {
  28739. if (opts.tooltip.index == i) {
  28740. context.setStrokeStyle(mapOption.activeBorderColor);
  28741. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  28742. }
  28743. }
  28744. var coorda = data[i].geometry.coordinates;
  28745. for (var k = 0; k < coorda.length; k++) {
  28746. coords = coorda[k];
  28747. if (coords.length == 1) {
  28748. coords = coords[0];
  28749. }
  28750. for (var j = 0; j < coords.length; j++) {
  28751. var gaosi = Array(2);
  28752. if (mapOption.mercator) {
  28753. gaosi = lonlat2mercator(coords[j][0], coords[j][1]);
  28754. } else {
  28755. gaosi = coords[j];
  28756. }
  28757. point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset);
  28758. if (j === 0) {
  28759. context.beginPath();
  28760. context.moveTo(point.x, point.y);
  28761. } else {
  28762. context.lineTo(point.x, point.y);
  28763. }
  28764. }
  28765. context.fill();
  28766. if (mapOption.border == true) {
  28767. context.stroke();
  28768. }
  28769. }
  28770. }
  28771. if (opts.dataLabel == true) {
  28772. for (var i = 0; i < data.length; i++) {
  28773. var centerPoint = data[i].properties.centroid;
  28774. if (centerPoint) {
  28775. if (mapOption.mercator) {
  28776. centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]);
  28777. }
  28778. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  28779. var fontSize = data[i].textSize * opts.pix || config.fontSize;
  28780. var fontColor = data[i].textColor || opts.fontColor;
  28781. if (mapOption.active && mapOption.activeTextColor && opts.tooltip && opts.tooltip.index == i) {
  28782. fontColor = mapOption.activeTextColor;
  28783. }
  28784. var text = data[i].properties.name;
  28785. context.beginPath();
  28786. context.setFontSize(fontSize);
  28787. context.setFillStyle(fontColor);
  28788. context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2);
  28789. context.closePath();
  28790. context.stroke();
  28791. }
  28792. }
  28793. }
  28794. opts.chartData.mapData = {
  28795. bounds: bounds,
  28796. scale: scale,
  28797. xoffset: xoffset,
  28798. yoffset: yoffset,
  28799. mercator: mapOption.mercator
  28800. };
  28801. drawToolTipBridge(opts, config, context, 1);
  28802. context.draw();
  28803. }
  28804. function normalInt(min, max, iter) {
  28805. iter = iter == 0 ? 1 : iter;
  28806. var arr = [];
  28807. for (var i = 0; i < iter; i++) {
  28808. arr[i] = Math.random();
  28809. }
  28810. ;
  28811. return Math.floor(arr.reduce(function (i, j) {
  28812. return i + j;
  28813. }) / iter * (max - min)) + min;
  28814. }
  28815. ;
  28816. function collisionNew(area, points, width, height) {
  28817. var isIn = false;
  28818. for (var i = 0; i < points.length; i++) {
  28819. if (points[i].area) {
  28820. 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]) {
  28821. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  28822. isIn = true;
  28823. break;
  28824. } else {
  28825. isIn = false;
  28826. }
  28827. } else {
  28828. isIn = true;
  28829. break;
  28830. }
  28831. }
  28832. }
  28833. return isIn;
  28834. }
  28835. ;
  28836. function getWordCloudPoint(opts, type, context) {
  28837. var points = opts.series;
  28838. switch (type) {
  28839. case 'normal':
  28840. for (var i = 0; i < points.length; i++) {
  28841. var text = points[i].name;
  28842. var tHeight = points[i].textSize * opts.pix;
  28843. var tWidth = measureText(text, tHeight, context);
  28844. var x = void 0,
  28845. y = void 0;
  28846. var area = void 0;
  28847. var breaknum = 0;
  28848. while (true) {
  28849. breaknum++;
  28850. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  28851. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  28852. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  28853. var isCollision = collisionNew(area, points, opts.width, opts.height);
  28854. if (!isCollision) break;
  28855. if (breaknum == 1000) {
  28856. area = [-100, -100, -100, -100];
  28857. break;
  28858. }
  28859. }
  28860. ;
  28861. points[i].area = area;
  28862. }
  28863. break;
  28864. case 'vertical':
  28865. var Spin = function Spin() {
  28866. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  28867. if (Math.random() > 0.7) {
  28868. return true;
  28869. } else {
  28870. return false;
  28871. }
  28872. ;
  28873. };
  28874. ;
  28875. for (var _i30 = 0; _i30 < points.length; _i30++) {
  28876. var _text = points[_i30].name;
  28877. var _tHeight = points[_i30].textSize * opts.pix;
  28878. var _tWidth = measureText(_text, _tHeight, context);
  28879. var isSpin = Spin();
  28880. var _x = void 0,
  28881. _y = void 0,
  28882. _area = void 0,
  28883. areav = void 0;
  28884. var _breaknum = 0;
  28885. while (true) {
  28886. _breaknum++;
  28887. var _isCollision = void 0;
  28888. if (isSpin) {
  28889. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  28890. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  28891. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  28892. 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];
  28893. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  28894. } else {
  28895. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  28896. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  28897. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  28898. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  28899. }
  28900. if (!_isCollision) break;
  28901. if (_breaknum == 1000) {
  28902. _area = [-1000, -1000, -1000, -1000];
  28903. break;
  28904. }
  28905. }
  28906. ;
  28907. if (isSpin) {
  28908. points[_i30].area = areav;
  28909. points[_i30].areav = _area;
  28910. } else {
  28911. points[_i30].area = _area;
  28912. }
  28913. points[_i30].rotate = isSpin;
  28914. }
  28915. ;
  28916. break;
  28917. }
  28918. return points;
  28919. }
  28920. function drawWordCloudDataPoints(series, opts, config, context) {
  28921. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28922. var wordOption = assign({}, {
  28923. type: 'normal',
  28924. autoColors: true
  28925. }, opts.extra.word);
  28926. if (!opts.chartData.wordCloudData) {
  28927. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context);
  28928. }
  28929. context.beginPath();
  28930. context.setFillStyle(opts.background);
  28931. context.rect(0, 0, opts.width, opts.height);
  28932. context.fill();
  28933. context.save();
  28934. var points = opts.chartData.wordCloudData;
  28935. context.translate(opts.width / 2, opts.height / 2);
  28936. for (var i = 0; i < points.length; i++) {
  28937. context.save();
  28938. if (points[i].rotate) {
  28939. context.rotate(90 * Math.PI / 180);
  28940. }
  28941. var text = points[i].name;
  28942. var tHeight = points[i].textSize * opts.pix;
  28943. var tWidth = measureText(text, tHeight, context);
  28944. context.beginPath();
  28945. context.setStrokeStyle(points[i].color);
  28946. context.setFillStyle(points[i].color);
  28947. context.setFontSize(tHeight);
  28948. if (points[i].rotate) {
  28949. if (points[i].areav[0] > 0) {
  28950. if (opts.tooltip) {
  28951. if (opts.tooltip.index == i) {
  28952. 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);
  28953. } else {
  28954. 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);
  28955. }
  28956. } else {
  28957. 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);
  28958. }
  28959. }
  28960. } else {
  28961. if (points[i].area[0] > 0) {
  28962. if (opts.tooltip) {
  28963. if (opts.tooltip.index == i) {
  28964. 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);
  28965. } else {
  28966. 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);
  28967. }
  28968. } else {
  28969. 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);
  28970. }
  28971. }
  28972. }
  28973. context.stroke();
  28974. context.restore();
  28975. }
  28976. context.restore();
  28977. }
  28978. function drawFunnelDataPoints(series, opts, config, context) {
  28979. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  28980. var funnelOption = assign({}, {
  28981. type: 'funnel',
  28982. activeWidth: 10,
  28983. activeOpacity: 0.3,
  28984. border: false,
  28985. borderWidth: 2,
  28986. borderColor: '#FFFFFF',
  28987. fillOpacity: 1,
  28988. minSize: 0,
  28989. labelAlign: 'right',
  28990. linearType: 'none',
  28991. customColor: []
  28992. }, opts.extra.funnel);
  28993. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  28994. var centerPosition = {
  28995. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  28996. y: opts.height - opts.area[2]
  28997. };
  28998. var activeWidth = funnelOption.activeWidth * opts.pix;
  28999. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  29000. var seriesNew = getFunnelDataPoints(series, radius, funnelOption, eachSpacing, process);
  29001. context.save();
  29002. context.translate(centerPosition.x, centerPosition.y);
  29003. funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config);
  29004. if (funnelOption.type == 'pyramid') {
  29005. for (var i = 0; i < seriesNew.length; i++) {
  29006. if (i == seriesNew.length - 1) {
  29007. if (opts.tooltip) {
  29008. if (opts.tooltip.index == i) {
  29009. context.beginPath();
  29010. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29011. context.moveTo(-activeWidth, -eachSpacing);
  29012. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29013. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29014. context.lineTo(activeWidth, -eachSpacing);
  29015. context.lineTo(-activeWidth, -eachSpacing);
  29016. context.closePath();
  29017. context.fill();
  29018. }
  29019. }
  29020. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29021. context.beginPath();
  29022. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29023. context.setStrokeStyle(funnelOption.borderColor);
  29024. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29025. if (funnelOption.linearType == 'custom') {
  29026. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29027. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29028. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29029. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29030. fillColor = grd;
  29031. }
  29032. context.setFillStyle(fillColor);
  29033. context.moveTo(0, -eachSpacing);
  29034. context.lineTo(-seriesNew[i].radius, 0);
  29035. context.lineTo(seriesNew[i].radius, 0);
  29036. context.lineTo(0, -eachSpacing);
  29037. context.closePath();
  29038. context.fill();
  29039. if (funnelOption.border == true) {
  29040. context.stroke();
  29041. }
  29042. } else {
  29043. if (opts.tooltip) {
  29044. if (opts.tooltip.index == i) {
  29045. context.beginPath();
  29046. context.setFillStyle(hexToRgb(seriesNew[i].color, funnelOption.activeOpacity));
  29047. context.moveTo(0, 0);
  29048. context.lineTo(-seriesNew[i].radius - activeWidth, 0);
  29049. context.lineTo(-seriesNew[i + 1].radius - activeWidth, -eachSpacing);
  29050. context.lineTo(seriesNew[i + 1].radius + activeWidth, -eachSpacing);
  29051. context.lineTo(seriesNew[i].radius + activeWidth, 0);
  29052. context.lineTo(0, 0);
  29053. context.closePath();
  29054. context.fill();
  29055. }
  29056. }
  29057. seriesNew[i].funnelArea = [centerPosition.x - seriesNew[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + seriesNew[i].radius, centerPosition.y - eachSpacing * i];
  29058. context.beginPath();
  29059. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29060. context.setStrokeStyle(funnelOption.borderColor);
  29061. var fillColor = hexToRgb(seriesNew[i].color, funnelOption.fillOpacity);
  29062. if (funnelOption.linearType == 'custom') {
  29063. var grd = context.createLinearGradient(seriesNew[i].radius, -eachSpacing, -seriesNew[i].radius, -eachSpacing);
  29064. grd.addColorStop(0, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29065. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[i].linearIndex], funnelOption.fillOpacity));
  29066. grd.addColorStop(1, hexToRgb(seriesNew[i].color, funnelOption.fillOpacity));
  29067. fillColor = grd;
  29068. }
  29069. context.setFillStyle(fillColor);
  29070. context.moveTo(0, 0);
  29071. context.lineTo(-seriesNew[i].radius, 0);
  29072. context.lineTo(-seriesNew[i + 1].radius, -eachSpacing);
  29073. context.lineTo(seriesNew[i + 1].radius, -eachSpacing);
  29074. context.lineTo(seriesNew[i].radius, 0);
  29075. context.lineTo(0, 0);
  29076. context.closePath();
  29077. context.fill();
  29078. if (funnelOption.border == true) {
  29079. context.stroke();
  29080. }
  29081. }
  29082. context.translate(0, -eachSpacing);
  29083. }
  29084. } else {
  29085. context.translate(0, -(seriesNew.length - 1) * eachSpacing);
  29086. for (var _i31 = 0; _i31 < seriesNew.length; _i31++) {
  29087. if (_i31 == seriesNew.length - 1) {
  29088. if (opts.tooltip) {
  29089. if (opts.tooltip.index == _i31) {
  29090. context.beginPath();
  29091. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29092. context.moveTo(-activeWidth - funnelOption.minSize / 2, 0);
  29093. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29094. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29095. context.lineTo(activeWidth + funnelOption.minSize / 2, 0);
  29096. context.lineTo(-activeWidth - funnelOption.minSize / 2, 0);
  29097. context.closePath();
  29098. context.fill();
  29099. }
  29100. }
  29101. seriesNew[_i31].funnelArea = [centerPosition.x - seriesNew[_i31].radius, centerPosition.y - eachSpacing, centerPosition.x + seriesNew[_i31].radius, centerPosition.y];
  29102. context.beginPath();
  29103. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29104. context.setStrokeStyle(funnelOption.borderColor);
  29105. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29106. if (funnelOption.linearType == 'custom') {
  29107. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29108. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29109. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29110. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29111. fillColor = grd;
  29112. }
  29113. context.setFillStyle(fillColor);
  29114. context.moveTo(0, 0);
  29115. context.lineTo(-funnelOption.minSize / 2, 0);
  29116. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29117. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29118. context.lineTo(funnelOption.minSize / 2, 0);
  29119. context.lineTo(0, 0);
  29120. context.closePath();
  29121. context.fill();
  29122. if (funnelOption.border == true) {
  29123. context.stroke();
  29124. }
  29125. } else {
  29126. if (opts.tooltip) {
  29127. if (opts.tooltip.index == _i31) {
  29128. context.beginPath();
  29129. context.setFillStyle(hexToRgb(seriesNew[_i31].color, funnelOption.activeOpacity));
  29130. context.moveTo(0, 0);
  29131. context.lineTo(-seriesNew[_i31 + 1].radius - activeWidth, 0);
  29132. context.lineTo(-seriesNew[_i31].radius - activeWidth, -eachSpacing);
  29133. context.lineTo(seriesNew[_i31].radius + activeWidth, -eachSpacing);
  29134. context.lineTo(seriesNew[_i31 + 1].radius + activeWidth, 0);
  29135. context.lineTo(0, 0);
  29136. context.closePath();
  29137. context.fill();
  29138. }
  29139. }
  29140. 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)];
  29141. context.beginPath();
  29142. context.setLineWidth(funnelOption.borderWidth * opts.pix);
  29143. context.setStrokeStyle(funnelOption.borderColor);
  29144. var fillColor = hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity);
  29145. if (funnelOption.linearType == 'custom') {
  29146. var grd = context.createLinearGradient(seriesNew[_i31].radius, -eachSpacing, -seriesNew[_i31].radius, -eachSpacing);
  29147. grd.addColorStop(0, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29148. grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[seriesNew[_i31].linearIndex], funnelOption.fillOpacity));
  29149. grd.addColorStop(1, hexToRgb(seriesNew[_i31].color, funnelOption.fillOpacity));
  29150. fillColor = grd;
  29151. }
  29152. context.setFillStyle(fillColor);
  29153. context.moveTo(0, 0);
  29154. context.lineTo(-seriesNew[_i31 + 1].radius, 0);
  29155. context.lineTo(-seriesNew[_i31].radius, -eachSpacing);
  29156. context.lineTo(seriesNew[_i31].radius, -eachSpacing);
  29157. context.lineTo(seriesNew[_i31 + 1].radius, 0);
  29158. context.lineTo(0, 0);
  29159. context.closePath();
  29160. context.fill();
  29161. if (funnelOption.border == true) {
  29162. context.stroke();
  29163. }
  29164. }
  29165. context.translate(0, eachSpacing);
  29166. }
  29167. }
  29168. context.restore();
  29169. if (opts.dataLabel !== false && process === 1) {
  29170. drawFunnelText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29171. }
  29172. if (process === 1) {
  29173. drawFunnelCenterText(seriesNew, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  29174. }
  29175. return {
  29176. center: centerPosition,
  29177. radius: radius,
  29178. series: seriesNew
  29179. };
  29180. }
  29181. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29182. for (var i = 0; i < series.length; i++) {
  29183. var item = series[i];
  29184. if (item.labelShow === false) {
  29185. continue;
  29186. }
  29187. var startX = void 0,
  29188. endX = void 0,
  29189. startY = void 0,
  29190. fontSize = void 0;
  29191. var text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%';
  29192. text = item.labelText ? item.labelText : text;
  29193. if (labelAlign == 'right') {
  29194. if (i == series.length - 1) {
  29195. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  29196. } else {
  29197. startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2;
  29198. }
  29199. endX = startX + activeWidth * 2;
  29200. startY = item.funnelArea[1] + eachSpacing / 2;
  29201. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29202. context.setLineWidth(1 * opts.pix);
  29203. context.setStrokeStyle(item.color);
  29204. context.setFillStyle(item.color);
  29205. context.beginPath();
  29206. context.moveTo(startX, startY);
  29207. context.lineTo(endX, startY);
  29208. context.stroke();
  29209. context.closePath();
  29210. context.beginPath();
  29211. context.moveTo(endX, startY);
  29212. context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI);
  29213. context.closePath();
  29214. context.fill();
  29215. context.beginPath();
  29216. context.setFontSize(fontSize);
  29217. context.setFillStyle(item.textColor || opts.fontColor);
  29218. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  29219. context.closePath();
  29220. context.stroke();
  29221. context.closePath();
  29222. }
  29223. if (labelAlign == 'left') {
  29224. if (i == series.length - 1) {
  29225. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  29226. } else {
  29227. startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2;
  29228. }
  29229. endX = startX - activeWidth * 2;
  29230. startY = item.funnelArea[1] + eachSpacing / 2;
  29231. fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix;
  29232. context.setLineWidth(1 * opts.pix);
  29233. context.setStrokeStyle(item.color);
  29234. context.setFillStyle(item.color);
  29235. context.beginPath();
  29236. context.moveTo(startX, startY);
  29237. context.lineTo(endX, startY);
  29238. context.stroke();
  29239. context.closePath();
  29240. context.beginPath();
  29241. context.moveTo(endX, startY);
  29242. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  29243. context.closePath();
  29244. context.fill();
  29245. context.beginPath();
  29246. context.setFontSize(fontSize);
  29247. context.setFillStyle(item.textColor || opts.fontColor);
  29248. context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2);
  29249. context.closePath();
  29250. context.stroke();
  29251. context.closePath();
  29252. }
  29253. }
  29254. }
  29255. function drawFunnelCenterText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  29256. for (var i = 0; i < series.length; i++) {
  29257. var item = series[i];
  29258. var startY = void 0,
  29259. fontSize = void 0;
  29260. if (item.centerText) {
  29261. startY = item.funnelArea[1] + eachSpacing / 2;
  29262. fontSize = item.centerTextSize * opts.pix || opts.fontSize * opts.pix;
  29263. context.beginPath();
  29264. context.setFontSize(fontSize);
  29265. context.setFillStyle(item.centerTextColor || "#FFFFFF");
  29266. context.fillText(item.centerText, centerPosition.x - measureText(item.centerText, fontSize, context) / 2, startY + fontSize / 2 - 2);
  29267. context.closePath();
  29268. context.stroke();
  29269. context.closePath();
  29270. }
  29271. }
  29272. }
  29273. function drawCanvas(opts, context) {
  29274. context.save();
  29275. context.translate(0, 0.5);
  29276. context.restore();
  29277. context.draw();
  29278. }
  29279. var Timing = {
  29280. easeIn: function easeIn(pos) {
  29281. return Math.pow(pos, 3);
  29282. },
  29283. easeOut: function easeOut(pos) {
  29284. return Math.pow(pos - 1, 3) + 1;
  29285. },
  29286. easeInOut: function easeInOut(pos) {
  29287. if ((pos /= 0.5) < 1) {
  29288. return 0.5 * Math.pow(pos, 3);
  29289. } else {
  29290. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  29291. }
  29292. },
  29293. linear: function linear(pos) {
  29294. return pos;
  29295. }
  29296. };
  29297. function Animation(opts) {
  29298. this.isStop = false;
  29299. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  29300. opts.timing = opts.timing || 'easeInOut';
  29301. var delay = 17;
  29302. function createAnimationFrame() {
  29303. if (typeof setTimeout !== 'undefined') {
  29304. return function (step, delay) {
  29305. setTimeout(function () {
  29306. var timeStamp = +new Date();
  29307. step(timeStamp);
  29308. }, delay);
  29309. };
  29310. } else if (typeof requestAnimationFrame !== 'undefined') {
  29311. return requestAnimationFrame;
  29312. } else {
  29313. return function (step) {
  29314. step(null);
  29315. };
  29316. }
  29317. }
  29318. ;
  29319. var animationFrame = createAnimationFrame();
  29320. var startTimeStamp = null;
  29321. var _step = function step(timestamp) {
  29322. if (timestamp === null || this.isStop === true) {
  29323. opts.onProcess && opts.onProcess(1);
  29324. opts.onAnimationFinish && opts.onAnimationFinish();
  29325. return;
  29326. }
  29327. if (startTimeStamp === null) {
  29328. startTimeStamp = timestamp;
  29329. }
  29330. if (timestamp - startTimeStamp < opts.duration) {
  29331. var process = (timestamp - startTimeStamp) / opts.duration;
  29332. var timingFunction = Timing[opts.timing];
  29333. process = timingFunction(process);
  29334. opts.onProcess && opts.onProcess(process);
  29335. animationFrame(_step, delay);
  29336. } else {
  29337. opts.onProcess && opts.onProcess(1);
  29338. opts.onAnimationFinish && opts.onAnimationFinish();
  29339. }
  29340. };
  29341. _step = _step.bind(this);
  29342. animationFrame(_step, delay);
  29343. }
  29344. Animation.prototype.stop = function () {
  29345. this.isStop = true;
  29346. };
  29347. function drawCharts(type, opts, config, context) {
  29348. var _this2 = this;
  29349. var _this = this;
  29350. var series = opts.series;
  29351. //兼容ECharts饼图类数据格式
  29352. if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') {
  29353. series = fixPieSeries(series, opts, config);
  29354. }
  29355. var categories = opts.categories;
  29356. if (type === 'mount') {
  29357. categories = [];
  29358. for (var j = 0; j < series.length; j++) {
  29359. if (series[j].show !== false) categories.push(series[j].name);
  29360. }
  29361. opts.categories = categories;
  29362. }
  29363. series = fillSeries(series, opts, config);
  29364. var duration = opts.animation ? opts.duration : 0;
  29365. _this.animationInstance && _this.animationInstance.stop();
  29366. var seriesMA = null;
  29367. if (type == 'candle') {
  29368. var average = assign({}, opts.extra.candle.average);
  29369. if (average.show) {
  29370. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  29371. seriesMA = fillSeries(seriesMA, opts, config);
  29372. opts.seriesMA = seriesMA;
  29373. } else if (opts.seriesMA) {
  29374. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  29375. } else {
  29376. seriesMA = series;
  29377. }
  29378. } else {
  29379. seriesMA = series;
  29380. }
  29381. /* 过滤掉show=false的series */
  29382. opts._series_ = series = filterSeries(series);
  29383. //重新计算图表区域
  29384. opts.area = new Array(4);
  29385. //复位绘图区域
  29386. for (var _j11 = 0; _j11 < 4; _j11++) {
  29387. opts.area[_j11] = opts.padding[_j11] * opts.pix;
  29388. }
  29389. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  29390. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context),
  29391. legendHeight = _calLegendData.area.wholeHeight,
  29392. legendWidth = _calLegendData.area.wholeWidth;
  29393. switch (opts.legend.position) {
  29394. case 'top':
  29395. opts.area[0] += legendHeight;
  29396. break;
  29397. case 'bottom':
  29398. opts.area[2] += legendHeight;
  29399. break;
  29400. case 'left':
  29401. opts.area[3] += legendWidth;
  29402. break;
  29403. case 'right':
  29404. opts.area[1] += legendWidth;
  29405. break;
  29406. }
  29407. var _calYAxisData = {},
  29408. yAxisWidth = 0;
  29409. 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') {
  29410. _calYAxisData = calYAxisData(series, opts, config, context);
  29411. yAxisWidth = _calYAxisData.yAxisWidth;
  29412. //如果显示Y轴标题
  29413. if (opts.yAxis.showTitle) {
  29414. var maxTitleHeight = 0;
  29415. for (var i = 0; i < opts.yAxis.data.length; i++) {
  29416. maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i].titleFontSize * opts.pix : config.fontSize);
  29417. }
  29418. opts.area[0] += maxTitleHeight;
  29419. }
  29420. var rightIndex = 0,
  29421. leftIndex = 0;
  29422. //计算主绘图区域左右位置
  29423. for (var _i32 = 0; _i32 < yAxisWidth.length; _i32++) {
  29424. if (yAxisWidth[_i32].position == 'left') {
  29425. if (leftIndex > 0) {
  29426. opts.area[3] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29427. } else {
  29428. opts.area[3] += yAxisWidth[_i32].width;
  29429. }
  29430. leftIndex += 1;
  29431. } else if (yAxisWidth[_i32].position == 'right') {
  29432. if (rightIndex > 0) {
  29433. opts.area[1] += yAxisWidth[_i32].width + opts.yAxis.padding * opts.pix;
  29434. } else {
  29435. opts.area[1] += yAxisWidth[_i32].width;
  29436. }
  29437. rightIndex += 1;
  29438. }
  29439. }
  29440. } else {
  29441. config.yAxisWidth = yAxisWidth;
  29442. }
  29443. opts.chartData.yAxisData = _calYAxisData;
  29444. if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== 'bar') {
  29445. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  29446. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29447. xAxisHeight = _calCategoriesData.xAxisHeight,
  29448. angle = _calCategoriesData.angle;
  29449. config.xAxisHeight = xAxisHeight;
  29450. config._xAxisTextAngle_ = angle;
  29451. opts.area[2] += xAxisHeight;
  29452. opts.chartData.categoriesData = _calCategoriesData;
  29453. } else {
  29454. if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') {
  29455. opts.chartData.xAxisData = calXAxisData(series, opts, config, context);
  29456. categories = opts.chartData.xAxisData.rangesFormat;
  29457. var _calCategoriesData2 = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, context),
  29458. _xAxisHeight = _calCategoriesData2.xAxisHeight,
  29459. _angle = _calCategoriesData2.angle;
  29460. config.xAxisHeight = _xAxisHeight;
  29461. config._xAxisTextAngle_ = _angle;
  29462. opts.area[2] += _xAxisHeight;
  29463. opts.chartData.categoriesData = _calCategoriesData2;
  29464. } else {
  29465. opts.chartData.xAxisData = {
  29466. xAxisPoints: []
  29467. };
  29468. }
  29469. }
  29470. //计算右对齐偏移距离
  29471. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  29472. var offsetLeft = 0,
  29473. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  29474. startX = opts.chartData.xAxisData.startX,
  29475. endX = opts.chartData.xAxisData.endX,
  29476. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  29477. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  29478. var screenWidth = endX - startX;
  29479. offsetLeft = screenWidth - totalWidth;
  29480. _this.scrollOption.currentOffset = offsetLeft;
  29481. _this.scrollOption.startTouchX = offsetLeft;
  29482. _this.scrollOption.distance = 0;
  29483. _this.scrollOption.lastMoveTime = 0;
  29484. opts._scrollDistance_ = offsetLeft;
  29485. }
  29486. if (type === 'pie' || type === 'ring' || type === 'rose') {
  29487. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts);
  29488. }
  29489. switch (type) {
  29490. case 'word':
  29491. this.animationInstance = new Animation({
  29492. timing: opts.timing,
  29493. duration: duration,
  29494. onProcess: function onProcess(process) {
  29495. context.clearRect(0, 0, opts.width, opts.height);
  29496. if (opts.rotate) {
  29497. contextRotate(context, opts);
  29498. }
  29499. drawWordCloudDataPoints(series, opts, config, context, process);
  29500. drawCanvas(opts, context);
  29501. },
  29502. onAnimationFinish: function onAnimationFinish() {
  29503. _this.uevent.trigger('renderComplete');
  29504. }
  29505. });
  29506. break;
  29507. case 'map':
  29508. context.clearRect(0, 0, opts.width, opts.height);
  29509. drawMapDataPoints(series, opts, config, context);
  29510. setTimeout(function () {
  29511. _this2.uevent.trigger('renderComplete');
  29512. }, 50);
  29513. break;
  29514. case 'funnel':
  29515. this.animationInstance = new Animation({
  29516. timing: opts.timing,
  29517. duration: duration,
  29518. onProcess: function onProcess(process) {
  29519. context.clearRect(0, 0, opts.width, opts.height);
  29520. if (opts.rotate) {
  29521. contextRotate(context, opts);
  29522. }
  29523. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  29524. drawLegend(opts.series, opts, config, context, opts.chartData);
  29525. drawToolTipBridge(opts, config, context, process);
  29526. drawCanvas(opts, context);
  29527. },
  29528. onAnimationFinish: function onAnimationFinish() {
  29529. _this.uevent.trigger('renderComplete');
  29530. }
  29531. });
  29532. break;
  29533. case 'line':
  29534. this.animationInstance = new Animation({
  29535. timing: opts.timing,
  29536. duration: duration,
  29537. onProcess: function onProcess(process) {
  29538. context.clearRect(0, 0, opts.width, opts.height);
  29539. if (opts.rotate) {
  29540. contextRotate(context, opts);
  29541. }
  29542. drawYAxisGrid(categories, opts, config, context);
  29543. drawXAxis(categories, opts, config, context);
  29544. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  29545. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  29546. calPoints = _drawLineDataPoints.calPoints,
  29547. eachSpacing = _drawLineDataPoints.eachSpacing;
  29548. opts.chartData.xAxisPoints = xAxisPoints;
  29549. opts.chartData.calPoints = calPoints;
  29550. opts.chartData.eachSpacing = eachSpacing;
  29551. drawYAxis(series, opts, config, context);
  29552. if (opts.enableMarkLine !== false && process === 1) {
  29553. drawMarkLine(opts, config, context);
  29554. }
  29555. drawLegend(opts.series, opts, config, context, opts.chartData);
  29556. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29557. drawCanvas(opts, context);
  29558. },
  29559. onAnimationFinish: function onAnimationFinish() {
  29560. _this.uevent.trigger('renderComplete');
  29561. }
  29562. });
  29563. break;
  29564. case 'scatter':
  29565. this.animationInstance = new Animation({
  29566. timing: opts.timing,
  29567. duration: duration,
  29568. onProcess: function onProcess(process) {
  29569. context.clearRect(0, 0, opts.width, opts.height);
  29570. if (opts.rotate) {
  29571. contextRotate(context, opts);
  29572. }
  29573. drawYAxisGrid(categories, opts, config, context);
  29574. drawXAxis(categories, opts, config, context);
  29575. var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, process),
  29576. xAxisPoints = _drawScatterDataPoints.xAxisPoints,
  29577. calPoints = _drawScatterDataPoints.calPoints,
  29578. eachSpacing = _drawScatterDataPoints.eachSpacing;
  29579. opts.chartData.xAxisPoints = xAxisPoints;
  29580. opts.chartData.calPoints = calPoints;
  29581. opts.chartData.eachSpacing = eachSpacing;
  29582. drawYAxis(series, opts, config, context);
  29583. if (opts.enableMarkLine !== false && process === 1) {
  29584. drawMarkLine(opts, config, context);
  29585. }
  29586. drawLegend(opts.series, opts, config, context, opts.chartData);
  29587. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29588. drawCanvas(opts, context);
  29589. },
  29590. onAnimationFinish: function onAnimationFinish() {
  29591. _this.uevent.trigger('renderComplete');
  29592. }
  29593. });
  29594. break;
  29595. case 'bubble':
  29596. this.animationInstance = new Animation({
  29597. timing: opts.timing,
  29598. duration: duration,
  29599. onProcess: function onProcess(process) {
  29600. context.clearRect(0, 0, opts.width, opts.height);
  29601. if (opts.rotate) {
  29602. contextRotate(context, opts);
  29603. }
  29604. drawYAxisGrid(categories, opts, config, context);
  29605. drawXAxis(categories, opts, config, context);
  29606. var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, process),
  29607. xAxisPoints = _drawBubbleDataPoints.xAxisPoints,
  29608. calPoints = _drawBubbleDataPoints.calPoints,
  29609. eachSpacing = _drawBubbleDataPoints.eachSpacing;
  29610. opts.chartData.xAxisPoints = xAxisPoints;
  29611. opts.chartData.calPoints = calPoints;
  29612. opts.chartData.eachSpacing = eachSpacing;
  29613. drawYAxis(series, opts, config, context);
  29614. if (opts.enableMarkLine !== false && process === 1) {
  29615. drawMarkLine(opts, config, context);
  29616. }
  29617. drawLegend(opts.series, opts, config, context, opts.chartData);
  29618. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29619. drawCanvas(opts, context);
  29620. },
  29621. onAnimationFinish: function onAnimationFinish() {
  29622. _this.uevent.trigger('renderComplete');
  29623. }
  29624. });
  29625. break;
  29626. case 'mix':
  29627. this.animationInstance = new Animation({
  29628. timing: opts.timing,
  29629. duration: duration,
  29630. onProcess: function onProcess(process) {
  29631. context.clearRect(0, 0, opts.width, opts.height);
  29632. if (opts.rotate) {
  29633. contextRotate(context, opts);
  29634. }
  29635. drawYAxisGrid(categories, opts, config, context);
  29636. drawXAxis(categories, opts, config, context);
  29637. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  29638. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  29639. calPoints = _drawMixDataPoints.calPoints,
  29640. eachSpacing = _drawMixDataPoints.eachSpacing;
  29641. opts.chartData.xAxisPoints = xAxisPoints;
  29642. opts.chartData.calPoints = calPoints;
  29643. opts.chartData.eachSpacing = eachSpacing;
  29644. drawYAxis(series, opts, config, context);
  29645. if (opts.enableMarkLine !== false && process === 1) {
  29646. drawMarkLine(opts, config, context);
  29647. }
  29648. drawLegend(opts.series, opts, config, context, opts.chartData);
  29649. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29650. drawCanvas(opts, context);
  29651. },
  29652. onAnimationFinish: function onAnimationFinish() {
  29653. _this.uevent.trigger('renderComplete');
  29654. }
  29655. });
  29656. break;
  29657. case 'column':
  29658. this.animationInstance = new Animation({
  29659. timing: opts.timing,
  29660. duration: duration,
  29661. onProcess: function onProcess(process) {
  29662. context.clearRect(0, 0, opts.width, opts.height);
  29663. if (opts.rotate) {
  29664. contextRotate(context, opts);
  29665. }
  29666. drawYAxisGrid(categories, opts, config, context);
  29667. drawXAxis(categories, opts, config, context);
  29668. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  29669. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  29670. calPoints = _drawColumnDataPoints.calPoints,
  29671. eachSpacing = _drawColumnDataPoints.eachSpacing;
  29672. opts.chartData.xAxisPoints = xAxisPoints;
  29673. opts.chartData.calPoints = calPoints;
  29674. opts.chartData.eachSpacing = eachSpacing;
  29675. drawYAxis(series, opts, config, context);
  29676. if (opts.enableMarkLine !== false && process === 1) {
  29677. drawMarkLine(opts, config, context);
  29678. }
  29679. drawLegend(opts.series, opts, config, context, opts.chartData);
  29680. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29681. drawCanvas(opts, context);
  29682. },
  29683. onAnimationFinish: function onAnimationFinish() {
  29684. _this.uevent.trigger('renderComplete');
  29685. }
  29686. });
  29687. break;
  29688. case 'mount':
  29689. this.animationInstance = new Animation({
  29690. timing: opts.timing,
  29691. duration: duration,
  29692. onProcess: function onProcess(process) {
  29693. context.clearRect(0, 0, opts.width, opts.height);
  29694. if (opts.rotate) {
  29695. contextRotate(context, opts);
  29696. }
  29697. drawYAxisGrid(categories, opts, config, context);
  29698. drawXAxis(categories, opts, config, context);
  29699. var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process),
  29700. xAxisPoints = _drawMountDataPoints.xAxisPoints,
  29701. calPoints = _drawMountDataPoints.calPoints,
  29702. eachSpacing = _drawMountDataPoints.eachSpacing;
  29703. opts.chartData.xAxisPoints = xAxisPoints;
  29704. opts.chartData.calPoints = calPoints;
  29705. opts.chartData.eachSpacing = eachSpacing;
  29706. drawYAxis(series, opts, config, context);
  29707. if (opts.enableMarkLine !== false && process === 1) {
  29708. drawMarkLine(opts, config, context);
  29709. }
  29710. drawLegend(opts.series, opts, config, context, opts.chartData);
  29711. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29712. drawCanvas(opts, context);
  29713. },
  29714. onAnimationFinish: function onAnimationFinish() {
  29715. _this.uevent.trigger('renderComplete');
  29716. }
  29717. });
  29718. break;
  29719. case 'bar':
  29720. this.animationInstance = new Animation({
  29721. timing: opts.timing,
  29722. duration: duration,
  29723. onProcess: function onProcess(process) {
  29724. context.clearRect(0, 0, opts.width, opts.height);
  29725. if (opts.rotate) {
  29726. contextRotate(context, opts);
  29727. }
  29728. drawXAxis(categories, opts, config, context);
  29729. var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process),
  29730. yAxisPoints = _drawBarDataPoints.yAxisPoints,
  29731. calPoints = _drawBarDataPoints.calPoints,
  29732. eachSpacing = _drawBarDataPoints.eachSpacing;
  29733. opts.chartData.yAxisPoints = yAxisPoints;
  29734. opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints;
  29735. opts.chartData.calPoints = calPoints;
  29736. opts.chartData.eachSpacing = eachSpacing;
  29737. drawYAxis(series, opts, config, context);
  29738. if (opts.enableMarkLine !== false && process === 1) {
  29739. drawMarkLine(opts, config, context);
  29740. }
  29741. drawLegend(opts.series, opts, config, context, opts.chartData);
  29742. drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints);
  29743. drawCanvas(opts, context);
  29744. },
  29745. onAnimationFinish: function onAnimationFinish() {
  29746. _this.uevent.trigger('renderComplete');
  29747. }
  29748. });
  29749. break;
  29750. case 'area':
  29751. this.animationInstance = new Animation({
  29752. timing: opts.timing,
  29753. duration: duration,
  29754. onProcess: function onProcess(process) {
  29755. context.clearRect(0, 0, opts.width, opts.height);
  29756. if (opts.rotate) {
  29757. contextRotate(context, opts);
  29758. }
  29759. drawYAxisGrid(categories, opts, config, context);
  29760. drawXAxis(categories, opts, config, context);
  29761. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  29762. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  29763. calPoints = _drawAreaDataPoints.calPoints,
  29764. eachSpacing = _drawAreaDataPoints.eachSpacing;
  29765. opts.chartData.xAxisPoints = xAxisPoints;
  29766. opts.chartData.calPoints = calPoints;
  29767. opts.chartData.eachSpacing = eachSpacing;
  29768. drawYAxis(series, opts, config, context);
  29769. if (opts.enableMarkLine !== false && process === 1) {
  29770. drawMarkLine(opts, config, context);
  29771. }
  29772. drawLegend(opts.series, opts, config, context, opts.chartData);
  29773. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29774. drawCanvas(opts, context);
  29775. },
  29776. onAnimationFinish: function onAnimationFinish() {
  29777. _this.uevent.trigger('renderComplete');
  29778. }
  29779. });
  29780. break;
  29781. case 'ring':
  29782. this.animationInstance = new Animation({
  29783. timing: opts.timing,
  29784. duration: duration,
  29785. onProcess: function onProcess(process) {
  29786. context.clearRect(0, 0, opts.width, opts.height);
  29787. if (opts.rotate) {
  29788. contextRotate(context, opts);
  29789. }
  29790. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29791. drawLegend(opts.series, opts, config, context, opts.chartData);
  29792. drawToolTipBridge(opts, config, context, process);
  29793. drawCanvas(opts, context);
  29794. },
  29795. onAnimationFinish: function onAnimationFinish() {
  29796. _this.uevent.trigger('renderComplete');
  29797. }
  29798. });
  29799. break;
  29800. case 'pie':
  29801. this.animationInstance = new Animation({
  29802. timing: opts.timing,
  29803. duration: duration,
  29804. onProcess: function onProcess(process) {
  29805. context.clearRect(0, 0, opts.width, opts.height);
  29806. if (opts.rotate) {
  29807. contextRotate(context, opts);
  29808. }
  29809. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  29810. drawLegend(opts.series, opts, config, context, opts.chartData);
  29811. drawToolTipBridge(opts, config, context, process);
  29812. drawCanvas(opts, context);
  29813. },
  29814. onAnimationFinish: function onAnimationFinish() {
  29815. _this.uevent.trigger('renderComplete');
  29816. }
  29817. });
  29818. break;
  29819. case 'rose':
  29820. this.animationInstance = new Animation({
  29821. timing: opts.timing,
  29822. duration: duration,
  29823. onProcess: function onProcess(process) {
  29824. context.clearRect(0, 0, opts.width, opts.height);
  29825. if (opts.rotate) {
  29826. contextRotate(context, opts);
  29827. }
  29828. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  29829. drawLegend(opts.series, opts, config, context, opts.chartData);
  29830. drawToolTipBridge(opts, config, context, process);
  29831. drawCanvas(opts, context);
  29832. },
  29833. onAnimationFinish: function onAnimationFinish() {
  29834. _this.uevent.trigger('renderComplete');
  29835. }
  29836. });
  29837. break;
  29838. case 'radar':
  29839. this.animationInstance = new Animation({
  29840. timing: opts.timing,
  29841. duration: duration,
  29842. onProcess: function onProcess(process) {
  29843. context.clearRect(0, 0, opts.width, opts.height);
  29844. if (opts.rotate) {
  29845. contextRotate(context, opts);
  29846. }
  29847. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  29848. drawLegend(opts.series, opts, config, context, opts.chartData);
  29849. drawToolTipBridge(opts, config, context, process);
  29850. drawCanvas(opts, context);
  29851. },
  29852. onAnimationFinish: function onAnimationFinish() {
  29853. _this.uevent.trigger('renderComplete');
  29854. }
  29855. });
  29856. break;
  29857. case 'arcbar':
  29858. this.animationInstance = new Animation({
  29859. timing: opts.timing,
  29860. duration: duration,
  29861. onProcess: function onProcess(process) {
  29862. context.clearRect(0, 0, opts.width, opts.height);
  29863. if (opts.rotate) {
  29864. contextRotate(context, opts);
  29865. }
  29866. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  29867. drawCanvas(opts, context);
  29868. },
  29869. onAnimationFinish: function onAnimationFinish() {
  29870. _this.uevent.trigger('renderComplete');
  29871. }
  29872. });
  29873. break;
  29874. case 'gauge':
  29875. this.animationInstance = new Animation({
  29876. timing: opts.timing,
  29877. duration: duration,
  29878. onProcess: function onProcess(process) {
  29879. context.clearRect(0, 0, opts.width, opts.height);
  29880. if (opts.rotate) {
  29881. contextRotate(context, opts);
  29882. }
  29883. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  29884. drawCanvas(opts, context);
  29885. },
  29886. onAnimationFinish: function onAnimationFinish() {
  29887. _this.uevent.trigger('renderComplete');
  29888. }
  29889. });
  29890. break;
  29891. case 'candle':
  29892. this.animationInstance = new Animation({
  29893. timing: opts.timing,
  29894. duration: duration,
  29895. onProcess: function onProcess(process) {
  29896. context.clearRect(0, 0, opts.width, opts.height);
  29897. if (opts.rotate) {
  29898. contextRotate(context, opts);
  29899. }
  29900. drawYAxisGrid(categories, opts, config, context);
  29901. drawXAxis(categories, opts, config, context);
  29902. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  29903. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  29904. calPoints = _drawCandleDataPoints.calPoints,
  29905. eachSpacing = _drawCandleDataPoints.eachSpacing;
  29906. opts.chartData.xAxisPoints = xAxisPoints;
  29907. opts.chartData.calPoints = calPoints;
  29908. opts.chartData.eachSpacing = eachSpacing;
  29909. drawYAxis(series, opts, config, context);
  29910. if (opts.enableMarkLine !== false && process === 1) {
  29911. drawMarkLine(opts, config, context);
  29912. }
  29913. if (seriesMA) {
  29914. drawLegend(seriesMA, opts, config, context, opts.chartData);
  29915. } else {
  29916. drawLegend(opts.series, opts, config, context, opts.chartData);
  29917. }
  29918. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  29919. drawCanvas(opts, context);
  29920. },
  29921. onAnimationFinish: function onAnimationFinish() {
  29922. _this.uevent.trigger('renderComplete');
  29923. }
  29924. });
  29925. break;
  29926. }
  29927. }
  29928. function uChartsEvent() {
  29929. this.events = {};
  29930. }
  29931. uChartsEvent.prototype.addEventListener = function (type, listener) {
  29932. this.events[type] = this.events[type] || [];
  29933. this.events[type].push(listener);
  29934. };
  29935. uChartsEvent.prototype.delEventListener = function (type) {
  29936. this.events[type] = [];
  29937. };
  29938. uChartsEvent.prototype.trigger = function () {
  29939. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  29940. args[_key] = arguments[_key];
  29941. }
  29942. var type = args[0];
  29943. var params = args.slice(1);
  29944. if (!!this.events[type]) {
  29945. this.events[type].forEach(function (listener) {
  29946. try {
  29947. listener.apply(null, params);
  29948. } catch (e) {
  29949. //console.log('[uCharts] '+e);
  29950. }
  29951. });
  29952. }
  29953. };
  29954. var uCharts = function uCharts(opts) {
  29955. opts.pix = opts.pixelRatio ? opts.pixelRatio : 1;
  29956. opts.fontSize = opts.fontSize ? opts.fontSize : 13;
  29957. opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor;
  29958. if (opts.background == "" || opts.background == "none") {
  29959. opts.background = "#FFFFFF";
  29960. }
  29961. opts.title = assign({}, opts.title);
  29962. opts.subtitle = assign({}, opts.subtitle);
  29963. opts.duration = opts.duration ? opts.duration : 1000;
  29964. opts.yAxis = assign({}, {
  29965. data: [],
  29966. showTitle: false,
  29967. disabled: false,
  29968. disableGrid: false,
  29969. gridSet: 'number',
  29970. splitNumber: 5,
  29971. gridType: 'solid',
  29972. dashLength: 4 * opts.pix,
  29973. gridColor: '#cccccc',
  29974. padding: 10,
  29975. fontColor: '#666666'
  29976. }, opts.yAxis);
  29977. opts.xAxis = assign({}, {
  29978. rotateLabel: false,
  29979. rotateAngle: 45,
  29980. disabled: false,
  29981. disableGrid: false,
  29982. splitNumber: 5,
  29983. calibration: false,
  29984. fontColor: '#666666',
  29985. fontSize: 13,
  29986. lineHeight: 20,
  29987. marginTop: 0,
  29988. gridType: 'solid',
  29989. dashLength: 4,
  29990. scrollAlign: 'left',
  29991. boundaryGap: 'center',
  29992. axisLine: true,
  29993. axisLineColor: '#cccccc',
  29994. titleFontSize: 13,
  29995. titleOffsetY: 0,
  29996. titleOffsetX: 0,
  29997. titleFontColor: '#666666'
  29998. }, opts.xAxis);
  29999. opts.xAxis.scrollPosition = opts.xAxis.scrollAlign;
  30000. opts.legend = assign({}, {
  30001. show: true,
  30002. position: 'bottom',
  30003. float: 'center',
  30004. backgroundColor: 'rgba(0,0,0,0)',
  30005. borderColor: 'rgba(0,0,0,0)',
  30006. borderWidth: 0,
  30007. padding: 5,
  30008. margin: 5,
  30009. itemGap: 10,
  30010. fontSize: opts.fontSize,
  30011. lineHeight: opts.fontSize,
  30012. fontColor: opts.fontColor,
  30013. formatter: {},
  30014. hiddenColor: '#CECECE'
  30015. }, opts.legend);
  30016. opts.extra = assign({
  30017. tooltip: {
  30018. legendShape: 'auto'
  30019. }
  30020. }, opts.extra);
  30021. opts.rotate = opts.rotate ? true : false;
  30022. opts.animation = opts.animation ? true : false;
  30023. opts.rotate = opts.rotate ? true : false;
  30024. opts.canvas2d = opts.canvas2d ? true : false;
  30025. var config$$1 = assign({}, config);
  30026. config$$1.color = opts.color ? opts.color : config$$1.color;
  30027. if (opts.type == 'pie') {
  30028. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30029. }
  30030. if (opts.type == 'ring') {
  30031. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30032. }
  30033. if (opts.type == 'rose') {
  30034. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || config$$1.pieChartLinePadding * opts.pix;
  30035. }
  30036. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix;
  30037. //屏幕旋转
  30038. config$$1.rotate = opts.rotate;
  30039. if (opts.rotate) {
  30040. var tempWidth = opts.width;
  30041. var tempHeight = opts.height;
  30042. opts.width = tempHeight;
  30043. opts.height = tempWidth;
  30044. }
  30045. //适配高分屏
  30046. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  30047. config$$1.yAxisWidth = config.yAxisWidth * opts.pix;
  30048. config$$1.fontSize = opts.fontSize * opts.pix;
  30049. config$$1.titleFontSize = config.titleFontSize * opts.pix;
  30050. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix;
  30051. if (!opts.context) {
  30052. throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!');
  30053. }
  30054. this.context = opts.context;
  30055. if (!this.context.setTextAlign) {
  30056. this.context.setStrokeStyle = function (e) {
  30057. return this.strokeStyle = e;
  30058. };
  30059. this.context.setLineWidth = function (e) {
  30060. return this.lineWidth = e;
  30061. };
  30062. this.context.setLineCap = function (e) {
  30063. return this.lineCap = e;
  30064. };
  30065. this.context.setFontSize = function (e) {
  30066. return this.font = e + "px sans-serif";
  30067. };
  30068. this.context.setFillStyle = function (e) {
  30069. return this.fillStyle = e;
  30070. };
  30071. this.context.setTextAlign = function (e) {
  30072. return this.textAlign = e;
  30073. };
  30074. this.context.setTextBaseline = function (e) {
  30075. return this.textBaseline = e;
  30076. };
  30077. this.context.setShadow = function (offsetX, offsetY, blur, color) {
  30078. this.shadowColor = color;
  30079. this.shadowOffsetX = offsetX;
  30080. this.shadowOffsetY = offsetY;
  30081. this.shadowBlur = blur;
  30082. };
  30083. this.context.draw = function () {};
  30084. }
  30085. //兼容NVUEsetLineDash
  30086. if (!this.context.setLineDash) {
  30087. this.context.setLineDash = function (e) {};
  30088. }
  30089. opts.chartData = {};
  30090. this.uevent = new uChartsEvent();
  30091. this.scrollOption = {
  30092. currentOffset: 0,
  30093. startTouchX: 0,
  30094. distance: 0,
  30095. lastMoveTime: 0
  30096. };
  30097. this.opts = opts;
  30098. this.config = config$$1;
  30099. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  30100. };
  30101. uCharts.prototype.updateData = function () {
  30102. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  30103. this.opts = assign({}, this.opts, data);
  30104. this.opts.updateData = true;
  30105. var scrollPosition = data.scrollPosition || 'current';
  30106. switch (scrollPosition) {
  30107. case 'current':
  30108. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30109. break;
  30110. case 'left':
  30111. this.opts._scrollDistance_ = 0;
  30112. this.scrollOption = {
  30113. currentOffset: 0,
  30114. startTouchX: 0,
  30115. distance: 0,
  30116. lastMoveTime: 0
  30117. };
  30118. break;
  30119. case 'right':
  30120. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30121. yAxisWidth = _calYAxisData.yAxisWidth;
  30122. this.config.yAxisWidth = yAxisWidth;
  30123. var offsetLeft = 0;
  30124. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30125. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30126. startX = _getXAxisPoints0.startX,
  30127. endX = _getXAxisPoints0.endX,
  30128. eachSpacing = _getXAxisPoints0.eachSpacing;
  30129. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  30130. var screenWidth = endX - startX;
  30131. offsetLeft = screenWidth - totalWidth;
  30132. this.scrollOption = {
  30133. currentOffset: offsetLeft,
  30134. startTouchX: offsetLeft,
  30135. distance: 0,
  30136. lastMoveTime: 0
  30137. };
  30138. this.opts._scrollDistance_ = offsetLeft;
  30139. break;
  30140. }
  30141. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30142. };
  30143. uCharts.prototype.zoom = function () {
  30144. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  30145. if (this.opts.enableScroll !== true) {
  30146. console.log('[uCharts] 请启用滚动条后使用');
  30147. return;
  30148. }
  30149. //当前屏幕中间点
  30150. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(this.opts.xAxis.itemCount / 2);
  30151. this.opts.animation = false;
  30152. this.opts.xAxis.itemCount = val.itemCount;
  30153. //重新计算x轴偏移距离
  30154. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context),
  30155. yAxisWidth = _calYAxisData.yAxisWidth;
  30156. this.config.yAxisWidth = yAxisWidth;
  30157. var offsetLeft = 0;
  30158. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30159. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30160. startX = _getXAxisPoints0.startX,
  30161. endX = _getXAxisPoints0.endX,
  30162. eachSpacing = _getXAxisPoints0.eachSpacing;
  30163. var centerLeft = eachSpacing * centerPoint;
  30164. var screenWidth = endX - startX;
  30165. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30166. offsetLeft = screenWidth / 2 - centerLeft;
  30167. if (offsetLeft > 0) {
  30168. offsetLeft = 0;
  30169. }
  30170. if (offsetLeft < MaxLeft) {
  30171. offsetLeft = MaxLeft;
  30172. }
  30173. this.scrollOption = {
  30174. currentOffset: offsetLeft,
  30175. startTouchX: 0,
  30176. distance: 0,
  30177. lastMoveTime: 0
  30178. };
  30179. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30180. this.opts._scrollDistance_ = offsetLeft;
  30181. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30182. };
  30183. uCharts.prototype.dobuleZoom = function (e) {
  30184. if (this.opts.enableScroll !== true) {
  30185. console.log('[uCharts] 请启用滚动条后使用');
  30186. return;
  30187. }
  30188. var tcs = e.changedTouches;
  30189. if (tcs.length < 2) {
  30190. return;
  30191. }
  30192. for (var i = 0; i < tcs.length; i++) {
  30193. tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX;
  30194. tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY;
  30195. }
  30196. var ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)];
  30197. var xlength = Math.abs(ntcs[0].x - ntcs[1].x);
  30198. // 记录初始的两指之间的数据
  30199. if (!this.scrollOption.moveCount) {
  30200. var cts0 = {
  30201. changedTouches: [{
  30202. x: tcs[0].x,
  30203. y: this.opts.area[0] / this.opts.pix + 2
  30204. }]
  30205. };
  30206. var cts1 = {
  30207. changedTouches: [{
  30208. x: tcs[1].x,
  30209. y: this.opts.area[0] / this.opts.pix + 2
  30210. }]
  30211. };
  30212. if (this.opts.rotate) {
  30213. cts0 = {
  30214. changedTouches: [{
  30215. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30216. y: tcs[0].y
  30217. }]
  30218. };
  30219. cts1 = {
  30220. changedTouches: [{
  30221. x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2,
  30222. y: tcs[1].y
  30223. }]
  30224. };
  30225. }
  30226. var moveCurrent1 = this.getCurrentDataIndex(cts0).index;
  30227. var moveCurrent2 = this.getCurrentDataIndex(cts1).index;
  30228. var moveCount = Math.abs(moveCurrent1 - moveCurrent2);
  30229. this.scrollOption.moveCount = moveCount;
  30230. this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2);
  30231. this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2);
  30232. return;
  30233. }
  30234. var currentEachSpacing = xlength / this.scrollOption.moveCount;
  30235. var itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing;
  30236. itemCount = itemCount <= 2 ? 2 : itemCount;
  30237. itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount;
  30238. this.opts.animation = false;
  30239. this.opts.xAxis.itemCount = itemCount;
  30240. // 重新计算滚动条偏移距离
  30241. var offsetLeft = 0;
  30242. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  30243. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  30244. startX = _getXAxisPoints0.startX,
  30245. endX = _getXAxisPoints0.endX,
  30246. eachSpacing = _getXAxisPoints0.eachSpacing;
  30247. var currentLeft = eachSpacing * this.scrollOption.moveCurrent1;
  30248. var screenWidth = endX - startX;
  30249. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  30250. offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing;
  30251. if (offsetLeft > 0) {
  30252. offsetLeft = 0;
  30253. }
  30254. if (offsetLeft < MaxLeft) {
  30255. offsetLeft = MaxLeft;
  30256. }
  30257. this.scrollOption.currentOffset = offsetLeft;
  30258. this.scrollOption.startTouchX = 0;
  30259. this.scrollOption.distance = 0;
  30260. calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts);
  30261. this.opts._scrollDistance_ = offsetLeft;
  30262. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30263. };
  30264. uCharts.prototype.stopAnimation = function () {
  30265. this.animationInstance && this.animationInstance.stop();
  30266. };
  30267. uCharts.prototype.addEventListener = function (type, listener) {
  30268. this.uevent.addEventListener(type, listener);
  30269. };
  30270. uCharts.prototype.delEventListener = function (type) {
  30271. this.uevent.delEventListener(type);
  30272. };
  30273. uCharts.prototype.getCurrentDataIndex = function (e) {
  30274. var touches = null;
  30275. if (e.changedTouches) {
  30276. touches = e.changedTouches[0];
  30277. } else {
  30278. touches = e.mp.changedTouches[0];
  30279. }
  30280. if (touches) {
  30281. var _touches$ = getTouches(touches, this.opts, e);
  30282. if (this.opts.type === 'pie' || this.opts.type === 'ring') {
  30283. return findPieChartCurrentIndex({
  30284. x: _touches$.x,
  30285. y: _touches$.y
  30286. }, this.opts.chartData.pieData, this.opts);
  30287. } else if (this.opts.type === 'rose') {
  30288. return findRoseChartCurrentIndex({
  30289. x: _touches$.x,
  30290. y: _touches$.y
  30291. }, this.opts.chartData.pieData, this.opts);
  30292. } else if (this.opts.type === 'radar') {
  30293. return findRadarChartCurrentIndex({
  30294. x: _touches$.x,
  30295. y: _touches$.y
  30296. }, this.opts.chartData.radarData, this.opts.categories.length);
  30297. } else if (this.opts.type === 'funnel') {
  30298. return findFunnelChartCurrentIndex({
  30299. x: _touches$.x,
  30300. y: _touches$.y
  30301. }, this.opts.chartData.funnelData);
  30302. } else if (this.opts.type === 'map') {
  30303. return findMapChartCurrentIndex({
  30304. x: _touches$.x,
  30305. y: _touches$.y
  30306. }, this.opts);
  30307. } else if (this.opts.type === 'word') {
  30308. return findWordChartCurrentIndex({
  30309. x: _touches$.x,
  30310. y: _touches$.y
  30311. }, this.opts.chartData.wordCloudData);
  30312. } else if (this.opts.type === 'bar') {
  30313. return findBarChartCurrentIndex({
  30314. x: _touches$.x,
  30315. y: _touches$.y
  30316. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30317. } else {
  30318. return findCurrentIndex({
  30319. x: _touches$.x,
  30320. y: _touches$.y
  30321. }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  30322. }
  30323. }
  30324. return -1;
  30325. };
  30326. uCharts.prototype.getLegendDataIndex = function (e) {
  30327. var touches = null;
  30328. if (e.changedTouches) {
  30329. touches = e.changedTouches[0];
  30330. } else {
  30331. touches = e.mp.changedTouches[0];
  30332. }
  30333. if (touches) {
  30334. var _touches$ = getTouches(touches, this.opts, e);
  30335. return findLegendIndex({
  30336. x: _touches$.x,
  30337. y: _touches$.y
  30338. }, this.opts.chartData.legendData);
  30339. }
  30340. return -1;
  30341. };
  30342. uCharts.prototype.touchLegend = function (e) {
  30343. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30344. var touches = null;
  30345. if (e.changedTouches) {
  30346. touches = e.changedTouches[0];
  30347. } else {
  30348. touches = e.mp.changedTouches[0];
  30349. }
  30350. if (touches) {
  30351. var _touches$ = getTouches(touches, this.opts, e);
  30352. var index = this.getLegendDataIndex(e);
  30353. if (index >= 0) {
  30354. if (this.opts.type == 'candle') {
  30355. this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show;
  30356. } else {
  30357. this.opts.series[index].show = !this.opts.series[index].show;
  30358. }
  30359. this.opts.animation = option.animation ? true : false;
  30360. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  30361. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  30362. }
  30363. }
  30364. };
  30365. uCharts.prototype.showToolTip = function (e) {
  30366. var _this3 = this;
  30367. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  30368. var touches = null;
  30369. if (e.changedTouches) {
  30370. touches = e.changedTouches[0];
  30371. } else {
  30372. touches = e.mp.changedTouches[0];
  30373. }
  30374. if (!touches) {
  30375. console.log("[uCharts] 未获取到event坐标信息");
  30376. }
  30377. var _touches$ = getTouches(touches, this.opts, e);
  30378. var currentOffset = this.scrollOption.currentOffset;
  30379. var opts = assign({}, this.opts, {
  30380. _scrollDistance_: currentOffset,
  30381. animation: false
  30382. });
  30383. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === 'scatter' || this.opts.type === 'bubble') {
  30384. var current = this.getCurrentDataIndex(e);
  30385. var index = option.index == undefined ? current.index : option.index;
  30386. if (index > -1 || index.length > 0) {
  30387. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30388. if (seriesData.length !== 0) {
  30389. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30390. textList = _getToolTipData.textList,
  30391. offset = _getToolTipData.offset;
  30392. offset.y = _touches$.y;
  30393. opts.tooltip = {
  30394. textList: option.textList !== undefined ? option.textList : textList,
  30395. offset: option.offset !== undefined ? option.offset : offset,
  30396. option: option,
  30397. index: index,
  30398. group: current.group
  30399. };
  30400. }
  30401. }
  30402. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30403. }
  30404. if (this.opts.type === 'mount') {
  30405. var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index;
  30406. if (index > -1) {
  30407. var opts = assign({}, this.opts, {
  30408. animation: false
  30409. });
  30410. var seriesData = assign({}, opts._series_[index]);
  30411. var textList = [{
  30412. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30413. color: seriesData.color,
  30414. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30415. }];
  30416. var offset = {
  30417. x: opts.chartData.calPoints[index].x,
  30418. y: _touches$.y
  30419. };
  30420. opts.tooltip = {
  30421. textList: option.textList ? option.textList : textList,
  30422. offset: option.offset !== undefined ? option.offset : offset,
  30423. option: option,
  30424. index: index
  30425. };
  30426. }
  30427. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30428. }
  30429. if (this.opts.type === 'bar') {
  30430. var current = this.getCurrentDataIndex(e);
  30431. var index = option.index == undefined ? current.index : option.index;
  30432. if (index > -1 || index.length > 0) {
  30433. var seriesData = getSeriesDataItem(this.opts.series, index, current.group);
  30434. if (seriesData.length !== 0) {
  30435. var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts.categories, option),
  30436. textList = _getToolTipData.textList,
  30437. offset = _getToolTipData.offset;
  30438. offset.x = _touches$.x;
  30439. opts.tooltip = {
  30440. textList: option.textList !== undefined ? option.textList : textList,
  30441. offset: option.offset !== undefined ? option.offset : offset,
  30442. option: option,
  30443. index: index
  30444. };
  30445. }
  30446. }
  30447. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30448. }
  30449. if (this.opts.type === 'mix') {
  30450. var current = this.getCurrentDataIndex(e);
  30451. var index = option.index == undefined ? current.index : option.index;
  30452. if (index > -1) {
  30453. var currentOffset = this.scrollOption.currentOffset;
  30454. var opts = assign({}, this.opts, {
  30455. _scrollDistance_: currentOffset,
  30456. animation: false
  30457. });
  30458. var seriesData = getSeriesDataItem(this.opts.series, index);
  30459. if (seriesData.length !== 0) {
  30460. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, option),
  30461. textList = _getMixToolTipData.textList,
  30462. offset = _getMixToolTipData.offset;
  30463. offset.y = _touches$.y;
  30464. opts.tooltip = {
  30465. textList: option.textList ? option.textList : textList,
  30466. offset: option.offset !== undefined ? option.offset : offset,
  30467. option: option,
  30468. index: index
  30469. };
  30470. }
  30471. }
  30472. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30473. }
  30474. if (this.opts.type === 'candle') {
  30475. var current = this.getCurrentDataIndex(e);
  30476. var index = option.index == undefined ? current.index : option.index;
  30477. if (index > -1) {
  30478. var currentOffset = this.scrollOption.currentOffset;
  30479. var opts = assign({}, this.opts, {
  30480. _scrollDistance_: currentOffset,
  30481. animation: false
  30482. });
  30483. var seriesData = getSeriesDataItem(this.opts.series, index);
  30484. if (seriesData.length !== 0) {
  30485. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, this.opts.categories, this.opts.extra.candle, option),
  30486. textList = _getToolTipData.textList,
  30487. offset = _getToolTipData.offset;
  30488. offset.y = _touches$.y;
  30489. opts.tooltip = {
  30490. textList: option.textList ? option.textList : textList,
  30491. offset: option.offset !== undefined ? option.offset : offset,
  30492. option: option,
  30493. index: index
  30494. };
  30495. }
  30496. }
  30497. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30498. }
  30499. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  30500. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30501. if (index > -1) {
  30502. var opts = assign({}, this.opts, {
  30503. animation: false
  30504. });
  30505. var seriesData = assign({}, opts._series_[index]);
  30506. var textList = [{
  30507. text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData.name + ': ' + seriesData.data,
  30508. color: seriesData.color,
  30509. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30510. }];
  30511. var offset = {
  30512. x: _touches$.x,
  30513. y: _touches$.y
  30514. };
  30515. opts.tooltip = {
  30516. textList: option.textList ? option.textList : textList,
  30517. offset: option.offset !== undefined ? option.offset : offset,
  30518. option: option,
  30519. index: index
  30520. };
  30521. }
  30522. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30523. }
  30524. if (this.opts.type === 'map') {
  30525. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30526. if (index > -1) {
  30527. var opts = assign({}, this.opts, {
  30528. animation: false
  30529. });
  30530. var seriesData = assign({}, this.opts.series[index]);
  30531. seriesData.name = seriesData.properties.name;
  30532. var textList = [{
  30533. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30534. color: seriesData.color,
  30535. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30536. }];
  30537. var offset = {
  30538. x: _touches$.x,
  30539. y: _touches$.y
  30540. };
  30541. opts.tooltip = {
  30542. textList: option.textList ? option.textList : textList,
  30543. offset: option.offset !== undefined ? option.offset : offset,
  30544. option: option,
  30545. index: index
  30546. };
  30547. }
  30548. opts.updateData = false;
  30549. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30550. }
  30551. if (this.opts.type === 'word') {
  30552. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30553. if (index > -1) {
  30554. var opts = assign({}, this.opts, {
  30555. animation: false
  30556. });
  30557. var seriesData = assign({}, this.opts.series[index]);
  30558. var textList = [{
  30559. text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : seriesData.name,
  30560. color: seriesData.color,
  30561. legendShape: this.opts.extra.tooltip.legendShape == 'auto' ? seriesData.legendShape : this.opts.extra.tooltip.legendShape
  30562. }];
  30563. var offset = {
  30564. x: _touches$.x,
  30565. y: _touches$.y
  30566. };
  30567. opts.tooltip = {
  30568. textList: option.textList ? option.textList : textList,
  30569. offset: option.offset !== undefined ? option.offset : offset,
  30570. option: option,
  30571. index: index
  30572. };
  30573. }
  30574. opts.updateData = false;
  30575. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30576. }
  30577. if (this.opts.type === 'radar') {
  30578. var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index;
  30579. if (index > -1) {
  30580. var opts = assign({}, this.opts, {
  30581. animation: false
  30582. });
  30583. var seriesData = getSeriesDataItem(this.opts.series, index);
  30584. if (seriesData.length !== 0) {
  30585. var textList = seriesData.map(function (item) {
  30586. return {
  30587. text: option.formatter ? option.formatter(item, _this3.opts.categories[index], index, _this3.opts) : item.name + ': ' + item.data,
  30588. color: item.color,
  30589. legendShape: _this3.opts.extra.tooltip.legendShape == 'auto' ? item.legendShape : _this3.opts.extra.tooltip.legendShape
  30590. };
  30591. });
  30592. var offset = {
  30593. x: _touches$.x,
  30594. y: _touches$.y
  30595. };
  30596. opts.tooltip = {
  30597. textList: option.textList ? option.textList : textList,
  30598. offset: option.offset !== undefined ? option.offset : offset,
  30599. option: option,
  30600. index: index
  30601. };
  30602. }
  30603. }
  30604. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30605. }
  30606. };
  30607. uCharts.prototype.translate = function (distance) {
  30608. this.scrollOption = {
  30609. currentOffset: distance,
  30610. startTouchX: distance,
  30611. distance: 0,
  30612. lastMoveTime: 0
  30613. };
  30614. var opts = assign({}, this.opts, {
  30615. _scrollDistance_: distance,
  30616. animation: false
  30617. });
  30618. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  30619. };
  30620. uCharts.prototype.scrollStart = function (e) {
  30621. var touches = null;
  30622. if (e.changedTouches) {
  30623. touches = e.changedTouches[0];
  30624. } else {
  30625. touches = e.mp.changedTouches[0];
  30626. }
  30627. var _touches$ = getTouches(touches, this.opts, e);
  30628. if (touches && this.opts.enableScroll === true) {
  30629. this.scrollOption.startTouchX = _touches$.x;
  30630. }
  30631. };
  30632. uCharts.prototype.scroll = function (e) {
  30633. if (this.scrollOption.lastMoveTime === 0) {
  30634. this.scrollOption.lastMoveTime = Date.now();
  30635. }
  30636. var Limit = this.opts.touchMoveLimit || 60;
  30637. var currMoveTime = Date.now();
  30638. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  30639. if (duration < Math.floor(1000 / Limit)) return;
  30640. if (this.scrollOption.startTouchX == 0) return;
  30641. this.scrollOption.lastMoveTime = currMoveTime;
  30642. var touches = null;
  30643. if (e.changedTouches) {
  30644. touches = e.changedTouches[0];
  30645. } else {
  30646. touches = e.mp.changedTouches[0];
  30647. }
  30648. if (touches && this.opts.enableScroll === true) {
  30649. var _touches$ = getTouches(touches, this.opts, e);
  30650. var _distance;
  30651. _distance = _touches$.x - this.scrollOption.startTouchX;
  30652. var currentOffset = this.scrollOption.currentOffset;
  30653. var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  30654. this.scrollOption.distance = _distance = validDistance - currentOffset;
  30655. var opts = assign({}, this.opts, {
  30656. _scrollDistance_: currentOffset + _distance,
  30657. animation: false
  30658. });
  30659. this.opts = opts;
  30660. drawCharts.call(this, opts.type, opts, this.config, this.context);
  30661. return currentOffset + _distance;
  30662. }
  30663. };
  30664. uCharts.prototype.scrollEnd = function (e) {
  30665. if (this.opts.enableScroll === true) {
  30666. var _scrollOption = this.scrollOption,
  30667. currentOffset = _scrollOption.currentOffset,
  30668. distance = _scrollOption.distance;
  30669. this.scrollOption.currentOffset = currentOffset + distance;
  30670. this.scrollOption.distance = 0;
  30671. this.scrollOption.moveCount = 0;
  30672. }
  30673. };
  30674. var _default = uCharts;
  30675. exports.default = _default;
  30676. /***/ }),
  30677. /***/ 683:
  30678. /*!************************************************************************************!*\
  30679. !*** E:/work/mdapp/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js ***!
  30680. \************************************************************************************/
  30681. /*! no static exports found */
  30682. /***/ (function(module, exports, __webpack_require__) {
  30683. "use strict";
  30684. Object.defineProperty(exports, "__esModule", {
  30685. value: true
  30686. });
  30687. exports.default = void 0;
  30688. /*
  30689. * uCharts®
  30690. * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台
  30691. * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
  30692. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  30693. * 复制使用请保留本段注释,感谢支持开源!
  30694. *
  30695. * uCharts®官方网站
  30696. * https://www.uCharts.cn
  30697. *
  30698. * 开源地址:
  30699. * https://gitee.com/uCharts/uCharts
  30700. *
  30701. * uni-app插件市场地址:
  30702. * http://ext.dcloud.net.cn/plugin?id=271
  30703. *
  30704. */
  30705. // 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
  30706. var color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'];
  30707. //事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
  30708. var formatDateTime = function formatDateTime(timeStamp, returnType) {
  30709. var date = new Date();
  30710. date.setTime(timeStamp * 1000);
  30711. var y = date.getFullYear();
  30712. var m = date.getMonth() + 1;
  30713. m = m < 10 ? '0' + m : m;
  30714. var d = date.getDate();
  30715. d = d < 10 ? '0' + d : d;
  30716. var h = date.getHours();
  30717. h = h < 10 ? '0' + h : h;
  30718. var minute = date.getMinutes();
  30719. var second = date.getSeconds();
  30720. minute = minute < 10 ? '0' + minute : minute;
  30721. second = second < 10 ? '0' + second : second;
  30722. if (returnType == 'full') {
  30723. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  30724. }
  30725. if (returnType == 'y-m-d') {
  30726. return y + '-' + m + '-' + d;
  30727. }
  30728. if (returnType == 'h:m') {
  30729. return h + ':' + minute;
  30730. }
  30731. if (returnType == 'h:m:s') {
  30732. return h + ':' + minute + ':' + second;
  30733. }
  30734. return [y, m, d, h, minute, second];
  30735. };
  30736. var cfu = {
  30737. //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
  30738. "type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
  30739. "range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
  30740. //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
  30741. //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
  30742. "categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
  30743. //instance为实例变量承载属性,不要删除
  30744. "instance": {},
  30745. //option为opts及eopts承载属性,不要删除
  30746. "option": {},
  30747. //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
  30748. "formatter": {
  30749. "yAxisDemo1": function yAxisDemo1(val, index, opts) {
  30750. return val + '元';
  30751. },
  30752. "yAxisDemo2": function yAxisDemo2(val, index, opts) {
  30753. return val.toFixed(2);
  30754. },
  30755. "xAxisDemo1": function xAxisDemo1(val, index, opts) {
  30756. return val + '年';
  30757. },
  30758. "xAxisDemo2": function xAxisDemo2(val, index, opts) {
  30759. return formatDateTime(val, 'h:m');
  30760. },
  30761. "seriesDemo1": function seriesDemo1(val, index, series, opts) {
  30762. return val + '元';
  30763. },
  30764. "tooltipDemo1": function tooltipDemo1(item, category, index, opts) {
  30765. if (index == 0) {
  30766. return '随便用' + item.data + '年';
  30767. } else {
  30768. return '其他我没改' + item.data + '天';
  30769. }
  30770. },
  30771. "pieDemo": function pieDemo(val, index, series, opts) {
  30772. if (index !== undefined) {
  30773. return series[index].name + ':' + series[index].data + '元';
  30774. }
  30775. }
  30776. },
  30777. //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
  30778. "demotype": {
  30779. //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
  30780. "type": "line",
  30781. "color": color,
  30782. "padding": [15, 10, 0, 15],
  30783. "xAxis": {
  30784. "disableGrid": true
  30785. },
  30786. "yAxis": {
  30787. "gridType": "dash",
  30788. "dashLength": 2
  30789. },
  30790. "legend": {},
  30791. "extra": {
  30792. "line": {
  30793. "type": "curve",
  30794. "width": 2
  30795. }
  30796. }
  30797. },
  30798. //下面是自定义配置,请添加项目所需的通用配置
  30799. "pie": {
  30800. "type": "pie",
  30801. "color": color,
  30802. "padding": [5, 5, 5, 5],
  30803. "extra": {
  30804. "pie": {
  30805. "activeOpacity": 0.5,
  30806. "activeRadius": 10,
  30807. "offsetAngle": 0,
  30808. "labelWidth": 15,
  30809. "border": true,
  30810. "borderWidth": 3,
  30811. "borderColor": "#FFFFFF"
  30812. }
  30813. }
  30814. },
  30815. "ring": {
  30816. "type": "ring",
  30817. "color": color,
  30818. "padding": [5, 5, 5, 5],
  30819. "rotate": false,
  30820. "dataLabel": true,
  30821. "legend": {
  30822. "show": true,
  30823. "position": "right",
  30824. "lineHeight": 25
  30825. },
  30826. "title": {
  30827. "name": "收益率",
  30828. "fontSize": 15,
  30829. "color": "#666666"
  30830. },
  30831. "subtitle": {
  30832. "name": "70%",
  30833. "fontSize": 25,
  30834. "color": "#7cb5ec"
  30835. },
  30836. "extra": {
  30837. "ring": {
  30838. "ringWidth": 30,
  30839. "activeOpacity": 0.5,
  30840. "activeRadius": 10,
  30841. "offsetAngle": 0,
  30842. "labelWidth": 15,
  30843. "border": true,
  30844. "borderWidth": 3,
  30845. "borderColor": "#FFFFFF"
  30846. }
  30847. }
  30848. },
  30849. "rose": {
  30850. "type": "rose",
  30851. "color": color,
  30852. "padding": [5, 5, 5, 5],
  30853. "legend": {
  30854. "show": true,
  30855. "position": "left",
  30856. "lineHeight": 25
  30857. },
  30858. "extra": {
  30859. "rose": {
  30860. "type": "area",
  30861. "minRadius": 50,
  30862. "activeOpacity": 0.5,
  30863. "activeRadius": 10,
  30864. "offsetAngle": 0,
  30865. "labelWidth": 15,
  30866. "border": false,
  30867. "borderWidth": 2,
  30868. "borderColor": "#FFFFFF"
  30869. }
  30870. }
  30871. },
  30872. "word": {
  30873. "type": "word",
  30874. "color": color,
  30875. "extra": {
  30876. "word": {
  30877. "type": "normal",
  30878. "autoColors": false
  30879. }
  30880. }
  30881. },
  30882. "funnel": {
  30883. "type": "funnel",
  30884. "color": color,
  30885. "padding": [15, 15, 0, 15],
  30886. "extra": {
  30887. "funnel": {
  30888. "activeOpacity": 0.3,
  30889. "activeWidth": 10,
  30890. "border": true,
  30891. "borderWidth": 2,
  30892. "borderColor": "#FFFFFF",
  30893. "fillOpacity": 1,
  30894. "labelAlign": "right"
  30895. }
  30896. }
  30897. },
  30898. "map": {
  30899. "type": "map",
  30900. "color": color,
  30901. "padding": [0, 0, 0, 0],
  30902. "dataLabel": true,
  30903. "extra": {
  30904. "map": {
  30905. "border": true,
  30906. "borderWidth": 1,
  30907. "borderColor": "#666666",
  30908. "fillOpacity": 0.6,
  30909. "activeBorderColor": "#F04864",
  30910. "activeFillColor": "#FACC14",
  30911. "activeFillOpacity": 1
  30912. }
  30913. }
  30914. },
  30915. "arcbar": {
  30916. "type": "arcbar",
  30917. "color": color,
  30918. "title": {
  30919. "name": "百分比",
  30920. "fontSize": 25,
  30921. "color": "#00FF00"
  30922. },
  30923. "subtitle": {
  30924. "name": "默认标题",
  30925. "fontSize": 15,
  30926. "color": "#666666"
  30927. },
  30928. "extra": {
  30929. "arcbar": {
  30930. "type": "default",
  30931. "width": 12,
  30932. "backgroundColor": "#E9E9E9",
  30933. "startAngle": 0.75,
  30934. "endAngle": 0.25,
  30935. "gap": 2
  30936. }
  30937. }
  30938. },
  30939. "line": {
  30940. "type": "line",
  30941. "color": color,
  30942. "padding": [15, 10, 0, 15],
  30943. "xAxis": {
  30944. "disableGrid": true
  30945. },
  30946. "yAxis": {
  30947. "gridType": "dash",
  30948. "dashLength": 2
  30949. },
  30950. "legend": {},
  30951. "extra": {
  30952. "line": {
  30953. "type": "straight",
  30954. "width": 2,
  30955. "activeType": "hollow"
  30956. }
  30957. }
  30958. },
  30959. "tline": {
  30960. "type": "line",
  30961. "color": color,
  30962. "padding": [15, 10, 0, 15],
  30963. "xAxis": {
  30964. "disableGrid": false,
  30965. "boundaryGap": "justify"
  30966. },
  30967. "yAxis": {
  30968. "gridType": "dash",
  30969. "dashLength": 2,
  30970. "data": [{
  30971. "min": 0,
  30972. "max": 80
  30973. }]
  30974. },
  30975. "legend": {},
  30976. "extra": {
  30977. "line": {
  30978. "type": "curve",
  30979. "width": 2,
  30980. "activeType": "hollow"
  30981. }
  30982. }
  30983. },
  30984. "tarea": {
  30985. "type": "area",
  30986. "color": color,
  30987. "padding": [15, 10, 0, 15],
  30988. "xAxis": {
  30989. "disableGrid": true,
  30990. "boundaryGap": "justify"
  30991. },
  30992. "yAxis": {
  30993. "gridType": "dash",
  30994. "dashLength": 2,
  30995. "data": [{
  30996. "min": 0,
  30997. "max": 80
  30998. }]
  30999. },
  31000. "legend": {},
  31001. "extra": {
  31002. "area": {
  31003. "type": "curve",
  31004. "opacity": 0.2,
  31005. "addLine": true,
  31006. "width": 2,
  31007. "gradient": true,
  31008. "activeType": "hollow"
  31009. }
  31010. }
  31011. },
  31012. "column": {
  31013. "type": "column",
  31014. "color": color,
  31015. "padding": [15, 15, 0, 5],
  31016. "xAxis": {
  31017. "disableGrid": true
  31018. },
  31019. "yAxis": {
  31020. "data": [{
  31021. "min": 0
  31022. }]
  31023. },
  31024. "legend": {},
  31025. "extra": {
  31026. "column": {
  31027. "type": "group",
  31028. "width": 30,
  31029. "activeBgColor": "#000000",
  31030. "activeBgOpacity": 0.08
  31031. }
  31032. }
  31033. },
  31034. "mount": {
  31035. "type": "mount",
  31036. "color": color,
  31037. "padding": [15, 15, 0, 5],
  31038. "xAxis": {
  31039. "disableGrid": true
  31040. },
  31041. "yAxis": {
  31042. "data": [{
  31043. "min": 0
  31044. }]
  31045. },
  31046. "legend": {},
  31047. "extra": {
  31048. "mount": {
  31049. "type": "mount",
  31050. "widthRatio": 1.5
  31051. }
  31052. }
  31053. },
  31054. "bar": {
  31055. "type": "bar",
  31056. "color": color,
  31057. "padding": [15, 30, 0, 5],
  31058. "xAxis": {
  31059. "boundaryGap": "justify",
  31060. "disableGrid": false,
  31061. "min": 0,
  31062. "axisLine": false
  31063. },
  31064. "yAxis": {},
  31065. "legend": {},
  31066. "extra": {
  31067. "bar": {
  31068. "type": "group",
  31069. "width": 30,
  31070. "meterBorde": 1,
  31071. "meterFillColor": "#FFFFFF",
  31072. "activeBgColor": "#000000",
  31073. "activeBgOpacity": 0.08
  31074. }
  31075. }
  31076. },
  31077. "area": {
  31078. "type": "area",
  31079. "color": color,
  31080. "padding": [15, 15, 0, 15],
  31081. "xAxis": {
  31082. "disableGrid": true
  31083. },
  31084. "yAxis": {
  31085. "gridType": "dash",
  31086. "dashLength": 2
  31087. },
  31088. "legend": {},
  31089. "extra": {
  31090. "area": {
  31091. "type": "straight",
  31092. "opacity": 0.2,
  31093. "addLine": true,
  31094. "width": 2,
  31095. "gradient": false,
  31096. "activeType": "hollow"
  31097. }
  31098. }
  31099. },
  31100. "radar": {
  31101. "type": "radar",
  31102. "color": color,
  31103. "padding": [5, 5, 5, 5],
  31104. "dataLabel": false,
  31105. "legend": {
  31106. "show": true,
  31107. "position": "right",
  31108. "lineHeight": 25
  31109. },
  31110. "extra": {
  31111. "radar": {
  31112. "gridType": "radar",
  31113. "gridColor": "#CCCCCC",
  31114. "gridCount": 3,
  31115. "opacity": 0.2,
  31116. "max": 200,
  31117. "labelShow": true
  31118. }
  31119. }
  31120. },
  31121. "gauge": {
  31122. "type": "gauge",
  31123. "color": color,
  31124. "title": {
  31125. "name": "66Km/H",
  31126. "fontSize": 25,
  31127. "color": "#2fc25b",
  31128. "offsetY": 50
  31129. },
  31130. "subtitle": {
  31131. "name": "实时速度",
  31132. "fontSize": 15,
  31133. "color": "#1890ff",
  31134. "offsetY": -50
  31135. },
  31136. "extra": {
  31137. "gauge": {
  31138. "type": "default",
  31139. "width": 30,
  31140. "labelColor": "#666666",
  31141. "startAngle": 0.75,
  31142. "endAngle": 0.25,
  31143. "startNumber": 0,
  31144. "endNumber": 100,
  31145. "labelFormat": "",
  31146. "splitLine": {
  31147. "fixRadius": 0,
  31148. "splitNumber": 10,
  31149. "width": 30,
  31150. "color": "#FFFFFF",
  31151. "childNumber": 5,
  31152. "childWidth": 12
  31153. },
  31154. "pointer": {
  31155. "width": 24,
  31156. "color": "auto"
  31157. }
  31158. }
  31159. }
  31160. },
  31161. "candle": {
  31162. "type": "candle",
  31163. "color": color,
  31164. "padding": [15, 15, 0, 15],
  31165. "enableScroll": true,
  31166. "enableMarkLine": true,
  31167. "dataLabel": false,
  31168. "xAxis": {
  31169. "labelCount": 4,
  31170. "itemCount": 40,
  31171. "disableGrid": true,
  31172. "gridColor": "#CCCCCC",
  31173. "gridType": "solid",
  31174. "dashLength": 4,
  31175. "scrollShow": true,
  31176. "scrollAlign": "left",
  31177. "scrollColor": "#A6A6A6",
  31178. "scrollBackgroundColor": "#EFEBEF"
  31179. },
  31180. "yAxis": {},
  31181. "legend": {},
  31182. "extra": {
  31183. "candle": {
  31184. "color": {
  31185. "upLine": "#f04864",
  31186. "upFill": "#f04864",
  31187. "downLine": "#2fc25b",
  31188. "downFill": "#2fc25b"
  31189. },
  31190. "average": {
  31191. "show": true,
  31192. "name": ["MA5", "MA10", "MA30"],
  31193. "day": [5, 10, 20],
  31194. "color": ["#1890ff", "#2fc25b", "#facc14"]
  31195. }
  31196. },
  31197. "markLine": {
  31198. "type": "dash",
  31199. "dashLength": 5,
  31200. "data": [{
  31201. "value": 2150,
  31202. "lineColor": "#f04864",
  31203. "showLabel": true
  31204. }, {
  31205. "value": 2350,
  31206. "lineColor": "#f04864",
  31207. "showLabel": true
  31208. }]
  31209. }
  31210. }
  31211. },
  31212. "mix": {
  31213. "type": "mix",
  31214. "color": color,
  31215. "padding": [15, 15, 0, 15],
  31216. "xAxis": {
  31217. "disableGrid": true
  31218. },
  31219. "yAxis": {
  31220. "disabled": false,
  31221. "disableGrid": false,
  31222. "splitNumber": 5,
  31223. "gridType": "dash",
  31224. "dashLength": 4,
  31225. "gridColor": "#CCCCCC",
  31226. "padding": 10,
  31227. "showTitle": true,
  31228. "data": []
  31229. },
  31230. "legend": {},
  31231. "extra": {
  31232. "mix": {
  31233. "column": {
  31234. "width": 20
  31235. }
  31236. }
  31237. }
  31238. },
  31239. "scatter": {
  31240. "type": "scatter",
  31241. "color": color,
  31242. "padding": [15, 15, 0, 15],
  31243. "dataLabel": false,
  31244. "xAxis": {
  31245. "disableGrid": false,
  31246. "gridType": "dash",
  31247. "splitNumber": 5,
  31248. "boundaryGap": "justify",
  31249. "min": 0
  31250. },
  31251. "yAxis": {
  31252. "disableGrid": false,
  31253. "gridType": "dash"
  31254. },
  31255. "legend": {},
  31256. "extra": {
  31257. "scatter": {}
  31258. }
  31259. },
  31260. "bubble": {
  31261. "type": "bubble",
  31262. "color": color,
  31263. "padding": [15, 15, 0, 15],
  31264. "xAxis": {
  31265. "disableGrid": false,
  31266. "gridType": "dash",
  31267. "splitNumber": 5,
  31268. "boundaryGap": "justify",
  31269. "min": 0,
  31270. "max": 250
  31271. },
  31272. "yAxis": {
  31273. "disableGrid": false,
  31274. "gridType": "dash",
  31275. "data": [{
  31276. "min": 0,
  31277. "max": 150
  31278. }]
  31279. },
  31280. "legend": {},
  31281. "extra": {
  31282. "bubble": {
  31283. "border": 2,
  31284. "opacity": 0.5
  31285. }
  31286. }
  31287. }
  31288. };
  31289. var _default = cfu;
  31290. exports.default = _default;
  31291. /***/ }),
  31292. /***/ 69:
  31293. /*!***********************************!*\
  31294. !*** E:/work/mdapp/utils/tool.js ***!
  31295. \***********************************/
  31296. /*! no static exports found */
  31297. /***/ (function(module, exports, __webpack_require__) {
  31298. "use strict";
  31299. /* WEBPACK VAR INJECTION */(function(uni) {
  31300. Object.defineProperty(exports, "__esModule", {
  31301. value: true
  31302. });
  31303. exports.msgBase = exports.getRandomNum = exports.confirmMsgFn = void 0;
  31304. var getRandomNum = function getRandomNum(len, radix) {
  31305. // getRandomNum(24, 16)
  31306. var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
  31307. var uuid = [];
  31308. radix = radix || chars.length;
  31309. if (len) {
  31310. // Compact form
  31311. for (var i = 0; i < len; i++) {
  31312. uuid[i] = chars[0 | Math.random() * radix];
  31313. }
  31314. } else {
  31315. // rfc4122, version 4 form
  31316. var r;
  31317. // rfc4122 requires these characters
  31318. uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
  31319. uuid[14] = '4';
  31320. // Fill in random data.  At i==19 set the high bits of clock sequence as
  31321. // per rfc4122, sec. 4.1.5
  31322. for (var _i = 0; _i < 36; _i++) {
  31323. if (!uuid[_i]) {
  31324. r = 0 | Math.random() * 16;
  31325. uuid[_i] = chars[_i === 19 ? r & 0x3 | 0x8 : r];
  31326. }
  31327. }
  31328. }
  31329. return uuid.join('') + new Date().getTime();
  31330. };
  31331. exports.getRandomNum = getRandomNum;
  31332. var msgBase = function msgBase(msgText, bc) {
  31333. uni.showToast({
  31334. title: msgText,
  31335. icon: 'none',
  31336. duration: 2000
  31337. }).then(function () {
  31338. if (bc) bc();
  31339. });
  31340. };
  31341. exports.msgBase = msgBase;
  31342. var confirmMsgFn = function confirmMsgFn(msgText, successBc, errorBc) {
  31343. var title = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '提示';
  31344. uni.showModal({
  31345. title: title,
  31346. content: msgText,
  31347. success: function success(res) {
  31348. if (res.confirm) {
  31349. if (successBc) successBc();
  31350. } else if (res.cancel) {
  31351. if (errorBc) errorBc();
  31352. }
  31353. }
  31354. });
  31355. };
  31356. exports.confirmMsgFn = confirmMsgFn;
  31357. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
  31358. /***/ }),
  31359. /***/ 7:
  31360. /*!*********************************************************************!*\
  31361. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  31362. \*********************************************************************/
  31363. /*! no static exports found */
  31364. /***/ (function(module, exports) {
  31365. function _iterableToArrayLimit(arr, i) {
  31366. var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
  31367. if (null != _i) {
  31368. var _s,
  31369. _e,
  31370. _x,
  31371. _r,
  31372. _arr = [],
  31373. _n = !0,
  31374. _d = !1;
  31375. try {
  31376. if (_x = (_i = _i.call(arr)).next, 0 === i) {
  31377. if (Object(_i) !== _i) return;
  31378. _n = !1;
  31379. } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
  31380. ;
  31381. }
  31382. } catch (err) {
  31383. _d = !0, _e = err;
  31384. } finally {
  31385. try {
  31386. if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
  31387. } finally {
  31388. if (_d) throw _e;
  31389. }
  31390. }
  31391. return _arr;
  31392. }
  31393. }
  31394. module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31395. /***/ }),
  31396. /***/ 8:
  31397. /*!***************************************************************************!*\
  31398. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  31399. \***************************************************************************/
  31400. /*! no static exports found */
  31401. /***/ (function(module, exports, __webpack_require__) {
  31402. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ 9);
  31403. function _unsupportedIterableToArray(o, minLen) {
  31404. if (!o) return;
  31405. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  31406. var n = Object.prototype.toString.call(o).slice(8, -1);
  31407. if (n === "Object" && o.constructor) n = o.constructor.name;
  31408. if (n === "Map" || n === "Set") return Array.from(o);
  31409. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  31410. }
  31411. module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31412. /***/ }),
  31413. /***/ 9:
  31414. /*!*****************************************************************!*\
  31415. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  31416. \*****************************************************************/
  31417. /*! no static exports found */
  31418. /***/ (function(module, exports) {
  31419. function _arrayLikeToArray(arr, len) {
  31420. if (len == null || len > arr.length) len = arr.length;
  31421. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  31422. arr2[i] = arr[i];
  31423. }
  31424. return arr2;
  31425. }
  31426. module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
  31427. /***/ })
  31428. }]);
  31429. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map