vendor.js 458 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!************************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  5. \************************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. /* WEBPACK VAR INJECTION */(function(global) {Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.createPlugin = createPlugin;exports.createSubpackageApp = createSubpackageApp;exports.default = void 0;var _uniI18n = __webpack_require__(/*! @dcloudio/uni-i18n */ 3);
  10. var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 4));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}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);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}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;}
  11. var realAtob;
  12. var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  13. var b64re = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
  14. if (typeof atob !== 'function') {
  15. realAtob = function realAtob(str) {
  16. str = String(str).replace(/[\t\n\f\r ]+/g, '');
  17. if (!b64re.test(str)) {throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");}
  18. // Adding the padding if missing, for semplicity
  19. str += '=='.slice(2 - (str.length & 3));
  20. var bitmap;var result = '';var r1;var r2;var i = 0;
  21. for (; i < str.length;) {
  22. bitmap = b64.indexOf(str.charAt(i++)) << 18 | b64.indexOf(str.charAt(i++)) << 12 |
  23. (r1 = b64.indexOf(str.charAt(i++))) << 6 | (r2 = b64.indexOf(str.charAt(i++)));
  24. result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255) :
  25. r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255) :
  26. String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
  27. }
  28. return result;
  29. };
  30. } else {
  31. // 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
  32. realAtob = atob;
  33. }
  34. function b64DecodeUnicode(str) {
  35. return decodeURIComponent(realAtob(str).split('').map(function (c) {
  36. return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  37. }).join(''));
  38. }
  39. function getCurrentUserInfo() {
  40. var token = wx.getStorageSync('uni_id_token') || '';
  41. var tokenArr = token.split('.');
  42. if (!token || tokenArr.length !== 3) {
  43. return {
  44. uid: null,
  45. role: [],
  46. permission: [],
  47. tokenExpired: 0 };
  48. }
  49. var userInfo;
  50. try {
  51. userInfo = JSON.parse(b64DecodeUnicode(tokenArr[1]));
  52. } catch (error) {
  53. throw new Error('获取当前用户信息出错,详细错误信息为:' + error.message);
  54. }
  55. userInfo.tokenExpired = userInfo.exp * 1000;
  56. delete userInfo.exp;
  57. delete userInfo.iat;
  58. return userInfo;
  59. }
  60. function uniIdMixin(Vue) {
  61. Vue.prototype.uniIDHasRole = function (roleId) {var _getCurrentUserInfo =
  62. getCurrentUserInfo(),role = _getCurrentUserInfo.role;
  63. return role.indexOf(roleId) > -1;
  64. };
  65. Vue.prototype.uniIDHasPermission = function (permissionId) {var _getCurrentUserInfo2 =
  66. getCurrentUserInfo(),permission = _getCurrentUserInfo2.permission;
  67. return this.uniIDHasRole('admin') || permission.indexOf(permissionId) > -1;
  68. };
  69. Vue.prototype.uniIDTokenValid = function () {var _getCurrentUserInfo3 =
  70. getCurrentUserInfo(),tokenExpired = _getCurrentUserInfo3.tokenExpired;
  71. return tokenExpired > Date.now();
  72. };
  73. }
  74. var _toString = Object.prototype.toString;
  75. var hasOwnProperty = Object.prototype.hasOwnProperty;
  76. function isFn(fn) {
  77. return typeof fn === 'function';
  78. }
  79. function isStr(str) {
  80. return typeof str === 'string';
  81. }
  82. function isPlainObject(obj) {
  83. return _toString.call(obj) === '[object Object]';
  84. }
  85. function hasOwn(obj, key) {
  86. return hasOwnProperty.call(obj, key);
  87. }
  88. function noop() {}
  89. /**
  90. * Create a cached version of a pure function.
  91. */
  92. function cached(fn) {
  93. var cache = Object.create(null);
  94. return function cachedFn(str) {
  95. var hit = cache[str];
  96. return hit || (cache[str] = fn(str));
  97. };
  98. }
  99. /**
  100. * Camelize a hyphen-delimited string.
  101. */
  102. var camelizeRE = /-(\w)/g;
  103. var camelize = cached(function (str) {
  104. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  105. });
  106. function sortObject(obj) {
  107. var sortObj = {};
  108. if (isPlainObject(obj)) {
  109. Object.keys(obj).sort().forEach(function (key) {
  110. sortObj[key] = obj[key];
  111. });
  112. }
  113. return !Object.keys(sortObj) ? obj : sortObj;
  114. }
  115. var HOOKS = [
  116. 'invoke',
  117. 'success',
  118. 'fail',
  119. 'complete',
  120. 'returnValue'];
  121. var globalInterceptors = {};
  122. var scopedInterceptors = {};
  123. function mergeHook(parentVal, childVal) {
  124. var res = childVal ?
  125. parentVal ?
  126. parentVal.concat(childVal) :
  127. Array.isArray(childVal) ?
  128. childVal : [childVal] :
  129. parentVal;
  130. return res ?
  131. dedupeHooks(res) :
  132. res;
  133. }
  134. function dedupeHooks(hooks) {
  135. var res = [];
  136. for (var i = 0; i < hooks.length; i++) {
  137. if (res.indexOf(hooks[i]) === -1) {
  138. res.push(hooks[i]);
  139. }
  140. }
  141. return res;
  142. }
  143. function removeHook(hooks, hook) {
  144. var index = hooks.indexOf(hook);
  145. if (index !== -1) {
  146. hooks.splice(index, 1);
  147. }
  148. }
  149. function mergeInterceptorHook(interceptor, option) {
  150. Object.keys(option).forEach(function (hook) {
  151. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  152. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  153. }
  154. });
  155. }
  156. function removeInterceptorHook(interceptor, option) {
  157. if (!interceptor || !option) {
  158. return;
  159. }
  160. Object.keys(option).forEach(function (hook) {
  161. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  162. removeHook(interceptor[hook], option[hook]);
  163. }
  164. });
  165. }
  166. function addInterceptor(method, option) {
  167. if (typeof method === 'string' && isPlainObject(option)) {
  168. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  169. } else if (isPlainObject(method)) {
  170. mergeInterceptorHook(globalInterceptors, method);
  171. }
  172. }
  173. function removeInterceptor(method, option) {
  174. if (typeof method === 'string') {
  175. if (isPlainObject(option)) {
  176. removeInterceptorHook(scopedInterceptors[method], option);
  177. } else {
  178. delete scopedInterceptors[method];
  179. }
  180. } else if (isPlainObject(method)) {
  181. removeInterceptorHook(globalInterceptors, method);
  182. }
  183. }
  184. function wrapperHook(hook) {
  185. return function (data) {
  186. return hook(data) || data;
  187. };
  188. }
  189. function isPromise(obj) {
  190. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  191. }
  192. function queue(hooks, data) {
  193. var promise = false;
  194. for (var i = 0; i < hooks.length; i++) {
  195. var hook = hooks[i];
  196. if (promise) {
  197. promise = Promise.resolve(wrapperHook(hook));
  198. } else {
  199. var res = hook(data);
  200. if (isPromise(res)) {
  201. promise = Promise.resolve(res);
  202. }
  203. if (res === false) {
  204. return {
  205. then: function then() {} };
  206. }
  207. }
  208. }
  209. return promise || {
  210. then: function then(callback) {
  211. return callback(data);
  212. } };
  213. }
  214. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  215. ['success', 'fail', 'complete'].forEach(function (name) {
  216. if (Array.isArray(interceptor[name])) {
  217. var oldCallback = options[name];
  218. options[name] = function callbackInterceptor(res) {
  219. queue(interceptor[name], res).then(function (res) {
  220. /* eslint-disable no-mixed-operators */
  221. return isFn(oldCallback) && oldCallback(res) || res;
  222. });
  223. };
  224. }
  225. });
  226. return options;
  227. }
  228. function wrapperReturnValue(method, returnValue) {
  229. var returnValueHooks = [];
  230. if (Array.isArray(globalInterceptors.returnValue)) {
  231. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  232. }
  233. var interceptor = scopedInterceptors[method];
  234. if (interceptor && Array.isArray(interceptor.returnValue)) {
  235. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  236. }
  237. returnValueHooks.forEach(function (hook) {
  238. returnValue = hook(returnValue) || returnValue;
  239. });
  240. return returnValue;
  241. }
  242. function getApiInterceptorHooks(method) {
  243. var interceptor = Object.create(null);
  244. Object.keys(globalInterceptors).forEach(function (hook) {
  245. if (hook !== 'returnValue') {
  246. interceptor[hook] = globalInterceptors[hook].slice();
  247. }
  248. });
  249. var scopedInterceptor = scopedInterceptors[method];
  250. if (scopedInterceptor) {
  251. Object.keys(scopedInterceptor).forEach(function (hook) {
  252. if (hook !== 'returnValue') {
  253. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  254. }
  255. });
  256. }
  257. return interceptor;
  258. }
  259. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  260. var interceptor = getApiInterceptorHooks(method);
  261. if (interceptor && Object.keys(interceptor).length) {
  262. if (Array.isArray(interceptor.invoke)) {
  263. var res = queue(interceptor.invoke, options);
  264. return res.then(function (options) {
  265. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  266. });
  267. } else {
  268. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  269. }
  270. }
  271. return api.apply(void 0, [options].concat(params));
  272. }
  273. var promiseInterceptor = {
  274. returnValue: function returnValue(res) {
  275. if (!isPromise(res)) {
  276. return res;
  277. }
  278. return new Promise(function (resolve, reject) {
  279. res.then(function (res) {
  280. if (res[0]) {
  281. reject(res[0]);
  282. } else {
  283. resolve(res[1]);
  284. }
  285. });
  286. });
  287. } };
  288. var SYNC_API_RE =
  289. /^\$|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/;
  290. var CONTEXT_API_RE = /^create|Manager$/;
  291. // Context例外情况
  292. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  293. // 同步例外情况
  294. var ASYNC_API = ['createBLEConnection', 'createPushMessage'];
  295. var CALLBACK_API_RE = /^on|^off/;
  296. function isContextApi(name) {
  297. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  298. }
  299. function isSyncApi(name) {
  300. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  301. }
  302. function isCallbackApi(name) {
  303. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  304. }
  305. function handlePromise(promise) {
  306. return promise.then(function (data) {
  307. return [null, data];
  308. }).
  309. catch(function (err) {return [err];});
  310. }
  311. function shouldPromise(name) {
  312. if (
  313. isContextApi(name) ||
  314. isSyncApi(name) ||
  315. isCallbackApi(name))
  316. {
  317. return false;
  318. }
  319. return true;
  320. }
  321. /* eslint-disable no-extend-native */
  322. if (!Promise.prototype.finally) {
  323. Promise.prototype.finally = function (callback) {
  324. var promise = this.constructor;
  325. return this.then(
  326. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  327. function (reason) {return promise.resolve(callback()).then(function () {
  328. throw reason;
  329. });});
  330. };
  331. }
  332. function promisify(name, api) {
  333. if (!shouldPromise(name)) {
  334. return api;
  335. }
  336. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  337. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  338. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  339. }
  340. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  341. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  342. success: resolve,
  343. fail: reject })].concat(
  344. params));
  345. })));
  346. };
  347. }
  348. var EPS = 1e-4;
  349. var BASE_DEVICE_WIDTH = 750;
  350. var isIOS = false;
  351. var deviceWidth = 0;
  352. var deviceDPR = 0;
  353. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  354. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  355. deviceWidth = windowWidth;
  356. deviceDPR = pixelRatio;
  357. isIOS = platform === 'ios';
  358. }
  359. function upx2px(number, newDeviceWidth) {
  360. if (deviceWidth === 0) {
  361. checkDeviceWidth();
  362. }
  363. number = Number(number);
  364. if (number === 0) {
  365. return 0;
  366. }
  367. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  368. if (result < 0) {
  369. result = -result;
  370. }
  371. result = Math.floor(result + EPS);
  372. if (result === 0) {
  373. if (deviceDPR === 1 || !isIOS) {
  374. result = 1;
  375. } else {
  376. result = 0.5;
  377. }
  378. }
  379. return number < 0 ? -result : result;
  380. }
  381. var LOCALE_ZH_HANS = 'zh-Hans';
  382. var LOCALE_ZH_HANT = 'zh-Hant';
  383. var LOCALE_EN = 'en';
  384. var LOCALE_FR = 'fr';
  385. var LOCALE_ES = 'es';
  386. var messages = {};
  387. var locale;
  388. {
  389. locale = normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  390. }
  391. function initI18nMessages() {
  392. if (!isEnableLocale()) {
  393. return;
  394. }
  395. var localeKeys = Object.keys(__uniConfig.locales);
  396. if (localeKeys.length) {
  397. localeKeys.forEach(function (locale) {
  398. var curMessages = messages[locale];
  399. var userMessages = __uniConfig.locales[locale];
  400. if (curMessages) {
  401. Object.assign(curMessages, userMessages);
  402. } else {
  403. messages[locale] = userMessages;
  404. }
  405. });
  406. }
  407. }
  408. initI18nMessages();
  409. var i18n = (0, _uniI18n.initVueI18n)(
  410. locale,
  411. {});
  412. var t = i18n.t;
  413. var i18nMixin = i18n.mixin = {
  414. beforeCreate: function beforeCreate() {var _this = this;
  415. var unwatch = i18n.i18n.watchLocale(function () {
  416. _this.$forceUpdate();
  417. });
  418. this.$once('hook:beforeDestroy', function () {
  419. unwatch();
  420. });
  421. },
  422. methods: {
  423. $$t: function $$t(key, values) {
  424. return t(key, values);
  425. } } };
  426. var setLocale = i18n.setLocale;
  427. var getLocale = i18n.getLocale;
  428. function initAppLocale(Vue, appVm, locale) {
  429. var state = Vue.observable({
  430. locale: locale || i18n.getLocale() });
  431. var localeWatchers = [];
  432. appVm.$watchLocale = function (fn) {
  433. localeWatchers.push(fn);
  434. };
  435. Object.defineProperty(appVm, '$locale', {
  436. get: function get() {
  437. return state.locale;
  438. },
  439. set: function set(v) {
  440. state.locale = v;
  441. localeWatchers.forEach(function (watch) {return watch(v);});
  442. } });
  443. }
  444. function isEnableLocale() {
  445. return typeof __uniConfig !== 'undefined' && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length;
  446. }
  447. function include(str, parts) {
  448. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  449. }
  450. function startsWith(str, parts) {
  451. return parts.find(function (part) {return str.indexOf(part) === 0;});
  452. }
  453. function normalizeLocale(locale, messages) {
  454. if (!locale) {
  455. return;
  456. }
  457. locale = locale.trim().replace(/_/g, '-');
  458. if (messages && messages[locale]) {
  459. return locale;
  460. }
  461. locale = locale.toLowerCase();
  462. if (locale === 'chinese') {
  463. // 支付宝
  464. return LOCALE_ZH_HANS;
  465. }
  466. if (locale.indexOf('zh') === 0) {
  467. if (locale.indexOf('-hans') > -1) {
  468. return LOCALE_ZH_HANS;
  469. }
  470. if (locale.indexOf('-hant') > -1) {
  471. return LOCALE_ZH_HANT;
  472. }
  473. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  474. return LOCALE_ZH_HANT;
  475. }
  476. return LOCALE_ZH_HANS;
  477. }
  478. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  479. if (lang) {
  480. return lang;
  481. }
  482. }
  483. // export function initI18n() {
  484. // const localeKeys = Object.keys(__uniConfig.locales || {})
  485. // if (localeKeys.length) {
  486. // localeKeys.forEach((locale) =>
  487. // i18n.add(locale, __uniConfig.locales[locale])
  488. // )
  489. // }
  490. // }
  491. function getLocale$1() {
  492. // 优先使用 $locale
  493. var app = getApp({
  494. allowDefault: true });
  495. if (app && app.$vm) {
  496. return app.$vm.$locale;
  497. }
  498. return normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN;
  499. }
  500. function setLocale$1(locale) {
  501. var app = getApp();
  502. if (!app) {
  503. return false;
  504. }
  505. var oldLocale = app.$vm.$locale;
  506. if (oldLocale !== locale) {
  507. app.$vm.$locale = locale;
  508. onLocaleChangeCallbacks.forEach(function (fn) {return fn({
  509. locale: locale });});
  510. return true;
  511. }
  512. return false;
  513. }
  514. var onLocaleChangeCallbacks = [];
  515. function onLocaleChange(fn) {
  516. if (onLocaleChangeCallbacks.indexOf(fn) === -1) {
  517. onLocaleChangeCallbacks.push(fn);
  518. }
  519. }
  520. if (typeof global !== 'undefined') {
  521. global.getLocale = getLocale$1;
  522. }
  523. var interceptors = {
  524. promiseInterceptor: promiseInterceptor };
  525. var baseApi = /*#__PURE__*/Object.freeze({
  526. __proto__: null,
  527. upx2px: upx2px,
  528. getLocale: getLocale$1,
  529. setLocale: setLocale$1,
  530. onLocaleChange: onLocaleChange,
  531. addInterceptor: addInterceptor,
  532. removeInterceptor: removeInterceptor,
  533. interceptors: interceptors });
  534. function findExistsPageIndex(url) {
  535. var pages = getCurrentPages();
  536. var len = pages.length;
  537. while (len--) {
  538. var page = pages[len];
  539. if (page.$page && page.$page.fullPath === url) {
  540. return len;
  541. }
  542. }
  543. return -1;
  544. }
  545. var redirectTo = {
  546. name: function name(fromArgs) {
  547. if (fromArgs.exists === 'back' && fromArgs.delta) {
  548. return 'navigateBack';
  549. }
  550. return 'redirectTo';
  551. },
  552. args: function args(fromArgs) {
  553. if (fromArgs.exists === 'back' && fromArgs.url) {
  554. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  555. if (existsPageIndex !== -1) {
  556. var delta = getCurrentPages().length - 1 - existsPageIndex;
  557. if (delta > 0) {
  558. fromArgs.delta = delta;
  559. }
  560. }
  561. }
  562. } };
  563. var previewImage = {
  564. args: function args(fromArgs) {
  565. var currentIndex = parseInt(fromArgs.current);
  566. if (isNaN(currentIndex)) {
  567. return;
  568. }
  569. var urls = fromArgs.urls;
  570. if (!Array.isArray(urls)) {
  571. return;
  572. }
  573. var len = urls.length;
  574. if (!len) {
  575. return;
  576. }
  577. if (currentIndex < 0) {
  578. currentIndex = 0;
  579. } else if (currentIndex >= len) {
  580. currentIndex = len - 1;
  581. }
  582. if (currentIndex > 0) {
  583. fromArgs.current = urls[currentIndex];
  584. fromArgs.urls = urls.filter(
  585. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  586. } else {
  587. fromArgs.current = urls[0];
  588. }
  589. return {
  590. indicator: false,
  591. loop: false };
  592. } };
  593. var UUID_KEY = '__DC_STAT_UUID';
  594. var deviceId;
  595. function useDeviceId(result) {
  596. deviceId = deviceId || wx.getStorageSync(UUID_KEY);
  597. if (!deviceId) {
  598. deviceId = Date.now() + '' + Math.floor(Math.random() * 1e7);
  599. wx.setStorage({
  600. key: UUID_KEY,
  601. data: deviceId });
  602. }
  603. result.deviceId = deviceId;
  604. }
  605. function addSafeAreaInsets(result) {
  606. if (result.safeArea) {
  607. var safeArea = result.safeArea;
  608. result.safeAreaInsets = {
  609. top: safeArea.top,
  610. left: safeArea.left,
  611. right: result.windowWidth - safeArea.right,
  612. bottom: result.screenHeight - safeArea.bottom };
  613. }
  614. }
  615. function populateParameters(result) {var _result$brand =
  616. result.brand,brand = _result$brand === void 0 ? '' : _result$brand,_result$model = result.model,model = _result$model === void 0 ? '' : _result$model,_result$system = result.system,system = _result$system === void 0 ? '' : _result$system,_result$language = result.language,language = _result$language === void 0 ? '' : _result$language,theme = result.theme,version = result.version,platform = result.platform,fontSizeSetting = result.fontSizeSetting,SDKVersion = result.SDKVersion,pixelRatio = result.pixelRatio,deviceOrientation = result.deviceOrientation;
  617. // const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1
  618. // osName osVersion
  619. var osName = '';
  620. var osVersion = '';
  621. {
  622. osName = system.split(' ')[0] || '';
  623. osVersion = system.split(' ')[1] || '';
  624. }
  625. var hostVersion = version;
  626. // deviceType
  627. var deviceType = getGetDeviceType(result, model);
  628. // deviceModel
  629. var deviceBrand = getDeviceBrand(brand);
  630. // hostName
  631. var _hostName = getHostName(result);
  632. // deviceOrientation
  633. var _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
  634. // devicePixelRatio
  635. var _devicePixelRatio = pixelRatio;
  636. // SDKVersion
  637. var _SDKVersion = SDKVersion;
  638. // hostLanguage
  639. var hostLanguage = language.replace(/_/g, '-');
  640. // wx.getAccountInfoSync
  641. var parameters = {
  642. appId: "__UNI__CA02DBC",
  643. appName: "vrv-platform",
  644. appVersion: "1.0.0",
  645. appVersionCode: "100",
  646. appLanguage: getAppLanguage(hostLanguage),
  647. uniCompileVersion: "3.5.3",
  648. uniRuntimeVersion: "3.5.3",
  649. uniPlatform: undefined || "mp-weixin",
  650. deviceBrand: deviceBrand,
  651. deviceModel: model,
  652. deviceType: deviceType,
  653. devicePixelRatio: _devicePixelRatio,
  654. deviceOrientation: _deviceOrientation,
  655. osName: osName.toLocaleLowerCase(),
  656. osVersion: osVersion,
  657. hostTheme: theme,
  658. hostVersion: hostVersion,
  659. hostLanguage: hostLanguage,
  660. hostName: _hostName,
  661. hostSDKVersion: _SDKVersion,
  662. hostFontSizeSetting: fontSizeSetting,
  663. windowTop: 0,
  664. windowBottom: 0,
  665. // TODO
  666. osLanguage: undefined,
  667. osTheme: undefined,
  668. ua: undefined,
  669. hostPackageName: undefined,
  670. browserName: undefined,
  671. browserVersion: undefined };
  672. Object.assign(result, parameters);
  673. }
  674. function getGetDeviceType(result, model) {
  675. var deviceType = result.deviceType || 'phone';
  676. {
  677. var deviceTypeMaps = {
  678. ipad: 'pad',
  679. windows: 'pc',
  680. mac: 'pc' };
  681. var deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
  682. var _model = model.toLocaleLowerCase();
  683. for (var index = 0; index < deviceTypeMapsKeys.length; index++) {
  684. var _m = deviceTypeMapsKeys[index];
  685. if (_model.indexOf(_m) !== -1) {
  686. deviceType = deviceTypeMaps[_m];
  687. break;
  688. }
  689. }
  690. }
  691. return deviceType;
  692. }
  693. function getDeviceBrand(brand) {
  694. var deviceBrand = brand;
  695. if (deviceBrand) {
  696. deviceBrand = brand.toLocaleLowerCase();
  697. }
  698. return deviceBrand;
  699. }
  700. function getAppLanguage(defaultLanguage) {
  701. return getLocale$1 ?
  702. getLocale$1() :
  703. defaultLanguage;
  704. }
  705. function getHostName(result) {
  706. var _platform = 'WeChat';
  707. var _hostName = result.hostName || _platform; // mp-jd
  708. {
  709. if (result.environment) {
  710. _hostName = result.environment;
  711. } else if (result.host && result.host.env) {
  712. _hostName = result.host.env;
  713. }
  714. }
  715. return _hostName;
  716. }
  717. var getSystemInfo = {
  718. returnValue: function returnValue(result) {
  719. useDeviceId(result);
  720. addSafeAreaInsets(result);
  721. populateParameters(result);
  722. } };
  723. var showActionSheet = {
  724. args: function args(fromArgs) {
  725. if (typeof fromArgs === 'object') {
  726. fromArgs.alertText = fromArgs.title;
  727. }
  728. } };
  729. var getAppBaseInfo = {
  730. returnValue: function returnValue(result) {var _result =
  731. result,version = _result.version,language = _result.language,SDKVersion = _result.SDKVersion,theme = _result.theme;
  732. var _hostName = getHostName(result);
  733. var hostLanguage = language.replace('_', '-');
  734. result = sortObject(Object.assign(result, {
  735. appId: "__UNI__CA02DBC",
  736. appName: "vrv-platform",
  737. appVersion: "1.0.0",
  738. appVersionCode: "100",
  739. appLanguage: getAppLanguage(hostLanguage),
  740. hostVersion: version,
  741. hostLanguage: hostLanguage,
  742. hostName: _hostName,
  743. hostSDKVersion: SDKVersion,
  744. hostTheme: theme }));
  745. } };
  746. var getDeviceInfo = {
  747. returnValue: function returnValue(result) {var _result2 =
  748. result,brand = _result2.brand,model = _result2.model;
  749. var deviceType = getGetDeviceType(result, model);
  750. var deviceBrand = getDeviceBrand(brand);
  751. useDeviceId(result);
  752. result = sortObject(Object.assign(result, {
  753. deviceType: deviceType,
  754. deviceBrand: deviceBrand,
  755. deviceModel: model }));
  756. } };
  757. var getWindowInfo = {
  758. returnValue: function returnValue(result) {
  759. addSafeAreaInsets(result);
  760. result = sortObject(Object.assign(result, {
  761. windowTop: 0,
  762. windowBottom: 0 }));
  763. } };
  764. var getAppAuthorizeSetting = {
  765. returnValue: function returnValue(result) {var
  766. locationReducedAccuracy = result.locationReducedAccuracy;
  767. result.locationAccuracy = 'unsupported';
  768. if (locationReducedAccuracy === true) {
  769. result.locationAccuracy = 'reduced';
  770. } else if (locationReducedAccuracy === false) {
  771. result.locationAccuracy = 'full';
  772. }
  773. } };
  774. // import navigateTo from 'uni-helpers/navigate-to'
  775. var protocols = {
  776. redirectTo: redirectTo,
  777. // navigateTo, // 由于在微信开发者工具的页面参数,会显示__id__参数,因此暂时关闭mp-weixin对于navigateTo的AOP
  778. previewImage: previewImage,
  779. getSystemInfo: getSystemInfo,
  780. getSystemInfoSync: getSystemInfo,
  781. showActionSheet: showActionSheet,
  782. getAppBaseInfo: getAppBaseInfo,
  783. getDeviceInfo: getDeviceInfo,
  784. getWindowInfo: getWindowInfo,
  785. getAppAuthorizeSetting: getAppAuthorizeSetting };
  786. var todos = [
  787. 'vibrate',
  788. 'preloadPage',
  789. 'unPreloadPage',
  790. 'loadSubPackage'];
  791. var canIUses = [];
  792. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  793. function processCallback(methodName, method, returnValue) {
  794. return function (res) {
  795. return method(processReturnValue(methodName, res, returnValue));
  796. };
  797. }
  798. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  799. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  800. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  801. if (isFn(argsOption)) {
  802. argsOption = argsOption(fromArgs, toArgs) || {};
  803. }
  804. for (var key in fromArgs) {
  805. if (hasOwn(argsOption, key)) {
  806. var keyOption = argsOption[key];
  807. if (isFn(keyOption)) {
  808. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  809. }
  810. if (!keyOption) {// 不支持的参数
  811. console.warn("The '".concat(methodName, "' method of platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support option '").concat(key, "'"));
  812. } else if (isStr(keyOption)) {// 重写参数 key
  813. toArgs[keyOption] = fromArgs[key];
  814. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  815. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  816. }
  817. } else if (CALLBACKS.indexOf(key) !== -1) {
  818. if (isFn(fromArgs[key])) {
  819. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  820. }
  821. } else {
  822. if (!keepFromArgs) {
  823. toArgs[key] = fromArgs[key];
  824. }
  825. }
  826. }
  827. return toArgs;
  828. } else if (isFn(fromArgs)) {
  829. fromArgs = processCallback(methodName, fromArgs, returnValue);
  830. }
  831. return fromArgs;
  832. }
  833. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  834. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  835. res = protocols.returnValue(methodName, res);
  836. }
  837. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  838. }
  839. function wrapper(methodName, method) {
  840. if (hasOwn(protocols, methodName)) {
  841. var protocol = protocols[methodName];
  842. if (!protocol) {// 暂不支持的 api
  843. return function () {
  844. console.error("Platform '\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F' does not support '".concat(methodName, "'."));
  845. };
  846. }
  847. return function (arg1, arg2) {// 目前 api 最多两个参数
  848. var options = protocol;
  849. if (isFn(protocol)) {
  850. options = protocol(arg1);
  851. }
  852. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  853. var args = [arg1];
  854. if (typeof arg2 !== 'undefined') {
  855. args.push(arg2);
  856. }
  857. if (isFn(options.name)) {
  858. methodName = options.name(arg1);
  859. } else if (isStr(options.name)) {
  860. methodName = options.name;
  861. }
  862. var returnValue = wx[methodName].apply(wx, args);
  863. if (isSyncApi(methodName)) {// 同步 api
  864. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  865. }
  866. return returnValue;
  867. };
  868. }
  869. return method;
  870. }
  871. var todoApis = Object.create(null);
  872. var TODOS = [
  873. 'onTabBarMidButtonTap',
  874. 'subscribePush',
  875. 'unsubscribePush',
  876. 'onPush',
  877. 'offPush',
  878. 'share'];
  879. function createTodoApi(name) {
  880. return function todoApi(_ref)
  881. {var fail = _ref.fail,complete = _ref.complete;
  882. var res = {
  883. errMsg: "".concat(name, ":fail method '").concat(name, "' not supported") };
  884. isFn(fail) && fail(res);
  885. isFn(complete) && complete(res);
  886. };
  887. }
  888. TODOS.forEach(function (name) {
  889. todoApis[name] = createTodoApi(name);
  890. });
  891. var providers = {
  892. oauth: ['weixin'],
  893. share: ['weixin'],
  894. payment: ['wxpay'],
  895. push: ['weixin'] };
  896. function getProvider(_ref2)
  897. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  898. var res = false;
  899. if (providers[service]) {
  900. res = {
  901. errMsg: 'getProvider:ok',
  902. service: service,
  903. provider: providers[service] };
  904. isFn(success) && success(res);
  905. } else {
  906. res = {
  907. errMsg: 'getProvider:fail service not found' };
  908. isFn(fail) && fail(res);
  909. }
  910. isFn(complete) && complete(res);
  911. }
  912. var extraApi = /*#__PURE__*/Object.freeze({
  913. __proto__: null,
  914. getProvider: getProvider });
  915. var getEmitter = function () {
  916. var Emitter;
  917. return function getUniEmitter() {
  918. if (!Emitter) {
  919. Emitter = new _vue.default();
  920. }
  921. return Emitter;
  922. };
  923. }();
  924. function apply(ctx, method, args) {
  925. return ctx[method].apply(ctx, args);
  926. }
  927. function $on() {
  928. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  929. }
  930. function $off() {
  931. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  932. }
  933. function $once() {
  934. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  935. }
  936. function $emit() {
  937. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  938. }
  939. var eventApi = /*#__PURE__*/Object.freeze({
  940. __proto__: null,
  941. $on: $on,
  942. $off: $off,
  943. $once: $once,
  944. $emit: $emit });
  945. /**
  946. * 框架内 try-catch
  947. */
  948. /**
  949. * 开发者 try-catch
  950. */
  951. function tryCatch(fn) {
  952. return function () {
  953. try {
  954. return fn.apply(fn, arguments);
  955. } catch (e) {
  956. // TODO
  957. console.error(e);
  958. }
  959. };
  960. }
  961. function getApiCallbacks(params) {
  962. var apiCallbacks = {};
  963. for (var name in params) {
  964. var param = params[name];
  965. if (isFn(param)) {
  966. apiCallbacks[name] = tryCatch(param);
  967. delete params[name];
  968. }
  969. }
  970. return apiCallbacks;
  971. }
  972. var cid;
  973. var cidErrMsg;
  974. var enabled;
  975. function normalizePushMessage(message) {
  976. try {
  977. return JSON.parse(message);
  978. } catch (e) {}
  979. return message;
  980. }
  981. function invokePushCallback(
  982. args)
  983. {
  984. if (args.type === 'enabled') {
  985. enabled = true;
  986. } else if (args.type === 'clientId') {
  987. cid = args.cid;
  988. cidErrMsg = args.errMsg;
  989. invokeGetPushCidCallbacks(cid, args.errMsg);
  990. } else if (args.type === 'pushMsg') {
  991. var message = {
  992. type: 'receive',
  993. data: normalizePushMessage(args.message) };
  994. for (var i = 0; i < onPushMessageCallbacks.length; i++) {
  995. var callback = onPushMessageCallbacks[i];
  996. callback(message);
  997. // 该消息已被阻止
  998. if (message.stopped) {
  999. break;
  1000. }
  1001. }
  1002. } else if (args.type === 'click') {
  1003. onPushMessageCallbacks.forEach(function (callback) {
  1004. callback({
  1005. type: 'click',
  1006. data: normalizePushMessage(args.message) });
  1007. });
  1008. }
  1009. }
  1010. var getPushCidCallbacks = [];
  1011. function invokeGetPushCidCallbacks(cid, errMsg) {
  1012. getPushCidCallbacks.forEach(function (callback) {
  1013. callback(cid, errMsg);
  1014. });
  1015. getPushCidCallbacks.length = 0;
  1016. }
  1017. function getPushClientId(args) {
  1018. if (!isPlainObject(args)) {
  1019. args = {};
  1020. }var _getApiCallbacks =
  1021. getApiCallbacks(args),success = _getApiCallbacks.success,fail = _getApiCallbacks.fail,complete = _getApiCallbacks.complete;
  1022. var hasSuccess = isFn(success);
  1023. var hasFail = isFn(fail);
  1024. var hasComplete = isFn(complete);
  1025. Promise.resolve().then(function () {
  1026. if (typeof enabled === 'undefined') {
  1027. enabled = false;
  1028. cid = '';
  1029. cidErrMsg = 'unipush is not enabled';
  1030. }
  1031. getPushCidCallbacks.push(function (cid, errMsg) {
  1032. var res;
  1033. if (cid) {
  1034. res = {
  1035. errMsg: 'getPushClientId:ok',
  1036. cid: cid };
  1037. hasSuccess && success(res);
  1038. } else {
  1039. res = {
  1040. errMsg: 'getPushClientId:fail' + (errMsg ? ' ' + errMsg : '') };
  1041. hasFail && fail(res);
  1042. }
  1043. hasComplete && complete(res);
  1044. });
  1045. if (typeof cid !== 'undefined') {
  1046. invokeGetPushCidCallbacks(cid, cidErrMsg);
  1047. }
  1048. });
  1049. }
  1050. var onPushMessageCallbacks = [];
  1051. // 不使用 defineOnApi 实现,是因为 defineOnApi 依赖 UniServiceJSBridge ,该对象目前在小程序上未提供,故简单实现
  1052. var onPushMessage = function onPushMessage(fn) {
  1053. if (onPushMessageCallbacks.indexOf(fn) === -1) {
  1054. onPushMessageCallbacks.push(fn);
  1055. }
  1056. };
  1057. var offPushMessage = function offPushMessage(fn) {
  1058. if (!fn) {
  1059. onPushMessageCallbacks.length = 0;
  1060. } else {
  1061. var index = onPushMessageCallbacks.indexOf(fn);
  1062. if (index > -1) {
  1063. onPushMessageCallbacks.splice(index, 1);
  1064. }
  1065. }
  1066. };
  1067. var api = /*#__PURE__*/Object.freeze({
  1068. __proto__: null,
  1069. getPushClientId: getPushClientId,
  1070. onPushMessage: onPushMessage,
  1071. offPushMessage: offPushMessage,
  1072. invokePushCallback: invokePushCallback });
  1073. var MPPage = Page;
  1074. var MPComponent = Component;
  1075. var customizeRE = /:/g;
  1076. var customize = cached(function (str) {
  1077. return camelize(str.replace(customizeRE, '-'));
  1078. });
  1079. function initTriggerEvent(mpInstance) {
  1080. var oldTriggerEvent = mpInstance.triggerEvent;
  1081. var newTriggerEvent = function newTriggerEvent(event) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  1082. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  1083. };
  1084. try {
  1085. // 京东小程序 triggerEvent 为只读
  1086. mpInstance.triggerEvent = newTriggerEvent;
  1087. } catch (error) {
  1088. mpInstance._triggerEvent = newTriggerEvent;
  1089. }
  1090. }
  1091. function initHook(name, options, isComponent) {
  1092. var oldHook = options[name];
  1093. if (!oldHook) {
  1094. options[name] = function () {
  1095. initTriggerEvent(this);
  1096. };
  1097. } else {
  1098. options[name] = function () {
  1099. initTriggerEvent(this);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}
  1100. return oldHook.apply(this, args);
  1101. };
  1102. }
  1103. }
  1104. if (!MPPage.__$wrappered) {
  1105. MPPage.__$wrappered = true;
  1106. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1107. initHook('onLoad', options);
  1108. return MPPage(options);
  1109. };
  1110. Page.after = MPPage.after;
  1111. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1112. initHook('created', options);
  1113. return MPComponent(options);
  1114. };
  1115. }
  1116. var PAGE_EVENT_HOOKS = [
  1117. 'onPullDownRefresh',
  1118. 'onReachBottom',
  1119. 'onAddToFavorites',
  1120. 'onShareTimeline',
  1121. 'onShareAppMessage',
  1122. 'onPageScroll',
  1123. 'onResize',
  1124. 'onTabItemTap'];
  1125. function initMocks(vm, mocks) {
  1126. var mpInstance = vm.$mp[vm.mpType];
  1127. mocks.forEach(function (mock) {
  1128. if (hasOwn(mpInstance, mock)) {
  1129. vm[mock] = mpInstance[mock];
  1130. }
  1131. });
  1132. }
  1133. function hasHook(hook, vueOptions) {
  1134. if (!vueOptions) {
  1135. return true;
  1136. }
  1137. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  1138. return true;
  1139. }
  1140. vueOptions = vueOptions.default || vueOptions;
  1141. if (isFn(vueOptions)) {
  1142. if (isFn(vueOptions.extendOptions[hook])) {
  1143. return true;
  1144. }
  1145. if (vueOptions.super &&
  1146. vueOptions.super.options &&
  1147. Array.isArray(vueOptions.super.options[hook])) {
  1148. return true;
  1149. }
  1150. return false;
  1151. }
  1152. if (isFn(vueOptions[hook])) {
  1153. return true;
  1154. }
  1155. var mixins = vueOptions.mixins;
  1156. if (Array.isArray(mixins)) {
  1157. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  1158. }
  1159. }
  1160. function initHooks(mpOptions, hooks, vueOptions) {
  1161. hooks.forEach(function (hook) {
  1162. if (hasHook(hook, vueOptions)) {
  1163. mpOptions[hook] = function (args) {
  1164. return this.$vm && this.$vm.__call_hook(hook, args);
  1165. };
  1166. }
  1167. });
  1168. }
  1169. function initVueComponent(Vue, vueOptions) {
  1170. vueOptions = vueOptions.default || vueOptions;
  1171. var VueComponent;
  1172. if (isFn(vueOptions)) {
  1173. VueComponent = vueOptions;
  1174. } else {
  1175. VueComponent = Vue.extend(vueOptions);
  1176. }
  1177. vueOptions = VueComponent.options;
  1178. return [VueComponent, vueOptions];
  1179. }
  1180. function initSlots(vm, vueSlots) {
  1181. if (Array.isArray(vueSlots) && vueSlots.length) {
  1182. var $slots = Object.create(null);
  1183. vueSlots.forEach(function (slotName) {
  1184. $slots[slotName] = true;
  1185. });
  1186. vm.$scopedSlots = vm.$slots = $slots;
  1187. }
  1188. }
  1189. function initVueIds(vueIds, mpInstance) {
  1190. vueIds = (vueIds || '').split(',');
  1191. var len = vueIds.length;
  1192. if (len === 1) {
  1193. mpInstance._$vueId = vueIds[0];
  1194. } else if (len === 2) {
  1195. mpInstance._$vueId = vueIds[0];
  1196. mpInstance._$vuePid = vueIds[1];
  1197. }
  1198. }
  1199. function initData(vueOptions, context) {
  1200. var data = vueOptions.data || {};
  1201. var methods = vueOptions.methods || {};
  1202. if (typeof data === 'function') {
  1203. try {
  1204. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  1205. } catch (e) {
  1206. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  1207. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  1208. }
  1209. }
  1210. } else {
  1211. try {
  1212. // 对 data 格式化
  1213. data = JSON.parse(JSON.stringify(data));
  1214. } catch (e) {}
  1215. }
  1216. if (!isPlainObject(data)) {
  1217. data = {};
  1218. }
  1219. Object.keys(methods).forEach(function (methodName) {
  1220. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  1221. data[methodName] = methods[methodName];
  1222. }
  1223. });
  1224. return data;
  1225. }
  1226. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  1227. function createObserver(name) {
  1228. return function observer(newVal, oldVal) {
  1229. if (this.$vm) {
  1230. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  1231. }
  1232. };
  1233. }
  1234. function initBehaviors(vueOptions, initBehavior) {
  1235. var vueBehaviors = vueOptions.behaviors;
  1236. var vueExtends = vueOptions.extends;
  1237. var vueMixins = vueOptions.mixins;
  1238. var vueProps = vueOptions.props;
  1239. if (!vueProps) {
  1240. vueOptions.props = vueProps = [];
  1241. }
  1242. var behaviors = [];
  1243. if (Array.isArray(vueBehaviors)) {
  1244. vueBehaviors.forEach(function (behavior) {
  1245. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  1246. if (behavior === 'uni://form-field') {
  1247. if (Array.isArray(vueProps)) {
  1248. vueProps.push('name');
  1249. vueProps.push('value');
  1250. } else {
  1251. vueProps.name = {
  1252. type: String,
  1253. default: '' };
  1254. vueProps.value = {
  1255. type: [String, Number, Boolean, Array, Object, Date],
  1256. default: '' };
  1257. }
  1258. }
  1259. });
  1260. }
  1261. if (isPlainObject(vueExtends) && vueExtends.props) {
  1262. behaviors.push(
  1263. initBehavior({
  1264. properties: initProperties(vueExtends.props, true) }));
  1265. }
  1266. if (Array.isArray(vueMixins)) {
  1267. vueMixins.forEach(function (vueMixin) {
  1268. if (isPlainObject(vueMixin) && vueMixin.props) {
  1269. behaviors.push(
  1270. initBehavior({
  1271. properties: initProperties(vueMixin.props, true) }));
  1272. }
  1273. });
  1274. }
  1275. return behaviors;
  1276. }
  1277. function parsePropType(key, type, defaultValue, file) {
  1278. // [String]=>String
  1279. if (Array.isArray(type) && type.length === 1) {
  1280. return type[0];
  1281. }
  1282. return type;
  1283. }
  1284. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';var options = arguments.length > 3 ? arguments[3] : undefined;
  1285. var properties = {};
  1286. if (!isBehavior) {
  1287. properties.vueId = {
  1288. type: String,
  1289. value: '' };
  1290. {
  1291. if (options.virtualHost) {
  1292. properties.virtualHostStyle = {
  1293. type: null,
  1294. value: '' };
  1295. properties.virtualHostClass = {
  1296. type: null,
  1297. value: '' };
  1298. }
  1299. }
  1300. // scopedSlotsCompiler auto
  1301. properties.scopedSlotsCompiler = {
  1302. type: String,
  1303. value: '' };
  1304. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  1305. type: null,
  1306. value: [],
  1307. observer: function observer(newVal, oldVal) {
  1308. var $slots = Object.create(null);
  1309. newVal.forEach(function (slotName) {
  1310. $slots[slotName] = true;
  1311. });
  1312. this.setData({
  1313. $slots: $slots });
  1314. } };
  1315. }
  1316. if (Array.isArray(props)) {// ['title']
  1317. props.forEach(function (key) {
  1318. properties[key] = {
  1319. type: null,
  1320. observer: createObserver(key) };
  1321. });
  1322. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  1323. Object.keys(props).forEach(function (key) {
  1324. var opts = props[key];
  1325. if (isPlainObject(opts)) {// title:{type:String,default:''}
  1326. var value = opts.default;
  1327. if (isFn(value)) {
  1328. value = value();
  1329. }
  1330. opts.type = parsePropType(key, opts.type);
  1331. properties[key] = {
  1332. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  1333. value: value,
  1334. observer: createObserver(key) };
  1335. } else {// content:String
  1336. var type = parsePropType(key, opts);
  1337. properties[key] = {
  1338. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  1339. observer: createObserver(key) };
  1340. }
  1341. });
  1342. }
  1343. return properties;
  1344. }
  1345. function wrapper$1(event) {
  1346. // TODO 又得兼容 mpvue 的 mp 对象
  1347. try {
  1348. event.mp = JSON.parse(JSON.stringify(event));
  1349. } catch (e) {}
  1350. event.stopPropagation = noop;
  1351. event.preventDefault = noop;
  1352. event.target = event.target || {};
  1353. if (!hasOwn(event, 'detail')) {
  1354. event.detail = {};
  1355. }
  1356. if (hasOwn(event, 'markerId')) {
  1357. event.detail = typeof event.detail === 'object' ? event.detail : {};
  1358. event.detail.markerId = event.markerId;
  1359. }
  1360. if (isPlainObject(event.detail)) {
  1361. event.target = Object.assign({}, event.target, event.detail);
  1362. }
  1363. return event;
  1364. }
  1365. function getExtraValue(vm, dataPathsArray) {
  1366. var context = vm;
  1367. dataPathsArray.forEach(function (dataPathArray) {
  1368. var dataPath = dataPathArray[0];
  1369. var value = dataPathArray[2];
  1370. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  1371. var propPath = dataPathArray[1];
  1372. var valuePath = dataPathArray[3];
  1373. var vFor;
  1374. if (Number.isInteger(dataPath)) {
  1375. vFor = dataPath;
  1376. } else if (!dataPath) {
  1377. vFor = context;
  1378. } else if (typeof dataPath === 'string' && dataPath) {
  1379. if (dataPath.indexOf('#s#') === 0) {
  1380. vFor = dataPath.substr(3);
  1381. } else {
  1382. vFor = vm.__get_value(dataPath, context);
  1383. }
  1384. }
  1385. if (Number.isInteger(vFor)) {
  1386. context = value;
  1387. } else if (!propPath) {
  1388. context = vFor[value];
  1389. } else {
  1390. if (Array.isArray(vFor)) {
  1391. context = vFor.find(function (vForItem) {
  1392. return vm.__get_value(propPath, vForItem) === value;
  1393. });
  1394. } else if (isPlainObject(vFor)) {
  1395. context = Object.keys(vFor).find(function (vForKey) {
  1396. return vm.__get_value(propPath, vFor[vForKey]) === value;
  1397. });
  1398. } else {
  1399. console.error('v-for 暂不支持循环数据:', vFor);
  1400. }
  1401. }
  1402. if (valuePath) {
  1403. context = vm.__get_value(valuePath, context);
  1404. }
  1405. }
  1406. });
  1407. return context;
  1408. }
  1409. function processEventExtra(vm, extra, event) {
  1410. var extraObj = {};
  1411. if (Array.isArray(extra) && extra.length) {
  1412. /**
  1413. *[
  1414. * ['data.items', 'data.id', item.data.id],
  1415. * ['metas', 'id', meta.id]
  1416. *],
  1417. *[
  1418. * ['data.items', 'data.id', item.data.id],
  1419. * ['metas', 'id', meta.id]
  1420. *],
  1421. *'test'
  1422. */
  1423. extra.forEach(function (dataPath, index) {
  1424. if (typeof dataPath === 'string') {
  1425. if (!dataPath) {// model,prop.sync
  1426. extraObj['$' + index] = vm;
  1427. } else {
  1428. if (dataPath === '$event') {// $event
  1429. extraObj['$' + index] = event;
  1430. } else if (dataPath === 'arguments') {
  1431. if (event.detail && event.detail.__args__) {
  1432. extraObj['$' + index] = event.detail.__args__;
  1433. } else {
  1434. extraObj['$' + index] = [event];
  1435. }
  1436. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  1437. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  1438. } else {
  1439. extraObj['$' + index] = vm.__get_value(dataPath);
  1440. }
  1441. }
  1442. } else {
  1443. extraObj['$' + index] = getExtraValue(vm, dataPath);
  1444. }
  1445. });
  1446. }
  1447. return extraObj;
  1448. }
  1449. function getObjByArray(arr) {
  1450. var obj = {};
  1451. for (var i = 1; i < arr.length; i++) {
  1452. var element = arr[i];
  1453. obj[element[0]] = element[1];
  1454. }
  1455. return obj;
  1456. }
  1457. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1458. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1459. if (isCustom) {// 自定义事件
  1460. isCustomMPEvent = event.currentTarget &&
  1461. event.currentTarget.dataset &&
  1462. event.currentTarget.dataset.comType === 'wx';
  1463. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  1464. if (isCustomMPEvent) {
  1465. return [event];
  1466. }
  1467. return event.detail.__args__ || event.detail;
  1468. }
  1469. }
  1470. var extraObj = processEventExtra(vm, extra, event);
  1471. var ret = [];
  1472. args.forEach(function (arg) {
  1473. if (arg === '$event') {
  1474. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1475. ret.push(event.target.value);
  1476. } else {
  1477. if (isCustom && !isCustomMPEvent) {
  1478. ret.push(event.detail.__args__[0]);
  1479. } else {// wxcomponent 组件或内置组件
  1480. ret.push(event);
  1481. }
  1482. }
  1483. } else {
  1484. if (Array.isArray(arg) && arg[0] === 'o') {
  1485. ret.push(getObjByArray(arg));
  1486. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1487. ret.push(extraObj[arg]);
  1488. } else {
  1489. ret.push(arg);
  1490. }
  1491. }
  1492. });
  1493. return ret;
  1494. }
  1495. var ONCE = '~';
  1496. var CUSTOM = '^';
  1497. function isMatchEventType(eventType, optType) {
  1498. return eventType === optType ||
  1499. optType === 'regionchange' && (
  1500. eventType === 'begin' ||
  1501. eventType === 'end');
  1502. }
  1503. function getContextVm(vm) {
  1504. var $parent = vm.$parent;
  1505. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1506. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1507. $parent = $parent.$parent;
  1508. }
  1509. return $parent && $parent.$parent;
  1510. }
  1511. function handleEvent(event) {var _this2 = this;
  1512. event = wrapper$1(event);
  1513. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1514. var dataset = (event.currentTarget || event.target).dataset;
  1515. if (!dataset) {
  1516. return console.warn('事件信息不存在');
  1517. }
  1518. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1519. if (!eventOpts) {
  1520. return console.warn('事件信息不存在');
  1521. }
  1522. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1523. var eventType = event.type;
  1524. var ret = [];
  1525. eventOpts.forEach(function (eventOpt) {
  1526. var type = eventOpt[0];
  1527. var eventsArray = eventOpt[1];
  1528. var isCustom = type.charAt(0) === CUSTOM;
  1529. type = isCustom ? type.slice(1) : type;
  1530. var isOnce = type.charAt(0) === ONCE;
  1531. type = isOnce ? type.slice(1) : type;
  1532. if (eventsArray && isMatchEventType(eventType, type)) {
  1533. eventsArray.forEach(function (eventArray) {
  1534. var methodName = eventArray[0];
  1535. if (methodName) {
  1536. var handlerCtx = _this2.$vm;
  1537. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1538. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1539. }
  1540. if (methodName === '$emit') {
  1541. handlerCtx.$emit.apply(handlerCtx,
  1542. processEventArgs(
  1543. _this2.$vm,
  1544. event,
  1545. eventArray[1],
  1546. eventArray[2],
  1547. isCustom,
  1548. methodName));
  1549. return;
  1550. }
  1551. var handler = handlerCtx[methodName];
  1552. if (!isFn(handler)) {
  1553. var _type = _this2.$vm.mpType === 'page' ? 'Page' : 'Component';
  1554. var path = _this2.route || _this2.is;
  1555. throw new Error("".concat(_type, " \"").concat(path, "\" does not have a method \"").concat(methodName, "\""));
  1556. }
  1557. if (isOnce) {
  1558. if (handler.once) {
  1559. return;
  1560. }
  1561. handler.once = true;
  1562. }
  1563. var params = processEventArgs(
  1564. _this2.$vm,
  1565. event,
  1566. eventArray[1],
  1567. eventArray[2],
  1568. isCustom,
  1569. methodName);
  1570. params = Array.isArray(params) ? params : [];
  1571. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1572. if (/=\s*\S+\.eventParams\s*\|\|\s*\S+\[['"]event-params['"]\]/.test(handler.toString())) {
  1573. // eslint-disable-next-line no-sparse-arrays
  1574. params = params.concat([,,,,,,,,,, event]);
  1575. }
  1576. ret.push(handler.apply(handlerCtx, params));
  1577. }
  1578. });
  1579. }
  1580. });
  1581. if (
  1582. eventType === 'input' &&
  1583. ret.length === 1 &&
  1584. typeof ret[0] !== 'undefined')
  1585. {
  1586. return ret[0];
  1587. }
  1588. }
  1589. var eventChannels = {};
  1590. var eventChannelStack = [];
  1591. function getEventChannel(id) {
  1592. if (id) {
  1593. var eventChannel = eventChannels[id];
  1594. delete eventChannels[id];
  1595. return eventChannel;
  1596. }
  1597. return eventChannelStack.shift();
  1598. }
  1599. var hooks = [
  1600. 'onShow',
  1601. 'onHide',
  1602. 'onError',
  1603. 'onPageNotFound',
  1604. 'onThemeChange',
  1605. 'onUnhandledRejection'];
  1606. function initEventChannel() {
  1607. _vue.default.prototype.getOpenerEventChannel = function () {
  1608. // 微信小程序使用自身getOpenerEventChannel
  1609. {
  1610. return this.$scope.getOpenerEventChannel();
  1611. }
  1612. };
  1613. var callHook = _vue.default.prototype.__call_hook;
  1614. _vue.default.prototype.__call_hook = function (hook, args) {
  1615. if (hook === 'onLoad' && args && args.__id__) {
  1616. this.__eventChannel__ = getEventChannel(args.__id__);
  1617. delete args.__id__;
  1618. }
  1619. return callHook.call(this, hook, args);
  1620. };
  1621. }
  1622. function initScopedSlotsParams() {
  1623. var center = {};
  1624. var parents = {};
  1625. _vue.default.prototype.$hasScopedSlotsParams = function (vueId) {
  1626. var has = center[vueId];
  1627. if (!has) {
  1628. parents[vueId] = this;
  1629. this.$on('hook:destroyed', function () {
  1630. delete parents[vueId];
  1631. });
  1632. }
  1633. return has;
  1634. };
  1635. _vue.default.prototype.$getScopedSlotsParams = function (vueId, name, key) {
  1636. var data = center[vueId];
  1637. if (data) {
  1638. var object = data[name] || {};
  1639. return key ? object[key] : object;
  1640. } else {
  1641. parents[vueId] = this;
  1642. this.$on('hook:destroyed', function () {
  1643. delete parents[vueId];
  1644. });
  1645. }
  1646. };
  1647. _vue.default.prototype.$setScopedSlotsParams = function (name, value) {
  1648. var vueIds = this.$options.propsData.vueId;
  1649. if (vueIds) {
  1650. var vueId = vueIds.split(',')[0];
  1651. var object = center[vueId] = center[vueId] || {};
  1652. object[name] = value;
  1653. if (parents[vueId]) {
  1654. parents[vueId].$forceUpdate();
  1655. }
  1656. }
  1657. };
  1658. _vue.default.mixin({
  1659. destroyed: function destroyed() {
  1660. var propsData = this.$options.propsData;
  1661. var vueId = propsData && propsData.vueId;
  1662. if (vueId) {
  1663. delete center[vueId];
  1664. delete parents[vueId];
  1665. }
  1666. } });
  1667. }
  1668. function parseBaseApp(vm, _ref3)
  1669. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1670. initEventChannel();
  1671. {
  1672. initScopedSlotsParams();
  1673. }
  1674. if (vm.$options.store) {
  1675. _vue.default.prototype.$store = vm.$options.store;
  1676. }
  1677. uniIdMixin(_vue.default);
  1678. _vue.default.prototype.mpHost = "mp-weixin";
  1679. _vue.default.mixin({
  1680. beforeCreate: function beforeCreate() {
  1681. if (!this.$options.mpType) {
  1682. return;
  1683. }
  1684. this.mpType = this.$options.mpType;
  1685. this.$mp = _defineProperty({
  1686. data: {} },
  1687. this.mpType, this.$options.mpInstance);
  1688. this.$scope = this.$options.mpInstance;
  1689. delete this.$options.mpType;
  1690. delete this.$options.mpInstance;
  1691. if (this.mpType === 'page' && typeof getApp === 'function') {// hack vue-i18n
  1692. var app = getApp();
  1693. if (app.$vm && app.$vm.$i18n) {
  1694. this._i18n = app.$vm.$i18n;
  1695. }
  1696. }
  1697. if (this.mpType !== 'app') {
  1698. initRefs(this);
  1699. initMocks(this, mocks);
  1700. }
  1701. } });
  1702. var appOptions = {
  1703. onLaunch: function onLaunch(args) {
  1704. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1705. return;
  1706. }
  1707. {
  1708. if (wx.canIUse && !wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1709. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1710. }
  1711. }
  1712. this.$vm = vm;
  1713. this.$vm.$mp = {
  1714. app: this };
  1715. this.$vm.$scope = this;
  1716. // vm 上也挂载 globalData
  1717. this.$vm.globalData = this.globalData;
  1718. this.$vm._isMounted = true;
  1719. this.$vm.__call_hook('mounted', args);
  1720. this.$vm.__call_hook('onLaunch', args);
  1721. } };
  1722. // 兼容旧版本 globalData
  1723. appOptions.globalData = vm.$options.globalData || {};
  1724. // 将 methods 中的方法挂在 getApp() 中
  1725. var methods = vm.$options.methods;
  1726. if (methods) {
  1727. Object.keys(methods).forEach(function (name) {
  1728. appOptions[name] = methods[name];
  1729. });
  1730. }
  1731. initAppLocale(_vue.default, vm, normalizeLocale(wx.getSystemInfoSync().language) || LOCALE_EN);
  1732. initHooks(appOptions, hooks);
  1733. return appOptions;
  1734. }
  1735. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1736. function findVmByVueId(vm, vuePid) {
  1737. var $children = vm.$children;
  1738. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1739. for (var i = $children.length - 1; i >= 0; i--) {
  1740. var childVm = $children[i];
  1741. if (childVm.$scope._$vueId === vuePid) {
  1742. return childVm;
  1743. }
  1744. }
  1745. // 反向递归查找
  1746. var parentVm;
  1747. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1748. parentVm = findVmByVueId($children[_i], vuePid);
  1749. if (parentVm) {
  1750. return parentVm;
  1751. }
  1752. }
  1753. }
  1754. function initBehavior(options) {
  1755. return Behavior(options);
  1756. }
  1757. function isPage() {
  1758. return !!this.route;
  1759. }
  1760. function initRelation(detail) {
  1761. this.triggerEvent('__l', detail);
  1762. }
  1763. function selectAllComponents(mpInstance, selector, $refs) {
  1764. var components = mpInstance.selectAllComponents(selector);
  1765. components.forEach(function (component) {
  1766. var ref = component.dataset.ref;
  1767. $refs[ref] = component.$vm || component;
  1768. {
  1769. if (component.dataset.vueGeneric === 'scoped') {
  1770. component.selectAllComponents('.scoped-ref').forEach(function (scopedComponent) {
  1771. selectAllComponents(scopedComponent, selector, $refs);
  1772. });
  1773. }
  1774. }
  1775. });
  1776. }
  1777. function initRefs(vm) {
  1778. var mpInstance = vm.$scope;
  1779. Object.defineProperty(vm, '$refs', {
  1780. get: function get() {
  1781. var $refs = {};
  1782. selectAllComponents(mpInstance, '.vue-ref', $refs);
  1783. // TODO 暂不考虑 for 中的 scoped
  1784. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1785. forComponents.forEach(function (component) {
  1786. var ref = component.dataset.ref;
  1787. if (!$refs[ref]) {
  1788. $refs[ref] = [];
  1789. }
  1790. $refs[ref].push(component.$vm || component);
  1791. });
  1792. return $refs;
  1793. } });
  1794. }
  1795. function handleLink(event) {var _ref4 =
  1796. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1797. var parentVm;
  1798. if (vuePid) {
  1799. parentVm = findVmByVueId(this.$vm, vuePid);
  1800. }
  1801. if (!parentVm) {
  1802. parentVm = this.$vm;
  1803. }
  1804. vueOptions.parent = parentVm;
  1805. }
  1806. function parseApp(vm) {
  1807. return parseBaseApp(vm, {
  1808. mocks: mocks,
  1809. initRefs: initRefs });
  1810. }
  1811. function createApp(vm) {
  1812. App(parseApp(vm));
  1813. return vm;
  1814. }
  1815. var encodeReserveRE = /[!'()*]/g;
  1816. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1817. var commaRE = /%2C/g;
  1818. // fixed encodeURIComponent which is more conformant to RFC3986:
  1819. // - escapes [!'()*]
  1820. // - preserve commas
  1821. var encode = function encode(str) {return encodeURIComponent(str).
  1822. replace(encodeReserveRE, encodeReserveReplacer).
  1823. replace(commaRE, ',');};
  1824. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1825. var res = obj ? Object.keys(obj).map(function (key) {
  1826. var val = obj[key];
  1827. if (val === undefined) {
  1828. return '';
  1829. }
  1830. if (val === null) {
  1831. return encodeStr(key);
  1832. }
  1833. if (Array.isArray(val)) {
  1834. var result = [];
  1835. val.forEach(function (val2) {
  1836. if (val2 === undefined) {
  1837. return;
  1838. }
  1839. if (val2 === null) {
  1840. result.push(encodeStr(key));
  1841. } else {
  1842. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1843. }
  1844. });
  1845. return result.join('&');
  1846. }
  1847. return encodeStr(key) + '=' + encodeStr(val);
  1848. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1849. return res ? "?".concat(res) : '';
  1850. }
  1851. function parseBaseComponent(vueComponentOptions)
  1852. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1853. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1854. var options = _objectSpread({
  1855. multipleSlots: true,
  1856. addGlobalClass: true },
  1857. vueOptions.options || {});
  1858. {
  1859. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1860. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1861. Object.assign(options, vueOptions['mp-weixin'].options);
  1862. }
  1863. }
  1864. var componentOptions = {
  1865. options: options,
  1866. data: initData(vueOptions, _vue.default.prototype),
  1867. behaviors: initBehaviors(vueOptions, initBehavior),
  1868. properties: initProperties(vueOptions.props, false, vueOptions.__file, options),
  1869. lifetimes: {
  1870. attached: function attached() {
  1871. var properties = this.properties;
  1872. var options = {
  1873. mpType: isPage.call(this) ? 'page' : 'component',
  1874. mpInstance: this,
  1875. propsData: properties };
  1876. initVueIds(properties.vueId, this);
  1877. // 处理父子关系
  1878. initRelation.call(this, {
  1879. vuePid: this._$vuePid,
  1880. vueOptions: options });
  1881. // 初始化 vue 实例
  1882. this.$vm = new VueComponent(options);
  1883. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1884. initSlots(this.$vm, properties.vueSlots);
  1885. // 触发首次 setData
  1886. this.$vm.$mount();
  1887. },
  1888. ready: function ready() {
  1889. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1890. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1891. if (this.$vm) {
  1892. this.$vm._isMounted = true;
  1893. this.$vm.__call_hook('mounted');
  1894. this.$vm.__call_hook('onReady');
  1895. }
  1896. },
  1897. detached: function detached() {
  1898. this.$vm && this.$vm.$destroy();
  1899. } },
  1900. pageLifetimes: {
  1901. show: function show(args) {
  1902. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1903. },
  1904. hide: function hide() {
  1905. this.$vm && this.$vm.__call_hook('onPageHide');
  1906. },
  1907. resize: function resize(size) {
  1908. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1909. } },
  1910. methods: {
  1911. __l: handleLink,
  1912. __e: handleEvent } };
  1913. // externalClasses
  1914. if (vueOptions.externalClasses) {
  1915. componentOptions.externalClasses = vueOptions.externalClasses;
  1916. }
  1917. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1918. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1919. componentOptions.methods[callMethod] = function (args) {
  1920. return this.$vm[callMethod](args);
  1921. };
  1922. });
  1923. }
  1924. if (isPage) {
  1925. return componentOptions;
  1926. }
  1927. return [componentOptions, VueComponent];
  1928. }
  1929. function parseComponent(vueComponentOptions) {
  1930. return parseBaseComponent(vueComponentOptions, {
  1931. isPage: isPage,
  1932. initRelation: initRelation });
  1933. }
  1934. var hooks$1 = [
  1935. 'onShow',
  1936. 'onHide',
  1937. 'onUnload'];
  1938. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1939. function parseBasePage(vuePageOptions, _ref6)
  1940. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1941. var pageOptions = parseComponent(vuePageOptions);
  1942. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1943. pageOptions.methods.onLoad = function (query) {
  1944. this.options = query;
  1945. var copyQuery = Object.assign({}, query);
  1946. delete copyQuery.__id__;
  1947. this.$page = {
  1948. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1949. this.$vm.$mp.query = query; // 兼容 mpvue
  1950. this.$vm.__call_hook('onLoad', query);
  1951. };
  1952. return pageOptions;
  1953. }
  1954. function parsePage(vuePageOptions) {
  1955. return parseBasePage(vuePageOptions, {
  1956. isPage: isPage,
  1957. initRelation: initRelation });
  1958. }
  1959. function createPage(vuePageOptions) {
  1960. {
  1961. return Component(parsePage(vuePageOptions));
  1962. }
  1963. }
  1964. function createComponent(vueOptions) {
  1965. {
  1966. return Component(parseComponent(vueOptions));
  1967. }
  1968. }
  1969. function createSubpackageApp(vm) {
  1970. var appOptions = parseApp(vm);
  1971. var app = getApp({
  1972. allowDefault: true });
  1973. vm.$scope = app;
  1974. var globalData = app.globalData;
  1975. if (globalData) {
  1976. Object.keys(appOptions.globalData).forEach(function (name) {
  1977. if (!hasOwn(globalData, name)) {
  1978. globalData[name] = appOptions.globalData[name];
  1979. }
  1980. });
  1981. }
  1982. Object.keys(appOptions).forEach(function (name) {
  1983. if (!hasOwn(app, name)) {
  1984. app[name] = appOptions[name];
  1985. }
  1986. });
  1987. if (isFn(appOptions.onShow) && wx.onAppShow) {
  1988. wx.onAppShow(function () {for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  1989. vm.__call_hook('onShow', args);
  1990. });
  1991. }
  1992. if (isFn(appOptions.onHide) && wx.onAppHide) {
  1993. wx.onAppHide(function () {for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}
  1994. vm.__call_hook('onHide', args);
  1995. });
  1996. }
  1997. if (isFn(appOptions.onLaunch)) {
  1998. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  1999. vm.__call_hook('onLaunch', args);
  2000. }
  2001. return vm;
  2002. }
  2003. function createPlugin(vm) {
  2004. var appOptions = parseApp(vm);
  2005. if (isFn(appOptions.onShow) && wx.onAppShow) {
  2006. wx.onAppShow(function () {for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}
  2007. vm.__call_hook('onShow', args);
  2008. });
  2009. }
  2010. if (isFn(appOptions.onHide) && wx.onAppHide) {
  2011. wx.onAppHide(function () {for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}
  2012. vm.__call_hook('onHide', args);
  2013. });
  2014. }
  2015. if (isFn(appOptions.onLaunch)) {
  2016. var args = wx.getLaunchOptionsSync && wx.getLaunchOptionsSync();
  2017. vm.__call_hook('onLaunch', args);
  2018. }
  2019. return vm;
  2020. }
  2021. todos.forEach(function (todoApi) {
  2022. protocols[todoApi] = false;
  2023. });
  2024. canIUses.forEach(function (canIUseApi) {
  2025. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  2026. canIUseApi;
  2027. if (!wx.canIUse(apiName)) {
  2028. protocols[canIUseApi] = false;
  2029. }
  2030. });
  2031. var uni = {};
  2032. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  2033. uni = new Proxy({}, {
  2034. get: function get(target, name) {
  2035. if (hasOwn(target, name)) {
  2036. return target[name];
  2037. }
  2038. if (baseApi[name]) {
  2039. return baseApi[name];
  2040. }
  2041. if (api[name]) {
  2042. return promisify(name, api[name]);
  2043. }
  2044. {
  2045. if (extraApi[name]) {
  2046. return promisify(name, extraApi[name]);
  2047. }
  2048. if (todoApis[name]) {
  2049. return promisify(name, todoApis[name]);
  2050. }
  2051. }
  2052. if (eventApi[name]) {
  2053. return eventApi[name];
  2054. }
  2055. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  2056. return;
  2057. }
  2058. return promisify(name, wrapper(name, wx[name]));
  2059. },
  2060. set: function set(target, name, value) {
  2061. target[name] = value;
  2062. return true;
  2063. } });
  2064. } else {
  2065. Object.keys(baseApi).forEach(function (name) {
  2066. uni[name] = baseApi[name];
  2067. });
  2068. {
  2069. Object.keys(todoApis).forEach(function (name) {
  2070. uni[name] = promisify(name, todoApis[name]);
  2071. });
  2072. Object.keys(extraApi).forEach(function (name) {
  2073. uni[name] = promisify(name, todoApis[name]);
  2074. });
  2075. }
  2076. Object.keys(eventApi).forEach(function (name) {
  2077. uni[name] = eventApi[name];
  2078. });
  2079. Object.keys(api).forEach(function (name) {
  2080. uni[name] = promisify(name, api[name]);
  2081. });
  2082. Object.keys(wx).forEach(function (name) {
  2083. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  2084. uni[name] = promisify(name, wrapper(name, wx[name]));
  2085. }
  2086. });
  2087. }
  2088. wx.createApp = createApp;
  2089. wx.createPage = createPage;
  2090. wx.createComponent = createComponent;
  2091. wx.createSubpackageApp = createSubpackageApp;
  2092. wx.createPlugin = createPlugin;
  2093. var uni$1 = uni;var _default =
  2094. uni$1;exports.default = _default;
  2095. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  2096. /***/ }),
  2097. /***/ 11:
  2098. /*!**********************************************************************************************************!*\
  2099. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  2100. \**********************************************************************************************************/
  2101. /*! exports provided: default */
  2102. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2103. "use strict";
  2104. __webpack_require__.r(__webpack_exports__);
  2105. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  2106. /* globals __VUE_SSR_CONTEXT__ */
  2107. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  2108. // This module is a runtime utility for cleaner component module output and will
  2109. // be included in the final webpack user bundle.
  2110. function normalizeComponent (
  2111. scriptExports,
  2112. render,
  2113. staticRenderFns,
  2114. functionalTemplate,
  2115. injectStyles,
  2116. scopeId,
  2117. moduleIdentifier, /* server only */
  2118. shadowMode, /* vue-cli only */
  2119. components, // fixed by xxxxxx auto components
  2120. renderjs // fixed by xxxxxx renderjs
  2121. ) {
  2122. // Vue.extend constructor export interop
  2123. var options = typeof scriptExports === 'function'
  2124. ? scriptExports.options
  2125. : scriptExports
  2126. // fixed by xxxxxx auto components
  2127. if (components) {
  2128. if (!options.components) {
  2129. options.components = {}
  2130. }
  2131. var hasOwn = Object.prototype.hasOwnProperty
  2132. for (var name in components) {
  2133. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  2134. options.components[name] = components[name]
  2135. }
  2136. }
  2137. }
  2138. // fixed by xxxxxx renderjs
  2139. if (renderjs) {
  2140. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  2141. this[renderjs.__module] = this
  2142. });
  2143. (options.mixins || (options.mixins = [])).push(renderjs)
  2144. }
  2145. // render functions
  2146. if (render) {
  2147. options.render = render
  2148. options.staticRenderFns = staticRenderFns
  2149. options._compiled = true
  2150. }
  2151. // functional template
  2152. if (functionalTemplate) {
  2153. options.functional = true
  2154. }
  2155. // scopedId
  2156. if (scopeId) {
  2157. options._scopeId = 'data-v-' + scopeId
  2158. }
  2159. var hook
  2160. if (moduleIdentifier) { // server build
  2161. hook = function (context) {
  2162. // 2.3 injection
  2163. context =
  2164. context || // cached call
  2165. (this.$vnode && this.$vnode.ssrContext) || // stateful
  2166. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  2167. // 2.2 with runInNewContext: true
  2168. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  2169. context = __VUE_SSR_CONTEXT__
  2170. }
  2171. // inject component styles
  2172. if (injectStyles) {
  2173. injectStyles.call(this, context)
  2174. }
  2175. // register component module identifier for async chunk inferrence
  2176. if (context && context._registeredComponents) {
  2177. context._registeredComponents.add(moduleIdentifier)
  2178. }
  2179. }
  2180. // used by ssr in case component is cached and beforeCreate
  2181. // never gets called
  2182. options._ssrRegister = hook
  2183. } else if (injectStyles) {
  2184. hook = shadowMode
  2185. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  2186. : injectStyles
  2187. }
  2188. if (hook) {
  2189. if (options.functional) {
  2190. // for template-only hot-reload because in that case the render fn doesn't
  2191. // go through the normalizer
  2192. options._injectStyles = hook
  2193. // register for functioal component in vue file
  2194. var originalRender = options.render
  2195. options.render = function renderWithStyleInjection (h, context) {
  2196. hook.call(context)
  2197. return originalRender(h, context)
  2198. }
  2199. } else {
  2200. // inject component registration as beforeCreate hook
  2201. var existing = options.beforeCreate
  2202. options.beforeCreate = existing
  2203. ? [].concat(existing, hook)
  2204. : [hook]
  2205. }
  2206. }
  2207. return {
  2208. exports: scriptExports,
  2209. options: options
  2210. }
  2211. }
  2212. /***/ }),
  2213. /***/ 12:
  2214. /*!******************************************************************************************!*\
  2215. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/utils/http.js ***!
  2216. \******************************************************************************************/
  2217. /*! no static exports found */
  2218. /***/ (function(module, exports, __webpack_require__) {
  2219. "use strict";
  2220. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var http = {
  2221. get: function get(url, data)
  2222. {var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},header = _ref.header,_ref$timeout = _ref.timeout,timeout = _ref$timeout === void 0 ? 20000 : _ref$timeout;
  2223. var promise = new Promise(function (resolve, reject) {
  2224. uni.request({
  2225. url: url,
  2226. method: 'GET',
  2227. data: data,
  2228. timeout: timeout }).
  2229. then(
  2230. function (res) {
  2231. resolve(res[1]);
  2232. }).
  2233. catch();
  2234. });
  2235. return promise;
  2236. } };var _default =
  2237. http;exports.default = _default;
  2238. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  2239. /***/ }),
  2240. /***/ 13:
  2241. /*!******************************************************************************************!*\
  2242. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/config/api.js ***!
  2243. \******************************************************************************************/
  2244. /*! no static exports found */
  2245. /***/ (function(module, exports, __webpack_require__) {
  2246. "use strict";
  2247. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; //路径
  2248. var root = "http://127.0.0.1:9999";
  2249. //接口auth
  2250. var api = {
  2251. user: {
  2252. list: "".concat(root, "/user/list"),
  2253. add: "".concat(root, "/user/add"),
  2254. update: "".concat(root, "/user/update"),
  2255. detail: "".concat(root, "/user/detail"),
  2256. delete: "".concat(root, "/user/delete"),
  2257. batchDelete: "".concat(root, "/user/batchDelete"),
  2258. bindRole: "".concat(root, "/user/bindRole"),
  2259. bindOperator: "".concat(root, "/user/bindOperator") },
  2260. operator: {
  2261. list: "".concat(root, "/operator/list"),
  2262. add: "".concat(root, "/operator/add"),
  2263. update: "".concat(root, "/operator/update"),
  2264. detail: "".concat(root, "/operator/detail"),
  2265. delete: "".concat(root, "/operator/delete"),
  2266. batchDelete: "".concat(root, "/operator/batchDelete") },
  2267. project: {
  2268. list: "".concat(root, "/project/list"),
  2269. operatorList: "".concat(root, "/project/operatorList"),
  2270. add: "".concat(root, "/project/add"),
  2271. update: "".concat(root, "/project/update"),
  2272. detail: "".concat(root, "/project/detail"),
  2273. delete: "".concat(root, "/project/delete"),
  2274. batchDelete: "".concat(root, "/project/batchDelete") },
  2275. gateway: {
  2276. list: "".concat(root, "/gateway/list"),
  2277. add: "".concat(root, "/gateway/add"),
  2278. update: "".concat(root, "/gateway/update"),
  2279. detail: "".concat(root, "/gateway/detail"),
  2280. delete: "".concat(root, "/gateway/delete"),
  2281. batchDelete: "".concat(root, "/gateway/batchDelete") },
  2282. device: {
  2283. list: "".concat(root, "/device/list"),
  2284. add: "".concat(root, "/device/add"),
  2285. update: "".concat(root, "/device/update"),
  2286. detail: "".concat(root, "/device/detail"),
  2287. delete: "".concat(root, "/device/delete"),
  2288. batchDelete: "".concat(root, "/device/batchDelete") },
  2289. deviceParam: {
  2290. list: "".concat(root, "/deviceParam/list"),
  2291. add: "".concat(root, "/deviceParam/add"),
  2292. update: "".concat(root, "/deviceParam/update"),
  2293. updateParam: "".concat(root, "/deviceParam/updateParam"),
  2294. detail: "".concat(root, "/deviceParam/detail"),
  2295. delete: "".concat(root, "/deviceParam/delete"),
  2296. batchDelete: "".concat(root, "/deviceParam/batchDelete") },
  2297. deviceAlarmRecord: {
  2298. list: "".concat(root, "/deviceAlarmRecord/list"),
  2299. add: "".concat(root, "/deviceAlarmRecord/add"),
  2300. update: "".concat(root, "/deviceAlarmRecord/update"),
  2301. detail: "".concat(root, "/deviceAlarmRecord/detail"),
  2302. delete: "".concat(root, "/deviceAlarmRecord/delete"),
  2303. batchDelete: "".concat(root, "/deviceAlarmRecord/batchDelete") },
  2304. deviceAlarmConfig: {
  2305. list: "".concat(root, "/deviceAlarmConfig/list"),
  2306. add: "".concat(root, "/deviceAlarmConfig/add"),
  2307. update: "".concat(root, "/deviceAlarmConfig/update"),
  2308. detail: "".concat(root, "/deviceAlarmConfig/detail"),
  2309. delete: "".concat(root, "/deviceAlarmConfig/delete"),
  2310. batchDelete: "".concat(root, "/deviceAlarmConfig/batchDelete") },
  2311. deviceAlarmRepairRecord: {
  2312. list: "".concat(root, "/deviceAlarmRepairRecord/list"),
  2313. add: "".concat(root, "/deviceAlarmRepairRecord/add"),
  2314. update: "".concat(root, "/deviceAlarmRepairRecord/update"),
  2315. detail: "".concat(root, "/deviceAlarmRepairRecord/detail"),
  2316. delete: "".concat(root, "/deviceAlarmRepairRecord/delete"),
  2317. batchDelete: "".concat(root, "/deviceAlarmRepairRecord/batchDelete") },
  2318. operatorLog: {
  2319. list: "".concat(root, "/operatorLog/list"),
  2320. add: "".concat(root, "/operatorLog/add"),
  2321. update: "".concat(root, "/operatorLog/update"),
  2322. detail: "".concat(root, "/operatorLog/detail"),
  2323. delete: "".concat(root, "/operatorLog/delete"),
  2324. batchDelete: "".concat(root, "/operatorLog/batchDelete") },
  2325. auth: {
  2326. verifyCode: "".concat(root, "/auth/verifyCode"),
  2327. login: "".concat(root, "/auth/login"),
  2328. updateUserPassword: "".concat(root, "/auth/updateUserPassword"),
  2329. userInfo: "".concat(root, "/auth/userInfo"),
  2330. logout: "".concat(root, "/auth/logout") },
  2331. role: {
  2332. list: "".concat(root, "/role/list"),
  2333. add: "".concat(root, "/role/add"),
  2334. update: "".concat(root, "/role/update"),
  2335. detail: "".concat(root, "/role/detail"),
  2336. delete: "".concat(root, "/role/delete") },
  2337. power: {
  2338. list: "".concat(root, "/power/list"),
  2339. add: "".concat(root, "/power/add"),
  2340. update: "".concat(root, "/power/update"),
  2341. detail: "".concat(root, "/power/detail"),
  2342. delete: "".concat(root, "/power/delete") },
  2343. rolePower: {
  2344. list: "".concat(root, "/rolePower/list"),
  2345. add: "".concat(root, "/rolePower/add"),
  2346. update: "".concat(root, "/rolePower/update"),
  2347. detail: "".concat(root, "/rolePower/detail"),
  2348. delete: "".concat(root, "/rolePower/delete") },
  2349. menu: {} };var _default =
  2350. Object.assign({
  2351. $base: {
  2352. root: root } },
  2353. api);exports.default = _default;
  2354. /***/ }),
  2355. /***/ 181:
  2356. /*!************************************************************************************************************!*\
  2357. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/components/u-charts/u-charts.js ***!
  2358. \************************************************************************************************************/
  2359. /*! no static exports found */
  2360. /***/ (function(module, exports, __webpack_require__) {
  2361. "use strict";
  2362. /* WEBPACK VAR INJECTION */(function(uni) {/*
  2363. * uCharts v1.8.5.20190815
  2364. * uni-app平台高性能跨全端图表,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)
  2365. * Copyright (c) 2019 QIUN秋云 https://www.ucharts.cn All rights reserved.
  2366. * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  2367. *
  2368. * uCharts官方网站
  2369. * https://www.uCharts.cn
  2370. *
  2371. * 开源地址:
  2372. * https://gitee.com/uCharts/uCharts
  2373. *
  2374. * uni-app插件市场地址:
  2375. * http://ext.dcloud.net.cn/plugin?id=271
  2376. *
  2377. */
  2378. var config = {
  2379. yAxisWidth: 15,
  2380. yAxisSplit: 5,
  2381. xAxisHeight: 15,
  2382. xAxisLineHeight: 15,
  2383. legendHeight: 15,
  2384. yAxisTitleWidth: 15,
  2385. padding: [10, 10, 10, 10],
  2386. pixelRatio: 1,
  2387. rotate: false,
  2388. columePadding: 3,
  2389. fontSize: 13,
  2390. //dataPointShape: ['diamond', 'circle', 'triangle', 'rect'],
  2391. dataPointShape: ['circle', 'circle', 'circle', 'circle'],
  2392. colors: ['#1890ff', '#2fc25b', '#facc14', '#f04864', '#8543e0', '#90ed7d'],
  2393. pieChartLinePadding: 15,
  2394. pieChartTextPadding: 5,
  2395. xAxisTextPadding: 3,
  2396. titleColor: '#333333',
  2397. titleFontSize: 20,
  2398. subtitleColor: '#999999',
  2399. subtitleFontSize: 15,
  2400. toolTipPadding: 3,
  2401. toolTipBackground: '#000000',
  2402. toolTipOpacity: 0.7,
  2403. toolTipLineHeight: 20,
  2404. radarGridCount: 3,
  2405. radarLabelTextMargin: 15,
  2406. gaugeLabelTextMargin: 15 };
  2407. var assign;
  2408. if (Object.assign) {
  2409. assign = Object.assign;
  2410. } else {
  2411. // 使用polyfill
  2412. assign = function assign(target, varArgs) {
  2413. if (target == null) {
  2414. throw new TypeError('Cannot convert undefined or null to object');
  2415. }
  2416. var to = Object(target);
  2417. for (var index = 1; index < arguments.length; index++) {
  2418. var nextSource = arguments[index];
  2419. if (nextSource != null) {
  2420. for (var nextKey in nextSource) {
  2421. if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
  2422. to[nextKey] = nextSource[nextKey];
  2423. }
  2424. }
  2425. }
  2426. }
  2427. return to;
  2428. };
  2429. }
  2430. var util = {
  2431. toFixed: function toFixed(num, limit) {
  2432. limit = limit || 2;
  2433. if (this.isFloat(num)) {
  2434. num = num.toFixed(limit);
  2435. }
  2436. return num;
  2437. },
  2438. isFloat: function isFloat(num) {
  2439. return num % 1 !== 0;
  2440. },
  2441. approximatelyEqual: function approximatelyEqual(num1, num2) {
  2442. return Math.abs(num1 - num2) < 1e-10;
  2443. },
  2444. isSameSign: function isSameSign(num1, num2) {
  2445. return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs(num2) !== num2;
  2446. },
  2447. isSameXCoordinateArea: function isSameXCoordinateArea(p1, p2) {
  2448. return this.isSameSign(p1.x, p2.x);
  2449. },
  2450. isCollision: function isCollision(obj1, obj2) {
  2451. obj1.end = {};
  2452. obj1.end.x = obj1.start.x + obj1.width;
  2453. obj1.end.y = obj1.start.y - obj1.height;
  2454. obj2.end = {};
  2455. obj2.end.x = obj2.start.x + obj2.width;
  2456. obj2.end.y = obj2.start.y - obj2.height;
  2457. 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;
  2458. return !flag;
  2459. } };
  2460. //兼容H5点击事件
  2461. function getH5Offset(e) {
  2462. e.mp = {
  2463. changedTouches: [] };
  2464. e.mp.changedTouches.push({
  2465. x: e.offsetX,
  2466. y: e.offsetY });
  2467. return e;
  2468. }
  2469. // hex 转 rgba
  2470. function hexToRgb(hexValue, opc) {
  2471. var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
  2472. var hex = hexValue.replace(rgx, function (m, r, g, b) {
  2473. return r + r + g + g + b + b;
  2474. });
  2475. var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  2476. var r = parseInt(rgb[1], 16);
  2477. var g = parseInt(rgb[2], 16);
  2478. var b = parseInt(rgb[3], 16);
  2479. return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')';
  2480. }
  2481. function findRange(num, type, limit) {
  2482. if (isNaN(num)) {
  2483. throw new Error('[uCharts] unvalid series data!');
  2484. }
  2485. limit = limit || 10;
  2486. type = type ? type : 'upper';
  2487. var multiple = 1;
  2488. while (limit < 1) {
  2489. limit *= 10;
  2490. multiple *= 10;
  2491. }
  2492. if (type === 'upper') {
  2493. num = Math.ceil(num * multiple);
  2494. } else {
  2495. num = Math.floor(num * multiple);
  2496. }
  2497. while (num % limit !== 0) {
  2498. if (type === 'upper') {
  2499. num++;
  2500. } else {
  2501. num--;
  2502. }
  2503. }
  2504. return num / multiple;
  2505. }
  2506. function calCandleMA(dayArr, nameArr, colorArr, kdata) {
  2507. var seriesTemp = [];
  2508. for (var k = 0; k < dayArr.length; k++) {
  2509. var seriesItem = {
  2510. data: [],
  2511. name: nameArr[k],
  2512. color: colorArr[k] };
  2513. for (var i = 0, len = kdata.length; i < len; i++) {
  2514. if (i < dayArr[k]) {
  2515. seriesItem.data.push(null);
  2516. continue;
  2517. }
  2518. var sum = 0;
  2519. for (var j = 0; j < dayArr[k]; j++) {
  2520. sum += kdata[i - j][1];
  2521. }
  2522. seriesItem.data.push(+(sum / dayArr[k]).toFixed(3));
  2523. }
  2524. seriesTemp.push(seriesItem);
  2525. }
  2526. return seriesTemp;
  2527. }
  2528. function calValidDistance(distance, chartData, config, opts) {
  2529. var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3];
  2530. var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1);
  2531. var validDistance = distance;
  2532. if (distance >= 0) {
  2533. validDistance = 0;
  2534. } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) {
  2535. validDistance = dataChartAreaWidth - dataChartWidth;
  2536. }
  2537. return validDistance;
  2538. }
  2539. function isInAngleRange(angle, startAngle, endAngle) {
  2540. function adjust(angle) {
  2541. while (angle < 0) {
  2542. angle += 2 * Math.PI;
  2543. }
  2544. while (angle > 2 * Math.PI) {
  2545. angle -= 2 * Math.PI;
  2546. }
  2547. return angle;
  2548. }
  2549. angle = adjust(angle);
  2550. startAngle = adjust(startAngle);
  2551. endAngle = adjust(endAngle);
  2552. if (startAngle > endAngle) {
  2553. endAngle += 2 * Math.PI;
  2554. if (angle < startAngle) {
  2555. angle += 2 * Math.PI;
  2556. }
  2557. }
  2558. return angle >= startAngle && angle <= endAngle;
  2559. }
  2560. function calRotateTranslate(x, y, h) {
  2561. var xv = x;
  2562. var yv = h - y;
  2563. var transX = xv + (h - yv - xv) / Math.sqrt(2);
  2564. transX *= -1;
  2565. var transY = (h - yv) * (Math.sqrt(2) - 1) - (h - yv - xv) / Math.sqrt(2);
  2566. return {
  2567. transX: transX,
  2568. transY: transY };
  2569. }
  2570. function createCurveControlPoints(points, i) {
  2571. function isNotMiddlePoint(points, i) {
  2572. if (points[i - 1] && points[i + 1]) {
  2573. return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y,
  2574. points[
  2575. i + 1].y);
  2576. } else {
  2577. return false;
  2578. }
  2579. }
  2580. var a = 0.2;
  2581. var b = 0.2;
  2582. var pAx = null;
  2583. var pAy = null;
  2584. var pBx = null;
  2585. var pBy = null;
  2586. if (i < 1) {
  2587. pAx = points[0].x + (points[1].x - points[0].x) * a;
  2588. pAy = points[0].y + (points[1].y - points[0].y) * a;
  2589. } else {
  2590. pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a;
  2591. pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a;
  2592. }
  2593. if (i > points.length - 3) {
  2594. var last = points.length - 1;
  2595. pBx = points[last].x - (points[last].x - points[last - 1].x) * b;
  2596. pBy = points[last].y - (points[last].y - points[last - 1].y) * b;
  2597. } else {
  2598. pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b;
  2599. pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b;
  2600. }
  2601. if (isNotMiddlePoint(points, i + 1)) {
  2602. pBy = points[i + 1].y;
  2603. }
  2604. if (isNotMiddlePoint(points, i)) {
  2605. pAy = points[i].y;
  2606. }
  2607. return {
  2608. ctrA: {
  2609. x: pAx,
  2610. y: pAy },
  2611. ctrB: {
  2612. x: pBx,
  2613. y: pBy } };
  2614. }
  2615. function convertCoordinateOrigin(x, y, center) {
  2616. return {
  2617. x: center.x + x,
  2618. y: center.y - y };
  2619. }
  2620. function avoidCollision(obj, target) {
  2621. if (target) {
  2622. // is collision test
  2623. while (util.isCollision(obj, target)) {
  2624. if (obj.start.x > 0) {
  2625. obj.start.y--;
  2626. } else if (obj.start.x < 0) {
  2627. obj.start.y++;
  2628. } else {
  2629. if (obj.start.y > 0) {
  2630. obj.start.y++;
  2631. } else {
  2632. obj.start.y--;
  2633. }
  2634. }
  2635. }
  2636. }
  2637. return obj;
  2638. }
  2639. function fillSeries(series, opts, config) {
  2640. var index = 0;
  2641. return series.map(function (item) {
  2642. if (!item.color) {
  2643. item.color = config.colors[index];
  2644. index = (index + 1) % config.colors.length;
  2645. }
  2646. if (!item.type) {
  2647. item.type = opts.type;
  2648. }
  2649. if (typeof item.show == "undefined") {
  2650. item.show = true;
  2651. }
  2652. if (!item.type) {
  2653. item.type = opts.type;
  2654. }
  2655. if (!item.pointShape) {
  2656. item.pointShape = "circle";
  2657. }
  2658. if (!item.legendShape) {
  2659. switch (item.type) {
  2660. case 'line':
  2661. item.legendShape = "line";
  2662. break;
  2663. case 'column':
  2664. item.legendShape = "rect";
  2665. break;
  2666. case 'area':
  2667. item.legendShape = "triangle";
  2668. break;
  2669. default:
  2670. item.legendShape = "circle";}
  2671. }
  2672. return item;
  2673. });
  2674. }
  2675. function getDataRange(minData, maxData) {
  2676. var limit = 0;
  2677. var range = maxData - minData;
  2678. if (range >= 10000) {
  2679. limit = 1000;
  2680. } else if (range >= 1000) {
  2681. limit = 100;
  2682. } else if (range >= 100) {
  2683. limit = 10;
  2684. } else if (range >= 10) {
  2685. limit = 5;
  2686. } else if (range >= 1) {
  2687. limit = 1;
  2688. } else if (range >= 0.1) {
  2689. limit = 0.1;
  2690. } else if (range >= 0.01) {
  2691. limit = 0.01;
  2692. } else if (range >= 0.001) {
  2693. limit = 0.001;
  2694. } else if (range >= 0.0001) {
  2695. limit = 0.0001;
  2696. } else if (range >= 0.00001) {
  2697. limit = 0.00001;
  2698. } else {
  2699. limit = 0.000001;
  2700. }
  2701. return {
  2702. minRange: findRange(minData, 'lower', limit),
  2703. maxRange: findRange(maxData, 'upper', limit) };
  2704. }
  2705. function measureText(text) {
  2706. var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.fontSize;
  2707. text = String(text);
  2708. var text = text.split('');
  2709. var width = 0;
  2710. for (var i = 0; i < text.length; i++) {
  2711. var item = text[i];
  2712. if (/[a-zA-Z]/.test(item)) {
  2713. width += 7;
  2714. } else if (/[0-9]/.test(item)) {
  2715. width += 5.5;
  2716. } else if (/\./.test(item)) {
  2717. width += 2.7;
  2718. } else if (/-/.test(item)) {
  2719. width += 3.25;
  2720. } else if (/[\u4e00-\u9fa5]/.test(item)) {
  2721. width += 10;
  2722. } else if (/\(|\)/.test(item)) {
  2723. width += 3.73;
  2724. } else if (/\s/.test(item)) {
  2725. width += 2.5;
  2726. } else if (/%/.test(item)) {
  2727. width += 8;
  2728. } else {
  2729. width += 10;
  2730. }
  2731. }
  2732. return width * fontSize / 10;
  2733. }
  2734. function dataCombine(series) {
  2735. return series.reduce(function (a, b) {
  2736. return (a.data ? a.data : a).concat(b.data);
  2737. }, []);
  2738. }
  2739. function dataCombineStack(series, len) {
  2740. var sum = new Array(len);
  2741. for (var j = 0; j < sum.length; j++) {
  2742. sum[j] = 0;
  2743. }
  2744. for (var i = 0; i < series.length; i++) {
  2745. for (var j = 0; j < sum.length; j++) {
  2746. sum[j] += series[i].data[j];
  2747. }
  2748. }
  2749. return series.reduce(function (a, b) {
  2750. return (a.data ? a.data : a).concat(b.data).concat(sum);
  2751. }, []);
  2752. }
  2753. function getTouches(touches, opts, e) {
  2754. var x, y;
  2755. if (touches.clientX) {
  2756. if (opts.rotate) {
  2757. y = opts.height - touches.clientX * opts.pixelRatio;
  2758. x = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pixelRatio / 2 * (opts.pixelRatio - 1)) *
  2759. opts.pixelRatio;
  2760. } else {
  2761. x = touches.clientX * opts.pixelRatio;
  2762. y = (touches.pageY - e.currentTarget.offsetTop - opts.height / opts.pixelRatio / 2 * (opts.pixelRatio - 1)) *
  2763. opts.pixelRatio;
  2764. }
  2765. } else {
  2766. if (opts.rotate) {
  2767. y = opts.height - touches.x * opts.pixelRatio;
  2768. x = touches.y * opts.pixelRatio;
  2769. } else {
  2770. x = touches.x * opts.pixelRatio;
  2771. y = touches.y * opts.pixelRatio;
  2772. }
  2773. }
  2774. return {
  2775. x: x,
  2776. y: y };
  2777. }
  2778. function getSeriesDataItem(series, index) {
  2779. var data = [];
  2780. for (var i = 0; i < series.length; i++) {
  2781. var item = series[i];
  2782. if (item.data[index] !== null && typeof item.data[index] !== 'undefined' && item.show) {
  2783. var seriesItem = {};
  2784. seriesItem.color = item.color;
  2785. seriesItem.type = item.type;
  2786. seriesItem.style = item.style;
  2787. seriesItem.pointShape = item.pointShape;
  2788. seriesItem.disableLegend = item.disableLegend;
  2789. seriesItem.name = item.name;
  2790. seriesItem.show = item.show;
  2791. seriesItem.data = item.format ? item.format(item.data[index]) : item.data[index];
  2792. data.push(seriesItem);
  2793. }
  2794. }
  2795. return data;
  2796. }
  2797. function getMaxTextListLength(list) {
  2798. var lengthList = list.map(function (item) {
  2799. return measureText(item);
  2800. });
  2801. return Math.max.apply(null, lengthList);
  2802. }
  2803. function getRadarCoordinateSeries(length) {
  2804. var eachAngle = 2 * Math.PI / length;
  2805. var CoordinateSeries = [];
  2806. for (var i = 0; i < length; i++) {
  2807. CoordinateSeries.push(eachAngle * i);
  2808. }
  2809. return CoordinateSeries.map(function (item) {
  2810. return -1 * item + Math.PI / 2;
  2811. });
  2812. }
  2813. function getToolTipData(seriesData, calPoints, index, categories) {
  2814. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  2815. var textList = seriesData.map(function (item) {
  2816. return {
  2817. text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
  2818. color: item.color };
  2819. });
  2820. var validCalPoints = [];
  2821. var offset = {
  2822. x: 0,
  2823. y: 0 };
  2824. for (var i = 0; i < calPoints.length; i++) {
  2825. var points = calPoints[i];
  2826. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2827. validCalPoints.push(points[index]);
  2828. }
  2829. }
  2830. for (var _i = 0; _i < validCalPoints.length; _i++) {
  2831. var item = validCalPoints[_i];
  2832. offset.x = Math.round(item.x);
  2833. offset.y += item.y;
  2834. }
  2835. offset.y /= validCalPoints.length;
  2836. return {
  2837. textList: textList,
  2838. offset: offset };
  2839. }
  2840. function getMixToolTipData(seriesData, calPoints, index, categories) {
  2841. var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
  2842. var textList = seriesData.map(function (item) {
  2843. return {
  2844. text: option.format ? option.format(item, categories[index]) : item.name + ': ' + item.data,
  2845. color: item.color,
  2846. disableLegend: item.disableLegend ? true : false };
  2847. });
  2848. textList = textList.filter(function (item) {
  2849. if (item.disableLegend !== true) {
  2850. return item;
  2851. }
  2852. });
  2853. var validCalPoints = [];
  2854. var offset = {
  2855. x: 0,
  2856. y: 0 };
  2857. for (var i = 0; i < calPoints.length; i++) {
  2858. var points = calPoints[i];
  2859. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2860. validCalPoints.push(points[index]);
  2861. }
  2862. }
  2863. for (var _i2 = 0; _i2 < validCalPoints.length; _i2++) {
  2864. var item = validCalPoints[_i2];
  2865. offset.x = Math.round(item.x);
  2866. offset.y += item.y;
  2867. }
  2868. offset.y /= validCalPoints.length;
  2869. return {
  2870. textList: textList,
  2871. offset: offset };
  2872. }
  2873. function getCandleToolTipData(series, seriesData, calPoints, index, categories, extra) {
  2874. var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
  2875. var upColor = extra.color.upFill;
  2876. var downColor = extra.color.downFill;
  2877. //颜色顺序为开盘,收盘,最低,最高
  2878. var color = [upColor, upColor, downColor, upColor];
  2879. var textList = [];
  2880. var text0 = {
  2881. text: categories[index],
  2882. color: null };
  2883. textList.push(text0);
  2884. seriesData.map(function (item) {
  2885. if (index == 0 && item.data[1] - item.data[0] < 0) {
  2886. color[1] = downColor;
  2887. } else {
  2888. if (item.data[0] < series[index - 1][1]) {
  2889. color[0] = downColor;
  2890. }
  2891. if (item.data[1] < item.data[0]) {
  2892. color[1] = downColor;
  2893. }
  2894. if (item.data[2] > series[index - 1][1]) {
  2895. color[2] = upColor;
  2896. }
  2897. if (item.data[3] < series[index - 1][1]) {
  2898. color[3] = downColor;
  2899. }
  2900. }
  2901. var text1 = {
  2902. text: '开盘:' + item.data[0],
  2903. color: color[0] };
  2904. var text2 = {
  2905. text: '收盘:' + item.data[1],
  2906. color: color[1] };
  2907. var text3 = {
  2908. text: '最低:' + item.data[2],
  2909. color: color[2] };
  2910. var text4 = {
  2911. text: '最高:' + item.data[3],
  2912. color: color[3] };
  2913. textList.push(text1, text2, text3, text4);
  2914. });
  2915. var validCalPoints = [];
  2916. var offset = {
  2917. x: 0,
  2918. y: 0 };
  2919. for (var i = 0; i < calPoints.length; i++) {
  2920. var points = calPoints[i];
  2921. if (typeof points[index] !== 'undefined' && points[index] !== null) {
  2922. validCalPoints.push(points[index]);
  2923. }
  2924. }
  2925. offset.x = Math.round(validCalPoints[0][0].x);
  2926. return {
  2927. textList: textList,
  2928. offset: offset };
  2929. }
  2930. function filterSeries(series) {
  2931. var tempSeries = [];
  2932. for (var i = 0; i < series.length; i++) {
  2933. if (series[i].show == true) {
  2934. tempSeries.push(series[i]);
  2935. }
  2936. }
  2937. return tempSeries;
  2938. }
  2939. function findCurrentIndex(currentPoints, xAxisPoints, opts, config) {
  2940. var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  2941. var currentIndex = -1;
  2942. var spacing = 0;
  2943. if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') {
  2944. spacing = opts.chartData.eachSpacing / 2;
  2945. }
  2946. if (isInExactChartArea(currentPoints, opts, config)) {
  2947. xAxisPoints.forEach(function (item, index) {
  2948. if (currentPoints.x + offset + spacing > item) {
  2949. currentIndex = index;
  2950. }
  2951. });
  2952. }
  2953. return currentIndex;
  2954. }
  2955. function findLegendIndex(currentPoints, legendData, opts) {
  2956. var currentIndex = -1;
  2957. if (isInExactLegendArea(currentPoints, legendData.area)) {
  2958. var points = legendData.points;
  2959. var index = -1;
  2960. for (var i = 0, len = points.length; i < len; i++) {
  2961. var item = points[i];
  2962. for (var j = 0; j < item.length; j++) {
  2963. index += 1;
  2964. var area = item[j]['area'];
  2965. if (currentPoints.x > area[0] && currentPoints.x < area[2] && currentPoints.y > area[1] && currentPoints.y < area[3]) {
  2966. currentIndex = index;
  2967. break;
  2968. }
  2969. }
  2970. }
  2971. return currentIndex;
  2972. }
  2973. return currentIndex;
  2974. }
  2975. function isInExactLegendArea(currentPoints, area) {
  2976. return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y &&
  2977. currentPoints.y < area.end.y;
  2978. }
  2979. function isInExactChartArea(currentPoints, opts, config) {
  2980. 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];
  2981. }
  2982. function findRadarChartCurrentIndex(currentPoints, radarData, count) {
  2983. var eachAngleArea = 2 * Math.PI / count;
  2984. var currentIndex = -1;
  2985. if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) {
  2986. var fixAngle = function fixAngle(angle) {
  2987. if (angle < 0) {
  2988. angle += 2 * Math.PI;
  2989. }
  2990. if (angle > 2 * Math.PI) {
  2991. angle -= 2 * Math.PI;
  2992. }
  2993. return angle;
  2994. };
  2995. var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x);
  2996. angle = -1 * angle;
  2997. if (angle < 0) {
  2998. angle += 2 * Math.PI;
  2999. }
  3000. var angleList = radarData.angleList.map(function (item) {
  3001. item = fixAngle(-1 * item);
  3002. return item;
  3003. });
  3004. angleList.forEach(function (item, index) {
  3005. var rangeStart = fixAngle(item - eachAngleArea / 2);
  3006. var rangeEnd = fixAngle(item + eachAngleArea / 2);
  3007. if (rangeEnd < rangeStart) {
  3008. rangeEnd += 2 * Math.PI;
  3009. }
  3010. if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * Math.PI <=
  3011. rangeEnd) {
  3012. currentIndex = index;
  3013. }
  3014. });
  3015. }
  3016. return currentIndex;
  3017. }
  3018. function findFunnelChartCurrentIndex(currentPoints, funnelData) {
  3019. var currentIndex = -1;
  3020. for (var i = 0, len = funnelData.series.length; i < len; i++) {
  3021. var item = funnelData.series[i];
  3022. if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item.funnelArea[1] && currentPoints.y < item.funnelArea[3]) {
  3023. currentIndex = i;
  3024. break;
  3025. }
  3026. }
  3027. return currentIndex;
  3028. }
  3029. function findWordChartCurrentIndex(currentPoints, wordData) {
  3030. var currentIndex = -1;
  3031. for (var i = 0, len = wordData.length; i < len; i++) {
  3032. var item = wordData[i];
  3033. if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && currentPoints.y < item.area[3]) {
  3034. currentIndex = i;
  3035. break;
  3036. }
  3037. }
  3038. return currentIndex;
  3039. }
  3040. function findMapChartCurrentIndex(currentPoints, opts) {
  3041. var currentIndex = -1;
  3042. var cData = opts.chartData.mapData;
  3043. var data = opts.series;
  3044. var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData.yoffset);
  3045. var poi = [tmp.x, tmp.y];
  3046. for (var i = 0, len = data.length; i < len; i++) {
  3047. var item = data[i].geometry.coordinates;
  3048. if (isPoiWithinPoly(poi, item)) {
  3049. currentIndex = i;
  3050. break;
  3051. }
  3052. }
  3053. return currentIndex;
  3054. }
  3055. function findPieChartCurrentIndex(currentPoints, pieData) {
  3056. var currentIndex = -1;
  3057. if (isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) {
  3058. var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x);
  3059. angle = -angle;
  3060. for (var i = 0, len = pieData.series.length; i < len; i++) {
  3061. var item = pieData.series[i];
  3062. if (isInAngleRange(angle, item._start_, item._start_ + item._proportion_ * 2 * Math.PI)) {
  3063. currentIndex = i;
  3064. break;
  3065. }
  3066. }
  3067. }
  3068. return currentIndex;
  3069. }
  3070. function isInExactPieChartArea(currentPoints, center, radius) {
  3071. return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2);
  3072. }
  3073. function splitPoints(points) {
  3074. var newPoints = [];
  3075. var items = [];
  3076. points.forEach(function (item, index) {
  3077. if (item !== null) {
  3078. items.push(item);
  3079. } else {
  3080. if (items.length) {
  3081. newPoints.push(items);
  3082. }
  3083. items = [];
  3084. }
  3085. });
  3086. if (items.length) {
  3087. newPoints.push(items);
  3088. }
  3089. return newPoints;
  3090. }
  3091. function calLegendData(series, opts, config, chartData) {
  3092. var legendData = {
  3093. area: {
  3094. start: {
  3095. x: 0,
  3096. y: 0 },
  3097. end: {
  3098. x: 0,
  3099. y: 0 },
  3100. width: 0,
  3101. height: 0,
  3102. wholeWidth: 0,
  3103. wholeHeight: 0 },
  3104. points: [],
  3105. widthArr: [],
  3106. heightArr: [] };
  3107. if (opts.legend.show === false) {
  3108. chartData.legendData = legendData;
  3109. return legendData;
  3110. }
  3111. var padding = opts.legend.padding;
  3112. var margin = opts.legend.margin;
  3113. var fontSize = opts.legend.fontSize;
  3114. var shapeWidth = 15 * opts.pixelRatio;
  3115. var shapeRight = 5 * opts.pixelRatio;
  3116. var lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
  3117. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  3118. var legendList = [];
  3119. var widthCount = 0;
  3120. var widthCountArr = [];
  3121. var currentRow = [];
  3122. for (var i = 0; i < series.length; i++) {
  3123. var item = series[i];
  3124. var itemWidth = shapeWidth + shapeRight + measureText(item.name || 'undefined', fontSize) + opts.legend.itemGap;
  3125. if (widthCount + itemWidth > opts.width - opts.padding[1] - opts.padding[3]) {
  3126. legendList.push(currentRow);
  3127. widthCountArr.push(widthCount - opts.legend.itemGap);
  3128. widthCount = itemWidth;
  3129. currentRow = [item];
  3130. } else {
  3131. widthCount += itemWidth;
  3132. currentRow.push(item);
  3133. }
  3134. }
  3135. if (currentRow.length) {
  3136. legendList.push(currentRow);
  3137. widthCountArr.push(widthCount - opts.legend.itemGap);
  3138. legendData.widthArr = widthCountArr;
  3139. var legendWidth = Math.max.apply(null, widthCountArr);
  3140. switch (opts.legend.float) {
  3141. case 'left':
  3142. legendData.area.start.x = opts.padding[3];
  3143. legendData.area.end.x = opts.padding[3] + 2 * padding;
  3144. break;
  3145. case 'right':
  3146. legendData.area.start.x = opts.width - opts.padding[1] - legendWidth - 2 * padding;
  3147. legendData.area.end.x = opts.width - opts.padding[1];
  3148. break;
  3149. default:
  3150. legendData.area.start.x = (opts.width - legendWidth) / 2 - padding;
  3151. legendData.area.end.x = (opts.width + legendWidth) / 2 + padding;}
  3152. legendData.area.width = legendWidth + 2 * padding;
  3153. legendData.area.wholeWidth = legendWidth + 2 * padding;
  3154. legendData.area.height = legendList.length * lineHeight + 2 * padding;
  3155. legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin;
  3156. legendData.points = legendList;
  3157. }
  3158. } else {
  3159. var len = series.length;
  3160. var maxHeight = opts.height - opts.padding[0] - opts.padding[2] - 2 * margin - 2 * padding;
  3161. var maxLength = Math.min(Math.floor(maxHeight / lineHeight), len);
  3162. legendData.area.height = maxLength * lineHeight + padding * 2;
  3163. legendData.area.wholeHeight = maxLength * lineHeight + padding * 2;
  3164. switch (opts.legend.float) {
  3165. case 'top':
  3166. legendData.area.start.y = opts.padding[0] + margin;
  3167. legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
  3168. break;
  3169. case 'bottom':
  3170. legendData.area.start.y = opts.height - opts.padding[2] - margin - legendData.area.height;
  3171. legendData.area.end.y = opts.height - opts.padding[2] - margin;
  3172. break;
  3173. default:
  3174. legendData.area.start.y = (opts.height - legendData.area.height) / 2;
  3175. legendData.area.end.y = (opts.height + legendData.area.height) / 2;}
  3176. var lineNum = len % maxLength === 0 ? len / maxLength : Math.floor(len / maxLength + 1);
  3177. var _currentRow = [];
  3178. for (var _i3 = 0; _i3 < lineNum; _i3++) {
  3179. var temp = series.slice(_i3 * maxLength, _i3 * maxLength + maxLength);
  3180. _currentRow.push(temp);
  3181. }
  3182. legendData.points = _currentRow;
  3183. if (_currentRow.length) {
  3184. for (var _i4 = 0; _i4 < _currentRow.length; _i4++) {
  3185. var _item = _currentRow[_i4];
  3186. var maxWidth = 0;
  3187. for (var j = 0; j < _item.length; j++) {
  3188. var _itemWidth = shapeWidth + shapeRight + measureText(_item[j].name || 'undefined', fontSize) + opts.legend.itemGap;
  3189. if (_itemWidth > maxWidth) {
  3190. maxWidth = _itemWidth;
  3191. }
  3192. }
  3193. legendData.widthArr.push(maxWidth);
  3194. legendData.heightArr.push(_item.length * lineHeight + padding * 2);
  3195. }
  3196. var _legendWidth = 0;
  3197. for (var _i5 = 0; _i5 < legendData.widthArr.length; _i5++) {
  3198. _legendWidth += legendData.widthArr[_i5];
  3199. }
  3200. legendData.area.width = _legendWidth - opts.legend.itemGap + 2 * padding;
  3201. legendData.area.wholeWidth = legendData.area.width + padding;
  3202. }
  3203. }
  3204. switch (opts.legend.position) {
  3205. case 'top':
  3206. legendData.area.start.y = opts.padding[0] + margin;
  3207. legendData.area.end.y = opts.padding[0] + margin + legendData.area.height;
  3208. break;
  3209. case 'bottom':
  3210. legendData.area.start.y = opts.height - opts.padding[2] - legendData.area.height - margin;
  3211. legendData.area.end.y = opts.height - opts.padding[2] - margin;
  3212. break;
  3213. case 'left':
  3214. legendData.area.start.x = opts.padding[3];
  3215. legendData.area.end.x = opts.padding[3] + legendData.area.width;
  3216. break;
  3217. case 'right':
  3218. legendData.area.start.x = opts.width - opts.padding[1] - legendData.area.width;
  3219. legendData.area.end.x = opts.width - opts.padding[1];
  3220. break;}
  3221. chartData.legendData = legendData;
  3222. return legendData;
  3223. }
  3224. function calCategoriesData(categories, opts, config, eachSpacing) {
  3225. var result = {
  3226. angle: 0,
  3227. xAxisHeight: config.xAxisHeight };
  3228. var categoriesTextLenth = categories.map(function (item) {
  3229. return measureText(item);
  3230. });
  3231. var maxTextLength = Math.max.apply(this, categoriesTextLenth);
  3232. if (opts.xAxis.rotateLabel == true && maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) {
  3233. result.angle = 45 * Math.PI / 180;
  3234. result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle);
  3235. }
  3236. return result;
  3237. }
  3238. function getRadarDataPoints(angleList, center, radius, series, opts) {
  3239. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  3240. var radarOption = opts.extra.radar || {};
  3241. radarOption.max = radarOption.max || 0;
  3242. var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series)));
  3243. var data = [];var _loop2 = function _loop2(
  3244. i) {
  3245. var each = series[i];
  3246. var listItem = {};
  3247. listItem.color = each.color;
  3248. listItem.data = [];
  3249. each.data.forEach(function (item, index) {
  3250. var tmp = {};
  3251. tmp.angle = angleList[index];
  3252. tmp.proportion = item / maxData;
  3253. tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), radius * tmp.proportion *
  3254. process * Math.sin(tmp.angle), center);
  3255. listItem.data.push(tmp);
  3256. });
  3257. data.push(listItem);};for (var i = 0; i < series.length; i++) {_loop2(i);
  3258. }
  3259. return data;
  3260. }
  3261. function getPieDataPoints(series, radius) {
  3262. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3263. var count = 0;
  3264. var _start_ = 0;
  3265. for (var i = 0; i < series.length; i++) {
  3266. var item = series[i];
  3267. item.data = item.data === null ? 0 : item.data;
  3268. count += item.data;
  3269. }
  3270. for (var _i6 = 0; _i6 < series.length; _i6++) {
  3271. var _item2 = series[_i6];
  3272. _item2.data = _item2.data === null ? 0 : _item2.data;
  3273. if (count === 0) {
  3274. _item2._proportion_ = 1 / series.length * process;
  3275. } else {
  3276. _item2._proportion_ = _item2.data / count * process;
  3277. }
  3278. _item2._radius_ = radius;
  3279. }
  3280. for (var _i7 = 0; _i7 < series.length; _i7++) {
  3281. var _item3 = series[_i7];
  3282. _item3._start_ = _start_;
  3283. _start_ += 2 * _item3._proportion_ * Math.PI;
  3284. }
  3285. return series;
  3286. }
  3287. function getFunnelDataPoints(series, radius) {
  3288. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3289. series = series.sort(function (a, b) {return parseInt(b.data) - parseInt(a.data);});
  3290. for (var i = 0; i < series.length; i++) {
  3291. series[i].radius = series[i].data / series[0].data * radius * process;
  3292. series[i]._proportion_ = series[i].data / series[0].data;
  3293. }
  3294. return series.reverse();
  3295. }
  3296. function getRoseDataPoints(series, type, minRadius, radius) {
  3297. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  3298. var count = 0;
  3299. var _start_ = 0;
  3300. var dataArr = [];
  3301. for (var i = 0; i < series.length; i++) {
  3302. var item = series[i];
  3303. item.data = item.data === null ? 0 : item.data;
  3304. count += item.data;
  3305. dataArr.push(item.data);
  3306. }
  3307. var minData = Math.min.apply(null, dataArr);
  3308. var maxData = Math.max.apply(null, dataArr);
  3309. var radiusLength = radius - minRadius;
  3310. for (var _i8 = 0; _i8 < series.length; _i8++) {
  3311. var _item4 = series[_i8];
  3312. _item4.data = _item4.data === null ? 0 : _item4.data;
  3313. if (count === 0 || type == 'area') {
  3314. _item4._proportion_ = _item4.data / count * process;
  3315. _item4._rose_proportion_ = 1 / series.length * process;
  3316. } else {
  3317. _item4._proportion_ = _item4.data / count * process;
  3318. _item4._rose_proportion_ = _item4.data / count * process;
  3319. }
  3320. _item4._radius_ = minRadius + radiusLength * ((_item4.data - minData) / (maxData - minData));
  3321. }
  3322. for (var _i9 = 0; _i9 < series.length; _i9++) {
  3323. var _item5 = series[_i9];
  3324. _item5._start_ = _start_;
  3325. _start_ += 2 * _item5._rose_proportion_ * Math.PI;
  3326. }
  3327. return series;
  3328. }
  3329. function getArcbarDataPoints(series, arcbarOption) {
  3330. var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  3331. if (process == 1) {
  3332. process = 0.999999;
  3333. }
  3334. for (var i = 0; i < series.length; i++) {
  3335. var item = series[i];
  3336. item.data = item.data === null ? 0 : item.data;
  3337. var totalAngle = void 0;
  3338. if (arcbarOption.type == 'default') {
  3339. if (arcbarOption.endAngle < arcbarOption.startAngle) {
  3340. totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle;
  3341. } else {
  3342. totalAngle = arcbarOption.startAngle - arcbarOption.endAngle;
  3343. }
  3344. } else {
  3345. totalAngle = 2;
  3346. }
  3347. item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle;
  3348. if (item._proportion_ >= 2) {
  3349. item._proportion_ = item._proportion_ % 2;
  3350. }
  3351. }
  3352. return series;
  3353. }
  3354. function getGaugeAxisPoints(categories, startAngle, endAngle) {
  3355. var totalAngle = startAngle - endAngle + 1;
  3356. var tempStartAngle = startAngle;
  3357. for (var i = 0; i < categories.length; i++) {
  3358. categories[i].value = categories[i].value === null ? 0 : categories[i].value;
  3359. categories[i]._startAngle_ = tempStartAngle;
  3360. categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle;
  3361. if (categories[i]._endAngle_ >= 2) {
  3362. categories[i]._endAngle_ = categories[i]._endAngle_ % 2;
  3363. }
  3364. tempStartAngle = categories[i]._endAngle_;
  3365. }
  3366. return categories;
  3367. }
  3368. function getGaugeDataPoints(series, categories, gaugeOption) {
  3369. var process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  3370. for (var i = 0; i < series.length; i++) {
  3371. var item = series[i];
  3372. item.data = item.data === null ? 0 : item.data;
  3373. if (gaugeOption.pointer.color == 'auto') {
  3374. for (var _i10 = 0; _i10 < categories.length; _i10++) {
  3375. if (item.data <= categories[_i10].value) {
  3376. item.color = categories[_i10].color;
  3377. break;
  3378. }
  3379. }
  3380. } else {
  3381. item.color = gaugeOption.pointer.color;
  3382. }
  3383. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  3384. item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle;
  3385. item._oldAngle_ = gaugeOption.oldAngle;
  3386. if (gaugeOption.oldAngle < gaugeOption.endAngle) {
  3387. item._oldAngle_ += 2;
  3388. }
  3389. if (item.data >= gaugeOption.oldData) {
  3390. item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle;
  3391. } else {
  3392. item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process;
  3393. }
  3394. if (item._proportion_ >= 2) {
  3395. item._proportion_ = item._proportion_ % 2;
  3396. }
  3397. }
  3398. return series;
  3399. }
  3400. function getPieTextMaxLength(series) {
  3401. series = getPieDataPoints(series);
  3402. var maxLength = 0;
  3403. for (var i = 0; i < series.length; i++) {
  3404. var item = series[i];
  3405. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  3406. maxLength = Math.max(maxLength, measureText(text));
  3407. }
  3408. return maxLength;
  3409. }
  3410. function fixColumeData(points, eachSpacing, columnLen, index, config, opts) {
  3411. return points.map(function (item) {
  3412. if (item === null) {
  3413. return null;
  3414. }
  3415. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / columnLen);
  3416. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3417. item.width = Math.min(item.width, +opts.extra.column.width);
  3418. }
  3419. if (item.width <= 0) {
  3420. item.width = 1;
  3421. }
  3422. item.x += (index + 0.5 - columnLen / 2) * item.width;
  3423. return item;
  3424. });
  3425. }
  3426. function fixColumeMeterData(points, eachSpacing, columnLen, index, config, opts, border) {
  3427. return points.map(function (item) {
  3428. if (item === null) {
  3429. return null;
  3430. }
  3431. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
  3432. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3433. item.width = Math.min(item.width, +opts.extra.column.width);
  3434. }
  3435. if (index > 0) {
  3436. item.width -= 2 * border;
  3437. }
  3438. return item;
  3439. });
  3440. }
  3441. function fixColumeStackData(points, eachSpacing, columnLen, index, config, opts, series) {
  3442. return points.map(function (item, indexn) {
  3443. if (item === null) {
  3444. return null;
  3445. }
  3446. item.width = Math.ceil((eachSpacing - 2 * config.columePadding) / 2);
  3447. if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) {
  3448. item.width = Math.min(item.width, +opts.extra.column.width);
  3449. }
  3450. return item;
  3451. });
  3452. }
  3453. function getXAxisPoints(categories, opts, config) {
  3454. var yAxisTotalWidth = config.yAxisWidth + config.yAxisTitleWidth;
  3455. var spacingValid = opts.width - opts.area[1] - opts.area[3];
  3456. var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length;
  3457. if ((opts.type == 'line' || opts.type == 'area') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') {
  3458. dataCount -= 1;
  3459. }
  3460. var eachSpacing = spacingValid / dataCount;
  3461. var xAxisPoints = [];
  3462. var startX = opts.area[3];
  3463. var endX = opts.width - opts.area[1];
  3464. categories.forEach(function (item, index) {
  3465. xAxisPoints.push(startX + index * eachSpacing);
  3466. });
  3467. if (opts.xAxis.boundaryGap !== 'justify') {
  3468. if (opts.enableScroll === true) {
  3469. xAxisPoints.push(startX + categories.length * eachSpacing);
  3470. } else {
  3471. xAxisPoints.push(endX);
  3472. }
  3473. }
  3474. return {
  3475. xAxisPoints: xAxisPoints,
  3476. startX: startX,
  3477. endX: endX,
  3478. eachSpacing: eachSpacing };
  3479. }
  3480. function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  3481. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  3482. var points = [];
  3483. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3484. data.forEach(function (item, index) {
  3485. if (item === null) {
  3486. points.push(null);
  3487. } else {
  3488. var cPoints = [];
  3489. item.forEach(function (items, indexs) {
  3490. var point = {};
  3491. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  3492. var value = items.value || items;
  3493. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3494. height *= process;
  3495. point.y = opts.height - Math.round(height) - opts.area[2];
  3496. cPoints.push(point);
  3497. });
  3498. points.push(cPoints);
  3499. }
  3500. });
  3501. return points;
  3502. }
  3503. function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
  3504. var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
  3505. var boundaryGap = 'center';
  3506. if (opts.type == 'line' || opts.type == 'area') {
  3507. boundaryGap = opts.xAxis.boundaryGap;
  3508. }
  3509. var points = [];
  3510. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3511. data.forEach(function (item, index) {
  3512. if (item === null) {
  3513. points.push(null);
  3514. } else {
  3515. var point = {};
  3516. point.color = item.color;
  3517. point.x = xAxisPoints[index];
  3518. if (boundaryGap == 'center') {
  3519. point.x += Math.round(eachSpacing / 2);
  3520. }
  3521. var value = item;
  3522. if (typeof item === 'object' && item !== null) {
  3523. value = item.value;
  3524. }
  3525. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3526. height *= process;
  3527. point.y = opts.height - Math.round(height) - opts.area[2];
  3528. points.push(point);
  3529. }
  3530. });
  3531. return points;
  3532. }
  3533. function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
  3534. var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;
  3535. var points = [];
  3536. var validHeight = opts.height - opts.area[0] - opts.area[2];
  3537. data.forEach(function (item, index) {
  3538. if (item === null) {
  3539. points.push(null);
  3540. } else {
  3541. var point = {};
  3542. point.color = item.color;
  3543. point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
  3544. if (seriesIndex > 0) {
  3545. var value = 0;
  3546. for (var i = 0; i <= seriesIndex; i++) {
  3547. value += stackSeries[i].data[index];
  3548. }
  3549. var value0 = value - item;
  3550. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3551. var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
  3552. } else {
  3553. var value = item;
  3554. var height = validHeight * (value - minRange) / (maxRange - minRange);
  3555. var height0 = 0;
  3556. }
  3557. var heightc = height0;
  3558. height *= process;
  3559. heightc *= process;
  3560. point.y = opts.height - Math.round(height) - opts.area[2];
  3561. point.y0 = opts.height - Math.round(heightc) - opts.area[2];
  3562. points.push(point);
  3563. }
  3564. });
  3565. return points;
  3566. }
  3567. function getYAxisTextList(series, opts, config, stack) {
  3568. var data;
  3569. if (stack == 'stack') {
  3570. data = dataCombineStack(series, opts.categories.length);
  3571. } else {
  3572. data = dataCombine(series);
  3573. }
  3574. var sorted = [];
  3575. // remove null from data
  3576. data = data.filter(function (item) {
  3577. //return item !== null;
  3578. if (typeof item === 'object' && item !== null) {
  3579. if (Array.isArray(item)) {
  3580. return item !== null;
  3581. } else {
  3582. return item.value !== null;
  3583. }
  3584. } else {
  3585. return item !== null;
  3586. }
  3587. });
  3588. data.map(function (item) {
  3589. if (typeof item === 'object') {
  3590. if (Array.isArray(item)) {
  3591. item.map(function (subitem) {
  3592. sorted.push(subitem);
  3593. });
  3594. } else {
  3595. sorted.push(item.value);
  3596. }
  3597. } else {
  3598. sorted.push(item);
  3599. }
  3600. });
  3601. var minData = 0;
  3602. var maxData = 0;
  3603. if (sorted.length > 0) {
  3604. minData = Math.min.apply(this, sorted);
  3605. maxData = Math.max.apply(this, sorted);
  3606. }
  3607. if (typeof opts.yAxis.min === 'number') {
  3608. minData = Math.min(opts.yAxis.min, minData);
  3609. }
  3610. if (typeof opts.yAxis.max === 'number') {
  3611. maxData = Math.max(opts.yAxis.max, maxData);
  3612. }
  3613. if (minData === maxData) {
  3614. var rangeSpan = maxData || 10;
  3615. maxData += rangeSpan;
  3616. }
  3617. var dataRange = getDataRange(minData, maxData);
  3618. var minRange = dataRange.minRange;
  3619. var maxRange = dataRange.maxRange;
  3620. var range = [];
  3621. var eachRange = (maxRange - minRange) / config.yAxisSplit;
  3622. for (var i = 0; i <= config.yAxisSplit; i++) {
  3623. range.push(minRange + eachRange * i);
  3624. }
  3625. return range.reverse();
  3626. }
  3627. function calYAxisData(series, opts, config) {
  3628. //堆叠图重算Y轴
  3629. var columnstyle = assign({}, {
  3630. type: "" },
  3631. opts.extra.column);
  3632. var ranges = getYAxisTextList(series, opts, config, columnstyle.type);
  3633. var yAxisWidth = config.yAxisWidth;
  3634. var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
  3635. var rangesFormat = ranges.map(function (item) {
  3636. item = util.toFixed(item, 6);
  3637. item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
  3638. yAxisWidth = Math.max(yAxisWidth, measureText(item, yAxisFontSize) + 5);
  3639. return item;
  3640. });
  3641. if (opts.yAxis.disabled === true) {
  3642. yAxisWidth = 0;
  3643. }
  3644. return {
  3645. rangesFormat: rangesFormat,
  3646. ranges: ranges,
  3647. yAxisWidth: yAxisWidth };
  3648. }
  3649. function calTooltipYAxisData(point, series, opts, config, eachSpacing) {
  3650. var ranges = getYAxisTextList(series, opts, config);
  3651. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  3652. var maxVal = ranges[0];
  3653. var minVal = ranges[ranges.length - 1];
  3654. var minAxis = opts.padding[3];
  3655. var maxAxis = opts.padding[1] + spacingValid;
  3656. var item = maxVal - (maxVal - minVal) * (point - minAxis) / (maxAxis - minAxis);
  3657. item = opts.yAxis.format ? opts.yAxis.format(Number(item)) : item;
  3658. return item;
  3659. }
  3660. function calMarkLineData(minRange, maxRange, points, opts) {
  3661. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  3662. for (var i = 0; i < points.length; i++) {
  3663. var height = spacingValid * (points[i].value - minRange) / (maxRange - minRange);
  3664. points[i].y = opts.height - Math.round(height) - opts.area[2];
  3665. }
  3666. return points;
  3667. }
  3668. function contextRotate(context, opts) {
  3669. if (opts.rotateLock !== true) {
  3670. context.translate(opts.height, 0);
  3671. context.rotate(90 * Math.PI / 180);
  3672. } else if (opts._rotate_ !== true) {
  3673. context.translate(opts.height, 0);
  3674. context.rotate(90 * Math.PI / 180);
  3675. opts._rotate_ = true;
  3676. }
  3677. }
  3678. function drawPointShape(points, color, shape, context, opts) {
  3679. context.beginPath();
  3680. context.setStrokeStyle("#ffffff");
  3681. context.setLineWidth(1 * opts.pixelRatio);
  3682. context.setFillStyle(color);
  3683. if (shape === 'diamond') {
  3684. points.forEach(function (item, index) {
  3685. if (item !== null) {
  3686. context.moveTo(item.x, item.y - 4.5);
  3687. context.lineTo(item.x - 4.5, item.y);
  3688. context.lineTo(item.x, item.y + 4.5);
  3689. context.lineTo(item.x + 4.5, item.y);
  3690. context.lineTo(item.x, item.y - 4.5);
  3691. }
  3692. });
  3693. } else if (shape === 'circle') {
  3694. points.forEach(function (item, index) {
  3695. if (item !== null) {
  3696. context.moveTo(item.x + 3.5 * opts.pixelRatio, item.y);
  3697. context.arc(item.x, item.y, 4 * opts.pixelRatio, 0, 2 * Math.PI, false);
  3698. }
  3699. });
  3700. } else if (shape === 'rect') {
  3701. points.forEach(function (item, index) {
  3702. if (item !== null) {
  3703. context.moveTo(item.x - 3.5, item.y - 3.5);
  3704. context.rect(item.x - 3.5, item.y - 3.5, 7, 7);
  3705. }
  3706. });
  3707. } else if (shape === 'triangle') {
  3708. points.forEach(function (item, index) {
  3709. if (item !== null) {
  3710. context.moveTo(item.x, item.y - 4.5);
  3711. context.lineTo(item.x - 4.5, item.y + 4.5);
  3712. context.lineTo(item.x + 4.5, item.y + 4.5);
  3713. context.lineTo(item.x, item.y - 4.5);
  3714. }
  3715. });
  3716. }
  3717. context.closePath();
  3718. context.fill();
  3719. context.stroke();
  3720. }
  3721. function drawRingTitle(opts, config, context, center) {
  3722. var titlefontSize = opts.title.fontSize || config.titleFontSize;
  3723. var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize;
  3724. var title = opts.title.name || '';
  3725. var subtitle = opts.subtitle.name || '';
  3726. var titleFontColor = opts.title.color || config.titleColor;
  3727. var subtitleFontColor = opts.subtitle.color || config.subtitleColor;
  3728. var titleHeight = title ? titlefontSize : 0;
  3729. var subtitleHeight = subtitle ? subtitlefontSize : 0;
  3730. var margin = 5;
  3731. if (subtitle) {
  3732. var textWidth = measureText(subtitle, subtitlefontSize);
  3733. var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0);
  3734. var startY = center.y + subtitlefontSize / 2 + (opts.subtitle.offsetY || 0);
  3735. if (title) {
  3736. startY += (titleHeight + margin) / 2;
  3737. }
  3738. context.beginPath();
  3739. context.setFontSize(subtitlefontSize);
  3740. context.setFillStyle(subtitleFontColor);
  3741. context.fillText(subtitle, startX, startY);
  3742. context.closePath();
  3743. context.stroke();
  3744. }
  3745. if (title) {
  3746. var _textWidth = measureText(title, titlefontSize);
  3747. var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0);
  3748. var _startY = center.y + titlefontSize / 2 + (opts.title.offsetY || 0);
  3749. if (subtitle) {
  3750. _startY -= (subtitleHeight + margin) / 2;
  3751. }
  3752. context.beginPath();
  3753. context.setFontSize(titlefontSize);
  3754. context.setFillStyle(titleFontColor);
  3755. context.fillText(title, _startX, _startY);
  3756. context.closePath();
  3757. context.stroke();
  3758. }
  3759. }
  3760. function drawPointText(points, series, config, context) {
  3761. // 绘制数据文案
  3762. var data = series.data;
  3763. points.forEach(function (item, index) {
  3764. if (item !== null) {
  3765. //var formatVal = series.format ? series.format(data[index]) : data[index];
  3766. context.beginPath();
  3767. context.setFontSize(series.textSize || config.fontSize);
  3768. context.setFillStyle(series.textColor || '#666666');
  3769. var value = data[index];
  3770. if (typeof data[index] === 'object' && data[index] !== null) {
  3771. value = data[index].value;
  3772. }
  3773. var formatVal = series.format ? series.format(value) : value;
  3774. context.fillText(String(formatVal), item.x - measureText(formatVal, series.textSize || config.fontSize) / 2, item.y -
  3775. 2);
  3776. context.closePath();
  3777. context.stroke();
  3778. }
  3779. });
  3780. }
  3781. function drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context) {
  3782. radius -= gaugeOption.width / 2 + config.gaugeLabelTextMargin;
  3783. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  3784. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  3785. var totalNumber = gaugeOption.endNumber - gaugeOption.startNumber;
  3786. var splitNumber = totalNumber / gaugeOption.splitLine.splitNumber;
  3787. var nowAngle = gaugeOption.startAngle;
  3788. var nowNumber = gaugeOption.startNumber;
  3789. for (var i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) {
  3790. var pos = {
  3791. x: radius * Math.cos(nowAngle * Math.PI),
  3792. y: radius * Math.sin(nowAngle * Math.PI) };
  3793. var labelText = gaugeOption.labelFormat ? gaugeOption.labelFormat(nowNumber) : nowNumber;
  3794. pos.x += centerPosition.x - measureText(labelText) / 2;
  3795. pos.y += centerPosition.y;
  3796. var startX = pos.x;
  3797. var startY = pos.y;
  3798. context.beginPath();
  3799. context.setFontSize(config.fontSize);
  3800. context.setFillStyle(gaugeOption.labelColor || '#666666');
  3801. context.fillText(labelText, startX, startY + config.fontSize / 2);
  3802. context.closePath();
  3803. context.stroke();
  3804. nowAngle += splitAngle;
  3805. if (nowAngle >= 2) {
  3806. nowAngle = nowAngle % 2;
  3807. }
  3808. nowNumber += splitNumber;
  3809. }
  3810. }
  3811. function drawRadarLabel(angleList, radius, centerPosition, opts, config, context) {
  3812. var radarOption = opts.extra.radar || {};
  3813. radius += config.radarLabelTextMargin;
  3814. angleList.forEach(function (angle, index) {
  3815. var pos = {
  3816. x: radius * Math.cos(angle),
  3817. y: radius * Math.sin(angle) };
  3818. var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition);
  3819. var startX = posRelativeCanvas.x;
  3820. var startY = posRelativeCanvas.y;
  3821. if (util.approximatelyEqual(pos.x, 0)) {
  3822. startX -= measureText(opts.categories[index] || '') / 2;
  3823. } else if (pos.x < 0) {
  3824. startX -= measureText(opts.categories[index] || '');
  3825. }
  3826. context.beginPath();
  3827. context.setFontSize(config.fontSize);
  3828. context.setFillStyle(radarOption.labelColor || '#666666');
  3829. context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2);
  3830. context.closePath();
  3831. context.stroke();
  3832. });
  3833. }
  3834. function drawPieText(series, opts, config, context, radius, center) {
  3835. var lineRadius = config.pieChartLinePadding;
  3836. var textObjectCollection = [];
  3837. var lastTextObject = null;
  3838. var seriesConvert = series.map(function (item) {
  3839. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_.toFixed(4) * 100) + '%';
  3840. if (item._rose_proportion_) item._proportion_ = item._rose_proportion_;
  3841. var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2);
  3842. var color = item.color;
  3843. var radius = item._radius_;
  3844. return {
  3845. arc: arc,
  3846. text: text,
  3847. color: color,
  3848. radius: radius,
  3849. textColor: item.textColor,
  3850. textSize: item.textSize };
  3851. });
  3852. for (var i = 0; i < seriesConvert.length; i++) {
  3853. var item = seriesConvert[i];
  3854. // line end
  3855. var orginX1 = Math.cos(item.arc) * (item.radius + lineRadius);
  3856. var orginY1 = Math.sin(item.arc) * (item.radius + lineRadius);
  3857. // line start
  3858. var orginX2 = Math.cos(item.arc) * item.radius;
  3859. var orginY2 = Math.sin(item.arc) * item.radius;
  3860. // text start
  3861. var orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding;
  3862. var orginY3 = orginY1;
  3863. var textWidth = measureText(item.text);
  3864. var startY = orginY3;
  3865. if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, {
  3866. x: orginX3 }))
  3867. {
  3868. if (orginX3 > 0) {
  3869. startY = Math.min(orginY3, lastTextObject.start.y);
  3870. } else if (orginX1 < 0) {
  3871. startY = Math.max(orginY3, lastTextObject.start.y);
  3872. } else {
  3873. if (orginY3 > 0) {
  3874. startY = Math.max(orginY3, lastTextObject.start.y);
  3875. } else {
  3876. startY = Math.min(orginY3, lastTextObject.start.y);
  3877. }
  3878. }
  3879. }
  3880. if (orginX3 < 0) {
  3881. orginX3 -= textWidth;
  3882. }
  3883. var textObject = {
  3884. lineStart: {
  3885. x: orginX2,
  3886. y: orginY2 },
  3887. lineEnd: {
  3888. x: orginX1,
  3889. y: orginY1 },
  3890. start: {
  3891. x: orginX3,
  3892. y: startY },
  3893. width: textWidth,
  3894. height: config.fontSize,
  3895. text: item.text,
  3896. color: item.color,
  3897. textColor: item.textColor,
  3898. textSize: item.textSize };
  3899. lastTextObject = avoidCollision(textObject, lastTextObject);
  3900. textObjectCollection.push(lastTextObject);
  3901. }
  3902. for (var _i11 = 0; _i11 < textObjectCollection.length; _i11++) {
  3903. var _item6 = textObjectCollection[_i11];
  3904. var lineStartPoistion = convertCoordinateOrigin(_item6.lineStart.x, _item6.lineStart.y, center);
  3905. var lineEndPoistion = convertCoordinateOrigin(_item6.lineEnd.x, _item6.lineEnd.y, center);
  3906. var textPosition = convertCoordinateOrigin(_item6.start.x, _item6.start.y, center);
  3907. context.setLineWidth(1 * opts.pixelRatio);
  3908. context.setFontSize(config.fontSize);
  3909. context.beginPath();
  3910. context.setStrokeStyle(_item6.color);
  3911. context.setFillStyle(_item6.color);
  3912. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  3913. var curveStartX = _item6.start.x < 0 ? textPosition.x + _item6.width : textPosition.x;
  3914. var textStartX = _item6.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5;
  3915. context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y);
  3916. context.moveTo(lineStartPoistion.x, lineStartPoistion.y);
  3917. context.stroke();
  3918. context.closePath();
  3919. context.beginPath();
  3920. context.moveTo(textPosition.x + _item6.width, textPosition.y);
  3921. context.arc(curveStartX, textPosition.y, 2, 0, 2 * Math.PI);
  3922. context.closePath();
  3923. context.fill();
  3924. context.beginPath();
  3925. context.setFontSize(_item6.textSize || config.fontSize);
  3926. context.setFillStyle(_item6.textColor || '#666666');
  3927. context.fillText(_item6.text, textStartX, textPosition.y + 3);
  3928. context.closePath();
  3929. context.stroke();
  3930. context.closePath();
  3931. }
  3932. }
  3933. function drawToolTipSplitLine(offsetX, opts, config, context) {
  3934. var toolTipOption = opts.extra.tooltip || {};
  3935. toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType;
  3936. toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength;
  3937. var startY = opts.area[0];
  3938. var endY = opts.height - opts.area[2];
  3939. if (toolTipOption.gridType == 'dash') {
  3940. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  3941. }
  3942. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  3943. context.setLineWidth(1 * opts.pixelRatio);
  3944. context.beginPath();
  3945. context.moveTo(offsetX, startY);
  3946. context.lineTo(offsetX, endY);
  3947. context.stroke();
  3948. context.setLineDash([]);
  3949. if (toolTipOption.xAxisLabel) {
  3950. var labelText = opts.categories[opts.tooltip.index];
  3951. context.setFontSize(config.fontSize);
  3952. var textWidth = measureText(labelText, config.fontSize);
  3953. var textX = offsetX - 0.5 * textWidth;
  3954. var textY = endY;
  3955. context.beginPath();
  3956. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  3957. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  3958. context.setLineWidth(1 * opts.pixelRatio);
  3959. context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * config.toolTipPadding);
  3960. context.closePath();
  3961. context.stroke();
  3962. context.fill();
  3963. context.beginPath();
  3964. context.setFontSize(config.fontSize);
  3965. context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
  3966. context.fillText(String(labelText), textX, textY + config.toolTipPadding + config.fontSize);
  3967. context.closePath();
  3968. context.stroke();
  3969. }
  3970. }
  3971. function drawMarkLine(minRange, maxRange, opts, config, context) {
  3972. var markLineOption = assign({}, {
  3973. type: 'solid',
  3974. dashLength: 4,
  3975. data: [] },
  3976. opts.extra.markLine);
  3977. var startX = opts.area[3];
  3978. var endX = opts.width - opts.padding[1];
  3979. var points = calMarkLineData(minRange, maxRange, markLineOption.data, opts);
  3980. for (var i = 0; i < points.length; i++) {
  3981. var item = assign({}, {
  3982. lineColor: '#DE4A42',
  3983. showLabel: false,
  3984. labelFontColor: '#666666',
  3985. labelBgColor: '#DFE8FF',
  3986. labelBgOpacity: 0.8,
  3987. yAxisIndex: 0 },
  3988. points[i]);
  3989. if (markLineOption.type == 'dash') {
  3990. context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]);
  3991. }
  3992. context.setStrokeStyle(item.lineColor);
  3993. context.setLineWidth(1 * opts.pixelRatio);
  3994. context.beginPath();
  3995. context.moveTo(startX, item.y);
  3996. context.lineTo(endX, item.y);
  3997. context.stroke();
  3998. context.setLineDash([]);
  3999. if (item.showLabel) {
  4000. var labelText = opts.yAxis.format ? opts.yAxis.format(Number(item.value)) : item.value;
  4001. context.setFontSize(config.fontSize);
  4002. var textWidth = measureText(labelText, config.fontSize);
  4003. var bgStartX = opts.padding[3] + config.yAxisTitleWidth - config.toolTipPadding;
  4004. var bgEndX = Math.max(opts.area[3], textWidth + config.toolTipPadding * 2);
  4005. var bgWidth = bgEndX - bgStartX;
  4006. var textX = bgStartX + (bgWidth - textWidth) / 2;
  4007. var textY = item.y;
  4008. context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity));
  4009. context.setStrokeStyle(item.labelBgColor);
  4010. context.setLineWidth(1 * opts.pixelRatio);
  4011. context.beginPath();
  4012. context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
  4013. context.closePath();
  4014. context.stroke();
  4015. context.fill();
  4016. context.beginPath();
  4017. context.setFontSize(config.fontSize);
  4018. context.setFillStyle(item.labelFontColor);
  4019. context.fillText(String(labelText), textX, textY + 0.5 * config.fontSize);
  4020. context.stroke();
  4021. }
  4022. }
  4023. }
  4024. function drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) {
  4025. var toolTipOption = assign({}, {
  4026. gridType: 'solid',
  4027. dashLength: 4 },
  4028. opts.extra.tooltip);
  4029. var startX = opts.area[3];
  4030. var endX = opts.width - opts.padding[1];
  4031. if (toolTipOption.gridType == 'dash') {
  4032. context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]);
  4033. }
  4034. context.setStrokeStyle(toolTipOption.gridColor || '#cccccc');
  4035. context.setLineWidth(1 * opts.pixelRatio);
  4036. context.beginPath();
  4037. context.moveTo(startX, opts.tooltip.offset.y);
  4038. context.lineTo(endX, opts.tooltip.offset.y);
  4039. context.stroke();
  4040. context.setLineDash([]);
  4041. if (toolTipOption.yAxisLabel) {
  4042. var labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing);
  4043. context.setFontSize(config.fontSize);
  4044. var textWidth = measureText(labelText, config.fontSize);
  4045. var bgStartX = opts.padding[3] + config.yAxisTitleWidth - config.toolTipPadding;
  4046. var bgEndX = Math.max(opts.area[3], textWidth + config.toolTipPadding * 2);
  4047. var bgWidth = bgEndX - bgStartX;
  4048. var textX = bgStartX + (bgWidth - textWidth) / 2;
  4049. var textY = opts.tooltip.offset.y;
  4050. context.beginPath();
  4051. context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption.labelBgOpacity || config.toolTipOpacity));
  4052. context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground);
  4053. context.setLineWidth(1 * opts.pixelRatio);
  4054. context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * config.toolTipPadding);
  4055. context.closePath();
  4056. context.stroke();
  4057. context.fill();
  4058. context.beginPath();
  4059. context.setFontSize(config.fontSize);
  4060. context.setFillStyle(toolTipOption.labelFontColor || config.fontColor);
  4061. context.fillText(labelText, textX, textY + 0.5 * config.fontSize);
  4062. context.closePath();
  4063. context.stroke();
  4064. }
  4065. }
  4066. function drawToolTipSplitArea(offsetX, opts, config, context, eachSpacing) {
  4067. var toolTipOption = assign({}, {
  4068. activeBgColor: '#000000',
  4069. activeBgOpacity: 0.08 },
  4070. opts.extra.tooltip);
  4071. var startY = opts.area[0];
  4072. var endY = opts.height - opts.area[2];
  4073. context.beginPath();
  4074. context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity));
  4075. context.rect(offsetX - eachSpacing / 2, startY, eachSpacing, endY - startY);
  4076. context.closePath();
  4077. context.fill();
  4078. }
  4079. function drawToolTip(textList, offset, opts, config, context, eachSpacing, xAxisPoints) {
  4080. var toolTipOption = assign({}, {
  4081. bgColor: '#000000',
  4082. bgOpacity: 0.7,
  4083. fontColor: '#FFFFFF' },
  4084. opts.extra.tooltip);
  4085. var legendWidth = 4 * opts.pixelRatio;
  4086. var legendMarginRight = 5 * opts.pixelRatio;
  4087. var arrowWidth = 8 * opts.pixelRatio;
  4088. var isOverRightBorder = false;
  4089. if (opts.type == 'line' || opts.type == 'area' || opts.type == 'candle' || opts.type == 'mix') {
  4090. drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context);
  4091. }
  4092. offset = assign({
  4093. x: 0,
  4094. y: 0 },
  4095. offset);
  4096. offset.y -= 8 * opts.pixelRatio;
  4097. var textWidth = textList.map(function (item) {
  4098. return measureText(item.text, config.fontSize);
  4099. });
  4100. var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth);
  4101. var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight;
  4102. // if beyond the right border
  4103. if (offset.x - Math.abs(opts._scrollDistance_) + arrowWidth + toolTipWidth > opts.width) {
  4104. isOverRightBorder = true;
  4105. }
  4106. if (toolTipHeight + offset.y > opts.height) {
  4107. offset.y = opts.height - toolTipHeight;
  4108. }
  4109. // draw background rect
  4110. context.beginPath();
  4111. context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config.toolTipOpacity));
  4112. if (isOverRightBorder) {
  4113. context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4114. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
  4115. context.lineTo(offset.x - arrowWidth, offset.y);
  4116. context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y);
  4117. context.lineTo(offset.x - arrowWidth - Math.round(toolTipWidth), offset.y + toolTipHeight);
  4118. context.lineTo(offset.x - arrowWidth, offset.y + toolTipHeight);
  4119. context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
  4120. context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4121. } else {
  4122. context.moveTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4123. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio - 5 * opts.pixelRatio);
  4124. context.lineTo(offset.x + arrowWidth, offset.y);
  4125. context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y);
  4126. context.lineTo(offset.x + arrowWidth + Math.round(toolTipWidth), offset.y + toolTipHeight);
  4127. context.lineTo(offset.x + arrowWidth, offset.y + toolTipHeight);
  4128. context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pixelRatio + 5 * opts.pixelRatio);
  4129. context.lineTo(offset.x, offset.y + 10 * opts.pixelRatio);
  4130. }
  4131. context.closePath();
  4132. context.fill();
  4133. // draw legend
  4134. textList.forEach(function (item, index) {
  4135. if (item.color !== null) {
  4136. context.beginPath();
  4137. context.setFillStyle(item.color);
  4138. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding;
  4139. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
  4140. config.toolTipPadding + 1;
  4141. if (isOverRightBorder) {
  4142. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding;
  4143. }
  4144. context.fillRect(startX, startY, legendWidth, config.fontSize);
  4145. context.closePath();
  4146. }
  4147. });
  4148. // draw text list
  4149. textList.forEach(function (item, index) {
  4150. var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight;
  4151. if (isOverRightBorder) {
  4152. startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + legendMarginRight;
  4153. }
  4154. var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * index +
  4155. config.toolTipPadding;
  4156. context.beginPath();
  4157. context.setFontSize(config.fontSize);
  4158. context.setFillStyle(toolTipOption.fontColor);
  4159. context.fillText(item.text, startX, startY + config.fontSize);
  4160. context.closePath();
  4161. context.stroke();
  4162. });
  4163. }
  4164. function drawYAxisTitle(title, opts, config, context) {
  4165. var startX = config.xAxisHeight + (opts.height - config.xAxisHeight - measureText(title)) / 2;
  4166. context.save();
  4167. context.beginPath();
  4168. context.setFontSize(config.fontSize);
  4169. context.setFillStyle(opts.yAxis.titleFontColor || '#333333');
  4170. context.translate(0, opts.height);
  4171. context.rotate(-90 * Math.PI / 180);
  4172. context.fillText(title, startX, opts.padding[3] + 0.5 * config.fontSize);
  4173. context.closePath();
  4174. context.stroke();
  4175. context.restore();
  4176. }
  4177. function drawColumnDataPoints(series, opts, config, context) {
  4178. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4179. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4180. var xAxisData = opts.chartData.xAxisData,
  4181. xAxisPoints = xAxisData.xAxisPoints,
  4182. eachSpacing = xAxisData.eachSpacing;
  4183. var columnOption = assign({}, {
  4184. type: 'group',
  4185. width: eachSpacing / 2,
  4186. meter: {
  4187. border: 4,
  4188. fillColor: '#FFFFFF' } },
  4189. opts.extra.column);
  4190. var minRange = ranges.pop();
  4191. var maxRange = ranges.shift();
  4192. var calPoints = [];
  4193. context.save();
  4194. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4195. context.translate(opts._scrollDistance_, 0);
  4196. }
  4197. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  4198. drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing);
  4199. }
  4200. series.forEach(function (eachSeries, seriesIndex) {
  4201. var data = eachSeries.data;
  4202. switch (columnOption.type) {
  4203. case 'group':
  4204. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4205. var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, series, process);
  4206. calPoints.push(tooltipPoints);
  4207. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  4208. points.forEach(function (item, index) {
  4209. if (item !== null) {
  4210. context.beginPath();
  4211. context.setStrokeStyle(item.color || eachSeries.color);
  4212. context.setLineWidth(1);
  4213. context.setFillStyle(item.color || eachSeries.color);
  4214. var startX = item.x - item.width / 2;
  4215. var height = opts.height - item.y - opts.area[2];
  4216. context.moveTo(startX - 1, item.y);
  4217. context.lineTo(startX + item.width - 2, item.y);
  4218. context.lineTo(startX + item.width - 2, opts.height - opts.area[2]);
  4219. context.lineTo(startX, opts.height - opts.area[2]);
  4220. context.lineTo(startX, item.y);
  4221. //context.rect(startX, item.y, item.width, height);
  4222. context.closePath();
  4223. context.stroke();
  4224. context.fill();
  4225. }
  4226. });
  4227. break;
  4228. case 'stack':
  4229. // 绘制堆叠数据图
  4230. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
  4231. seriesIndex,
  4232. series, process);
  4233. calPoints.push(points);
  4234. points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series);
  4235. points.forEach(function (item, index) {
  4236. if (item !== null) {
  4237. context.beginPath();
  4238. context.setFillStyle(item.color || eachSeries.color);
  4239. var startX = item.x - item.width / 2 + 1;
  4240. var height = opts.height - item.y - opts.area[2];
  4241. var height0 = opts.height - item.y0 - opts.area[2];
  4242. if (seriesIndex > 0) {
  4243. height -= height0;
  4244. }
  4245. context.moveTo(startX, item.y);
  4246. context.fillRect(startX, item.y, item.width - 2, height);
  4247. context.closePath();
  4248. context.fill();
  4249. }
  4250. });
  4251. break;
  4252. case 'meter':
  4253. // 绘制温度计数据图
  4254. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4255. calPoints.push(points);
  4256. points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, columnOption.meter.
  4257. border);
  4258. if (seriesIndex == 0) {
  4259. points.forEach(function (item, index) {
  4260. if (item !== null) {
  4261. //画背景颜色
  4262. context.beginPath();
  4263. context.setFillStyle(columnOption.meter.fillColor);
  4264. var startX = item.x - item.width / 2;
  4265. var height = opts.height - item.y - opts.area[2];
  4266. context.moveTo(startX, item.y);
  4267. context.fillRect(startX, item.y, item.width, height);
  4268. context.closePath();
  4269. context.fill();
  4270. //画边框线
  4271. if (columnOption.meter.border > 0) {
  4272. context.beginPath();
  4273. context.setStrokeStyle(eachSeries.color);
  4274. context.setLineWidth(columnOption.meter.border * opts.pixelRatio);
  4275. context.moveTo(startX + columnOption.meter.border * 0.5, item.y + height);
  4276. context.lineTo(startX + columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
  4277. context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + columnOption.meter.border * 0.5);
  4278. context.lineTo(startX + item.width - columnOption.meter.border * 0.5, item.y + height);
  4279. context.stroke();
  4280. }
  4281. }
  4282. });
  4283. } else {
  4284. points.forEach(function (item, index) {
  4285. if (item !== null) {
  4286. context.beginPath();
  4287. context.setFillStyle(item.color || eachSeries.color);
  4288. var startX = item.x - item.width / 2;
  4289. var height = opts.height - item.y - opts.area[2];
  4290. context.moveTo(startX, item.y);
  4291. context.fillRect(startX, item.y, item.width, height);
  4292. context.closePath();
  4293. context.fill();
  4294. }
  4295. });
  4296. }
  4297. break;}
  4298. });
  4299. if (opts.dataLabel !== false && process === 1) {
  4300. series.forEach(function (eachSeries, seriesIndex) {
  4301. var data = eachSeries.data;
  4302. switch (columnOption.type) {
  4303. case 'group':
  4304. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4305. points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts);
  4306. drawPointText(points, eachSeries, config, context);
  4307. break;
  4308. case 'stack':
  4309. var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config,
  4310. seriesIndex,
  4311. series, process);
  4312. drawPointText(points, eachSeries, config, context);
  4313. break;
  4314. case 'meter':
  4315. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4316. drawPointText(points, eachSeries, config, context);
  4317. break;}
  4318. });
  4319. }
  4320. context.restore();
  4321. return {
  4322. xAxisPoints: xAxisPoints,
  4323. calPoints: calPoints,
  4324. eachSpacing: eachSpacing,
  4325. minRange: minRange,
  4326. maxRange: maxRange };
  4327. }
  4328. function drawCandleDataPoints(series, seriesMA, opts, config, context) {
  4329. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  4330. var candleOption = assign({}, {
  4331. color: {},
  4332. average: {} },
  4333. opts.extra.candle);
  4334. candleOption.color = assign({}, {
  4335. upLine: '#f04864',
  4336. upFill: '#f04864',
  4337. downLine: '#2fc25b',
  4338. downFill: '#2fc25b' },
  4339. candleOption.color);
  4340. candleOption.average = assign({}, {
  4341. show: false,
  4342. name: [],
  4343. day: [],
  4344. color: config.colors },
  4345. candleOption.average);
  4346. opts.extra.candle = candleOption;
  4347. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4348. var xAxisData = opts.chartData.xAxisData,
  4349. xAxisPoints = xAxisData.xAxisPoints,
  4350. eachSpacing = xAxisData.eachSpacing;
  4351. var minRange = ranges.pop();
  4352. var maxRange = ranges.shift();
  4353. var calPoints = [];
  4354. context.save();
  4355. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4356. context.translate(opts._scrollDistance_, 0);
  4357. }
  4358. //画均线
  4359. if (candleOption.average.show) {
  4360. seriesMA.forEach(function (eachSeries, seriesIndex) {
  4361. var data = eachSeries.data;
  4362. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4363. //calPoints.push(points);
  4364. var splitPointList = splitPoints(points);
  4365. splitPointList.forEach(function (points, index) {
  4366. context.beginPath();
  4367. context.setStrokeStyle(eachSeries.color);
  4368. context.setLineWidth(1);
  4369. if (points.length === 1) {
  4370. context.moveTo(points[0].x, points[0].y);
  4371. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4372. } else {
  4373. context.moveTo(points[0].x, points[0].y);
  4374. points.forEach(function (item, index) {
  4375. if (index > 0) {
  4376. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4377. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4378. item.x, item.
  4379. y);
  4380. }
  4381. });
  4382. context.moveTo(points[0].x, points[0].y);
  4383. }
  4384. context.closePath();
  4385. context.stroke();
  4386. });
  4387. });
  4388. }
  4389. //画K线
  4390. series.forEach(function (eachSeries, seriesIndex) {
  4391. var data = eachSeries.data;
  4392. var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4393. calPoints.push(points);
  4394. var splitPointList = splitPoints(points);
  4395. splitPointList = splitPointList[0];
  4396. splitPointList.forEach(function (points, index) {
  4397. context.beginPath();
  4398. //如果上涨
  4399. if (data[index][1] - data[index][0] > 0) {
  4400. context.setStrokeStyle(candleOption.color.upLine);
  4401. context.setFillStyle(candleOption.color.upFill);
  4402. context.setLineWidth(1 * opts.pixelRatio);
  4403. context.moveTo(points[3].x, points[3].y); //顶点
  4404. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4405. context.lineTo(points[1].x - eachSpacing / 4, points[1].y); //收盘左侧点
  4406. context.lineTo(points[0].x - eachSpacing / 4, points[0].y); //开盘左侧点
  4407. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4408. context.lineTo(points[2].x, points[2].y); //底点
  4409. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4410. context.lineTo(points[0].x + eachSpacing / 4, points[0].y); //开盘右侧点
  4411. context.lineTo(points[1].x + eachSpacing / 4, points[1].y); //收盘右侧点
  4412. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4413. context.moveTo(points[3].x, points[3].y); //顶点
  4414. } else {
  4415. context.setStrokeStyle(candleOption.color.downLine);
  4416. context.setFillStyle(candleOption.color.downFill);
  4417. context.setLineWidth(1 * opts.pixelRatio);
  4418. context.moveTo(points[3].x, points[3].y); //顶点
  4419. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4420. context.lineTo(points[0].x - eachSpacing / 4, points[0].y); //开盘左侧点
  4421. context.lineTo(points[1].x - eachSpacing / 4, points[1].y); //收盘左侧点
  4422. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4423. context.lineTo(points[2].x, points[2].y); //底点
  4424. context.lineTo(points[1].x, points[1].y); //收盘中间点
  4425. context.lineTo(points[1].x + eachSpacing / 4, points[1].y); //收盘右侧点
  4426. context.lineTo(points[0].x + eachSpacing / 4, points[0].y); //开盘右侧点
  4427. context.lineTo(points[0].x, points[0].y); //开盘中间点
  4428. context.moveTo(points[3].x, points[3].y); //顶点
  4429. }
  4430. context.closePath();
  4431. context.fill();
  4432. context.stroke();
  4433. });
  4434. });
  4435. context.restore();
  4436. return {
  4437. xAxisPoints: xAxisPoints,
  4438. calPoints: calPoints,
  4439. eachSpacing: eachSpacing,
  4440. minRange: minRange,
  4441. maxRange: maxRange };
  4442. }
  4443. function drawAreaDataPoints(series, opts, config, context) {
  4444. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4445. var areaOption = assign({}, {
  4446. type: 'straight',
  4447. opacity: 0.2,
  4448. addLine: false,
  4449. width: 2 },
  4450. opts.extra.area);
  4451. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4452. var xAxisData = opts.chartData.xAxisData,
  4453. xAxisPoints = xAxisData.xAxisPoints,
  4454. eachSpacing = xAxisData.eachSpacing;
  4455. var minRange = ranges.pop();
  4456. var maxRange = ranges.shift();
  4457. var endY = opts.height - opts.area[2];
  4458. var calPoints = [];
  4459. context.save();
  4460. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4461. context.translate(opts._scrollDistance_, 0);
  4462. }
  4463. series.forEach(function (eachSeries, seriesIndex) {
  4464. var data = eachSeries.data;
  4465. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4466. calPoints.push(points);
  4467. var splitPointList = splitPoints(points);var _loop3 = function _loop3(
  4468. i) {
  4469. var points = splitPointList[i];
  4470. // 绘制区域数
  4471. context.beginPath();
  4472. context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  4473. context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity));
  4474. context.setLineWidth(areaOption.width * opts.pixelRatio);
  4475. if (points.length > 1) {
  4476. var firstPoint = points[0];
  4477. var lastPoint = points[points.length - 1];
  4478. context.moveTo(firstPoint.x, firstPoint.y);
  4479. if (areaOption.type === 'curve') {
  4480. points.forEach(function (item, index) {
  4481. if (index > 0) {
  4482. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4483. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4484. }
  4485. });
  4486. } else {
  4487. points.forEach(function (item, index) {
  4488. if (index > 0) {
  4489. context.lineTo(item.x, item.y);
  4490. }
  4491. });
  4492. }
  4493. context.lineTo(lastPoint.x, endY);
  4494. context.lineTo(firstPoint.x, endY);
  4495. context.lineTo(firstPoint.x, firstPoint.y);
  4496. } else {
  4497. var item = points[0];
  4498. context.moveTo(item.x - eachSpacing / 2, item.y);
  4499. context.lineTo(item.x + eachSpacing / 2, item.y);
  4500. context.lineTo(item.x + eachSpacing / 2, endY);
  4501. context.lineTo(item.x - eachSpacing / 2, endY);
  4502. context.moveTo(item.x - eachSpacing / 2, item.y);
  4503. }
  4504. context.closePath();
  4505. context.fill();
  4506. //画连线
  4507. if (areaOption.addLine) {
  4508. context.beginPath();
  4509. context.setStrokeStyle(eachSeries.color);
  4510. context.setLineWidth(areaOption.width * opts.pixelRatio);
  4511. if (points.length === 1) {
  4512. context.moveTo(points[0].x, points[0].y);
  4513. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4514. } else {
  4515. context.moveTo(points[0].x, points[0].y);
  4516. if (areaOption.type === 'curve') {
  4517. points.forEach(function (item, index) {
  4518. if (index > 0) {
  4519. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4520. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4521. }
  4522. });
  4523. } else {
  4524. points.forEach(function (item, index) {
  4525. if (index > 0) {
  4526. context.lineTo(item.x, item.y);
  4527. }
  4528. });
  4529. }
  4530. context.moveTo(points[0].x, points[0].y);
  4531. }
  4532. context.closePath();
  4533. context.stroke();
  4534. }};for (var i = 0; i < splitPointList.length; i++) {_loop3(i);
  4535. }
  4536. //画点
  4537. if (opts.dataPointShape !== false) {
  4538. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4539. drawPointShape(points, eachSeries.color, shape, context, opts);
  4540. }
  4541. });
  4542. if (opts.dataLabel !== false && process === 1) {
  4543. series.forEach(function (eachSeries, seriesIndex) {
  4544. var data = eachSeries.data;
  4545. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4546. drawPointText(points, eachSeries, config, context);
  4547. });
  4548. }
  4549. context.restore();
  4550. return {
  4551. xAxisPoints: xAxisPoints,
  4552. calPoints: calPoints,
  4553. eachSpacing: eachSpacing,
  4554. minRange: minRange,
  4555. maxRange: maxRange };
  4556. }
  4557. function drawLineDataPoints(series, opts, config, context) {
  4558. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4559. var lineOption = opts.extra.line || {
  4560. type: 'straight',
  4561. width: 2 };
  4562. lineOption.type = lineOption.type ? lineOption.type : 'straight';
  4563. lineOption.width = lineOption.width ? lineOption.width : 2;
  4564. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4565. var xAxisData = opts.chartData.xAxisData,
  4566. xAxisPoints = xAxisData.xAxisPoints,
  4567. eachSpacing = xAxisData.eachSpacing;
  4568. var minRange = ranges.pop();
  4569. var maxRange = ranges.shift();
  4570. var calPoints = [];
  4571. context.save();
  4572. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4573. context.translate(opts._scrollDistance_, 0);
  4574. }
  4575. series.forEach(function (eachSeries, seriesIndex) {
  4576. var data = eachSeries.data;
  4577. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4578. calPoints.push(points);
  4579. var splitPointList = splitPoints(points);
  4580. splitPointList.forEach(function (points, index) {
  4581. context.beginPath();
  4582. context.setStrokeStyle(eachSeries.color);
  4583. context.setLineWidth(lineOption.width * opts.pixelRatio);
  4584. if (points.length === 1) {
  4585. context.moveTo(points[0].x, points[0].y);
  4586. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4587. } else {
  4588. context.moveTo(points[0].x, points[0].y);
  4589. if (lineOption.type === 'curve') {
  4590. points.forEach(function (item, index) {
  4591. if (index > 0) {
  4592. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4593. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4594. item.x, item.
  4595. y);
  4596. }
  4597. });
  4598. } else {
  4599. points.forEach(function (item, index) {
  4600. if (index > 0) {
  4601. context.lineTo(item.x, item.y);
  4602. }
  4603. });
  4604. }
  4605. context.moveTo(points[0].x, points[0].y);
  4606. }
  4607. context.closePath();
  4608. context.stroke();
  4609. });
  4610. if (opts.dataPointShape !== false) {
  4611. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4612. drawPointShape(points, eachSeries.color, shape, context, opts);
  4613. }
  4614. });
  4615. if (opts.dataLabel !== false && process === 1) {
  4616. series.forEach(function (eachSeries, seriesIndex) {
  4617. var data = eachSeries.data;
  4618. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4619. drawPointText(points, eachSeries, config, context);
  4620. });
  4621. }
  4622. context.restore();
  4623. return {
  4624. xAxisPoints: xAxisPoints,
  4625. calPoints: calPoints,
  4626. eachSpacing: eachSpacing,
  4627. minRange: minRange,
  4628. maxRange: maxRange };
  4629. }
  4630. function drawMixDataPoints(series, opts, config, context) {
  4631. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  4632. var ranges = [].concat(opts.chartData.yAxisData.ranges);
  4633. var xAxisData = opts.chartData.xAxisData,
  4634. xAxisPoints = xAxisData.xAxisPoints,
  4635. eachSpacing = xAxisData.eachSpacing;
  4636. var minRange = ranges.pop();
  4637. var maxRange = ranges.shift();
  4638. var endY = opts.height - opts.area[2];
  4639. var calPoints = [];
  4640. var columnIndex = 0;
  4641. var columnLength = 0;
  4642. series.forEach(function (eachSeries, seriesIndex) {
  4643. if (eachSeries.type == 'column') {
  4644. columnLength += 1;
  4645. }
  4646. });
  4647. context.save();
  4648. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4649. context.translate(opts._scrollDistance_, 0);
  4650. }
  4651. series.forEach(function (eachSeries, seriesIndex) {
  4652. var data = eachSeries.data;
  4653. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4654. calPoints.push(points);
  4655. // 绘制柱状数据图
  4656. if (eachSeries.type == 'column') {
  4657. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  4658. points.forEach(function (item, index) {
  4659. if (item !== null) {
  4660. context.beginPath();
  4661. context.setStrokeStyle(item.color || eachSeries.color);
  4662. context.setLineWidth(1);
  4663. context.setFillStyle(item.color || eachSeries.color);
  4664. var startX = item.x - item.width / 2;
  4665. var height = opts.height - item.y - opts.area[2];
  4666. context.moveTo(startX, item.y);
  4667. context.moveTo(startX - 1, item.y);
  4668. context.lineTo(startX + item.width - 2, item.y);
  4669. context.lineTo(startX + item.width - 2, opts.height - opts.area[2]);
  4670. context.lineTo(startX, opts.height - opts.area[2]);
  4671. context.lineTo(startX, item.y);
  4672. //context.rect(startX, item.y, item.width, height);
  4673. context.closePath();
  4674. context.stroke();
  4675. context.fill();
  4676. context.closePath();
  4677. context.fill();
  4678. }
  4679. });
  4680. columnIndex += 1;
  4681. }
  4682. //绘制区域图数据
  4683. if (eachSeries.type == 'area') {
  4684. var _splitPointList = splitPoints(points);var _loop4 = function _loop4(
  4685. i) {
  4686. var points = _splitPointList[i];
  4687. // 绘制区域数据
  4688. context.beginPath();
  4689. context.setStrokeStyle(eachSeries.color);
  4690. context.setFillStyle(hexToRgb(eachSeries.color, 0.2));
  4691. context.setLineWidth(2 * opts.pixelRatio);
  4692. if (points.length > 1) {
  4693. firstPoint = points[0];
  4694. var lastPoint = points[points.length - 1];
  4695. context.moveTo(firstPoint.x, firstPoint.y);
  4696. if (eachSeries.style === 'curve') {
  4697. points.forEach(function (item, index) {
  4698. if (index > 0) {
  4699. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4700. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y, item.x, item.y);
  4701. }
  4702. });
  4703. } else {
  4704. points.forEach(function (item, index) {
  4705. if (index > 0) {
  4706. context.lineTo(item.x, item.y);
  4707. }
  4708. });
  4709. }
  4710. context.lineTo(lastPoint.x, endY);
  4711. context.lineTo(firstPoint.x, endY);
  4712. context.lineTo(firstPoint.x, firstPoint.y);
  4713. } else {
  4714. var item = points[0];
  4715. context.moveTo(item.x - eachSpacing / 2, item.y);
  4716. context.lineTo(item.x + eachSpacing / 2, item.y);
  4717. context.lineTo(item.x + eachSpacing / 2, endY);
  4718. context.lineTo(item.x - eachSpacing / 2, endY);
  4719. context.moveTo(item.x - eachSpacing / 2, item.y);
  4720. }
  4721. context.closePath();
  4722. context.fill();};for (var i = 0; i < _splitPointList.length; i++) {var firstPoint;_loop4(i);
  4723. }
  4724. }
  4725. // 绘制折线数据图
  4726. if (eachSeries.type == 'line') {
  4727. var splitPointList = splitPoints(points);
  4728. splitPointList.forEach(function (points, index) {
  4729. context.beginPath();
  4730. context.setStrokeStyle(eachSeries.color);
  4731. context.setLineWidth(2 * opts.pixelRatio);
  4732. if (points.length === 1) {
  4733. context.moveTo(points[0].x, points[0].y);
  4734. context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI);
  4735. } else {
  4736. context.moveTo(points[0].x, points[0].y);
  4737. if (eachSeries.style == 'curve') {
  4738. points.forEach(function (item, index) {
  4739. if (index > 0) {
  4740. var ctrlPoint = createCurveControlPoints(points, index - 1);
  4741. context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, ctrlPoint.ctrB.y,
  4742. item.x,
  4743. item.y);
  4744. }
  4745. });
  4746. } else {
  4747. points.forEach(function (item, index) {
  4748. if (index > 0) {
  4749. context.lineTo(item.x, item.y);
  4750. }
  4751. });
  4752. }
  4753. context.moveTo(points[0].x, points[0].y);
  4754. }
  4755. context.closePath();
  4756. context.stroke();
  4757. });
  4758. }
  4759. // 绘制点数据图
  4760. if (eachSeries.type == 'point') {
  4761. points.forEach(function (pointsa, index) {
  4762. if (pointsa) {
  4763. context.beginPath();
  4764. context.setFillStyle(eachSeries.color);
  4765. context.setStrokeStyle('#FFFFFF');
  4766. context.setLineWidth(1 * opts.pixelRatio);
  4767. context.moveTo(pointsa.x + 3.5 * opts.pixelRatio, pointsa.y);
  4768. context.arc(pointsa.x, pointsa.y, 4 * opts.pixelRatio, 0, 2 * Math.PI);
  4769. context.closePath();
  4770. context.fill();
  4771. context.stroke();
  4772. }
  4773. });
  4774. }
  4775. if (eachSeries.addPoint == true && eachSeries.type !== 'column') {
  4776. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  4777. drawPointShape(points, eachSeries.color, shape, context, opts);
  4778. }
  4779. });
  4780. if (opts.dataLabel !== false && process === 1) {
  4781. var columnIndex = 0;
  4782. series.forEach(function (eachSeries, seriesIndex) {
  4783. var data = eachSeries.data;
  4784. var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process);
  4785. if (eachSeries.type !== 'column') {
  4786. drawPointText(points, eachSeries, config, context);
  4787. } else {
  4788. points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts);
  4789. drawPointText(points, eachSeries, config, context);
  4790. columnIndex += 1;
  4791. }
  4792. });
  4793. }
  4794. context.restore();
  4795. return {
  4796. xAxisPoints: xAxisPoints,
  4797. calPoints: calPoints,
  4798. eachSpacing: eachSpacing,
  4799. minRange: minRange,
  4800. maxRange: maxRange };
  4801. }
  4802. function drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints) {
  4803. var toolTipOption = opts.extra.tooltip || {};
  4804. if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || opts.type == 'column' || opts.type == 'candle' || opts.type == 'mix')) {
  4805. drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints);
  4806. }
  4807. context.save();
  4808. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) {
  4809. context.translate(opts._scrollDistance_, 0);
  4810. }
  4811. if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) {
  4812. drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints);
  4813. }
  4814. context.restore();
  4815. }
  4816. function drawXAxis(categories, opts, config, context) {
  4817. var xAxisData = opts.chartData.xAxisData,
  4818. xAxisPoints = xAxisData.xAxisPoints,
  4819. startX = xAxisData.startX,
  4820. endX = xAxisData.endX,
  4821. eachSpacing = xAxisData.eachSpacing;
  4822. var boundaryGap = 'center';
  4823. if (opts.type == 'line' || opts.type == 'area') {
  4824. boundaryGap = opts.xAxis.boundaryGap;
  4825. }
  4826. var startY = opts.height - opts.area[2];
  4827. var endY = opts.area[0];
  4828. //绘制滚动条
  4829. if (opts.enableScroll && opts.xAxis.scrollShow) {
  4830. var scrollY = opts.height - opts.area[2] + config.xAxisHeight;
  4831. var scrollScreenWidth = endX - startX;
  4832. var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1);
  4833. var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth;
  4834. var scrollLeft = 0;
  4835. if (opts._scrollDistance_) {
  4836. scrollLeft = -opts._scrollDistance_ * scrollScreenWidth / scrollTotalWidth;
  4837. }
  4838. context.beginPath();
  4839. context.setLineCap('round');
  4840. context.setLineWidth(6 * opts.pixelRatio);
  4841. context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF");
  4842. context.moveTo(startX, scrollY);
  4843. context.lineTo(endX, scrollY);
  4844. context.stroke();
  4845. context.closePath();
  4846. context.beginPath();
  4847. context.setLineCap('round');
  4848. context.setLineWidth(6 * opts.pixelRatio);
  4849. context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6");
  4850. context.moveTo(startX + scrollLeft, scrollY);
  4851. context.lineTo(startX + scrollLeft + scrollWidth, scrollY);
  4852. context.stroke();
  4853. context.closePath();
  4854. context.setLineCap('butt');
  4855. }
  4856. context.save();
  4857. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  4858. context.translate(opts._scrollDistance_, 0);
  4859. }
  4860. if (opts.xAxis.disableGrid !== true) {
  4861. context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc");
  4862. context.setLineCap('butt');
  4863. context.setLineWidth(1 * opts.pixelRatio);
  4864. if (opts.xAxis.gridType == 'dash') {
  4865. context.setLineDash([opts.xAxis.dashLength, opts.xAxis.dashLength]);
  4866. }
  4867. if (opts.xAxis.type === 'calibration') {
  4868. xAxisPoints.forEach(function (item, index) {
  4869. if (index > 0) {
  4870. context.beginPath();
  4871. context.moveTo(item - eachSpacing / 2, startY);
  4872. context.lineTo(item - eachSpacing / 2, startY + 4 * opts.pixelRatio);
  4873. context.closePath();
  4874. context.stroke();
  4875. }
  4876. });
  4877. } else {
  4878. opts.xAxis.gridEval = opts.xAxis.gridEval || 1;
  4879. xAxisPoints.forEach(function (item, index) {
  4880. if (index % opts.xAxis.gridEval == 0) {
  4881. context.beginPath();
  4882. context.moveTo(item, startY);
  4883. context.lineTo(item, endY);
  4884. context.stroke();
  4885. }
  4886. });
  4887. }
  4888. context.setLineDash([]);
  4889. }
  4890. //不绘制X轴
  4891. if (opts.xAxis.disabled !== true) {
  4892. // 对X轴列表做抽稀处理
  4893. var validWidth = opts.width - opts.padding[1] - opts.padding[3] - config.yAxisWidth - config.yAxisTitleWidth;
  4894. //默认全部显示X轴标签
  4895. var maxXAxisListLength = categories.length;
  4896. //如果设置了X轴单屏数量
  4897. if (opts.xAxis.labelCount) {
  4898. //如果设置X轴密度
  4899. if (opts.xAxis.itemCount) {
  4900. maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount);
  4901. } else {
  4902. maxXAxisListLength = opts.xAxis.labelCount;
  4903. }
  4904. maxXAxisListLength -= 1;
  4905. }
  4906. var ratio = Math.ceil(categories.length / maxXAxisListLength);
  4907. var newCategories = [];
  4908. var cgLength = categories.length;
  4909. for (var i = 0; i < cgLength; i++) {
  4910. if (i % ratio !== 0) {
  4911. newCategories.push("");
  4912. } else {
  4913. newCategories.push(categories[i]);
  4914. }
  4915. }
  4916. newCategories[cgLength - 1] = categories[cgLength - 1];
  4917. var xAxisFontSize = opts.xAxis.fontSize || config.fontSize;
  4918. if (config._xAxisTextAngle_ === 0) {
  4919. newCategories.forEach(function (item, index) {
  4920. var offset = -measureText(item, xAxisFontSize) / 2;
  4921. if (boundaryGap == 'center') {
  4922. offset += eachSpacing / 2;
  4923. }
  4924. context.beginPath();
  4925. context.setFontSize(xAxisFontSize);
  4926. context.setFillStyle(opts.xAxis.fontColor || '#666666');
  4927. context.fillText(item, xAxisPoints[index] + offset, startY + xAxisFontSize + (config.xAxisHeight - xAxisFontSize) / 2);
  4928. context.closePath();
  4929. context.stroke();
  4930. });
  4931. } else {
  4932. newCategories.forEach(function (item, index) {
  4933. context.save();
  4934. context.beginPath();
  4935. context.setFontSize(xAxisFontSize);
  4936. context.setFillStyle(opts.xAxis.fontColor || '#666666');
  4937. var textWidth = measureText(item);
  4938. var offset = -textWidth;
  4939. if (boundaryGap == 'center') {
  4940. offset += eachSpacing / 2;
  4941. }
  4942. var _calRotateTranslate = calRotateTranslate(xAxisPoints[index] + eachSpacing / 2, startY + xAxisFontSize / 2 + 5, opts.height),
  4943. transX = _calRotateTranslate.transX,
  4944. transY = _calRotateTranslate.transY;
  4945. context.rotate(-1 * config._xAxisTextAngle_);
  4946. context.translate(transX, transY);
  4947. context.fillText(item, xAxisPoints[index] + offset, startY + xAxisFontSize + 5);
  4948. context.closePath();
  4949. context.stroke();
  4950. context.restore();
  4951. });
  4952. }
  4953. }
  4954. context.restore();
  4955. }
  4956. function drawYAxisGrid(categories, opts, config, context) {
  4957. if (opts.yAxis.disableGrid === true) {
  4958. return;
  4959. }
  4960. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4961. var eachSpacing = spacingValid / config.yAxisSplit;
  4962. var startX = opts.area[3];
  4963. var xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  4964. xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing;
  4965. var TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1);
  4966. var endX = startX + TotalWidth;
  4967. var points = [];
  4968. for (var i = 0; i < config.yAxisSplit + 1; i++) {
  4969. points.push(opts.height - opts.area[2] - eachSpacing * i);
  4970. }
  4971. context.save();
  4972. if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) {
  4973. context.translate(opts._scrollDistance_, 0);
  4974. }
  4975. if (opts.yAxis.gridType == 'dash') {
  4976. context.setLineDash([opts.yAxis.dashLength, opts.yAxis.dashLength]);
  4977. }
  4978. context.setStrokeStyle(opts.yAxis.gridColor || "#cccccc");
  4979. context.setLineWidth(1 * opts.pixelRatio);
  4980. points.forEach(function (item, index) {
  4981. context.beginPath();
  4982. context.moveTo(startX, item);
  4983. context.lineTo(endX, item);
  4984. context.stroke();
  4985. });
  4986. context.setLineDash([]);
  4987. context.restore();
  4988. }
  4989. function drawYAxis(series, opts, config, context) {
  4990. if (opts.yAxis.disabled === true) {
  4991. return;
  4992. }
  4993. var rangesFormat = opts.chartData.yAxisData.rangesFormat;
  4994. var spacingValid = opts.height - opts.area[0] - opts.area[2];
  4995. var eachSpacing = Math.floor(spacingValid / config.yAxisSplit);
  4996. var startX = opts.area[3];
  4997. var endX = opts.width - opts.area[1];
  4998. var endY = opts.height - opts.area[2];
  4999. var fillEndY = endY + config.xAxisHeight;
  5000. if (opts.xAxis.scrollShow) {
  5001. fillEndY -= 3 * opts.pixelRatio;
  5002. }
  5003. // set YAxis background
  5004. context.beginPath();
  5005. context.setFillStyle(opts.background || '#ffffff');
  5006. if (opts._scrollDistance_ < 0) {
  5007. context.fillRect(0, 0, startX, fillEndY);
  5008. }
  5009. if (opts.enableScroll == true) {
  5010. context.fillRect(endX, 0, opts.width, fillEndY);
  5011. }
  5012. context.closePath();
  5013. context.stroke();
  5014. var points = [];
  5015. for (var i = 0; i <= config.yAxisSplit; i++) {
  5016. points.push(opts.area[0] + eachSpacing * i);
  5017. }
  5018. var yAxisFontSize = opts.yAxis.fontSize || config.fontSize;
  5019. rangesFormat.forEach(function (item, index) {
  5020. var pos = points[index] ? points[index] : endY;
  5021. context.beginPath();
  5022. context.setFontSize(yAxisFontSize);
  5023. context.setFillStyle(opts.yAxis.fontColor || '#666666');
  5024. context.fillText(String(item), opts.area[3] - config.yAxisWidth, pos + yAxisFontSize / 2);
  5025. context.closePath();
  5026. context.stroke();
  5027. });
  5028. if (opts.yAxis.title) {
  5029. drawYAxisTitle(opts.yAxis.title, opts, config, context);
  5030. }
  5031. }
  5032. function drawLegend(series, opts, config, context, chartData) {
  5033. if (opts.legend.show === false) {
  5034. return;
  5035. }
  5036. var legendData = chartData.legendData;
  5037. var legendList = legendData.points;
  5038. var legendArea = legendData.area;
  5039. var padding = opts.legend.padding;
  5040. var fontSize = opts.legend.fontSize;
  5041. var shapeWidth = 15 * opts.pixelRatio;
  5042. var shapeRight = 5 * opts.pixelRatio;
  5043. var itemGap = opts.legend.itemGap;
  5044. var lineHeight = Math.max(opts.legend.lineHeight * opts.pixelRatio, fontSize);
  5045. //画背景及边框
  5046. context.beginPath();
  5047. context.setLineWidth(opts.legend.borderWidth);
  5048. context.setStrokeStyle(opts.legend.borderColor);
  5049. context.setFillStyle(opts.legend.backgroundColor);
  5050. context.moveTo(legendArea.start.x, legendArea.start.y);
  5051. context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height);
  5052. context.closePath();
  5053. context.fill();
  5054. context.stroke();
  5055. legendList.forEach(function (itemList, listIndex) {
  5056. var width = 0;
  5057. var height = 0;
  5058. width = legendData.widthArr[listIndex];
  5059. height = legendData.heightArr[listIndex];
  5060. var startX = 0;
  5061. var startY = 0;
  5062. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  5063. startX = legendArea.start.x + (legendArea.width - width) / 2;
  5064. startY = legendArea.start.y + padding + listIndex * lineHeight;
  5065. } else {
  5066. if (listIndex == 0) {
  5067. width = 0;
  5068. } else {
  5069. width = legendData.widthArr[listIndex - 1];
  5070. }
  5071. startX = legendArea.start.x + padding + width;
  5072. startY = legendArea.start.y + padding + (legendArea.height - height) / 2;
  5073. }
  5074. context.setFontSize(config.fontSize);
  5075. for (var i = 0; i < itemList.length; i++) {
  5076. var item = itemList[i];
  5077. item.area = [0, 0, 0, 0];
  5078. item.area[0] = startX;
  5079. item.area[1] = startY;
  5080. item.area[3] = startY + lineHeight;
  5081. context.beginPath();
  5082. context.setLineWidth(1 * opts.pixelRatio);
  5083. context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor);
  5084. context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor);
  5085. switch (item.legendShape) {
  5086. case 'line':
  5087. context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio);
  5088. context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pixelRatio, 15 * opts.pixelRatio, 4 * opts.pixelRatio);
  5089. break;
  5090. case 'triangle':
  5091. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5092. context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5093. context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5094. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5095. break;
  5096. case 'diamond':
  5097. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5098. context.lineTo(startX + 2.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5099. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight + 5 * opts.pixelRatio);
  5100. context.lineTo(startX + 12.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5101. context.lineTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5102. break;
  5103. case 'circle':
  5104. context.moveTo(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight);
  5105. context.arc(startX + 7.5 * opts.pixelRatio, startY + 0.5 * lineHeight, 5 * opts.pixelRatio, 0, 2 * Math.PI);
  5106. break;
  5107. case 'rect':
  5108. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5109. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);
  5110. break;
  5111. default:
  5112. context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio);
  5113. context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pixelRatio, 15 * opts.pixelRatio, 10 * opts.pixelRatio);}
  5114. context.closePath();
  5115. context.fill();
  5116. context.stroke();
  5117. startX += shapeWidth + shapeRight;
  5118. var fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2;
  5119. context.beginPath();
  5120. context.setFontSize(fontSize);
  5121. context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor);
  5122. context.fillText(item.name, startX, startY + fontTrans);
  5123. context.closePath();
  5124. context.stroke();
  5125. if (opts.legend.position == 'top' || opts.legend.position == 'bottom') {
  5126. startX += measureText(item.name, fontSize) + itemGap;
  5127. item.area[2] = startX;
  5128. } else {
  5129. item.area[2] = startX + measureText(item.name, fontSize) + itemGap;;
  5130. startX -= shapeWidth + shapeRight;
  5131. startY += lineHeight;
  5132. }
  5133. }
  5134. });
  5135. }
  5136. function drawPieDataPoints(series, opts, config, context) {
  5137. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5138. var pieOption = assign({}, {
  5139. activeOpacity: 0.5,
  5140. activeRadius: 10 * opts.pixelRatio,
  5141. offsetAngle: 0,
  5142. labelWidth: 15 * opts.pixelRatio,
  5143. ringWidth: 0,
  5144. border: false,
  5145. borderWidth: 2,
  5146. borderColor: '#FFFFFF' },
  5147. opts.extra.pie);
  5148. var centerPosition = {
  5149. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5150. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5151. if (config.pieChartLinePadding == 0) {
  5152. config.pieChartLinePadding = pieOption.activeRadius;
  5153. }
  5154. 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);
  5155. series = getPieDataPoints(series, radius, process);
  5156. var activeRadius = pieOption.activeRadius;
  5157. series = series.map(function (eachSeries) {
  5158. eachSeries._start_ += pieOption.offsetAngle * Math.PI / 180;
  5159. return eachSeries;
  5160. });
  5161. series.forEach(function (eachSeries, seriesIndex) {
  5162. if (opts.tooltip) {
  5163. if (opts.tooltip.index == seriesIndex) {
  5164. context.beginPath();
  5165. context.setFillStyle(hexToRgb(eachSeries.color, opts.extra.pie.activeOpacity || 0.5));
  5166. context.moveTo(centerPosition.x, centerPosition.y);
  5167. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries._start_,
  5168. eachSeries._start_ + 2 *
  5169. eachSeries._proportion_ * Math.PI);
  5170. context.closePath();
  5171. context.fill();
  5172. }
  5173. }
  5174. context.beginPath();
  5175. context.setLineWidth(pieOption.borderWidth * opts.pixelRatio);
  5176. context.lineJoin = "round";
  5177. context.setStrokeStyle(pieOption.borderColor);
  5178. context.setFillStyle(eachSeries.color);
  5179. context.moveTo(centerPosition.x, centerPosition.y);
  5180. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI);
  5181. context.closePath();
  5182. context.fill();
  5183. if (pieOption.border == true) {
  5184. context.stroke();
  5185. }
  5186. });
  5187. if (opts.type === 'ring') {
  5188. var innerPieWidth = radius * 0.6;
  5189. if (typeof opts.extra.pie.ringWidth === 'number' && opts.extra.pie.ringWidth > 0) {
  5190. innerPieWidth = Math.max(0, radius - opts.extra.pie.ringWidth);
  5191. }
  5192. context.beginPath();
  5193. context.setFillStyle(opts.background || '#ffffff');
  5194. context.moveTo(centerPosition.x, centerPosition.y);
  5195. context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI);
  5196. context.closePath();
  5197. context.fill();
  5198. }
  5199. if (opts.dataLabel !== false && process === 1) {
  5200. var valid = false;
  5201. for (var i = 0, len = series.length; i < len; i++) {
  5202. if (series[i].data > 0) {
  5203. valid = true;
  5204. break;
  5205. }
  5206. }
  5207. if (valid) {
  5208. drawPieText(series, opts, config, context, radius, centerPosition);
  5209. }
  5210. }
  5211. if (process === 1 && opts.type === 'ring') {
  5212. drawRingTitle(opts, config, context, centerPosition);
  5213. }
  5214. return {
  5215. center: centerPosition,
  5216. radius: radius,
  5217. series: series };
  5218. }
  5219. function drawRoseDataPoints(series, opts, config, context) {
  5220. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5221. var roseOption = assign({}, {
  5222. type: 'area',
  5223. activeOpacity: 0.5,
  5224. activeRadius: 10 * opts.pixelRatio,
  5225. offsetAngle: 0,
  5226. labelWidth: 15 * opts.pixelRatio,
  5227. border: false,
  5228. borderWidth: 2,
  5229. borderColor: '#FFFFFF' },
  5230. opts.extra.rose);
  5231. if (config.pieChartLinePadding == 0) {
  5232. config.pieChartLinePadding = roseOption.activeRadius;
  5233. }
  5234. var centerPosition = {
  5235. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5236. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5237. 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);
  5238. var minRadius = roseOption.minRadius || radius * 0.5;
  5239. series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process);
  5240. var activeRadius = roseOption.activeRadius;
  5241. series = series.map(function (eachSeries) {
  5242. eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180;
  5243. return eachSeries;
  5244. });
  5245. series.forEach(function (eachSeries, seriesIndex) {
  5246. if (opts.tooltip) {
  5247. if (opts.tooltip.index == seriesIndex) {
  5248. context.beginPath();
  5249. context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5));
  5250. context.moveTo(centerPosition.x, centerPosition.y);
  5251. context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries._start_,
  5252. eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI);
  5253. context.closePath();
  5254. context.fill();
  5255. }
  5256. }
  5257. context.beginPath();
  5258. context.setLineWidth(roseOption.borderWidth * opts.pixelRatio);
  5259. context.lineJoin = "round";
  5260. context.setStrokeStyle(roseOption.borderColor);
  5261. context.setFillStyle(eachSeries.color);
  5262. context.moveTo(centerPosition.x, centerPosition.y);
  5263. context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries._start_ + 2 *
  5264. eachSeries._rose_proportion_ * Math.PI);
  5265. context.closePath();
  5266. context.fill();
  5267. if (roseOption.border == true) {
  5268. context.stroke();
  5269. }
  5270. });
  5271. if (opts.dataLabel !== false && process === 1) {
  5272. var valid = false;
  5273. for (var i = 0, len = series.length; i < len; i++) {
  5274. if (series[i].data > 0) {
  5275. valid = true;
  5276. break;
  5277. }
  5278. }
  5279. if (valid) {
  5280. drawPieText(series, opts, config, context, radius, centerPosition);
  5281. }
  5282. }
  5283. return {
  5284. center: centerPosition,
  5285. radius: radius,
  5286. series: series };
  5287. }
  5288. function drawArcbarDataPoints(series, opts, config, context) {
  5289. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5290. var arcbarOption = assign({}, {
  5291. startAngle: 0.75,
  5292. endAngle: 0.25,
  5293. type: 'default',
  5294. width: 12 * opts.pixelRatio },
  5295. opts.extra.arcbar);
  5296. series = getArcbarDataPoints(series, arcbarOption, process);
  5297. var centerPosition = {
  5298. x: opts.width / 2,
  5299. y: opts.height / 2 };
  5300. var radius = Math.min(centerPosition.x, centerPosition.y);
  5301. radius -= 5 * opts.pixelRatio;
  5302. radius -= arcbarOption.width / 2;
  5303. //背景颜色
  5304. context.setLineWidth(arcbarOption.width);
  5305. context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9');
  5306. context.setLineCap('round');
  5307. context.beginPath();
  5308. if (arcbarOption.type == 'default') {
  5309. context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle *
  5310. Math.PI, false);
  5311. } else {
  5312. context.arc(centerPosition.x, centerPosition.y, radius, 0, 2 * Math.PI, false);
  5313. }
  5314. context.stroke();
  5315. for (var i = 0; i < series.length; i++) {
  5316. var eachSeries = series[i];
  5317. context.setLineWidth(arcbarOption.width);
  5318. context.setStrokeStyle(eachSeries.color);
  5319. context.setLineCap('round');
  5320. context.beginPath();
  5321. context.arc(centerPosition.x, centerPosition.y, radius, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ *
  5322. Math.PI, false);
  5323. context.stroke();
  5324. }
  5325. drawRingTitle(opts, config, context, centerPosition);
  5326. return {
  5327. center: centerPosition,
  5328. radius: radius,
  5329. series: series };
  5330. }
  5331. function drawGaugeDataPoints(categories, series, opts, config, context) {
  5332. var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
  5333. var gaugeOption = assign({}, {
  5334. startAngle: 0.75,
  5335. endAngle: 0.25,
  5336. width: 15,
  5337. splitLine: {
  5338. fixRadius: 0,
  5339. splitNumber: 10,
  5340. width: 15,
  5341. color: '#FFFFFF',
  5342. childNumber: 5,
  5343. childWidth: 5 },
  5344. pointer: {
  5345. width: 15,
  5346. color: 'auto' } },
  5347. opts.extra.gauge);
  5348. if (gaugeOption.oldAngle == undefined) {
  5349. gaugeOption.oldAngle = gaugeOption.startAngle;
  5350. }
  5351. if (gaugeOption.oldData == undefined) {
  5352. gaugeOption.oldData = 0;
  5353. }
  5354. categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle);
  5355. var centerPosition = {
  5356. x: opts.width / 2,
  5357. y: opts.height / 2 };
  5358. var radius = Math.min(centerPosition.x, centerPosition.y);
  5359. radius -= 5 * opts.pixelRatio;
  5360. radius -= gaugeOption.width / 2;
  5361. var innerRadius = radius - gaugeOption.width;
  5362. //画背景
  5363. context.setLineWidth(gaugeOption.width);
  5364. context.setLineCap('butt');
  5365. for (var i = 0; i < categories.length; i++) {
  5366. var eachCategories = categories[i];
  5367. context.beginPath();
  5368. context.setStrokeStyle(eachCategories.color);
  5369. context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, eachCategories._endAngle_ *
  5370. Math.PI, false);
  5371. context.stroke();
  5372. }
  5373. context.save();
  5374. //画刻度线
  5375. var totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1;
  5376. var splitAngle = totalAngle / gaugeOption.splitLine.splitNumber;
  5377. var childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber;
  5378. var startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius;
  5379. var endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width;
  5380. var childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.childWidth;
  5381. context.translate(centerPosition.x, centerPosition.y);
  5382. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  5383. for (var _i12 = 0; _i12 < gaugeOption.splitLine.splitNumber + 1; _i12++) {
  5384. context.beginPath();
  5385. context.setStrokeStyle(gaugeOption.splitLine.color);
  5386. context.setLineWidth(2 * opts.pixelRatio);
  5387. context.moveTo(startX, 0);
  5388. context.lineTo(endX, 0);
  5389. context.stroke();
  5390. context.rotate(splitAngle * Math.PI);
  5391. }
  5392. context.restore();
  5393. context.save();
  5394. context.translate(centerPosition.x, centerPosition.y);
  5395. context.rotate((gaugeOption.startAngle - 1) * Math.PI);
  5396. for (var _i13 = 0; _i13 < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; _i13++) {
  5397. context.beginPath();
  5398. context.setStrokeStyle(gaugeOption.splitLine.color);
  5399. context.setLineWidth(1 * opts.pixelRatio);
  5400. context.moveTo(startX, 0);
  5401. context.lineTo(childendX, 0);
  5402. context.stroke();
  5403. context.rotate(childAngle * Math.PI);
  5404. }
  5405. context.restore();
  5406. //画指针
  5407. series = getGaugeDataPoints(series, categories, gaugeOption, process);
  5408. for (var _i14 = 0; _i14 < series.length; _i14++) {
  5409. var eachSeries = series[_i14];
  5410. context.save();
  5411. context.translate(centerPosition.x, centerPosition.y);
  5412. context.rotate((eachSeries._proportion_ - 1) * Math.PI);
  5413. context.beginPath();
  5414. context.setFillStyle(eachSeries.color);
  5415. context.moveTo(gaugeOption.pointer.width, 0);
  5416. context.lineTo(0, -gaugeOption.pointer.width / 2);
  5417. context.lineTo(-innerRadius, 0);
  5418. context.lineTo(0, gaugeOption.pointer.width / 2);
  5419. context.lineTo(gaugeOption.pointer.width, 0);
  5420. context.closePath();
  5421. context.fill();
  5422. context.beginPath();
  5423. context.setFillStyle('#FFFFFF');
  5424. context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false);
  5425. context.fill();
  5426. context.restore();
  5427. }
  5428. if (opts.dataLabel !== false) {
  5429. drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context);
  5430. }
  5431. drawRingTitle(opts, config, context, centerPosition);
  5432. if (process === 1 && opts.type === 'gauge') {
  5433. opts.extra.gauge.oldAngle = series[0]._proportion_;
  5434. opts.extra.gauge.oldData = series[0].data;
  5435. }
  5436. return {
  5437. center: centerPosition,
  5438. radius: radius,
  5439. innerRadius: innerRadius,
  5440. categories: categories,
  5441. totalAngle: totalAngle };
  5442. }
  5443. function drawRadarDataPoints(series, opts, config, context) {
  5444. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5445. var radarOption = assign({}, {
  5446. gridColor: '#cccccc',
  5447. labelColor: '#666666',
  5448. opacity: 0.2 },
  5449. opts.extra.radar);
  5450. var coordinateAngle = getRadarCoordinateSeries(opts.categories.length);
  5451. var centerPosition = {
  5452. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5453. y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 };
  5454. var radius = Math.min(centerPosition.x - (getMaxTextListLength(opts.categories) + config.radarLabelTextMargin),
  5455. centerPosition.y - config.radarLabelTextMargin);
  5456. //TODO逻辑不对
  5457. radius -= opts.padding[1];
  5458. // draw grid
  5459. context.beginPath();
  5460. context.setLineWidth(1 * opts.pixelRatio);
  5461. context.setStrokeStyle(radarOption.gridColor);
  5462. coordinateAngle.forEach(function (angle) {
  5463. var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition);
  5464. context.moveTo(centerPosition.x, centerPosition.y);
  5465. context.lineTo(pos.x, pos.y);
  5466. });
  5467. context.stroke();
  5468. context.closePath();
  5469. // draw split line grid
  5470. var _loop = function _loop(i) {
  5471. var startPos = {};
  5472. context.beginPath();
  5473. context.setLineWidth(1 * opts.pixelRatio);
  5474. context.setStrokeStyle(radarOption.gridColor);
  5475. coordinateAngle.forEach(function (angle, index) {
  5476. var pos = convertCoordinateOrigin(radius / config.radarGridCount * i * Math.cos(angle), radius / config.radarGridCount *
  5477. i * Math.sin(angle), centerPosition);
  5478. if (index === 0) {
  5479. startPos = pos;
  5480. context.moveTo(pos.x, pos.y);
  5481. } else {
  5482. context.lineTo(pos.x, pos.y);
  5483. }
  5484. });
  5485. context.lineTo(startPos.x, startPos.y);
  5486. context.stroke();
  5487. context.closePath();
  5488. };
  5489. for (var i = 1; i <= config.radarGridCount; i++) {
  5490. _loop(i);
  5491. }
  5492. var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process);
  5493. radarDataPoints.forEach(function (eachSeries, seriesIndex) {
  5494. // 绘制区域数据
  5495. context.beginPath();
  5496. context.setFillStyle(hexToRgb(eachSeries.color, radarOption.opacity));
  5497. eachSeries.data.forEach(function (item, index) {
  5498. if (index === 0) {
  5499. context.moveTo(item.position.x, item.position.y);
  5500. } else {
  5501. context.lineTo(item.position.x, item.position.y);
  5502. }
  5503. });
  5504. context.closePath();
  5505. context.fill();
  5506. if (opts.dataPointShape !== false) {
  5507. var shape = config.dataPointShape[seriesIndex % config.dataPointShape.length];
  5508. var points = eachSeries.data.map(function (item) {
  5509. return item.position;
  5510. });
  5511. drawPointShape(points, eachSeries.color, shape, context, opts);
  5512. }
  5513. });
  5514. // draw label text
  5515. drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context);
  5516. return {
  5517. center: centerPosition,
  5518. radius: radius,
  5519. angleList: coordinateAngle };
  5520. }
  5521. function normalInt(min, max, iter) {
  5522. iter = iter == 0 ? 1 : iter;
  5523. var arr = [];
  5524. for (var i = 0; i < iter; i++) {
  5525. arr[i] = Math.random();
  5526. };
  5527. return Math.floor(arr.reduce(function (i, j) {return i + j;}) / iter * (max - min)) + min;
  5528. };
  5529. function collisionNew(area, points, width, height) {
  5530. var isIn = false;
  5531. for (var i = 0; i < points.length; i++) {
  5532. if (points[i].area) {
  5533. 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]) {
  5534. if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) {
  5535. isIn = true;
  5536. break;
  5537. } else {
  5538. isIn = false;
  5539. }
  5540. } else {
  5541. isIn = true;
  5542. break;
  5543. }
  5544. }
  5545. }
  5546. return isIn;
  5547. };
  5548. function getBoundingBox(data) {
  5549. var bounds = {},coords;
  5550. bounds.xMin = 180;
  5551. bounds.xMax = 0;
  5552. bounds.yMin = 90;
  5553. bounds.yMax = 0;
  5554. for (var i = 0; i < data.length; i++) {
  5555. var coorda = data[i].geometry.coordinates;
  5556. for (var k = 0; k < coorda.length; k++) {
  5557. coords = coorda[k];
  5558. if (coords.length == 1) {
  5559. coords = coords[0];
  5560. }
  5561. for (var j = 0; j < coords.length; j++) {
  5562. var longitude = coords[j][0];
  5563. var latitude = coords[j][1];
  5564. var point = {
  5565. x: longitude,
  5566. y: latitude };
  5567. bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x;
  5568. bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x;
  5569. bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y;
  5570. bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y;
  5571. }
  5572. }
  5573. }
  5574. return bounds;
  5575. }
  5576. function coordinateToPoint(latitude, longitude, bounds, scale, xoffset, yoffset) {
  5577. return {
  5578. x: (longitude - bounds.xMin) * scale + xoffset,
  5579. y: (bounds.yMax - latitude) * scale + yoffset };
  5580. }
  5581. function pointToCoordinate(pointY, pointX, bounds, scale, xoffset, yoffset) {
  5582. return {
  5583. x: (pointX - xoffset) / scale + bounds.xMin,
  5584. y: bounds.yMax - (pointY - yoffset) / scale };
  5585. }
  5586. function isRayIntersectsSegment(poi, s_poi, e_poi) {
  5587. if (s_poi[1] == e_poi[1]) {return false;}
  5588. if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) {return false;}
  5589. if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) {return false;}
  5590. if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) {return false;}
  5591. if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) {return false;}
  5592. if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) {return false;}
  5593. var xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]);
  5594. if (xseg < poi[0]) {
  5595. return false;
  5596. } else {
  5597. return true;
  5598. }
  5599. }
  5600. function isPoiWithinPoly(poi, poly) {
  5601. var sinsc = 0;
  5602. for (var i = 0; i < poly.length; i++) {
  5603. var epoly = poly[i][0];
  5604. if (poly.length == 1) {
  5605. epoly = poly[i][0];
  5606. }
  5607. for (var j = 0; j < epoly.length - 1; j++) {
  5608. var s_poi = epoly[j];
  5609. var e_poi = epoly[j + 1];
  5610. if (isRayIntersectsSegment(poi, s_poi, e_poi)) {
  5611. sinsc += 1;
  5612. }
  5613. }
  5614. }
  5615. if (sinsc % 2 == 1) {
  5616. return true;
  5617. } else {
  5618. return false;
  5619. }
  5620. }
  5621. function drawMapDataPoints(series, opts, config, context) {
  5622. var mapOption = assign({}, {
  5623. border: true,
  5624. borderWidth: 1,
  5625. borderColor: '#666666',
  5626. fillOpacity: 0.6,
  5627. activeBorderColor: '#f04864',
  5628. activeFillColor: '#facc14',
  5629. activeFillOpacity: 1 },
  5630. opts.extra.map);
  5631. var coords, point;
  5632. var data = series;
  5633. var bounds = getBoundingBox(data);
  5634. var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin);
  5635. var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin);
  5636. var scale = xScale < yScale ? xScale : yScale;
  5637. var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale;
  5638. var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale;
  5639. context.beginPath();
  5640. context.clearRect(0, 0, opts.width, opts.height);
  5641. context.setFillStyle(opts.background || '#FFFFFF');
  5642. context.rect(0, 0, opts.width, opts.height);
  5643. context.fill();
  5644. for (var i = 0; i < data.length; i++) {
  5645. context.beginPath();
  5646. context.setLineWidth(mapOption.borderWidth * opts.pixelRatio);
  5647. context.setStrokeStyle(mapOption.borderColor);
  5648. context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity));
  5649. if (opts.tooltip) {
  5650. if (opts.tooltip.index == i) {
  5651. context.setStrokeStyle(mapOption.activeBorderColor);
  5652. context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity));
  5653. }
  5654. }
  5655. var coorda = data[i].geometry.coordinates;
  5656. for (var k = 0; k < coorda.length; k++) {
  5657. coords = coorda[k];
  5658. if (coords.length == 1) {
  5659. coords = coords[0];
  5660. }
  5661. for (var j = 0; j < coords.length; j++) {
  5662. point = coordinateToPoint(coords[j][1], coords[j][0], bounds, scale, xoffset, yoffset);
  5663. if (j === 0) {
  5664. context.beginPath();
  5665. context.moveTo(point.x, point.y);
  5666. } else {
  5667. context.lineTo(point.x, point.y);
  5668. }
  5669. }
  5670. context.fill();
  5671. if (mapOption.border == true) {
  5672. context.stroke();
  5673. }
  5674. }
  5675. if (opts.dataLabel == true) {
  5676. var centerPoint = data[i].properties.centroid;
  5677. if (centerPoint) {
  5678. point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset);
  5679. var fontSize = data[i].textSize || config.fontSize;
  5680. var text = data[i].properties.name;
  5681. context.beginPath();
  5682. context.setFontSize(fontSize);
  5683. context.setFillStyle(data[i].textColor || '#666666');
  5684. context.fillText(text, point.x - measureText(text, fontSize) / 2, point.y + fontSize / 2);
  5685. context.closePath();
  5686. context.stroke();
  5687. }
  5688. }
  5689. }
  5690. opts.chartData.mapData = {
  5691. bounds: bounds,
  5692. scale: scale,
  5693. xoffset: xoffset,
  5694. yoffset: yoffset };
  5695. drawToolTipBridge(opts, config, context, 1);
  5696. context.draw();
  5697. }
  5698. function getWordCloudPoint(opts, type) {
  5699. var points = opts.series.sort(function (a, b) {return parseInt(b.textSize) - parseInt(a.textSize);});
  5700. switch (type) {
  5701. case 'normal':
  5702. for (var i = 0; i < points.length; i++) {
  5703. var text = points[i].name;
  5704. var tHeight = points[i].textSize;
  5705. var tWidth = measureText(text, tHeight);
  5706. var x = void 0,y = void 0;
  5707. var area = void 0;
  5708. var breaknum = 0;
  5709. while (true) {
  5710. breaknum++;
  5711. x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2;
  5712. y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2;
  5713. area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, y + 5 + opts.height / 2];
  5714. var isCollision = collisionNew(area, points, opts.width, opts.height);
  5715. if (!isCollision) break;
  5716. if (breaknum == 1000) {
  5717. area = [-100, -100, -100, -100];
  5718. break;
  5719. }
  5720. };
  5721. points[i].area = area;
  5722. }
  5723. break;
  5724. case 'vertical':var
  5725. Spin = function Spin() {
  5726. //获取均匀随机值,是否旋转,旋转的概率为(1-0.5)
  5727. if (Math.random() > 0.7) {
  5728. return true;
  5729. } else {return false;};
  5730. };;
  5731. for (var _i15 = 0; _i15 < points.length; _i15++) {
  5732. var _text = points[_i15].name;
  5733. var _tHeight = points[_i15].textSize;
  5734. var _tWidth = measureText(_text, _tHeight);
  5735. var isSpin = Spin();
  5736. var _x = void 0,_y = void 0,_area = void 0,areav = void 0;
  5737. var _breaknum = 0;
  5738. while (true) {
  5739. _breaknum++;
  5740. var _isCollision = void 0;
  5741. if (isSpin) {
  5742. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  5743. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  5744. _area = [_y - 5 - _tWidth + opts.width / 2, -_x - 5 + opts.height / 2, _y + 5 + opts.width / 2, -_x + _tHeight + 5 + opts.height / 2];
  5745. 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];
  5746. _isCollision = collisionNew(areav, points, opts.height, opts.width);
  5747. } else {
  5748. _x = normalInt(-opts.width / 2, opts.width / 2, 5) - _tWidth / 2;
  5749. _y = normalInt(-opts.height / 2, opts.height / 2, 5) + _tHeight / 2;
  5750. _area = [_x - 5 + opts.width / 2, _y - 5 - _tHeight + opts.height / 2, _x + _tWidth + 5 + opts.width / 2, _y + 5 + opts.height / 2];
  5751. _isCollision = collisionNew(_area, points, opts.width, opts.height);
  5752. }
  5753. if (!_isCollision) break;
  5754. if (_breaknum == 1000) {
  5755. _area = [-1000, -1000, -1000, -1000];
  5756. break;
  5757. }
  5758. };
  5759. if (isSpin) {
  5760. points[_i15].area = areav;
  5761. points[_i15].areav = _area;
  5762. } else {
  5763. points[_i15].area = _area;
  5764. }
  5765. points[_i15].rotate = isSpin;
  5766. };
  5767. break;}
  5768. return points;
  5769. }
  5770. function drawWordCloudDataPoints(series, opts, config, context) {
  5771. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5772. var wordOption = assign({}, {
  5773. type: 'normal',
  5774. autoColors: true },
  5775. opts.extra.word);
  5776. context.beginPath();
  5777. context.setFillStyle(opts.background || '#FFFFFF');
  5778. context.rect(0, 0, opts.width, opts.height);
  5779. context.fill();
  5780. context.save();
  5781. var points = opts.chartData.wordCloudData;
  5782. context.translate(opts.width / 2, opts.height / 2);
  5783. for (var i = 0; i < points.length; i++) {
  5784. context.save();
  5785. if (points[i].rotate) {
  5786. context.rotate(90 * Math.PI / 180);
  5787. }
  5788. var text = points[i].name;
  5789. var tHeight = points[i].textSize;
  5790. var tWidth = measureText(text, tHeight);
  5791. context.beginPath();
  5792. context.setStrokeStyle(points[i].color);
  5793. context.setFillStyle(points[i].color);
  5794. context.setFontSize(tHeight);
  5795. if (points[i].rotate) {
  5796. if (points[i].areav[0] > 0) {
  5797. if (opts.tooltip) {
  5798. if (opts.tooltip.index == i) {
  5799. 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);
  5800. } else {
  5801. 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);
  5802. }
  5803. } else {
  5804. 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);
  5805. }
  5806. }
  5807. } else {
  5808. if (points[i].area[0] > 0) {
  5809. if (opts.tooltip) {
  5810. if (opts.tooltip.index == i) {
  5811. 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);
  5812. } else {
  5813. 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);
  5814. }
  5815. } else {
  5816. 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);
  5817. }
  5818. }
  5819. }
  5820. context.stroke();
  5821. context.restore();
  5822. }
  5823. context.restore();
  5824. }
  5825. function drawFunnelDataPoints(series, opts, config, context) {
  5826. var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
  5827. var funnelOption = assign({}, {
  5828. activeWidth: 10,
  5829. activeOpacity: 0.3,
  5830. border: false,
  5831. borderWidth: 2,
  5832. borderColor: '#FFFFFF',
  5833. fillOpacity: 1,
  5834. labelAlign: 'right' },
  5835. opts.extra.funnel);
  5836. var eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length;
  5837. var centerPosition = {
  5838. x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2,
  5839. y: opts.height - opts.area[2] };
  5840. var activeWidth = funnelOption.activeWidth;
  5841. var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - opts.area[2]) / 2 - activeWidth);
  5842. series = getFunnelDataPoints(series, radius, process);
  5843. context.save();
  5844. context.translate(centerPosition.x, centerPosition.y);
  5845. for (var i = 0; i < series.length; i++) {
  5846. if (i == 0) {
  5847. if (opts.tooltip) {
  5848. if (opts.tooltip.index == i) {
  5849. context.beginPath();
  5850. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  5851. context.moveTo(-activeWidth, 0);
  5852. context.lineTo(-series[i].radius - activeWidth, -eachSpacing);
  5853. context.lineTo(series[i].radius + activeWidth, -eachSpacing);
  5854. context.lineTo(activeWidth, 0);
  5855. context.lineTo(-activeWidth, 0);
  5856. context.closePath();
  5857. context.fill();
  5858. }
  5859. }
  5860. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing, centerPosition.x + series[i].radius, centerPosition.y];
  5861. context.beginPath();
  5862. context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
  5863. context.setStrokeStyle(funnelOption.borderColor);
  5864. context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
  5865. context.moveTo(0, 0);
  5866. context.lineTo(-series[i].radius, -eachSpacing);
  5867. context.lineTo(series[i].radius, -eachSpacing);
  5868. context.lineTo(0, 0);
  5869. context.closePath();
  5870. context.fill();
  5871. if (funnelOption.border == true) {
  5872. context.stroke();
  5873. }
  5874. } else {
  5875. if (opts.tooltip) {
  5876. if (opts.tooltip.index == i) {
  5877. context.beginPath();
  5878. context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity));
  5879. context.moveTo(0, 0);
  5880. context.lineTo(-series[i - 1].radius - activeWidth, 0);
  5881. context.lineTo(-series[i].radius - activeWidth, -eachSpacing);
  5882. context.lineTo(series[i].radius + activeWidth, -eachSpacing);
  5883. context.lineTo(series[i - 1].radius + activeWidth, 0);
  5884. context.lineTo(0, 0);
  5885. context.closePath();
  5886. context.fill();
  5887. context.closePath();
  5888. context.fill();
  5889. }
  5890. }
  5891. series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i];
  5892. context.beginPath();
  5893. context.setLineWidth(funnelOption.borderWidth * opts.pixelRatio);
  5894. context.setStrokeStyle(funnelOption.borderColor);
  5895. context.setFillStyle(hexToRgb(series[i].color, funnelOption.fillOpacity));
  5896. context.moveTo(0, 0);
  5897. context.lineTo(-series[i - 1].radius, 0);
  5898. context.lineTo(-series[i].radius, -eachSpacing);
  5899. context.lineTo(series[i].radius, -eachSpacing);
  5900. context.lineTo(series[i - 1].radius, 0);
  5901. context.lineTo(0, 0);
  5902. context.closePath();
  5903. context.fill();
  5904. if (funnelOption.border == true) {
  5905. context.stroke();
  5906. }
  5907. }
  5908. context.translate(0, -eachSpacing);
  5909. }
  5910. context.restore();
  5911. if (opts.dataLabel !== false && process === 1) {
  5912. drawFunnelText(series, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition);
  5913. }
  5914. return {
  5915. center: centerPosition,
  5916. radius: radius,
  5917. series: series };
  5918. }
  5919. function drawFunnelText(series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) {
  5920. for (var i = 0; i < series.length; i++) {
  5921. var item = series[i];
  5922. var startX = void 0,endX = void 0,startY = void 0,fontSize = void 0;
  5923. var text = item.format ? item.format(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * 100) + '%';
  5924. if (labelAlign == 'right') {
  5925. if (i == 0) {
  5926. startX = (item.funnelArea[2] + centerPosition.x) / 2;
  5927. } else {
  5928. startX = (item.funnelArea[2] + series[i - 1].funnelArea[2]) / 2;
  5929. }
  5930. endX = startX + activeWidth * 2;
  5931. startY = item.funnelArea[1] + eachSpacing / 2;
  5932. fontSize = item.textSize || opts.fontSize;
  5933. context.setLineWidth(1 * opts.pixelRatio);
  5934. context.setStrokeStyle(item.color);
  5935. context.setFillStyle(item.color);
  5936. context.beginPath();
  5937. context.moveTo(startX, startY);
  5938. context.lineTo(endX, startY);
  5939. context.stroke();
  5940. context.closePath();
  5941. context.beginPath();
  5942. context.moveTo(endX, startY);
  5943. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  5944. context.closePath();
  5945. context.fill();
  5946. context.beginPath();
  5947. context.setFontSize(fontSize);
  5948. context.setFillStyle(item.textColor || '#666666');
  5949. context.fillText(text, endX + 5, startY + fontSize / 2 - 2);
  5950. context.closePath();
  5951. context.stroke();
  5952. context.closePath();
  5953. } else {
  5954. if (i == 0) {
  5955. startX = (item.funnelArea[0] + centerPosition.x) / 2;
  5956. } else {
  5957. startX = (item.funnelArea[0] + series[i - 1].funnelArea[0]) / 2;
  5958. }
  5959. endX = startX - activeWidth * 2;
  5960. startY = item.funnelArea[1] + eachSpacing / 2;
  5961. fontSize = item.textSize || opts.fontSize;
  5962. context.setLineWidth(1 * opts.pixelRatio);
  5963. context.setStrokeStyle(item.color);
  5964. context.setFillStyle(item.color);
  5965. context.beginPath();
  5966. context.moveTo(startX, startY);
  5967. context.lineTo(endX, startY);
  5968. context.stroke();
  5969. context.closePath();
  5970. context.beginPath();
  5971. context.moveTo(endX, startY);
  5972. context.arc(endX, startY, 2, 0, 2 * Math.PI);
  5973. context.closePath();
  5974. context.fill();
  5975. context.beginPath();
  5976. context.setFontSize(fontSize);
  5977. context.setFillStyle(item.textColor || '#666666');
  5978. context.fillText(text, endX - 5 - measureText(text), startY + fontSize / 2 - 2);
  5979. context.closePath();
  5980. context.stroke();
  5981. context.closePath();
  5982. }
  5983. }
  5984. }
  5985. function drawCanvas(opts, context) {
  5986. context.draw();
  5987. }
  5988. var Timing = {
  5989. easeIn: function easeIn(pos) {
  5990. return Math.pow(pos, 3);
  5991. },
  5992. easeOut: function easeOut(pos) {
  5993. return Math.pow(pos - 1, 3) + 1;
  5994. },
  5995. easeInOut: function easeInOut(pos) {
  5996. if ((pos /= 0.5) < 1) {
  5997. return 0.5 * Math.pow(pos, 3);
  5998. } else {
  5999. return 0.5 * (Math.pow(pos - 2, 3) + 2);
  6000. }
  6001. },
  6002. linear: function linear(pos) {
  6003. return pos;
  6004. } };
  6005. function Animation(opts) {
  6006. this.isStop = false;
  6007. opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration;
  6008. opts.timing = opts.timing || 'linear';
  6009. var delay = 17;
  6010. function createAnimationFrame() {
  6011. if (typeof setTimeout !== 'undefined') {
  6012. return function (step, delay) {
  6013. setTimeout(function () {
  6014. var timeStamp = +new Date();
  6015. step(timeStamp);
  6016. }, delay);
  6017. };
  6018. } else if (typeof requestAnimationFrame !== 'undefined') {
  6019. return requestAnimationFrame;
  6020. } else {
  6021. return function (step) {
  6022. step(null);
  6023. };
  6024. }
  6025. };
  6026. var animationFrame = createAnimationFrame();
  6027. var startTimeStamp = null;
  6028. var _step = function step(timestamp) {
  6029. if (timestamp === null || this.isStop === true) {
  6030. opts.onProcess && opts.onProcess(1);
  6031. opts.onAnimationFinish && opts.onAnimationFinish();
  6032. return;
  6033. }
  6034. if (startTimeStamp === null) {
  6035. startTimeStamp = timestamp;
  6036. }
  6037. if (timestamp - startTimeStamp < opts.duration) {
  6038. var process = (timestamp - startTimeStamp) / opts.duration;
  6039. var timingFunction = Timing[opts.timing];
  6040. process = timingFunction(process);
  6041. opts.onProcess && opts.onProcess(process);
  6042. animationFrame(_step, delay);
  6043. } else {
  6044. opts.onProcess && opts.onProcess(1);
  6045. opts.onAnimationFinish && opts.onAnimationFinish();
  6046. }
  6047. };
  6048. _step = _step.bind(this);
  6049. animationFrame(_step, delay);
  6050. }
  6051. // stop animation immediately
  6052. // and tigger onAnimationFinish
  6053. Animation.prototype.stop = function () {
  6054. this.isStop = true;
  6055. };
  6056. function drawCharts(type, opts, config, context) {
  6057. var _this = this;
  6058. var series = opts.series;
  6059. var categories = opts.categories;
  6060. series = fillSeries(series, opts, config);
  6061. var duration = opts.animation ? opts.duration : 0;
  6062. this.animationInstance && this.animationInstance.stop();
  6063. var seriesMA = null;
  6064. if (type == 'candle') {
  6065. var average = assign({}, opts.extra.candle.average);
  6066. if (average.show) {
  6067. seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data);
  6068. seriesMA = fillSeries(seriesMA, opts, config);
  6069. opts.seriesMA = seriesMA;
  6070. } else if (opts.seriesMA) {
  6071. seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config);
  6072. } else {
  6073. seriesMA = series;
  6074. }
  6075. } else {
  6076. seriesMA = series;
  6077. }
  6078. /* 过滤掉show=false的series */
  6079. opts._series_ = series = filterSeries(series);
  6080. //重新计算图表区域
  6081. opts.area = new Array(4);
  6082. //复位绘图区域
  6083. for (var j = 0; j < 4; j++) {
  6084. opts.area[j] = opts.padding[j];
  6085. }
  6086. //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域
  6087. var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData),
  6088. legendHeight = _calLegendData.area.wholeHeight,
  6089. legendWidth = _calLegendData.area.wholeWidth;
  6090. //TODO废弃config.legendHeight参数
  6091. config.legendHeight = legendHeight;
  6092. switch (opts.legend.position) {
  6093. case 'top':
  6094. opts.area[0] += legendHeight;
  6095. break;
  6096. case 'bottom':
  6097. opts.area[2] += legendHeight;
  6098. break;
  6099. case 'left':
  6100. opts.area[3] += legendWidth;
  6101. break;
  6102. case 'right':
  6103. opts.area[1] += legendWidth;
  6104. break;}
  6105. var _calYAxisData = {},yAxisWidth = 0;
  6106. if (opts.type === 'line' || opts.type === 'column' || opts.type === 'area' || opts.type === 'mix' || opts.type === 'candle') {
  6107. _calYAxisData = calYAxisData(series, opts, config);
  6108. yAxisWidth = _calYAxisData.yAxisWidth;
  6109. config.yAxisWidth = yAxisWidth;
  6110. opts.area[3] += yAxisWidth;
  6111. } else {
  6112. config.yAxisWidth = yAxisWidth;
  6113. }
  6114. opts.chartData.yAxisData = _calYAxisData;
  6115. if (opts.categories && opts.categories.length) {
  6116. opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config);
  6117. var _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing),
  6118. xAxisHeight = _calCategoriesData.xAxisHeight,
  6119. angle = _calCategoriesData.angle;
  6120. config.xAxisHeight = xAxisHeight;
  6121. config._xAxisTextAngle_ = angle;
  6122. opts.area[2] += xAxisHeight;
  6123. opts.chartData.categoriesData = _calCategoriesData;
  6124. }
  6125. //计算右对齐偏移距离
  6126. if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) {
  6127. var offsetLeft = 0,
  6128. xAxisPoints = opts.chartData.xAxisData.xAxisPoints,
  6129. startX = opts.chartData.xAxisData.startX,
  6130. endX = opts.chartData.xAxisData.endX,
  6131. eachSpacing = opts.chartData.xAxisData.eachSpacing;
  6132. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  6133. var screenWidth = endX - startX;
  6134. offsetLeft = screenWidth - totalWidth;
  6135. _this.scrollOption = {
  6136. currentOffset: offsetLeft,
  6137. startTouchX: offsetLeft,
  6138. distance: 0,
  6139. lastMoveTime: 0 };
  6140. opts._scrollDistance_ = offsetLeft;
  6141. }
  6142. if (type === 'pie' || type === 'ring' || type === 'rose') {
  6143. config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA);
  6144. }
  6145. switch (type) {
  6146. case 'word':
  6147. var wordOption = assign({}, {
  6148. type: 'normal',
  6149. autoColors: true },
  6150. opts.extra.word);
  6151. if (opts.updateData == true || opts.updateData == undefined) {
  6152. opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type);
  6153. }
  6154. this.animationInstance = new Animation({
  6155. timing: 'easeInOut',
  6156. duration: duration,
  6157. onProcess: function onProcess(process) {
  6158. context.clearRect(0, 0, opts.width, opts.height);
  6159. if (opts.rotate) {
  6160. contextRotate(context, opts);
  6161. }
  6162. drawWordCloudDataPoints(series, opts, config, context, process);
  6163. drawCanvas(opts, context);
  6164. },
  6165. onAnimationFinish: function onAnimationFinish() {
  6166. _this.event.trigger('renderComplete');
  6167. } });
  6168. break;
  6169. case 'map':
  6170. context.clearRect(0, 0, opts.width, opts.height);
  6171. drawMapDataPoints(series, opts, config, context);
  6172. break;
  6173. case 'funnel':
  6174. this.animationInstance = new Animation({
  6175. timing: 'easeInOut',
  6176. duration: duration,
  6177. onProcess: function onProcess(process) {
  6178. context.clearRect(0, 0, opts.width, opts.height);
  6179. if (opts.rotate) {
  6180. contextRotate(context, opts);
  6181. }
  6182. opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, process);
  6183. drawLegend(opts.series, opts, config, context, opts.chartData);
  6184. drawToolTipBridge(opts, config, context, process);
  6185. drawCanvas(opts, context);
  6186. },
  6187. onAnimationFinish: function onAnimationFinish() {
  6188. _this.event.trigger('renderComplete');
  6189. } });
  6190. break;
  6191. case 'line':
  6192. this.animationInstance = new Animation({
  6193. timing: 'easeIn',
  6194. duration: duration,
  6195. onProcess: function onProcess(process) {
  6196. context.clearRect(0, 0, opts.width, opts.height);
  6197. if (opts.rotate) {
  6198. contextRotate(context, opts);
  6199. }
  6200. drawYAxisGrid(categories, opts, config, context);
  6201. drawXAxis(categories, opts, config, context);
  6202. var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process),
  6203. xAxisPoints = _drawLineDataPoints.xAxisPoints,
  6204. calPoints = _drawLineDataPoints.calPoints,
  6205. eachSpacing = _drawLineDataPoints.eachSpacing,
  6206. minRange = _drawLineDataPoints.minRange,
  6207. maxRange = _drawLineDataPoints.maxRange;
  6208. opts.chartData.xAxisPoints = xAxisPoints;
  6209. opts.chartData.calPoints = calPoints;
  6210. opts.chartData.eachSpacing = eachSpacing;
  6211. drawYAxis(series, opts, config, context);
  6212. if (opts.enableMarkLine !== false && process === 1) {
  6213. drawMarkLine(minRange, maxRange, opts, config, context);
  6214. }
  6215. drawLegend(opts.series, opts, config, context, opts.chartData);
  6216. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6217. drawCanvas(opts, context);
  6218. },
  6219. onAnimationFinish: function onAnimationFinish() {
  6220. _this.event.trigger('renderComplete');
  6221. } });
  6222. break;
  6223. case 'mix':
  6224. this.animationInstance = new Animation({
  6225. timing: 'easeIn',
  6226. duration: duration,
  6227. onProcess: function onProcess(process) {
  6228. context.clearRect(0, 0, opts.width, opts.height);
  6229. if (opts.rotate) {
  6230. contextRotate(context, opts);
  6231. }
  6232. drawYAxisGrid(categories, opts, config, context);
  6233. drawXAxis(categories, opts, config, context);
  6234. var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process),
  6235. xAxisPoints = _drawMixDataPoints.xAxisPoints,
  6236. calPoints = _drawMixDataPoints.calPoints,
  6237. eachSpacing = _drawMixDataPoints.eachSpacing,
  6238. minRange = _drawMixDataPoints.minRange,
  6239. maxRange = _drawMixDataPoints.maxRange;
  6240. opts.chartData.xAxisPoints = xAxisPoints;
  6241. opts.chartData.calPoints = calPoints;
  6242. opts.chartData.eachSpacing = eachSpacing;
  6243. drawYAxis(series, opts, config, context);
  6244. if (opts.enableMarkLine !== false && process === 1) {
  6245. drawMarkLine(minRange, maxRange, opts, config, context);
  6246. }
  6247. drawLegend(opts.series, opts, config, context, opts.chartData);
  6248. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6249. drawCanvas(opts, context);
  6250. },
  6251. onAnimationFinish: function onAnimationFinish() {
  6252. _this.event.trigger('renderComplete');
  6253. } });
  6254. break;
  6255. case 'column':
  6256. this.animationInstance = new Animation({
  6257. timing: 'easeIn',
  6258. duration: duration,
  6259. onProcess: function onProcess(process) {
  6260. context.clearRect(0, 0, opts.width, opts.height);
  6261. if (opts.rotate) {
  6262. contextRotate(context, opts);
  6263. }
  6264. drawYAxisGrid(categories, opts, config, context);
  6265. drawXAxis(categories, opts, config, context);
  6266. var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, process),
  6267. xAxisPoints = _drawColumnDataPoints.xAxisPoints,
  6268. calPoints = _drawColumnDataPoints.calPoints,
  6269. eachSpacing = _drawColumnDataPoints.eachSpacing,
  6270. minRange = _drawColumnDataPoints.minRange,
  6271. maxRange = _drawColumnDataPoints.maxRange;
  6272. opts.chartData.xAxisPoints = xAxisPoints;
  6273. opts.chartData.calPoints = calPoints;
  6274. opts.chartData.eachSpacing = eachSpacing;
  6275. drawYAxis(series, opts, config, context);
  6276. if (opts.enableMarkLine !== false && process === 1) {
  6277. drawMarkLine(minRange, maxRange, opts, config, context);
  6278. }
  6279. drawLegend(opts.series, opts, config, context, opts.chartData);
  6280. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6281. drawCanvas(opts, context);
  6282. },
  6283. onAnimationFinish: function onAnimationFinish() {
  6284. _this.event.trigger('renderComplete');
  6285. } });
  6286. break;
  6287. case 'area':
  6288. this.animationInstance = new Animation({
  6289. timing: 'easeIn',
  6290. duration: duration,
  6291. onProcess: function onProcess(process) {
  6292. context.clearRect(0, 0, opts.width, opts.height);
  6293. if (opts.rotate) {
  6294. contextRotate(context, opts);
  6295. }
  6296. drawYAxisGrid(categories, opts, config, context);
  6297. drawXAxis(categories, opts, config, context);
  6298. var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process),
  6299. xAxisPoints = _drawAreaDataPoints.xAxisPoints,
  6300. calPoints = _drawAreaDataPoints.calPoints,
  6301. eachSpacing = _drawAreaDataPoints.eachSpacing,
  6302. minRange = _drawAreaDataPoints.minRange,
  6303. maxRange = _drawAreaDataPoints.maxRange;
  6304. opts.chartData.xAxisPoints = xAxisPoints;
  6305. opts.chartData.calPoints = calPoints;
  6306. opts.chartData.eachSpacing = eachSpacing;
  6307. drawYAxis(series, opts, config, context);
  6308. if (opts.enableMarkLine !== false && process === 1) {
  6309. drawMarkLine(minRange, maxRange, opts, config, context);
  6310. }
  6311. drawLegend(opts.series, opts, config, context, opts.chartData);
  6312. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6313. drawCanvas(opts, context);
  6314. },
  6315. onAnimationFinish: function onAnimationFinish() {
  6316. _this.event.trigger('renderComplete');
  6317. } });
  6318. break;
  6319. case 'ring':
  6320. case 'pie':
  6321. this.animationInstance = new Animation({
  6322. timing: 'easeInOut',
  6323. duration: duration,
  6324. onProcess: function onProcess(process) {
  6325. context.clearRect(0, 0, opts.width, opts.height);
  6326. if (opts.rotate) {
  6327. contextRotate(context, opts);
  6328. }
  6329. opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process);
  6330. drawLegend(opts.series, opts, config, context, opts.chartData);
  6331. drawToolTipBridge(opts, config, context, process);
  6332. drawCanvas(opts, context);
  6333. },
  6334. onAnimationFinish: function onAnimationFinish() {
  6335. _this.event.trigger('renderComplete');
  6336. } });
  6337. break;
  6338. case 'rose':
  6339. this.animationInstance = new Animation({
  6340. timing: 'easeInOut',
  6341. duration: duration,
  6342. onProcess: function onProcess(process) {
  6343. context.clearRect(0, 0, opts.width, opts.height);
  6344. if (opts.rotate) {
  6345. contextRotate(context, opts);
  6346. }
  6347. opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process);
  6348. drawLegend(opts.series, opts, config, context, opts.chartData);
  6349. drawToolTipBridge(opts, config, context, process);
  6350. drawCanvas(opts, context);
  6351. },
  6352. onAnimationFinish: function onAnimationFinish() {
  6353. _this.event.trigger('renderComplete');
  6354. } });
  6355. break;
  6356. case 'radar':
  6357. this.animationInstance = new Animation({
  6358. timing: 'easeInOut',
  6359. duration: duration,
  6360. onProcess: function onProcess(process) {
  6361. context.clearRect(0, 0, opts.width, opts.height);
  6362. if (opts.rotate) {
  6363. contextRotate(context, opts);
  6364. }
  6365. opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process);
  6366. drawLegend(opts.series, opts, config, context, opts.chartData);
  6367. drawToolTipBridge(opts, config, context, process);
  6368. drawCanvas(opts, context);
  6369. },
  6370. onAnimationFinish: function onAnimationFinish() {
  6371. _this.event.trigger('renderComplete');
  6372. } });
  6373. break;
  6374. case 'arcbar':
  6375. this.animationInstance = new Animation({
  6376. timing: 'easeInOut',
  6377. duration: duration,
  6378. onProcess: function onProcess(process) {
  6379. context.clearRect(0, 0, opts.width, opts.height);
  6380. if (opts.rotate) {
  6381. contextRotate(context, opts);
  6382. }
  6383. opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, process);
  6384. drawCanvas(opts, context);
  6385. },
  6386. onAnimationFinish: function onAnimationFinish() {
  6387. _this.event.trigger('renderComplete');
  6388. } });
  6389. break;
  6390. case 'gauge':
  6391. this.animationInstance = new Animation({
  6392. timing: 'easeInOut',
  6393. duration: duration,
  6394. onProcess: function onProcess(process) {
  6395. context.clearRect(0, 0, opts.width, opts.height);
  6396. if (opts.rotate) {
  6397. contextRotate(context, opts);
  6398. }
  6399. opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, context, process);
  6400. drawCanvas(opts, context);
  6401. },
  6402. onAnimationFinish: function onAnimationFinish() {
  6403. _this.event.trigger('renderComplete');
  6404. } });
  6405. break;
  6406. case 'candle':
  6407. this.animationInstance = new Animation({
  6408. timing: 'easeIn',
  6409. duration: duration,
  6410. onProcess: function onProcess(process) {
  6411. context.clearRect(0, 0, opts.width, opts.height);
  6412. if (opts.rotate) {
  6413. contextRotate(context, opts);
  6414. }
  6415. drawYAxisGrid(categories, opts, config, context);
  6416. drawXAxis(categories, opts, config, context);
  6417. var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, context, process),
  6418. xAxisPoints = _drawCandleDataPoints.xAxisPoints,
  6419. calPoints = _drawCandleDataPoints.calPoints,
  6420. eachSpacing = _drawCandleDataPoints.eachSpacing,
  6421. minRange = _drawCandleDataPoints.minRange,
  6422. maxRange = _drawCandleDataPoints.maxRange;
  6423. opts.chartData.xAxisPoints = xAxisPoints;
  6424. opts.chartData.calPoints = calPoints;
  6425. opts.chartData.eachSpacing = eachSpacing;
  6426. drawYAxis(series, opts, config, context);
  6427. if (opts.enableMarkLine !== false && process === 1) {
  6428. drawMarkLine(minRange, maxRange, opts, config, context);
  6429. }
  6430. if (seriesMA) {
  6431. drawLegend(seriesMA, opts, config, context, opts.chartData);
  6432. } else {
  6433. drawLegend(opts.series, opts, config, context, opts.chartData);
  6434. }
  6435. drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints);
  6436. drawCanvas(opts, context);
  6437. },
  6438. onAnimationFinish: function onAnimationFinish() {
  6439. _this.event.trigger('renderComplete');
  6440. } });
  6441. break;}
  6442. }
  6443. // simple event implement
  6444. function Event() {
  6445. this.events = {};
  6446. }
  6447. Event.prototype.addEventListener = function (type, listener) {
  6448. this.events[type] = this.events[type] || [];
  6449. this.events[type].push(listener);
  6450. };
  6451. Event.prototype.trigger = function () {
  6452. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  6453. args[_key] = arguments[_key];
  6454. }
  6455. var type = args[0];
  6456. var params = args.slice(1);
  6457. if (!!this.events[type]) {
  6458. this.events[type].forEach(function (listener) {
  6459. try {
  6460. listener.apply(null, params);
  6461. } catch (e) {
  6462. console.error(e);
  6463. }
  6464. });
  6465. }
  6466. };
  6467. var Charts = function Charts(opts) {
  6468. opts.pixelRatio = opts.pixelRatio ? opts.pixelRatio : 1;
  6469. opts.fontSize = opts.fontSize ? opts.fontSize * opts.pixelRatio : 13 * opts.pixelRatio;
  6470. opts.title = assign({}, opts.title);
  6471. opts.subtitle = assign({}, opts.subtitle);
  6472. opts.duration = opts.duration ? opts.duration : 1000;
  6473. opts.yAxis = assign({}, {
  6474. gridType: 'solid',
  6475. dashLength: 4 * opts.pixelRatio },
  6476. opts.yAxis);
  6477. opts.xAxis = assign({}, {
  6478. rotateLabel: false,
  6479. type: 'calibration',
  6480. gridType: 'solid',
  6481. dashLength: 4 * opts.pixelRatio,
  6482. scrollAlign: 'left',
  6483. boundaryGap: 'center' },
  6484. opts.xAxis);
  6485. opts.legend = assign({}, {
  6486. show: true,
  6487. position: 'bottom',
  6488. float: 'center',
  6489. backgroundColor: 'rgba(0,0,0,0)',
  6490. borderColor: 'rgba(0,0,0,0)',
  6491. borderWidth: 0,
  6492. padding: 5,
  6493. margin: 5,
  6494. itemGap: 10,
  6495. fontSize: opts.fontSize,
  6496. lineHeight: opts.fontSize,
  6497. fontColor: '#333333',
  6498. format: {},
  6499. hiddenColor: '#CECECE' },
  6500. opts.legend);
  6501. opts.legend.borderWidth = opts.legend.borderWidth * opts.pixelRatio;
  6502. opts.legend.itemGap = opts.legend.itemGap * opts.pixelRatio;
  6503. opts.legend.padding = opts.legend.padding * opts.pixelRatio;
  6504. opts.legend.margin = opts.legend.margin * opts.pixelRatio;
  6505. opts.extra = assign({}, opts.extra);
  6506. opts.rotate = opts.rotate ? true : false;
  6507. opts.animation = opts.animation ? true : false;
  6508. var config$$1 = JSON.parse(JSON.stringify(config));
  6509. config$$1.colors = opts.colors ? opts.colors : config$$1.colors;
  6510. config$$1.yAxisTitleWidth = opts.yAxis.disabled !== true && opts.yAxis.title ? config$$1.yAxisTitleWidth : 0;
  6511. if (opts.type == 'pie' || opts.type == 'ring') {
  6512. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
  6513. }
  6514. if (opts.type == 'rose') {
  6515. config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pixelRatio || config$$1.pieChartLinePadding * opts.pixelRatio;
  6516. }
  6517. config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pixelRatio;
  6518. config$$1.yAxisSplit = opts.yAxis.splitNumber ? opts.yAxis.splitNumber : config.yAxisSplit;
  6519. //屏幕旋转
  6520. config$$1.rotate = opts.rotate;
  6521. if (opts.rotate) {
  6522. var tempWidth = opts.width;
  6523. var tempHeight = opts.height;
  6524. opts.width = tempHeight;
  6525. opts.height = tempWidth;
  6526. }
  6527. //适配高分屏
  6528. opts.padding = opts.padding ? opts.padding : config$$1.padding;
  6529. for (var i = 0; i < 4; i++) {
  6530. opts.padding[i] *= opts.pixelRatio;
  6531. }
  6532. config$$1.yAxisWidth = config.yAxisWidth * opts.pixelRatio;
  6533. config$$1.xAxisHeight = config.xAxisHeight * opts.pixelRatio;
  6534. if (opts.enableScroll && opts.xAxis.scrollShow) {
  6535. config$$1.xAxisHeight += 6 * opts.pixelRatio;
  6536. }
  6537. config$$1.xAxisLineHeight = config.xAxisLineHeight * opts.pixelRatio;
  6538. config$$1.legendHeight = config.legendHeight * opts.pixelRatio;
  6539. config$$1.fontSize = opts.fontSize;
  6540. config$$1.titleFontSize = config.titleFontSize * opts.pixelRatio;
  6541. config$$1.subtitleFontSize = config.subtitleFontSize * opts.pixelRatio;
  6542. config$$1.toolTipPadding = config.toolTipPadding * opts.pixelRatio;
  6543. config$$1.toolTipLineHeight = config.toolTipLineHeight * opts.pixelRatio;
  6544. config$$1.columePadding = config.columePadding * opts.pixelRatio;
  6545. opts.$this = opts.$this ? opts.$this : this;
  6546. this.context = uni.createCanvasContext(opts.canvasId, opts.$this);
  6547. /* 兼容原生H5
  6548. this.context = document.getElementById(opts.canvasId).getContext("2d");
  6549. this.context.setStrokeStyle = function(e){ return this.strokeStyle=e; }
  6550. this.context.setLineWidth = function(e){ return this.lineWidth=e; }
  6551. this.context.setLineCap = function(e){ return this.lineCap=e; }
  6552. this.context.setFontSize = function(e){ return this.font=e+"px sans-serif"; }
  6553. this.context.setFillStyle = function(e){ return this.fillStyle=e; }
  6554. this.context.draw = function(){ }
  6555. */
  6556. opts.chartData = {};
  6557. this.event = new Event();
  6558. this.scrollOption = {
  6559. currentOffset: 0,
  6560. startTouchX: 0,
  6561. distance: 0,
  6562. lastMoveTime: 0 };
  6563. this.opts = opts;
  6564. this.config = config$$1;
  6565. drawCharts.call(this, opts.type, opts, config$$1, this.context);
  6566. };
  6567. Charts.prototype.updateData = function () {
  6568. var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  6569. this.opts = assign({}, this.opts, data);
  6570. this.opts.updateData = true;
  6571. var scrollPosition = data.scrollPosition || 'current';
  6572. switch (scrollPosition) {
  6573. case 'current':
  6574. this.opts._scrollDistance_ = this.scrollOption.currentOffset;
  6575. break;
  6576. case 'left':
  6577. this.opts._scrollDistance_ = 0;
  6578. this.scrollOption = {
  6579. currentOffset: 0,
  6580. startTouchX: 0,
  6581. distance: 0,
  6582. lastMoveTime: 0 };
  6583. break;
  6584. case 'right':
  6585. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
  6586. yAxisWidth = _calYAxisData.yAxisWidth;
  6587. this.config.yAxisWidth = yAxisWidth;
  6588. var offsetLeft = 0;
  6589. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  6590. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  6591. startX = _getXAxisPoints0.startX,
  6592. endX = _getXAxisPoints0.endX,
  6593. eachSpacing = _getXAxisPoints0.eachSpacing;
  6594. var totalWidth = eachSpacing * (xAxisPoints.length - 1);
  6595. var screenWidth = endX - startX;
  6596. offsetLeft = screenWidth - totalWidth;
  6597. this.scrollOption = {
  6598. currentOffset: offsetLeft,
  6599. startTouchX: offsetLeft,
  6600. distance: 0,
  6601. lastMoveTime: 0 };
  6602. this.opts._scrollDistance_ = offsetLeft;
  6603. break;}
  6604. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6605. };
  6606. Charts.prototype.zoom = function () {
  6607. var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount;
  6608. if (this.opts.enableScroll !== true) {
  6609. console.log('请启用滚动条后使用!');
  6610. return;
  6611. }
  6612. //当前屏幕中间点
  6613. var centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math.round(
  6614. this.opts.xAxis.itemCount / 2);
  6615. this.opts.animation = false;
  6616. this.opts.xAxis.itemCount = val.itemCount;
  6617. //重新计算x轴偏移距离
  6618. var _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config),
  6619. yAxisWidth = _calYAxisData.yAxisWidth;
  6620. this.config.yAxisWidth = yAxisWidth;
  6621. var offsetLeft = 0;
  6622. var _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config),
  6623. xAxisPoints = _getXAxisPoints0.xAxisPoints,
  6624. startX = _getXAxisPoints0.startX,
  6625. endX = _getXAxisPoints0.endX,
  6626. eachSpacing = _getXAxisPoints0.eachSpacing;
  6627. var centerLeft = eachSpacing * centerPoint;
  6628. var screenWidth = endX - startX;
  6629. var MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1);
  6630. offsetLeft = screenWidth / 2 - centerLeft;
  6631. if (offsetLeft > 0) {
  6632. offsetLeft = 0;
  6633. }
  6634. if (offsetLeft < MaxLeft) {
  6635. offsetLeft = MaxLeft;
  6636. }
  6637. this.scrollOption = {
  6638. currentOffset: offsetLeft,
  6639. startTouchX: offsetLeft,
  6640. distance: 0,
  6641. lastMoveTime: 0 };
  6642. this.opts._scrollDistance_ = offsetLeft;
  6643. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6644. };
  6645. Charts.prototype.stopAnimation = function () {
  6646. this.animationInstance && this.animationInstance.stop();
  6647. };
  6648. Charts.prototype.addEventListener = function (type, listener) {
  6649. this.event.addEventListener(type, listener);
  6650. };
  6651. Charts.prototype.getCurrentDataIndex = function (e) {
  6652. var touches = null;
  6653. if (e.changedTouches) {
  6654. touches = e.changedTouches[0];
  6655. } else {
  6656. touches = e.mp.changedTouches[0];
  6657. }
  6658. if (touches) {
  6659. var _touches$ = getTouches(touches, this.opts, e);
  6660. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose') {
  6661. return findPieChartCurrentIndex({
  6662. x: _touches$.x,
  6663. y: _touches$.y },
  6664. this.opts.chartData.pieData);
  6665. } else if (this.opts.type === 'radar') {
  6666. return findRadarChartCurrentIndex({
  6667. x: _touches$.x,
  6668. y: _touches$.y },
  6669. this.opts.chartData.radarData, this.opts.categories.length);
  6670. } else if (this.opts.type === 'funnel') {
  6671. return findFunnelChartCurrentIndex({
  6672. x: _touches$.x,
  6673. y: _touches$.y },
  6674. this.opts.chartData.funnelData);
  6675. } else if (this.opts.type === 'map') {
  6676. return findMapChartCurrentIndex({
  6677. x: _touches$.x,
  6678. y: _touches$.y },
  6679. this.opts);
  6680. } else if (this.opts.type === 'word') {
  6681. return findWordChartCurrentIndex({
  6682. x: _touches$.x,
  6683. y: _touches$.y },
  6684. this.opts.chartData.wordCloudData);
  6685. } else {
  6686. return findCurrentIndex({
  6687. x: _touches$.x,
  6688. y: _touches$.y },
  6689. this.opts.chartData.xAxisPoints, this.opts, this.config, Math.abs(this.scrollOption.currentOffset));
  6690. }
  6691. }
  6692. return -1;
  6693. };
  6694. Charts.prototype.getLegendDataIndex = function (e) {
  6695. var touches = null;
  6696. if (e.changedTouches) {
  6697. touches = e.changedTouches[0];
  6698. } else {
  6699. touches = e.mp.changedTouches[0];
  6700. }
  6701. if (touches) {
  6702. var _touches$ = getTouches(touches, this.opts, e);
  6703. return findLegendIndex({
  6704. x: _touches$.x,
  6705. y: _touches$.y },
  6706. this.opts.chartData.legendData);
  6707. }
  6708. return -1;
  6709. };
  6710. Charts.prototype.touchLegend = function (e) {
  6711. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6712. var touches = null;
  6713. if (e.changedTouches) {
  6714. touches = e.changedTouches[0];
  6715. } else {
  6716. touches = e.mp.changedTouches[0];
  6717. }
  6718. if (touches) {
  6719. var _touches$ = getTouches(touches, this.opts, e);
  6720. var index = this.getLegendDataIndex(e);
  6721. if (index >= 0) {
  6722. this.opts.series[index].show = !this.opts.series[index].show;
  6723. this.opts.animation = option.animation ? true : false;
  6724. drawCharts.call(this, this.opts.type, this.opts, this.config, this.context);
  6725. }
  6726. }
  6727. };
  6728. Charts.prototype.showToolTip = function (e) {
  6729. var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6730. var touches = null;
  6731. if (e.changedTouches) {
  6732. touches = e.changedTouches[0];
  6733. } else {
  6734. touches = e.mp.changedTouches[0];
  6735. }
  6736. if (!touches) {
  6737. console.log("touchError");
  6738. }
  6739. var _touches$ = getTouches(touches, this.opts, e);
  6740. var currentOffset = this.scrollOption.currentOffset;
  6741. var opts = assign({}, this.opts, {
  6742. _scrollDistance_: currentOffset,
  6743. animation: false });
  6744. if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column') {
  6745. var index = this.getCurrentDataIndex(e);
  6746. if (index > -1) {
  6747. var seriesData = getSeriesDataItem(this.opts.series, index);
  6748. if (seriesData.length !== 0) {
  6749. var _getToolTipData = getToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories, option),
  6750. textList = _getToolTipData.textList,
  6751. offset = _getToolTipData.offset;
  6752. offset.y = _touches$.y;
  6753. opts.tooltip = {
  6754. textList: textList,
  6755. offset: offset,
  6756. option: option,
  6757. index: index };
  6758. }
  6759. }
  6760. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6761. }
  6762. if (this.opts.type === 'mix') {
  6763. var index = this.getCurrentDataIndex(e);
  6764. if (index > -1) {
  6765. var currentOffset = this.scrollOption.currentOffset;
  6766. var opts = assign({}, this.opts, {
  6767. _scrollDistance_: currentOffset,
  6768. animation: false });
  6769. var seriesData = getSeriesDataItem(this.opts.series, index);
  6770. if (seriesData.length !== 0) {
  6771. var _getMixToolTipData = getMixToolTipData(seriesData, this.opts.chartData.calPoints, index, this.opts.categories, option),
  6772. textList = _getMixToolTipData.textList,
  6773. offset = _getMixToolTipData.offset;
  6774. offset.y = _touches$.y;
  6775. opts.tooltip = {
  6776. textList: textList,
  6777. offset: offset,
  6778. option: option,
  6779. index: index };
  6780. }
  6781. }
  6782. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6783. }
  6784. if (this.opts.type === 'candle') {
  6785. var index = this.getCurrentDataIndex(e);
  6786. if (index > -1) {
  6787. var currentOffset = this.scrollOption.currentOffset;
  6788. var opts = assign({}, this.opts, {
  6789. _scrollDistance_: currentOffset,
  6790. animation: false });
  6791. var seriesData = getSeriesDataItem(this.opts.series, index);
  6792. if (seriesData.length !== 0) {
  6793. var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts.chartData.calPoints,
  6794. index, this.opts.categories, this.opts.extra.candle, option),
  6795. textList = _getToolTipData.textList,
  6796. offset = _getToolTipData.offset;
  6797. offset.y = _touches$.y;
  6798. opts.tooltip = {
  6799. textList: textList,
  6800. offset: offset,
  6801. option: option,
  6802. index: index };
  6803. }
  6804. }
  6805. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6806. }
  6807. if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === 'funnel') {
  6808. var index = this.getCurrentDataIndex(e);
  6809. if (index > -1) {
  6810. var currentOffset = this.scrollOption.currentOffset;
  6811. var opts = assign({}, this.opts, {
  6812. _scrollDistance_: currentOffset,
  6813. animation: false });
  6814. var seriesData = this.opts._series_[index];
  6815. var textList = [{
  6816. text: option.format ? option.format(seriesData) : seriesData.name + ': ' + seriesData.data,
  6817. color: seriesData.color }];
  6818. var offset = {
  6819. x: _touches$.x,
  6820. y: _touches$.y };
  6821. opts.tooltip = {
  6822. textList: textList,
  6823. offset: offset,
  6824. option: option,
  6825. index: index };
  6826. }
  6827. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6828. }
  6829. if (this.opts.type === 'map' || this.opts.type === 'word') {
  6830. var index = this.getCurrentDataIndex(e);
  6831. if (index > -1) {
  6832. var currentOffset = this.scrollOption.currentOffset;
  6833. var opts = assign({}, this.opts, {
  6834. _scrollDistance_: currentOffset,
  6835. animation: false });
  6836. var seriesData = this.opts._series_[index];
  6837. var textList = [{
  6838. text: option.format ? option.format(seriesData) : seriesData.properties.name,
  6839. color: seriesData.color }];
  6840. var offset = {
  6841. x: _touches$.x,
  6842. y: _touches$.y };
  6843. opts.tooltip = {
  6844. textList: textList,
  6845. offset: offset,
  6846. option: option,
  6847. index: index };
  6848. }
  6849. opts.updateData = false;
  6850. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6851. }
  6852. if (this.opts.type === 'radar') {
  6853. var index = this.getCurrentDataIndex(e);
  6854. if (index > -1) {
  6855. var currentOffset = this.scrollOption.currentOffset;
  6856. var opts = assign({}, this.opts, {
  6857. _scrollDistance_: currentOffset,
  6858. animation: false });
  6859. var seriesData = getSeriesDataItem(this.opts.series, index);
  6860. if (seriesData.length !== 0) {
  6861. var textList = seriesData.map(function (item) {
  6862. return {
  6863. text: option.format ? option.format(item) : item.name + ': ' + item.data,
  6864. color: item.color };
  6865. });
  6866. var offset = {
  6867. x: _touches$.x,
  6868. y: _touches$.y };
  6869. opts.tooltip = {
  6870. textList: textList,
  6871. offset: offset,
  6872. option: option,
  6873. index: index };
  6874. }
  6875. }
  6876. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6877. }
  6878. };
  6879. Charts.prototype.translate = function (distance) {
  6880. this.scrollOption = {
  6881. currentOffset: distance,
  6882. startTouchX: distance,
  6883. distance: 0,
  6884. lastMoveTime: 0 };
  6885. var opts = assign({}, this.opts, {
  6886. _scrollDistance_: distance,
  6887. animation: false });
  6888. drawCharts.call(this, this.opts.type, opts, this.config, this.context);
  6889. };
  6890. Charts.prototype.scrollStart = function (e) {
  6891. var touches = null;
  6892. if (e.changedTouches) {
  6893. touches = e.changedTouches[0];
  6894. } else {
  6895. touches = e.mp.changedTouches[0];
  6896. }
  6897. var _touches$ = getTouches(touches, this.opts, e);
  6898. if (touches && this.opts.enableScroll === true) {
  6899. this.scrollOption.startTouchX = _touches$.x;
  6900. }
  6901. };
  6902. Charts.prototype.scroll = function (e) {
  6903. if (this.scrollOption.lastMoveTime === 0) {
  6904. this.scrollOption.lastMoveTime = Date.now();
  6905. }
  6906. var Limit = this.opts.extra.touchMoveLimit || 20;
  6907. var currMoveTime = Date.now();
  6908. var duration = currMoveTime - this.scrollOption.lastMoveTime;
  6909. if (duration < Math.floor(1000 / Limit)) return;
  6910. this.scrollOption.lastMoveTime = currMoveTime;
  6911. var touches = null;
  6912. if (e.changedTouches) {
  6913. touches = e.changedTouches[0];
  6914. } else {
  6915. touches = e.mp.changedTouches[0];
  6916. }
  6917. if (touches && this.opts.enableScroll === true) {
  6918. var _touches$ = getTouches(touches, this.opts, e);
  6919. var _distance;
  6920. _distance = _touches$.x - this.scrollOption.startTouchX;
  6921. var currentOffset = this.scrollOption.currentOffset;
  6922. var validDistance = calValidDistance(currentOffset + _distance, this.opts.chartData, this.config, this.opts);
  6923. this.scrollOption.distance = _distance = validDistance - currentOffset;
  6924. var opts = assign({}, this.opts, {
  6925. _scrollDistance_: currentOffset + _distance,
  6926. animation: false });
  6927. drawCharts.call(this, opts.type, opts, this.config, this.context);
  6928. return currentOffset + _distance;
  6929. }
  6930. };
  6931. Charts.prototype.scrollEnd = function (e) {
  6932. if (this.opts.enableScroll === true) {
  6933. var _scrollOption = this.scrollOption,
  6934. currentOffset = _scrollOption.currentOffset,
  6935. distance = _scrollOption.distance;
  6936. this.scrollOption.currentOffset = currentOffset + distance;
  6937. this.scrollOption.distance = 0;
  6938. }
  6939. };
  6940. if ( true && typeof module.exports === "object") {
  6941. module.exports = Charts;
  6942. //export default Charts;//建议使用nodejs的module导出方式,如报错请使用export方式导出
  6943. }
  6944. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  6945. /***/ }),
  6946. /***/ 2:
  6947. /*!***********************************!*\
  6948. !*** (webpack)/buildin/global.js ***!
  6949. \***********************************/
  6950. /*! no static exports found */
  6951. /***/ (function(module, exports) {
  6952. var g;
  6953. // This works in non-strict mode
  6954. g = (function() {
  6955. return this;
  6956. })();
  6957. try {
  6958. // This works if eval is allowed (see CSP)
  6959. g = g || new Function("return this")();
  6960. } catch (e) {
  6961. // This works if the window reference is available
  6962. if (typeof window === "object") g = window;
  6963. }
  6964. // g can still be undefined, but nothing to do about it...
  6965. // We return undefined, instead of nothing here, so it's
  6966. // easier to handle this case. if(!global) { ...}
  6967. module.exports = g;
  6968. /***/ }),
  6969. /***/ 20:
  6970. /*!**********************************************************!*\
  6971. !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  6972. \**********************************************************/
  6973. /*! no static exports found */
  6974. /***/ (function(module, exports, __webpack_require__) {
  6975. module.exports = __webpack_require__(/*! regenerator-runtime */ 21);
  6976. /***/ }),
  6977. /***/ 21:
  6978. /*!************************************************************!*\
  6979. !*** ./node_modules/regenerator-runtime/runtime-module.js ***!
  6980. \************************************************************/
  6981. /*! no static exports found */
  6982. /***/ (function(module, exports, __webpack_require__) {
  6983. /**
  6984. * Copyright (c) 2014-present, Facebook, Inc.
  6985. *
  6986. * This source code is licensed under the MIT license found in the
  6987. * LICENSE file in the root directory of this source tree.
  6988. */
  6989. // This method of obtaining a reference to the global object needs to be
  6990. // kept identical to the way it is obtained in runtime.js
  6991. var g = (function() {
  6992. return this || (typeof self === "object" && self);
  6993. })() || Function("return this")();
  6994. // Use `getOwnPropertyNames` because not all browsers support calling
  6995. // `hasOwnProperty` on the global `self` object in a worker. See #183.
  6996. var hadRuntime = g.regeneratorRuntime &&
  6997. Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  6998. // Save the old regeneratorRuntime in case it needs to be restored later.
  6999. var oldRuntime = hadRuntime && g.regeneratorRuntime;
  7000. // Force reevalutation of runtime.js.
  7001. g.regeneratorRuntime = undefined;
  7002. module.exports = __webpack_require__(/*! ./runtime */ 22);
  7003. if (hadRuntime) {
  7004. // Restore the original runtime.
  7005. g.regeneratorRuntime = oldRuntime;
  7006. } else {
  7007. // Remove the global property added by runtime.js.
  7008. try {
  7009. delete g.regeneratorRuntime;
  7010. } catch(e) {
  7011. g.regeneratorRuntime = undefined;
  7012. }
  7013. }
  7014. /***/ }),
  7015. /***/ 212:
  7016. /*!********************************************************************************************************************************!*\
  7017. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-popup/components/uni-popup/popup.js ***!
  7018. \********************************************************************************************************************************/
  7019. /*! no static exports found */
  7020. /***/ (function(module, exports, __webpack_require__) {
  7021. "use strict";
  7022. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _default =
  7023. {
  7024. data: function data() {
  7025. return {};
  7026. },
  7027. created: function created() {
  7028. this.popup = this.getParent();
  7029. },
  7030. methods: {
  7031. /**
  7032. * 获取父元素实例
  7033. */
  7034. getParent: function getParent() {var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'uniPopup';
  7035. var parent = this.$parent;
  7036. var parentName = parent.$options.name;
  7037. while (parentName !== name) {
  7038. parent = parent.$parent;
  7039. if (!parent) return false;
  7040. parentName = parent.$options.name;
  7041. }
  7042. return parent;
  7043. } } };exports.default = _default;
  7044. /***/ }),
  7045. /***/ 213:
  7046. /*!*************************************************************************************************************************************!*\
  7047. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-popup/components/uni-popup/i18n/index.js ***!
  7048. \*************************************************************************************************************************************/
  7049. /*! no static exports found */
  7050. /***/ (function(module, exports, __webpack_require__) {
  7051. "use strict";
  7052. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _en = _interopRequireDefault(__webpack_require__(/*! ./en.json */ 214));
  7053. var _zhHans = _interopRequireDefault(__webpack_require__(/*! ./zh-Hans.json */ 215));
  7054. var _zhHant = _interopRequireDefault(__webpack_require__(/*! ./zh-Hant.json */ 216));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}var _default =
  7055. {
  7056. en: _en.default,
  7057. 'zh-Hans': _zhHans.default,
  7058. 'zh-Hant': _zhHant.default };exports.default = _default;
  7059. /***/ }),
  7060. /***/ 214:
  7061. /*!************************************************************************************************************************************!*\
  7062. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-popup/components/uni-popup/i18n/en.json ***!
  7063. \************************************************************************************************************************************/
  7064. /*! exports provided: uni-popup.cancel, uni-popup.ok, uni-popup.placeholder, uni-popup.title, uni-popup.shareTitle, default */
  7065. /***/ (function(module) {
  7066. module.exports = JSON.parse("{\"uni-popup.cancel\":\"cancel\",\"uni-popup.ok\":\"ok\",\"uni-popup.placeholder\":\"pleace enter\",\"uni-popup.title\":\"Hint\",\"uni-popup.shareTitle\":\"Share to\"}");
  7067. /***/ }),
  7068. /***/ 215:
  7069. /*!*****************************************************************************************************************************************!*\
  7070. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json ***!
  7071. \*****************************************************************************************************************************************/
  7072. /*! exports provided: uni-popup.cancel, uni-popup.ok, uni-popup.placeholder, uni-popup.title, uni-popup.shareTitle, default */
  7073. /***/ (function(module) {
  7074. module.exports = JSON.parse("{\"uni-popup.cancel\":\"取消\",\"uni-popup.ok\":\"确定\",\"uni-popup.placeholder\":\"请输入\",\"uni-popup.title\":\"提示\",\"uni-popup.shareTitle\":\"分享到\"}");
  7075. /***/ }),
  7076. /***/ 216:
  7077. /*!*****************************************************************************************************************************************!*\
  7078. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json ***!
  7079. \*****************************************************************************************************************************************/
  7080. /*! exports provided: uni-popup.cancel, uni-popup.ok, uni-popup.placeholder, uni-popup.title, uni-popup.shareTitle, default */
  7081. /***/ (function(module) {
  7082. module.exports = JSON.parse("{\"uni-popup.cancel\":\"取消\",\"uni-popup.ok\":\"確定\",\"uni-popup.placeholder\":\"請輸入\",\"uni-popup.title\":\"提示\",\"uni-popup.shareTitle\":\"分享到\"}");
  7083. /***/ }),
  7084. /***/ 22:
  7085. /*!*****************************************************!*\
  7086. !*** ./node_modules/regenerator-runtime/runtime.js ***!
  7087. \*****************************************************/
  7088. /*! no static exports found */
  7089. /***/ (function(module, exports) {
  7090. /**
  7091. * Copyright (c) 2014-present, Facebook, Inc.
  7092. *
  7093. * This source code is licensed under the MIT license found in the
  7094. * LICENSE file in the root directory of this source tree.
  7095. */
  7096. !(function(global) {
  7097. "use strict";
  7098. var Op = Object.prototype;
  7099. var hasOwn = Op.hasOwnProperty;
  7100. var undefined; // More compressible than void 0.
  7101. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  7102. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  7103. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  7104. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  7105. var inModule = typeof module === "object";
  7106. var runtime = global.regeneratorRuntime;
  7107. if (runtime) {
  7108. if (inModule) {
  7109. // If regeneratorRuntime is defined globally and we're in a module,
  7110. // make the exports object identical to regeneratorRuntime.
  7111. module.exports = runtime;
  7112. }
  7113. // Don't bother evaluating the rest of this file if the runtime was
  7114. // already defined globally.
  7115. return;
  7116. }
  7117. // Define the runtime globally (as expected by generated code) as either
  7118. // module.exports (if we're in a module) or a new, empty object.
  7119. runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  7120. function wrap(innerFn, outerFn, self, tryLocsList) {
  7121. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  7122. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  7123. var generator = Object.create(protoGenerator.prototype);
  7124. var context = new Context(tryLocsList || []);
  7125. // The ._invoke method unifies the implementations of the .next,
  7126. // .throw, and .return methods.
  7127. generator._invoke = makeInvokeMethod(innerFn, self, context);
  7128. return generator;
  7129. }
  7130. runtime.wrap = wrap;
  7131. // Try/catch helper to minimize deoptimizations. Returns a completion
  7132. // record like context.tryEntries[i].completion. This interface could
  7133. // have been (and was previously) designed to take a closure to be
  7134. // invoked without arguments, but in all the cases we care about we
  7135. // already have an existing method we want to call, so there's no need
  7136. // to create a new function object. We can even get away with assuming
  7137. // the method takes exactly one argument, since that happens to be true
  7138. // in every case, so we don't have to touch the arguments object. The
  7139. // only additional allocation required is the completion record, which
  7140. // has a stable shape and so hopefully should be cheap to allocate.
  7141. function tryCatch(fn, obj, arg) {
  7142. try {
  7143. return { type: "normal", arg: fn.call(obj, arg) };
  7144. } catch (err) {
  7145. return { type: "throw", arg: err };
  7146. }
  7147. }
  7148. var GenStateSuspendedStart = "suspendedStart";
  7149. var GenStateSuspendedYield = "suspendedYield";
  7150. var GenStateExecuting = "executing";
  7151. var GenStateCompleted = "completed";
  7152. // Returning this object from the innerFn has the same effect as
  7153. // breaking out of the dispatch switch statement.
  7154. var ContinueSentinel = {};
  7155. // Dummy constructor functions that we use as the .constructor and
  7156. // .constructor.prototype properties for functions that return Generator
  7157. // objects. For full spec compliance, you may wish to configure your
  7158. // minifier not to mangle the names of these two functions.
  7159. function Generator() {}
  7160. function GeneratorFunction() {}
  7161. function GeneratorFunctionPrototype() {}
  7162. // This is a polyfill for %IteratorPrototype% for environments that
  7163. // don't natively support it.
  7164. var IteratorPrototype = {};
  7165. IteratorPrototype[iteratorSymbol] = function () {
  7166. return this;
  7167. };
  7168. var getProto = Object.getPrototypeOf;
  7169. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  7170. if (NativeIteratorPrototype &&
  7171. NativeIteratorPrototype !== Op &&
  7172. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  7173. // This environment has a native %IteratorPrototype%; use it instead
  7174. // of the polyfill.
  7175. IteratorPrototype = NativeIteratorPrototype;
  7176. }
  7177. var Gp = GeneratorFunctionPrototype.prototype =
  7178. Generator.prototype = Object.create(IteratorPrototype);
  7179. GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  7180. GeneratorFunctionPrototype.constructor = GeneratorFunction;
  7181. GeneratorFunctionPrototype[toStringTagSymbol] =
  7182. GeneratorFunction.displayName = "GeneratorFunction";
  7183. // Helper for defining the .next, .throw, and .return methods of the
  7184. // Iterator interface in terms of a single ._invoke method.
  7185. function defineIteratorMethods(prototype) {
  7186. ["next", "throw", "return"].forEach(function(method) {
  7187. prototype[method] = function(arg) {
  7188. return this._invoke(method, arg);
  7189. };
  7190. });
  7191. }
  7192. runtime.isGeneratorFunction = function(genFun) {
  7193. var ctor = typeof genFun === "function" && genFun.constructor;
  7194. return ctor
  7195. ? ctor === GeneratorFunction ||
  7196. // For the native GeneratorFunction constructor, the best we can
  7197. // do is to check its .name property.
  7198. (ctor.displayName || ctor.name) === "GeneratorFunction"
  7199. : false;
  7200. };
  7201. runtime.mark = function(genFun) {
  7202. if (Object.setPrototypeOf) {
  7203. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  7204. } else {
  7205. genFun.__proto__ = GeneratorFunctionPrototype;
  7206. if (!(toStringTagSymbol in genFun)) {
  7207. genFun[toStringTagSymbol] = "GeneratorFunction";
  7208. }
  7209. }
  7210. genFun.prototype = Object.create(Gp);
  7211. return genFun;
  7212. };
  7213. // Within the body of any async function, `await x` is transformed to
  7214. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  7215. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  7216. // meant to be awaited.
  7217. runtime.awrap = function(arg) {
  7218. return { __await: arg };
  7219. };
  7220. function AsyncIterator(generator) {
  7221. function invoke(method, arg, resolve, reject) {
  7222. var record = tryCatch(generator[method], generator, arg);
  7223. if (record.type === "throw") {
  7224. reject(record.arg);
  7225. } else {
  7226. var result = record.arg;
  7227. var value = result.value;
  7228. if (value &&
  7229. typeof value === "object" &&
  7230. hasOwn.call(value, "__await")) {
  7231. return Promise.resolve(value.__await).then(function(value) {
  7232. invoke("next", value, resolve, reject);
  7233. }, function(err) {
  7234. invoke("throw", err, resolve, reject);
  7235. });
  7236. }
  7237. return Promise.resolve(value).then(function(unwrapped) {
  7238. // When a yielded Promise is resolved, its final value becomes
  7239. // the .value of the Promise<{value,done}> result for the
  7240. // current iteration.
  7241. result.value = unwrapped;
  7242. resolve(result);
  7243. }, function(error) {
  7244. // If a rejected Promise was yielded, throw the rejection back
  7245. // into the async generator function so it can be handled there.
  7246. return invoke("throw", error, resolve, reject);
  7247. });
  7248. }
  7249. }
  7250. var previousPromise;
  7251. function enqueue(method, arg) {
  7252. function callInvokeWithMethodAndArg() {
  7253. return new Promise(function(resolve, reject) {
  7254. invoke(method, arg, resolve, reject);
  7255. });
  7256. }
  7257. return previousPromise =
  7258. // If enqueue has been called before, then we want to wait until
  7259. // all previous Promises have been resolved before calling invoke,
  7260. // so that results are always delivered in the correct order. If
  7261. // enqueue has not been called before, then it is important to
  7262. // call invoke immediately, without waiting on a callback to fire,
  7263. // so that the async generator function has the opportunity to do
  7264. // any necessary setup in a predictable way. This predictability
  7265. // is why the Promise constructor synchronously invokes its
  7266. // executor callback, and why async functions synchronously
  7267. // execute code before the first await. Since we implement simple
  7268. // async functions in terms of async generators, it is especially
  7269. // important to get this right, even though it requires care.
  7270. previousPromise ? previousPromise.then(
  7271. callInvokeWithMethodAndArg,
  7272. // Avoid propagating failures to Promises returned by later
  7273. // invocations of the iterator.
  7274. callInvokeWithMethodAndArg
  7275. ) : callInvokeWithMethodAndArg();
  7276. }
  7277. // Define the unified helper method that is used to implement .next,
  7278. // .throw, and .return (see defineIteratorMethods).
  7279. this._invoke = enqueue;
  7280. }
  7281. defineIteratorMethods(AsyncIterator.prototype);
  7282. AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  7283. return this;
  7284. };
  7285. runtime.AsyncIterator = AsyncIterator;
  7286. // Note that simple async functions are implemented on top of
  7287. // AsyncIterator objects; they just return a Promise for the value of
  7288. // the final result produced by the iterator.
  7289. runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  7290. var iter = new AsyncIterator(
  7291. wrap(innerFn, outerFn, self, tryLocsList)
  7292. );
  7293. return runtime.isGeneratorFunction(outerFn)
  7294. ? iter // If outerFn is a generator, return the full iterator.
  7295. : iter.next().then(function(result) {
  7296. return result.done ? result.value : iter.next();
  7297. });
  7298. };
  7299. function makeInvokeMethod(innerFn, self, context) {
  7300. var state = GenStateSuspendedStart;
  7301. return function invoke(method, arg) {
  7302. if (state === GenStateExecuting) {
  7303. throw new Error("Generator is already running");
  7304. }
  7305. if (state === GenStateCompleted) {
  7306. if (method === "throw") {
  7307. throw arg;
  7308. }
  7309. // Be forgiving, per 25.3.3.3.3 of the spec:
  7310. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  7311. return doneResult();
  7312. }
  7313. context.method = method;
  7314. context.arg = arg;
  7315. while (true) {
  7316. var delegate = context.delegate;
  7317. if (delegate) {
  7318. var delegateResult = maybeInvokeDelegate(delegate, context);
  7319. if (delegateResult) {
  7320. if (delegateResult === ContinueSentinel) continue;
  7321. return delegateResult;
  7322. }
  7323. }
  7324. if (context.method === "next") {
  7325. // Setting context._sent for legacy support of Babel's
  7326. // function.sent implementation.
  7327. context.sent = context._sent = context.arg;
  7328. } else if (context.method === "throw") {
  7329. if (state === GenStateSuspendedStart) {
  7330. state = GenStateCompleted;
  7331. throw context.arg;
  7332. }
  7333. context.dispatchException(context.arg);
  7334. } else if (context.method === "return") {
  7335. context.abrupt("return", context.arg);
  7336. }
  7337. state = GenStateExecuting;
  7338. var record = tryCatch(innerFn, self, context);
  7339. if (record.type === "normal") {
  7340. // If an exception is thrown from innerFn, we leave state ===
  7341. // GenStateExecuting and loop back for another invocation.
  7342. state = context.done
  7343. ? GenStateCompleted
  7344. : GenStateSuspendedYield;
  7345. if (record.arg === ContinueSentinel) {
  7346. continue;
  7347. }
  7348. return {
  7349. value: record.arg,
  7350. done: context.done
  7351. };
  7352. } else if (record.type === "throw") {
  7353. state = GenStateCompleted;
  7354. // Dispatch the exception by looping back around to the
  7355. // context.dispatchException(context.arg) call above.
  7356. context.method = "throw";
  7357. context.arg = record.arg;
  7358. }
  7359. }
  7360. };
  7361. }
  7362. // Call delegate.iterator[context.method](context.arg) and handle the
  7363. // result, either by returning a { value, done } result from the
  7364. // delegate iterator, or by modifying context.method and context.arg,
  7365. // setting context.delegate to null, and returning the ContinueSentinel.
  7366. function maybeInvokeDelegate(delegate, context) {
  7367. var method = delegate.iterator[context.method];
  7368. if (method === undefined) {
  7369. // A .throw or .return when the delegate iterator has no .throw
  7370. // method always terminates the yield* loop.
  7371. context.delegate = null;
  7372. if (context.method === "throw") {
  7373. if (delegate.iterator.return) {
  7374. // If the delegate iterator has a return method, give it a
  7375. // chance to clean up.
  7376. context.method = "return";
  7377. context.arg = undefined;
  7378. maybeInvokeDelegate(delegate, context);
  7379. if (context.method === "throw") {
  7380. // If maybeInvokeDelegate(context) changed context.method from
  7381. // "return" to "throw", let that override the TypeError below.
  7382. return ContinueSentinel;
  7383. }
  7384. }
  7385. context.method = "throw";
  7386. context.arg = new TypeError(
  7387. "The iterator does not provide a 'throw' method");
  7388. }
  7389. return ContinueSentinel;
  7390. }
  7391. var record = tryCatch(method, delegate.iterator, context.arg);
  7392. if (record.type === "throw") {
  7393. context.method = "throw";
  7394. context.arg = record.arg;
  7395. context.delegate = null;
  7396. return ContinueSentinel;
  7397. }
  7398. var info = record.arg;
  7399. if (! info) {
  7400. context.method = "throw";
  7401. context.arg = new TypeError("iterator result is not an object");
  7402. context.delegate = null;
  7403. return ContinueSentinel;
  7404. }
  7405. if (info.done) {
  7406. // Assign the result of the finished delegate to the temporary
  7407. // variable specified by delegate.resultName (see delegateYield).
  7408. context[delegate.resultName] = info.value;
  7409. // Resume execution at the desired location (see delegateYield).
  7410. context.next = delegate.nextLoc;
  7411. // If context.method was "throw" but the delegate handled the
  7412. // exception, let the outer generator proceed normally. If
  7413. // context.method was "next", forget context.arg since it has been
  7414. // "consumed" by the delegate iterator. If context.method was
  7415. // "return", allow the original .return call to continue in the
  7416. // outer generator.
  7417. if (context.method !== "return") {
  7418. context.method = "next";
  7419. context.arg = undefined;
  7420. }
  7421. } else {
  7422. // Re-yield the result returned by the delegate method.
  7423. return info;
  7424. }
  7425. // The delegate iterator is finished, so forget it and continue with
  7426. // the outer generator.
  7427. context.delegate = null;
  7428. return ContinueSentinel;
  7429. }
  7430. // Define Generator.prototype.{next,throw,return} in terms of the
  7431. // unified ._invoke helper method.
  7432. defineIteratorMethods(Gp);
  7433. Gp[toStringTagSymbol] = "Generator";
  7434. // A Generator should always return itself as the iterator object when the
  7435. // @@iterator function is called on it. Some browsers' implementations of the
  7436. // iterator prototype chain incorrectly implement this, causing the Generator
  7437. // object to not be returned from this call. This ensures that doesn't happen.
  7438. // See https://github.com/facebook/regenerator/issues/274 for more details.
  7439. Gp[iteratorSymbol] = function() {
  7440. return this;
  7441. };
  7442. Gp.toString = function() {
  7443. return "[object Generator]";
  7444. };
  7445. function pushTryEntry(locs) {
  7446. var entry = { tryLoc: locs[0] };
  7447. if (1 in locs) {
  7448. entry.catchLoc = locs[1];
  7449. }
  7450. if (2 in locs) {
  7451. entry.finallyLoc = locs[2];
  7452. entry.afterLoc = locs[3];
  7453. }
  7454. this.tryEntries.push(entry);
  7455. }
  7456. function resetTryEntry(entry) {
  7457. var record = entry.completion || {};
  7458. record.type = "normal";
  7459. delete record.arg;
  7460. entry.completion = record;
  7461. }
  7462. function Context(tryLocsList) {
  7463. // The root entry object (effectively a try statement without a catch
  7464. // or a finally block) gives us a place to store values thrown from
  7465. // locations where there is no enclosing try statement.
  7466. this.tryEntries = [{ tryLoc: "root" }];
  7467. tryLocsList.forEach(pushTryEntry, this);
  7468. this.reset(true);
  7469. }
  7470. runtime.keys = function(object) {
  7471. var keys = [];
  7472. for (var key in object) {
  7473. keys.push(key);
  7474. }
  7475. keys.reverse();
  7476. // Rather than returning an object with a next method, we keep
  7477. // things simple and return the next function itself.
  7478. return function next() {
  7479. while (keys.length) {
  7480. var key = keys.pop();
  7481. if (key in object) {
  7482. next.value = key;
  7483. next.done = false;
  7484. return next;
  7485. }
  7486. }
  7487. // To avoid creating an additional object, we just hang the .value
  7488. // and .done properties off the next function object itself. This
  7489. // also ensures that the minifier will not anonymize the function.
  7490. next.done = true;
  7491. return next;
  7492. };
  7493. };
  7494. function values(iterable) {
  7495. if (iterable) {
  7496. var iteratorMethod = iterable[iteratorSymbol];
  7497. if (iteratorMethod) {
  7498. return iteratorMethod.call(iterable);
  7499. }
  7500. if (typeof iterable.next === "function") {
  7501. return iterable;
  7502. }
  7503. if (!isNaN(iterable.length)) {
  7504. var i = -1, next = function next() {
  7505. while (++i < iterable.length) {
  7506. if (hasOwn.call(iterable, i)) {
  7507. next.value = iterable[i];
  7508. next.done = false;
  7509. return next;
  7510. }
  7511. }
  7512. next.value = undefined;
  7513. next.done = true;
  7514. return next;
  7515. };
  7516. return next.next = next;
  7517. }
  7518. }
  7519. // Return an iterator with no values.
  7520. return { next: doneResult };
  7521. }
  7522. runtime.values = values;
  7523. function doneResult() {
  7524. return { value: undefined, done: true };
  7525. }
  7526. Context.prototype = {
  7527. constructor: Context,
  7528. reset: function(skipTempReset) {
  7529. this.prev = 0;
  7530. this.next = 0;
  7531. // Resetting context._sent for legacy support of Babel's
  7532. // function.sent implementation.
  7533. this.sent = this._sent = undefined;
  7534. this.done = false;
  7535. this.delegate = null;
  7536. this.method = "next";
  7537. this.arg = undefined;
  7538. this.tryEntries.forEach(resetTryEntry);
  7539. if (!skipTempReset) {
  7540. for (var name in this) {
  7541. // Not sure about the optimal order of these conditions:
  7542. if (name.charAt(0) === "t" &&
  7543. hasOwn.call(this, name) &&
  7544. !isNaN(+name.slice(1))) {
  7545. this[name] = undefined;
  7546. }
  7547. }
  7548. }
  7549. },
  7550. stop: function() {
  7551. this.done = true;
  7552. var rootEntry = this.tryEntries[0];
  7553. var rootRecord = rootEntry.completion;
  7554. if (rootRecord.type === "throw") {
  7555. throw rootRecord.arg;
  7556. }
  7557. return this.rval;
  7558. },
  7559. dispatchException: function(exception) {
  7560. if (this.done) {
  7561. throw exception;
  7562. }
  7563. var context = this;
  7564. function handle(loc, caught) {
  7565. record.type = "throw";
  7566. record.arg = exception;
  7567. context.next = loc;
  7568. if (caught) {
  7569. // If the dispatched exception was caught by a catch block,
  7570. // then let that catch block handle the exception normally.
  7571. context.method = "next";
  7572. context.arg = undefined;
  7573. }
  7574. return !! caught;
  7575. }
  7576. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7577. var entry = this.tryEntries[i];
  7578. var record = entry.completion;
  7579. if (entry.tryLoc === "root") {
  7580. // Exception thrown outside of any try block that could handle
  7581. // it, so set the completion value of the entire function to
  7582. // throw the exception.
  7583. return handle("end");
  7584. }
  7585. if (entry.tryLoc <= this.prev) {
  7586. var hasCatch = hasOwn.call(entry, "catchLoc");
  7587. var hasFinally = hasOwn.call(entry, "finallyLoc");
  7588. if (hasCatch && hasFinally) {
  7589. if (this.prev < entry.catchLoc) {
  7590. return handle(entry.catchLoc, true);
  7591. } else if (this.prev < entry.finallyLoc) {
  7592. return handle(entry.finallyLoc);
  7593. }
  7594. } else if (hasCatch) {
  7595. if (this.prev < entry.catchLoc) {
  7596. return handle(entry.catchLoc, true);
  7597. }
  7598. } else if (hasFinally) {
  7599. if (this.prev < entry.finallyLoc) {
  7600. return handle(entry.finallyLoc);
  7601. }
  7602. } else {
  7603. throw new Error("try statement without catch or finally");
  7604. }
  7605. }
  7606. }
  7607. },
  7608. abrupt: function(type, arg) {
  7609. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7610. var entry = this.tryEntries[i];
  7611. if (entry.tryLoc <= this.prev &&
  7612. hasOwn.call(entry, "finallyLoc") &&
  7613. this.prev < entry.finallyLoc) {
  7614. var finallyEntry = entry;
  7615. break;
  7616. }
  7617. }
  7618. if (finallyEntry &&
  7619. (type === "break" ||
  7620. type === "continue") &&
  7621. finallyEntry.tryLoc <= arg &&
  7622. arg <= finallyEntry.finallyLoc) {
  7623. // Ignore the finally entry if control is not jumping to a
  7624. // location outside the try/catch block.
  7625. finallyEntry = null;
  7626. }
  7627. var record = finallyEntry ? finallyEntry.completion : {};
  7628. record.type = type;
  7629. record.arg = arg;
  7630. if (finallyEntry) {
  7631. this.method = "next";
  7632. this.next = finallyEntry.finallyLoc;
  7633. return ContinueSentinel;
  7634. }
  7635. return this.complete(record);
  7636. },
  7637. complete: function(record, afterLoc) {
  7638. if (record.type === "throw") {
  7639. throw record.arg;
  7640. }
  7641. if (record.type === "break" ||
  7642. record.type === "continue") {
  7643. this.next = record.arg;
  7644. } else if (record.type === "return") {
  7645. this.rval = this.arg = record.arg;
  7646. this.method = "return";
  7647. this.next = "end";
  7648. } else if (record.type === "normal" && afterLoc) {
  7649. this.next = afterLoc;
  7650. }
  7651. return ContinueSentinel;
  7652. },
  7653. finish: function(finallyLoc) {
  7654. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7655. var entry = this.tryEntries[i];
  7656. if (entry.finallyLoc === finallyLoc) {
  7657. this.complete(entry.completion, entry.afterLoc);
  7658. resetTryEntry(entry);
  7659. return ContinueSentinel;
  7660. }
  7661. }
  7662. },
  7663. "catch": function(tryLoc) {
  7664. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  7665. var entry = this.tryEntries[i];
  7666. if (entry.tryLoc === tryLoc) {
  7667. var record = entry.completion;
  7668. if (record.type === "throw") {
  7669. var thrown = record.arg;
  7670. resetTryEntry(entry);
  7671. }
  7672. return thrown;
  7673. }
  7674. }
  7675. // The context.catch method must only be called with a location
  7676. // argument that corresponds to a known catch block.
  7677. throw new Error("illegal catch attempt");
  7678. },
  7679. delegateYield: function(iterable, resultName, nextLoc) {
  7680. this.delegate = {
  7681. iterator: values(iterable),
  7682. resultName: resultName,
  7683. nextLoc: nextLoc
  7684. };
  7685. if (this.method === "next") {
  7686. // Deliberately forget the last sent value so that we don't
  7687. // accidentally pass it on to the delegate.
  7688. this.arg = undefined;
  7689. }
  7690. return ContinueSentinel;
  7691. }
  7692. };
  7693. })(
  7694. // In sloppy mode, unbound `this` refers to the global object, fallback to
  7695. // Function constructor if we're in global strict mode. That is sadly a form
  7696. // of indirect eval which violates Content Security Policy.
  7697. (function() {
  7698. return this || (typeof self === "object" && self);
  7699. })() || Function("return this")()
  7700. );
  7701. /***/ }),
  7702. /***/ 231:
  7703. /*!****************************************************************************************************************************************************!*\
  7704. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/uni_modules/uni-transition/components/uni-transition/createAnimation.js ***!
  7705. \****************************************************************************************************************************************************/
  7706. /*! no static exports found */
  7707. /***/ (function(module, exports, __webpack_require__) {
  7708. "use strict";
  7709. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.createAnimation = createAnimation;function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;} // const defaultOption = {
  7710. // duration: 300,
  7711. // timingFunction: 'linear',
  7712. // delay: 0,
  7713. // transformOrigin: '50% 50% 0'
  7714. // }
  7715. var
  7716. MPAnimation = /*#__PURE__*/function () {
  7717. function MPAnimation(options, _this) {_classCallCheck(this, MPAnimation);
  7718. this.options = options;
  7719. this.animation = uni.createAnimation(options);
  7720. this.currentStepAnimates = {};
  7721. this.next = 0;
  7722. this.$ = _this;
  7723. }_createClass(MPAnimation, [{ key: "_nvuePushAnimates", value: function _nvuePushAnimates(
  7724. type, args) {
  7725. var aniObj = this.currentStepAnimates[this.next];
  7726. var styles = {};
  7727. if (!aniObj) {
  7728. styles = {
  7729. styles: {},
  7730. config: {} };
  7731. } else {
  7732. styles = aniObj;
  7733. }
  7734. if (animateTypes1.includes(type)) {
  7735. if (!styles.styles.transform) {
  7736. styles.styles.transform = '';
  7737. }
  7738. var unit = '';
  7739. if (type === 'rotate') {
  7740. unit = 'deg';
  7741. }
  7742. styles.styles.transform += "".concat(type, "(").concat(args + unit, ") ");
  7743. } else {
  7744. styles.styles[type] = "".concat(args);
  7745. }
  7746. this.currentStepAnimates[this.next] = styles;
  7747. } }, { key: "_animateRun", value: function _animateRun()
  7748. {var styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  7749. var ref = this.$.$refs['ani'].ref;
  7750. if (!ref) return;
  7751. return new Promise(function (resolve, reject) {
  7752. nvueAnimation.transition(ref, _objectSpread({
  7753. styles: styles },
  7754. config),
  7755. function (res) {
  7756. resolve();
  7757. });
  7758. });
  7759. } }, { key: "_nvueNextAnimate", value: function _nvueNextAnimate(
  7760. animates) {var _this2 = this;var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;var fn = arguments.length > 2 ? arguments[2] : undefined;
  7761. var obj = animates[step];
  7762. if (obj) {var
  7763. styles =
  7764. obj.styles,config = obj.config;
  7765. this._animateRun(styles, config).then(function () {
  7766. step += 1;
  7767. _this2._nvueNextAnimate(animates, step, fn);
  7768. });
  7769. } else {
  7770. this.currentStepAnimates = {};
  7771. typeof fn === 'function' && fn();
  7772. this.isEnd = true;
  7773. }
  7774. } }, { key: "step", value: function step()
  7775. {var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7776. this.animation.step(config);
  7777. return this;
  7778. } }, { key: "run", value: function run(
  7779. fn) {
  7780. this.$.animationData = this.animation.export();
  7781. this.$.timer = setTimeout(function () {
  7782. typeof fn === 'function' && fn();
  7783. }, this.$.durationTime);
  7784. } }]);return MPAnimation;}();
  7785. var animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
  7786. 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
  7787. 'translateZ'];
  7788. var animateTypes2 = ['opacity', 'backgroundColor'];
  7789. var animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'];
  7790. animateTypes1.concat(animateTypes2, animateTypes3).forEach(function (type) {
  7791. MPAnimation.prototype[type] = function () {var _this$animation;
  7792. (_this$animation = this.animation)[type].apply(_this$animation, arguments);
  7793. return this;
  7794. };
  7795. });
  7796. function createAnimation(option, _this) {
  7797. if (!_this) return;
  7798. clearTimeout(_this.timer);
  7799. return new MPAnimation(option, _this);
  7800. }
  7801. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  7802. /***/ }),
  7803. /***/ 3:
  7804. /*!*************************************************************!*\
  7805. !*** ./node_modules/@dcloudio/uni-i18n/dist/uni-i18n.es.js ***!
  7806. \*************************************************************/
  7807. /*! no static exports found */
  7808. /***/ (function(module, exports, __webpack_require__) {
  7809. "use strict";
  7810. /* WEBPACK VAR INJECTION */(function(uni, global) {Object.defineProperty(exports, "__esModule", { value: true });exports.compileI18nJsonStr = compileI18nJsonStr;exports.hasI18nJson = hasI18nJson;exports.initVueI18n = initVueI18n;exports.isI18nStr = isI18nStr;exports.normalizeLocale = normalizeLocale;exports.parseI18nJson = parseI18nJson;exports.resolveLocale = resolveLocale;exports.isString = exports.LOCALE_ZH_HANT = exports.LOCALE_ZH_HANS = exports.LOCALE_FR = exports.LOCALE_ES = exports.LOCALE_EN = exports.I18n = exports.Formatter = void 0;function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}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);}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;}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}var isArray = Array.isArray;
  7811. var isObject = function isObject(val) {return val !== null && typeof val === 'object';};
  7812. var defaultDelimiters = ['{', '}'];var
  7813. BaseFormatter = /*#__PURE__*/function () {
  7814. function BaseFormatter() {_classCallCheck(this, BaseFormatter);
  7815. this._caches = Object.create(null);
  7816. }_createClass(BaseFormatter, [{ key: "interpolate", value: function interpolate(
  7817. message, values) {var delimiters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultDelimiters;
  7818. if (!values) {
  7819. return [message];
  7820. }
  7821. var tokens = this._caches[message];
  7822. if (!tokens) {
  7823. tokens = parse(message, delimiters);
  7824. this._caches[message] = tokens;
  7825. }
  7826. return compile(tokens, values);
  7827. } }]);return BaseFormatter;}();exports.Formatter = BaseFormatter;
  7828. var RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
  7829. var RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
  7830. function parse(format, _ref) {var _ref2 = _slicedToArray(_ref, 2),startDelimiter = _ref2[0],endDelimiter = _ref2[1];
  7831. var tokens = [];
  7832. var position = 0;
  7833. var text = '';
  7834. while (position < format.length) {
  7835. var char = format[position++];
  7836. if (char === startDelimiter) {
  7837. if (text) {
  7838. tokens.push({ type: 'text', value: text });
  7839. }
  7840. text = '';
  7841. var sub = '';
  7842. char = format[position++];
  7843. while (char !== undefined && char !== endDelimiter) {
  7844. sub += char;
  7845. char = format[position++];
  7846. }
  7847. var isClosed = char === endDelimiter;
  7848. var type = RE_TOKEN_LIST_VALUE.test(sub) ?
  7849. 'list' :
  7850. isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ?
  7851. 'named' :
  7852. 'unknown';
  7853. tokens.push({ value: sub, type: type });
  7854. }
  7855. // else if (char === '%') {
  7856. // // when found rails i18n syntax, skip text capture
  7857. // if (format[position] !== '{') {
  7858. // text += char
  7859. // }
  7860. // }
  7861. else {
  7862. text += char;
  7863. }
  7864. }
  7865. text && tokens.push({ type: 'text', value: text });
  7866. return tokens;
  7867. }
  7868. function compile(tokens, values) {
  7869. var compiled = [];
  7870. var index = 0;
  7871. var mode = isArray(values) ?
  7872. 'list' :
  7873. isObject(values) ?
  7874. 'named' :
  7875. 'unknown';
  7876. if (mode === 'unknown') {
  7877. return compiled;
  7878. }
  7879. while (index < tokens.length) {
  7880. var token = tokens[index];
  7881. switch (token.type) {
  7882. case 'text':
  7883. compiled.push(token.value);
  7884. break;
  7885. case 'list':
  7886. compiled.push(values[parseInt(token.value, 10)]);
  7887. break;
  7888. case 'named':
  7889. if (mode === 'named') {
  7890. compiled.push(values[token.value]);
  7891. } else
  7892. {
  7893. if (true) {
  7894. console.warn("Type of token '".concat(token.type, "' and format of value '").concat(mode, "' don't match!"));
  7895. }
  7896. }
  7897. break;
  7898. case 'unknown':
  7899. if (true) {
  7900. console.warn("Detect 'unknown' type of token!");
  7901. }
  7902. break;}
  7903. index++;
  7904. }
  7905. return compiled;
  7906. }
  7907. var LOCALE_ZH_HANS = 'zh-Hans';exports.LOCALE_ZH_HANS = LOCALE_ZH_HANS;
  7908. var LOCALE_ZH_HANT = 'zh-Hant';exports.LOCALE_ZH_HANT = LOCALE_ZH_HANT;
  7909. var LOCALE_EN = 'en';exports.LOCALE_EN = LOCALE_EN;
  7910. var LOCALE_FR = 'fr';exports.LOCALE_FR = LOCALE_FR;
  7911. var LOCALE_ES = 'es';exports.LOCALE_ES = LOCALE_ES;
  7912. var hasOwnProperty = Object.prototype.hasOwnProperty;
  7913. var hasOwn = function hasOwn(val, key) {return hasOwnProperty.call(val, key);};
  7914. var defaultFormatter = new BaseFormatter();
  7915. function include(str, parts) {
  7916. return !!parts.find(function (part) {return str.indexOf(part) !== -1;});
  7917. }
  7918. function startsWith(str, parts) {
  7919. return parts.find(function (part) {return str.indexOf(part) === 0;});
  7920. }
  7921. function normalizeLocale(locale, messages) {
  7922. if (!locale) {
  7923. return;
  7924. }
  7925. locale = locale.trim().replace(/_/g, '-');
  7926. if (messages && messages[locale]) {
  7927. return locale;
  7928. }
  7929. locale = locale.toLowerCase();
  7930. if (locale.indexOf('zh') === 0) {
  7931. if (locale.indexOf('-hans') > -1) {
  7932. return LOCALE_ZH_HANS;
  7933. }
  7934. if (locale.indexOf('-hant') > -1) {
  7935. return LOCALE_ZH_HANT;
  7936. }
  7937. if (include(locale, ['-tw', '-hk', '-mo', '-cht'])) {
  7938. return LOCALE_ZH_HANT;
  7939. }
  7940. return LOCALE_ZH_HANS;
  7941. }
  7942. var lang = startsWith(locale, [LOCALE_EN, LOCALE_FR, LOCALE_ES]);
  7943. if (lang) {
  7944. return lang;
  7945. }
  7946. }var
  7947. I18n = /*#__PURE__*/function () {
  7948. function I18n(_ref3) {var locale = _ref3.locale,fallbackLocale = _ref3.fallbackLocale,messages = _ref3.messages,watcher = _ref3.watcher,formater = _ref3.formater;_classCallCheck(this, I18n);
  7949. this.locale = LOCALE_EN;
  7950. this.fallbackLocale = LOCALE_EN;
  7951. this.message = {};
  7952. this.messages = {};
  7953. this.watchers = [];
  7954. if (fallbackLocale) {
  7955. this.fallbackLocale = fallbackLocale;
  7956. }
  7957. this.formater = formater || defaultFormatter;
  7958. this.messages = messages || {};
  7959. this.setLocale(locale || LOCALE_EN);
  7960. if (watcher) {
  7961. this.watchLocale(watcher);
  7962. }
  7963. }_createClass(I18n, [{ key: "setLocale", value: function setLocale(
  7964. locale) {var _this = this;
  7965. var oldLocale = this.locale;
  7966. this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
  7967. if (!this.messages[this.locale]) {
  7968. // 可能初始化时不存在
  7969. this.messages[this.locale] = {};
  7970. }
  7971. this.message = this.messages[this.locale];
  7972. // 仅发生变化时,通知
  7973. if (oldLocale !== this.locale) {
  7974. this.watchers.forEach(function (watcher) {
  7975. watcher(_this.locale, oldLocale);
  7976. });
  7977. }
  7978. } }, { key: "getLocale", value: function getLocale()
  7979. {
  7980. return this.locale;
  7981. } }, { key: "watchLocale", value: function watchLocale(
  7982. fn) {var _this2 = this;
  7983. var index = this.watchers.push(fn) - 1;
  7984. return function () {
  7985. _this2.watchers.splice(index, 1);
  7986. };
  7987. } }, { key: "add", value: function add(
  7988. locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  7989. var curMessages = this.messages[locale];
  7990. if (curMessages) {
  7991. if (override) {
  7992. Object.assign(curMessages, message);
  7993. } else
  7994. {
  7995. Object.keys(message).forEach(function (key) {
  7996. if (!hasOwn(curMessages, key)) {
  7997. curMessages[key] = message[key];
  7998. }
  7999. });
  8000. }
  8001. } else
  8002. {
  8003. this.messages[locale] = message;
  8004. }
  8005. } }, { key: "f", value: function f(
  8006. message, values, delimiters) {
  8007. return this.formater.interpolate(message, values, delimiters).join('');
  8008. } }, { key: "t", value: function t(
  8009. key, locale, values) {
  8010. var message = this.message;
  8011. if (typeof locale === 'string') {
  8012. locale = normalizeLocale(locale, this.messages);
  8013. locale && (message = this.messages[locale]);
  8014. } else
  8015. {
  8016. values = locale;
  8017. }
  8018. if (!hasOwn(message, key)) {
  8019. console.warn("Cannot translate the value of keypath ".concat(key, ". Use the value of keypath as default."));
  8020. return key;
  8021. }
  8022. return this.formater.interpolate(message[key], values).join('');
  8023. } }]);return I18n;}();exports.I18n = I18n;
  8024. function watchAppLocale(appVm, i18n) {
  8025. // 需要保证 watch 的触发在组件渲染之前
  8026. if (appVm.$watchLocale) {
  8027. // vue2
  8028. appVm.$watchLocale(function (newLocale) {
  8029. i18n.setLocale(newLocale);
  8030. });
  8031. } else
  8032. {
  8033. appVm.$watch(function () {return appVm.$locale;}, function (newLocale) {
  8034. i18n.setLocale(newLocale);
  8035. });
  8036. }
  8037. }
  8038. function getDefaultLocale() {
  8039. if (typeof uni !== 'undefined' && uni.getLocale) {
  8040. return uni.getLocale();
  8041. }
  8042. // 小程序平台,uni 和 uni-i18n 互相引用,导致访问不到 uni,故在 global 上挂了 getLocale
  8043. if (typeof global !== 'undefined' && global.getLocale) {
  8044. return global.getLocale();
  8045. }
  8046. return LOCALE_EN;
  8047. }
  8048. function initVueI18n(locale) {var messages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};var fallbackLocale = arguments.length > 2 ? arguments[2] : undefined;var watcher = arguments.length > 3 ? arguments[3] : undefined;
  8049. // 兼容旧版本入参
  8050. if (typeof locale !== 'string') {var _ref4 =
  8051. [
  8052. messages,
  8053. locale];locale = _ref4[0];messages = _ref4[1];
  8054. }
  8055. if (typeof locale !== 'string') {
  8056. // 因为小程序平台,uni-i18n 和 uni 互相引用,导致此时访问 uni 时,为 undefined
  8057. locale = getDefaultLocale();
  8058. }
  8059. if (typeof fallbackLocale !== 'string') {
  8060. fallbackLocale =
  8061. typeof __uniConfig !== 'undefined' && __uniConfig.fallbackLocale ||
  8062. LOCALE_EN;
  8063. }
  8064. var i18n = new I18n({
  8065. locale: locale,
  8066. fallbackLocale: fallbackLocale,
  8067. messages: messages,
  8068. watcher: watcher });
  8069. var _t = function t(key, values) {
  8070. if (typeof getApp !== 'function') {
  8071. // app view
  8072. /* eslint-disable no-func-assign */
  8073. _t = function t(key, values) {
  8074. return i18n.t(key, values);
  8075. };
  8076. } else
  8077. {
  8078. var isWatchedAppLocale = false;
  8079. _t = function t(key, values) {
  8080. var appVm = getApp().$vm;
  8081. // 可能$vm还不存在,比如在支付宝小程序中,组件定义较早,在props的default里使用了t()函数(如uni-goods-nav),此时app还未初始化
  8082. // options: {
  8083. // type: Array,
  8084. // default () {
  8085. // return [{
  8086. // icon: 'shop',
  8087. // text: t("uni-goods-nav.options.shop"),
  8088. // }, {
  8089. // icon: 'cart',
  8090. // text: t("uni-goods-nav.options.cart")
  8091. // }]
  8092. // }
  8093. // },
  8094. if (appVm) {
  8095. // 触发响应式
  8096. appVm.$locale;
  8097. if (!isWatchedAppLocale) {
  8098. isWatchedAppLocale = true;
  8099. watchAppLocale(appVm, i18n);
  8100. }
  8101. }
  8102. return i18n.t(key, values);
  8103. };
  8104. }
  8105. return _t(key, values);
  8106. };
  8107. return {
  8108. i18n: i18n,
  8109. f: function f(message, values, delimiters) {
  8110. return i18n.f(message, values, delimiters);
  8111. },
  8112. t: function t(key, values) {
  8113. return _t(key, values);
  8114. },
  8115. add: function add(locale, message) {var override = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
  8116. return i18n.add(locale, message, override);
  8117. },
  8118. watch: function watch(fn) {
  8119. return i18n.watchLocale(fn);
  8120. },
  8121. getLocale: function getLocale() {
  8122. return i18n.getLocale();
  8123. },
  8124. setLocale: function setLocale(newLocale) {
  8125. return i18n.setLocale(newLocale);
  8126. } };
  8127. }
  8128. var isString = function isString(val) {return typeof val === 'string';};exports.isString = isString;
  8129. var formater;
  8130. function hasI18nJson(jsonObj, delimiters) {
  8131. if (!formater) {
  8132. formater = new BaseFormatter();
  8133. }
  8134. return walkJsonObj(jsonObj, function (jsonObj, key) {
  8135. var value = jsonObj[key];
  8136. if (isString(value)) {
  8137. if (isI18nStr(value, delimiters)) {
  8138. return true;
  8139. }
  8140. } else
  8141. {
  8142. return hasI18nJson(value, delimiters);
  8143. }
  8144. });
  8145. }
  8146. function parseI18nJson(jsonObj, values, delimiters) {
  8147. if (!formater) {
  8148. formater = new BaseFormatter();
  8149. }
  8150. walkJsonObj(jsonObj, function (jsonObj, key) {
  8151. var value = jsonObj[key];
  8152. if (isString(value)) {
  8153. if (isI18nStr(value, delimiters)) {
  8154. jsonObj[key] = compileStr(value, values, delimiters);
  8155. }
  8156. } else
  8157. {
  8158. parseI18nJson(value, values, delimiters);
  8159. }
  8160. });
  8161. return jsonObj;
  8162. }
  8163. function compileI18nJsonStr(jsonStr, _ref5) {var locale = _ref5.locale,locales = _ref5.locales,delimiters = _ref5.delimiters;
  8164. if (!isI18nStr(jsonStr, delimiters)) {
  8165. return jsonStr;
  8166. }
  8167. if (!formater) {
  8168. formater = new BaseFormatter();
  8169. }
  8170. var localeValues = [];
  8171. Object.keys(locales).forEach(function (name) {
  8172. if (name !== locale) {
  8173. localeValues.push({
  8174. locale: name,
  8175. values: locales[name] });
  8176. }
  8177. });
  8178. localeValues.unshift({ locale: locale, values: locales[locale] });
  8179. try {
  8180. return JSON.stringify(compileJsonObj(JSON.parse(jsonStr), localeValues, delimiters), null, 2);
  8181. }
  8182. catch (e) {}
  8183. return jsonStr;
  8184. }
  8185. function isI18nStr(value, delimiters) {
  8186. return value.indexOf(delimiters[0]) > -1;
  8187. }
  8188. function compileStr(value, values, delimiters) {
  8189. return formater.interpolate(value, values, delimiters).join('');
  8190. }
  8191. function compileValue(jsonObj, key, localeValues, delimiters) {
  8192. var value = jsonObj[key];
  8193. if (isString(value)) {
  8194. // 存在国际化
  8195. if (isI18nStr(value, delimiters)) {
  8196. jsonObj[key] = compileStr(value, localeValues[0].values, delimiters);
  8197. if (localeValues.length > 1) {
  8198. // 格式化国际化语言
  8199. var valueLocales = jsonObj[key + 'Locales'] = {};
  8200. localeValues.forEach(function (localValue) {
  8201. valueLocales[localValue.locale] = compileStr(value, localValue.values, delimiters);
  8202. });
  8203. }
  8204. }
  8205. } else
  8206. {
  8207. compileJsonObj(value, localeValues, delimiters);
  8208. }
  8209. }
  8210. function compileJsonObj(jsonObj, localeValues, delimiters) {
  8211. walkJsonObj(jsonObj, function (jsonObj, key) {
  8212. compileValue(jsonObj, key, localeValues, delimiters);
  8213. });
  8214. return jsonObj;
  8215. }
  8216. function walkJsonObj(jsonObj, walk) {
  8217. if (isArray(jsonObj)) {
  8218. for (var i = 0; i < jsonObj.length; i++) {
  8219. if (walk(jsonObj, i)) {
  8220. return true;
  8221. }
  8222. }
  8223. } else
  8224. if (isObject(jsonObj)) {
  8225. for (var key in jsonObj) {
  8226. if (walk(jsonObj, key)) {
  8227. return true;
  8228. }
  8229. }
  8230. }
  8231. return false;
  8232. }
  8233. function resolveLocale(locales) {
  8234. return function (locale) {
  8235. if (!locale) {
  8236. return locale;
  8237. }
  8238. locale = normalizeLocale(locale) || locale;
  8239. return resolveLocaleChain(locale).find(function (locale) {return locales.indexOf(locale) > -1;});
  8240. };
  8241. }
  8242. function resolveLocaleChain(locale) {
  8243. var chain = [];
  8244. var tokens = locale.split('-');
  8245. while (tokens.length) {
  8246. chain.push(tokens.join('-'));
  8247. tokens.pop();
  8248. }
  8249. return chain;
  8250. }
  8251. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"], __webpack_require__(/*! ./../../../webpack/buildin/global.js */ 2)))
  8252. /***/ }),
  8253. /***/ 4:
  8254. /*!******************************************************************************************!*\
  8255. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  8256. \******************************************************************************************/
  8257. /*! exports provided: default */
  8258. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8259. "use strict";
  8260. __webpack_require__.r(__webpack_exports__);
  8261. /* WEBPACK VAR INJECTION */(function(global) {/*!
  8262. * Vue.js v2.6.11
  8263. * (c) 2014-2022 Evan You
  8264. * Released under the MIT License.
  8265. */
  8266. /* */
  8267. var emptyObject = Object.freeze({});
  8268. // These helpers produce better VM code in JS engines due to their
  8269. // explicitness and function inlining.
  8270. function isUndef (v) {
  8271. return v === undefined || v === null
  8272. }
  8273. function isDef (v) {
  8274. return v !== undefined && v !== null
  8275. }
  8276. function isTrue (v) {
  8277. return v === true
  8278. }
  8279. function isFalse (v) {
  8280. return v === false
  8281. }
  8282. /**
  8283. * Check if value is primitive.
  8284. */
  8285. function isPrimitive (value) {
  8286. return (
  8287. typeof value === 'string' ||
  8288. typeof value === 'number' ||
  8289. // $flow-disable-line
  8290. typeof value === 'symbol' ||
  8291. typeof value === 'boolean'
  8292. )
  8293. }
  8294. /**
  8295. * Quick object check - this is primarily used to tell
  8296. * Objects from primitive values when we know the value
  8297. * is a JSON-compliant type.
  8298. */
  8299. function isObject (obj) {
  8300. return obj !== null && typeof obj === 'object'
  8301. }
  8302. /**
  8303. * Get the raw type string of a value, e.g., [object Object].
  8304. */
  8305. var _toString = Object.prototype.toString;
  8306. function toRawType (value) {
  8307. return _toString.call(value).slice(8, -1)
  8308. }
  8309. /**
  8310. * Strict object type check. Only returns true
  8311. * for plain JavaScript objects.
  8312. */
  8313. function isPlainObject (obj) {
  8314. return _toString.call(obj) === '[object Object]'
  8315. }
  8316. function isRegExp (v) {
  8317. return _toString.call(v) === '[object RegExp]'
  8318. }
  8319. /**
  8320. * Check if val is a valid array index.
  8321. */
  8322. function isValidArrayIndex (val) {
  8323. var n = parseFloat(String(val));
  8324. return n >= 0 && Math.floor(n) === n && isFinite(val)
  8325. }
  8326. function isPromise (val) {
  8327. return (
  8328. isDef(val) &&
  8329. typeof val.then === 'function' &&
  8330. typeof val.catch === 'function'
  8331. )
  8332. }
  8333. /**
  8334. * Convert a value to a string that is actually rendered.
  8335. */
  8336. function toString (val) {
  8337. return val == null
  8338. ? ''
  8339. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  8340. ? JSON.stringify(val, null, 2)
  8341. : String(val)
  8342. }
  8343. /**
  8344. * Convert an input value to a number for persistence.
  8345. * If the conversion fails, return original string.
  8346. */
  8347. function toNumber (val) {
  8348. var n = parseFloat(val);
  8349. return isNaN(n) ? val : n
  8350. }
  8351. /**
  8352. * Make a map and return a function for checking if a key
  8353. * is in that map.
  8354. */
  8355. function makeMap (
  8356. str,
  8357. expectsLowerCase
  8358. ) {
  8359. var map = Object.create(null);
  8360. var list = str.split(',');
  8361. for (var i = 0; i < list.length; i++) {
  8362. map[list[i]] = true;
  8363. }
  8364. return expectsLowerCase
  8365. ? function (val) { return map[val.toLowerCase()]; }
  8366. : function (val) { return map[val]; }
  8367. }
  8368. /**
  8369. * Check if a tag is a built-in tag.
  8370. */
  8371. var isBuiltInTag = makeMap('slot,component', true);
  8372. /**
  8373. * Check if an attribute is a reserved attribute.
  8374. */
  8375. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  8376. /**
  8377. * Remove an item from an array.
  8378. */
  8379. function remove (arr, item) {
  8380. if (arr.length) {
  8381. var index = arr.indexOf(item);
  8382. if (index > -1) {
  8383. return arr.splice(index, 1)
  8384. }
  8385. }
  8386. }
  8387. /**
  8388. * Check whether an object has the property.
  8389. */
  8390. var hasOwnProperty = Object.prototype.hasOwnProperty;
  8391. function hasOwn (obj, key) {
  8392. return hasOwnProperty.call(obj, key)
  8393. }
  8394. /**
  8395. * Create a cached version of a pure function.
  8396. */
  8397. function cached (fn) {
  8398. var cache = Object.create(null);
  8399. return (function cachedFn (str) {
  8400. var hit = cache[str];
  8401. return hit || (cache[str] = fn(str))
  8402. })
  8403. }
  8404. /**
  8405. * Camelize a hyphen-delimited string.
  8406. */
  8407. var camelizeRE = /-(\w)/g;
  8408. var camelize = cached(function (str) {
  8409. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  8410. });
  8411. /**
  8412. * Capitalize a string.
  8413. */
  8414. var capitalize = cached(function (str) {
  8415. return str.charAt(0).toUpperCase() + str.slice(1)
  8416. });
  8417. /**
  8418. * Hyphenate a camelCase string.
  8419. */
  8420. var hyphenateRE = /\B([A-Z])/g;
  8421. var hyphenate = cached(function (str) {
  8422. return str.replace(hyphenateRE, '-$1').toLowerCase()
  8423. });
  8424. /**
  8425. * Simple bind polyfill for environments that do not support it,
  8426. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  8427. * since native bind is now performant enough in most browsers.
  8428. * But removing it would mean breaking code that was able to run in
  8429. * PhantomJS 1.x, so this must be kept for backward compatibility.
  8430. */
  8431. /* istanbul ignore next */
  8432. function polyfillBind (fn, ctx) {
  8433. function boundFn (a) {
  8434. var l = arguments.length;
  8435. return l
  8436. ? l > 1
  8437. ? fn.apply(ctx, arguments)
  8438. : fn.call(ctx, a)
  8439. : fn.call(ctx)
  8440. }
  8441. boundFn._length = fn.length;
  8442. return boundFn
  8443. }
  8444. function nativeBind (fn, ctx) {
  8445. return fn.bind(ctx)
  8446. }
  8447. var bind = Function.prototype.bind
  8448. ? nativeBind
  8449. : polyfillBind;
  8450. /**
  8451. * Convert an Array-like object to a real Array.
  8452. */
  8453. function toArray (list, start) {
  8454. start = start || 0;
  8455. var i = list.length - start;
  8456. var ret = new Array(i);
  8457. while (i--) {
  8458. ret[i] = list[i + start];
  8459. }
  8460. return ret
  8461. }
  8462. /**
  8463. * Mix properties into target object.
  8464. */
  8465. function extend (to, _from) {
  8466. for (var key in _from) {
  8467. to[key] = _from[key];
  8468. }
  8469. return to
  8470. }
  8471. /**
  8472. * Merge an Array of Objects into a single Object.
  8473. */
  8474. function toObject (arr) {
  8475. var res = {};
  8476. for (var i = 0; i < arr.length; i++) {
  8477. if (arr[i]) {
  8478. extend(res, arr[i]);
  8479. }
  8480. }
  8481. return res
  8482. }
  8483. /* eslint-disable no-unused-vars */
  8484. /**
  8485. * Perform no operation.
  8486. * Stubbing args to make Flow happy without leaving useless transpiled code
  8487. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  8488. */
  8489. function noop (a, b, c) {}
  8490. /**
  8491. * Always return false.
  8492. */
  8493. var no = function (a, b, c) { return false; };
  8494. /* eslint-enable no-unused-vars */
  8495. /**
  8496. * Return the same value.
  8497. */
  8498. var identity = function (_) { return _; };
  8499. /**
  8500. * Check if two values are loosely equal - that is,
  8501. * if they are plain objects, do they have the same shape?
  8502. */
  8503. function looseEqual (a, b) {
  8504. if (a === b) { return true }
  8505. var isObjectA = isObject(a);
  8506. var isObjectB = isObject(b);
  8507. if (isObjectA && isObjectB) {
  8508. try {
  8509. var isArrayA = Array.isArray(a);
  8510. var isArrayB = Array.isArray(b);
  8511. if (isArrayA && isArrayB) {
  8512. return a.length === b.length && a.every(function (e, i) {
  8513. return looseEqual(e, b[i])
  8514. })
  8515. } else if (a instanceof Date && b instanceof Date) {
  8516. return a.getTime() === b.getTime()
  8517. } else if (!isArrayA && !isArrayB) {
  8518. var keysA = Object.keys(a);
  8519. var keysB = Object.keys(b);
  8520. return keysA.length === keysB.length && keysA.every(function (key) {
  8521. return looseEqual(a[key], b[key])
  8522. })
  8523. } else {
  8524. /* istanbul ignore next */
  8525. return false
  8526. }
  8527. } catch (e) {
  8528. /* istanbul ignore next */
  8529. return false
  8530. }
  8531. } else if (!isObjectA && !isObjectB) {
  8532. return String(a) === String(b)
  8533. } else {
  8534. return false
  8535. }
  8536. }
  8537. /**
  8538. * Return the first index at which a loosely equal value can be
  8539. * found in the array (if value is a plain object, the array must
  8540. * contain an object of the same shape), or -1 if it is not present.
  8541. */
  8542. function looseIndexOf (arr, val) {
  8543. for (var i = 0; i < arr.length; i++) {
  8544. if (looseEqual(arr[i], val)) { return i }
  8545. }
  8546. return -1
  8547. }
  8548. /**
  8549. * Ensure a function is called only once.
  8550. */
  8551. function once (fn) {
  8552. var called = false;
  8553. return function () {
  8554. if (!called) {
  8555. called = true;
  8556. fn.apply(this, arguments);
  8557. }
  8558. }
  8559. }
  8560. var ASSET_TYPES = [
  8561. 'component',
  8562. 'directive',
  8563. 'filter'
  8564. ];
  8565. var LIFECYCLE_HOOKS = [
  8566. 'beforeCreate',
  8567. 'created',
  8568. 'beforeMount',
  8569. 'mounted',
  8570. 'beforeUpdate',
  8571. 'updated',
  8572. 'beforeDestroy',
  8573. 'destroyed',
  8574. 'activated',
  8575. 'deactivated',
  8576. 'errorCaptured',
  8577. 'serverPrefetch'
  8578. ];
  8579. /* */
  8580. var config = ({
  8581. /**
  8582. * Option merge strategies (used in core/util/options)
  8583. */
  8584. // $flow-disable-line
  8585. optionMergeStrategies: Object.create(null),
  8586. /**
  8587. * Whether to suppress warnings.
  8588. */
  8589. silent: false,
  8590. /**
  8591. * Show production mode tip message on boot?
  8592. */
  8593. productionTip: "development" !== 'production',
  8594. /**
  8595. * Whether to enable devtools
  8596. */
  8597. devtools: "development" !== 'production',
  8598. /**
  8599. * Whether to record perf
  8600. */
  8601. performance: false,
  8602. /**
  8603. * Error handler for watcher errors
  8604. */
  8605. errorHandler: null,
  8606. /**
  8607. * Warn handler for watcher warns
  8608. */
  8609. warnHandler: null,
  8610. /**
  8611. * Ignore certain custom elements
  8612. */
  8613. ignoredElements: [],
  8614. /**
  8615. * Custom user key aliases for v-on
  8616. */
  8617. // $flow-disable-line
  8618. keyCodes: Object.create(null),
  8619. /**
  8620. * Check if a tag is reserved so that it cannot be registered as a
  8621. * component. This is platform-dependent and may be overwritten.
  8622. */
  8623. isReservedTag: no,
  8624. /**
  8625. * Check if an attribute is reserved so that it cannot be used as a component
  8626. * prop. This is platform-dependent and may be overwritten.
  8627. */
  8628. isReservedAttr: no,
  8629. /**
  8630. * Check if a tag is an unknown element.
  8631. * Platform-dependent.
  8632. */
  8633. isUnknownElement: no,
  8634. /**
  8635. * Get the namespace of an element
  8636. */
  8637. getTagNamespace: noop,
  8638. /**
  8639. * Parse the real tag name for the specific platform.
  8640. */
  8641. parsePlatformTagName: identity,
  8642. /**
  8643. * Check if an attribute must be bound using property, e.g. value
  8644. * Platform-dependent.
  8645. */
  8646. mustUseProp: no,
  8647. /**
  8648. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  8649. * This will significantly reduce performance if set to false.
  8650. */
  8651. async: true,
  8652. /**
  8653. * Exposed for legacy reasons
  8654. */
  8655. _lifecycleHooks: LIFECYCLE_HOOKS
  8656. });
  8657. /* */
  8658. /**
  8659. * unicode letters used for parsing html tags, component names and property paths.
  8660. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  8661. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  8662. */
  8663. 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/;
  8664. /**
  8665. * Check if a string starts with $ or _
  8666. */
  8667. function isReserved (str) {
  8668. var c = (str + '').charCodeAt(0);
  8669. return c === 0x24 || c === 0x5F
  8670. }
  8671. /**
  8672. * Define a property.
  8673. */
  8674. function def (obj, key, val, enumerable) {
  8675. Object.defineProperty(obj, key, {
  8676. value: val,
  8677. enumerable: !!enumerable,
  8678. writable: true,
  8679. configurable: true
  8680. });
  8681. }
  8682. /**
  8683. * Parse simple path.
  8684. */
  8685. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  8686. function parsePath (path) {
  8687. if (bailRE.test(path)) {
  8688. return
  8689. }
  8690. var segments = path.split('.');
  8691. return function (obj) {
  8692. for (var i = 0; i < segments.length; i++) {
  8693. if (!obj) { return }
  8694. obj = obj[segments[i]];
  8695. }
  8696. return obj
  8697. }
  8698. }
  8699. /* */
  8700. // can we use __proto__?
  8701. var hasProto = '__proto__' in {};
  8702. // Browser environment sniffing
  8703. var inBrowser = typeof window !== 'undefined';
  8704. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  8705. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  8706. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  8707. var isIE = UA && /msie|trident/.test(UA);
  8708. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  8709. var isEdge = UA && UA.indexOf('edge/') > 0;
  8710. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  8711. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  8712. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  8713. var isPhantomJS = UA && /phantomjs/.test(UA);
  8714. var isFF = UA && UA.match(/firefox\/(\d+)/);
  8715. // Firefox has a "watch" function on Object.prototype...
  8716. var nativeWatch = ({}).watch;
  8717. if (inBrowser) {
  8718. try {
  8719. var opts = {};
  8720. Object.defineProperty(opts, 'passive', ({
  8721. get: function get () {
  8722. }
  8723. })); // https://github.com/facebook/flow/issues/285
  8724. window.addEventListener('test-passive', null, opts);
  8725. } catch (e) {}
  8726. }
  8727. // this needs to be lazy-evaled because vue may be required before
  8728. // vue-server-renderer can set VUE_ENV
  8729. var _isServer;
  8730. var isServerRendering = function () {
  8731. if (_isServer === undefined) {
  8732. /* istanbul ignore if */
  8733. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  8734. // detect presence of vue-server-renderer and avoid
  8735. // Webpack shimming the process
  8736. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  8737. } else {
  8738. _isServer = false;
  8739. }
  8740. }
  8741. return _isServer
  8742. };
  8743. // detect devtools
  8744. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  8745. /* istanbul ignore next */
  8746. function isNative (Ctor) {
  8747. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  8748. }
  8749. var hasSymbol =
  8750. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  8751. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  8752. var _Set;
  8753. /* istanbul ignore if */ // $flow-disable-line
  8754. if (typeof Set !== 'undefined' && isNative(Set)) {
  8755. // use native Set when available.
  8756. _Set = Set;
  8757. } else {
  8758. // a non-standard Set polyfill that only works with primitive keys.
  8759. _Set = /*@__PURE__*/(function () {
  8760. function Set () {
  8761. this.set = Object.create(null);
  8762. }
  8763. Set.prototype.has = function has (key) {
  8764. return this.set[key] === true
  8765. };
  8766. Set.prototype.add = function add (key) {
  8767. this.set[key] = true;
  8768. };
  8769. Set.prototype.clear = function clear () {
  8770. this.set = Object.create(null);
  8771. };
  8772. return Set;
  8773. }());
  8774. }
  8775. /* */
  8776. var warn = noop;
  8777. var tip = noop;
  8778. var generateComponentTrace = (noop); // work around flow check
  8779. var formatComponentName = (noop);
  8780. if (true) {
  8781. var hasConsole = typeof console !== 'undefined';
  8782. var classifyRE = /(?:^|[-_])(\w)/g;
  8783. var classify = function (str) { return str
  8784. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  8785. .replace(/[-_]/g, ''); };
  8786. warn = function (msg, vm) {
  8787. var trace = vm ? generateComponentTrace(vm) : '';
  8788. if (config.warnHandler) {
  8789. config.warnHandler.call(null, msg, vm, trace);
  8790. } else if (hasConsole && (!config.silent)) {
  8791. console.error(("[Vue warn]: " + msg + trace));
  8792. }
  8793. };
  8794. tip = function (msg, vm) {
  8795. if (hasConsole && (!config.silent)) {
  8796. console.warn("[Vue tip]: " + msg + (
  8797. vm ? generateComponentTrace(vm) : ''
  8798. ));
  8799. }
  8800. };
  8801. formatComponentName = function (vm, includeFile) {
  8802. if (vm.$root === vm) {
  8803. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  8804. return ('') + vm.$options.__file
  8805. }
  8806. return '<Root>'
  8807. }
  8808. var options = typeof vm === 'function' && vm.cid != null
  8809. ? vm.options
  8810. : vm._isVue
  8811. ? vm.$options || vm.constructor.options
  8812. : vm;
  8813. var name = options.name || options._componentTag;
  8814. var file = options.__file;
  8815. if (!name && file) {
  8816. var match = file.match(/([^/\\]+)\.vue$/);
  8817. name = match && match[1];
  8818. }
  8819. return (
  8820. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  8821. (file && includeFile !== false ? (" at " + file) : '')
  8822. )
  8823. };
  8824. var repeat = function (str, n) {
  8825. var res = '';
  8826. while (n) {
  8827. if (n % 2 === 1) { res += str; }
  8828. if (n > 1) { str += str; }
  8829. n >>= 1;
  8830. }
  8831. return res
  8832. };
  8833. generateComponentTrace = function (vm) {
  8834. if (vm._isVue && vm.$parent) {
  8835. var tree = [];
  8836. var currentRecursiveSequence = 0;
  8837. while (vm && vm.$options.name !== 'PageBody') {
  8838. if (tree.length > 0) {
  8839. var last = tree[tree.length - 1];
  8840. if (last.constructor === vm.constructor) {
  8841. currentRecursiveSequence++;
  8842. vm = vm.$parent;
  8843. continue
  8844. } else if (currentRecursiveSequence > 0) {
  8845. tree[tree.length - 1] = [last, currentRecursiveSequence];
  8846. currentRecursiveSequence = 0;
  8847. }
  8848. }
  8849. !vm.$options.isReserved && tree.push(vm);
  8850. vm = vm.$parent;
  8851. }
  8852. return '\n\nfound in\n\n' + tree
  8853. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  8854. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  8855. : formatComponentName(vm))); })
  8856. .join('\n')
  8857. } else {
  8858. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  8859. }
  8860. };
  8861. }
  8862. /* */
  8863. var uid = 0;
  8864. /**
  8865. * A dep is an observable that can have multiple
  8866. * directives subscribing to it.
  8867. */
  8868. var Dep = function Dep () {
  8869. this.id = uid++;
  8870. this.subs = [];
  8871. };
  8872. Dep.prototype.addSub = function addSub (sub) {
  8873. this.subs.push(sub);
  8874. };
  8875. Dep.prototype.removeSub = function removeSub (sub) {
  8876. remove(this.subs, sub);
  8877. };
  8878. Dep.prototype.depend = function depend () {
  8879. if (Dep.SharedObject.target) {
  8880. Dep.SharedObject.target.addDep(this);
  8881. }
  8882. };
  8883. Dep.prototype.notify = function notify () {
  8884. // stabilize the subscriber list first
  8885. var subs = this.subs.slice();
  8886. if ( true && !config.async) {
  8887. // subs aren't sorted in scheduler if not running async
  8888. // we need to sort them now to make sure they fire in correct
  8889. // order
  8890. subs.sort(function (a, b) { return a.id - b.id; });
  8891. }
  8892. for (var i = 0, l = subs.length; i < l; i++) {
  8893. subs[i].update();
  8894. }
  8895. };
  8896. // The current target watcher being evaluated.
  8897. // This is globally unique because only one watcher
  8898. // can be evaluated at a time.
  8899. // fixed by xxxxxx (nvue shared vuex)
  8900. /* eslint-disable no-undef */
  8901. Dep.SharedObject = {};
  8902. Dep.SharedObject.target = null;
  8903. Dep.SharedObject.targetStack = [];
  8904. function pushTarget (target) {
  8905. Dep.SharedObject.targetStack.push(target);
  8906. Dep.SharedObject.target = target;
  8907. Dep.target = target;
  8908. }
  8909. function popTarget () {
  8910. Dep.SharedObject.targetStack.pop();
  8911. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  8912. Dep.target = Dep.SharedObject.target;
  8913. }
  8914. /* */
  8915. var VNode = function VNode (
  8916. tag,
  8917. data,
  8918. children,
  8919. text,
  8920. elm,
  8921. context,
  8922. componentOptions,
  8923. asyncFactory
  8924. ) {
  8925. this.tag = tag;
  8926. this.data = data;
  8927. this.children = children;
  8928. this.text = text;
  8929. this.elm = elm;
  8930. this.ns = undefined;
  8931. this.context = context;
  8932. this.fnContext = undefined;
  8933. this.fnOptions = undefined;
  8934. this.fnScopeId = undefined;
  8935. this.key = data && data.key;
  8936. this.componentOptions = componentOptions;
  8937. this.componentInstance = undefined;
  8938. this.parent = undefined;
  8939. this.raw = false;
  8940. this.isStatic = false;
  8941. this.isRootInsert = true;
  8942. this.isComment = false;
  8943. this.isCloned = false;
  8944. this.isOnce = false;
  8945. this.asyncFactory = asyncFactory;
  8946. this.asyncMeta = undefined;
  8947. this.isAsyncPlaceholder = false;
  8948. };
  8949. var prototypeAccessors = { child: { configurable: true } };
  8950. // DEPRECATED: alias for componentInstance for backwards compat.
  8951. /* istanbul ignore next */
  8952. prototypeAccessors.child.get = function () {
  8953. return this.componentInstance
  8954. };
  8955. Object.defineProperties( VNode.prototype, prototypeAccessors );
  8956. var createEmptyVNode = function (text) {
  8957. if ( text === void 0 ) text = '';
  8958. var node = new VNode();
  8959. node.text = text;
  8960. node.isComment = true;
  8961. return node
  8962. };
  8963. function createTextVNode (val) {
  8964. return new VNode(undefined, undefined, undefined, String(val))
  8965. }
  8966. // optimized shallow clone
  8967. // used for static nodes and slot nodes because they may be reused across
  8968. // multiple renders, cloning them avoids errors when DOM manipulations rely
  8969. // on their elm reference.
  8970. function cloneVNode (vnode) {
  8971. var cloned = new VNode(
  8972. vnode.tag,
  8973. vnode.data,
  8974. // #7975
  8975. // clone children array to avoid mutating original in case of cloning
  8976. // a child.
  8977. vnode.children && vnode.children.slice(),
  8978. vnode.text,
  8979. vnode.elm,
  8980. vnode.context,
  8981. vnode.componentOptions,
  8982. vnode.asyncFactory
  8983. );
  8984. cloned.ns = vnode.ns;
  8985. cloned.isStatic = vnode.isStatic;
  8986. cloned.key = vnode.key;
  8987. cloned.isComment = vnode.isComment;
  8988. cloned.fnContext = vnode.fnContext;
  8989. cloned.fnOptions = vnode.fnOptions;
  8990. cloned.fnScopeId = vnode.fnScopeId;
  8991. cloned.asyncMeta = vnode.asyncMeta;
  8992. cloned.isCloned = true;
  8993. return cloned
  8994. }
  8995. /*
  8996. * not type checking this file because flow doesn't play well with
  8997. * dynamically accessing methods on Array prototype
  8998. */
  8999. var arrayProto = Array.prototype;
  9000. var arrayMethods = Object.create(arrayProto);
  9001. var methodsToPatch = [
  9002. 'push',
  9003. 'pop',
  9004. 'shift',
  9005. 'unshift',
  9006. 'splice',
  9007. 'sort',
  9008. 'reverse'
  9009. ];
  9010. /**
  9011. * Intercept mutating methods and emit events
  9012. */
  9013. methodsToPatch.forEach(function (method) {
  9014. // cache original method
  9015. var original = arrayProto[method];
  9016. def(arrayMethods, method, function mutator () {
  9017. var args = [], len = arguments.length;
  9018. while ( len-- ) args[ len ] = arguments[ len ];
  9019. var result = original.apply(this, args);
  9020. var ob = this.__ob__;
  9021. var inserted;
  9022. switch (method) {
  9023. case 'push':
  9024. case 'unshift':
  9025. inserted = args;
  9026. break
  9027. case 'splice':
  9028. inserted = args.slice(2);
  9029. break
  9030. }
  9031. if (inserted) { ob.observeArray(inserted); }
  9032. // notify change
  9033. ob.dep.notify();
  9034. return result
  9035. });
  9036. });
  9037. /* */
  9038. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  9039. /**
  9040. * In some cases we may want to disable observation inside a component's
  9041. * update computation.
  9042. */
  9043. var shouldObserve = true;
  9044. function toggleObserving (value) {
  9045. shouldObserve = value;
  9046. }
  9047. /**
  9048. * Observer class that is attached to each observed
  9049. * object. Once attached, the observer converts the target
  9050. * object's property keys into getter/setters that
  9051. * collect dependencies and dispatch updates.
  9052. */
  9053. var Observer = function Observer (value) {
  9054. this.value = value;
  9055. this.dep = new Dep();
  9056. this.vmCount = 0;
  9057. def(value, '__ob__', this);
  9058. if (Array.isArray(value)) {
  9059. if (hasProto) {
  9060. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  9061. if(value.push !== value.__proto__.push){
  9062. copyAugment(value, arrayMethods, arrayKeys);
  9063. } else {
  9064. protoAugment(value, arrayMethods);
  9065. }
  9066. }
  9067. } else {
  9068. copyAugment(value, arrayMethods, arrayKeys);
  9069. }
  9070. this.observeArray(value);
  9071. } else {
  9072. this.walk(value);
  9073. }
  9074. };
  9075. /**
  9076. * Walk through all properties and convert them into
  9077. * getter/setters. This method should only be called when
  9078. * value type is Object.
  9079. */
  9080. Observer.prototype.walk = function walk (obj) {
  9081. var keys = Object.keys(obj);
  9082. for (var i = 0; i < keys.length; i++) {
  9083. defineReactive$$1(obj, keys[i]);
  9084. }
  9085. };
  9086. /**
  9087. * Observe a list of Array items.
  9088. */
  9089. Observer.prototype.observeArray = function observeArray (items) {
  9090. for (var i = 0, l = items.length; i < l; i++) {
  9091. observe(items[i]);
  9092. }
  9093. };
  9094. // helpers
  9095. /**
  9096. * Augment a target Object or Array by intercepting
  9097. * the prototype chain using __proto__
  9098. */
  9099. function protoAugment (target, src) {
  9100. /* eslint-disable no-proto */
  9101. target.__proto__ = src;
  9102. /* eslint-enable no-proto */
  9103. }
  9104. /**
  9105. * Augment a target Object or Array by defining
  9106. * hidden properties.
  9107. */
  9108. /* istanbul ignore next */
  9109. function copyAugment (target, src, keys) {
  9110. for (var i = 0, l = keys.length; i < l; i++) {
  9111. var key = keys[i];
  9112. def(target, key, src[key]);
  9113. }
  9114. }
  9115. /**
  9116. * Attempt to create an observer instance for a value,
  9117. * returns the new observer if successfully observed,
  9118. * or the existing observer if the value already has one.
  9119. */
  9120. function observe (value, asRootData) {
  9121. if (!isObject(value) || value instanceof VNode) {
  9122. return
  9123. }
  9124. var ob;
  9125. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  9126. ob = value.__ob__;
  9127. } else if (
  9128. shouldObserve &&
  9129. !isServerRendering() &&
  9130. (Array.isArray(value) || isPlainObject(value)) &&
  9131. Object.isExtensible(value) &&
  9132. !value._isVue
  9133. ) {
  9134. ob = new Observer(value);
  9135. }
  9136. if (asRootData && ob) {
  9137. ob.vmCount++;
  9138. }
  9139. return ob
  9140. }
  9141. /**
  9142. * Define a reactive property on an Object.
  9143. */
  9144. function defineReactive$$1 (
  9145. obj,
  9146. key,
  9147. val,
  9148. customSetter,
  9149. shallow
  9150. ) {
  9151. var dep = new Dep();
  9152. var property = Object.getOwnPropertyDescriptor(obj, key);
  9153. if (property && property.configurable === false) {
  9154. return
  9155. }
  9156. // cater for pre-defined getter/setters
  9157. var getter = property && property.get;
  9158. var setter = property && property.set;
  9159. if ((!getter || setter) && arguments.length === 2) {
  9160. val = obj[key];
  9161. }
  9162. var childOb = !shallow && observe(val);
  9163. Object.defineProperty(obj, key, {
  9164. enumerable: true,
  9165. configurable: true,
  9166. get: function reactiveGetter () {
  9167. var value = getter ? getter.call(obj) : val;
  9168. if (Dep.SharedObject.target) { // fixed by xxxxxx
  9169. dep.depend();
  9170. if (childOb) {
  9171. childOb.dep.depend();
  9172. if (Array.isArray(value)) {
  9173. dependArray(value);
  9174. }
  9175. }
  9176. }
  9177. return value
  9178. },
  9179. set: function reactiveSetter (newVal) {
  9180. var value = getter ? getter.call(obj) : val;
  9181. /* eslint-disable no-self-compare */
  9182. if (newVal === value || (newVal !== newVal && value !== value)) {
  9183. return
  9184. }
  9185. /* eslint-enable no-self-compare */
  9186. if ( true && customSetter) {
  9187. customSetter();
  9188. }
  9189. // #7981: for accessor properties without setter
  9190. if (getter && !setter) { return }
  9191. if (setter) {
  9192. setter.call(obj, newVal);
  9193. } else {
  9194. val = newVal;
  9195. }
  9196. childOb = !shallow && observe(newVal);
  9197. dep.notify();
  9198. }
  9199. });
  9200. }
  9201. /**
  9202. * Set a property on an object. Adds the new property and
  9203. * triggers change notification if the property doesn't
  9204. * already exist.
  9205. */
  9206. function set (target, key, val) {
  9207. if ( true &&
  9208. (isUndef(target) || isPrimitive(target))
  9209. ) {
  9210. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  9211. }
  9212. if (Array.isArray(target) && isValidArrayIndex(key)) {
  9213. target.length = Math.max(target.length, key);
  9214. target.splice(key, 1, val);
  9215. return val
  9216. }
  9217. if (key in target && !(key in Object.prototype)) {
  9218. target[key] = val;
  9219. return val
  9220. }
  9221. var ob = (target).__ob__;
  9222. if (target._isVue || (ob && ob.vmCount)) {
  9223. true && warn(
  9224. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  9225. 'at runtime - declare it upfront in the data option.'
  9226. );
  9227. return val
  9228. }
  9229. if (!ob) {
  9230. target[key] = val;
  9231. return val
  9232. }
  9233. defineReactive$$1(ob.value, key, val);
  9234. ob.dep.notify();
  9235. return val
  9236. }
  9237. /**
  9238. * Delete a property and trigger change if necessary.
  9239. */
  9240. function del (target, key) {
  9241. if ( true &&
  9242. (isUndef(target) || isPrimitive(target))
  9243. ) {
  9244. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  9245. }
  9246. if (Array.isArray(target) && isValidArrayIndex(key)) {
  9247. target.splice(key, 1);
  9248. return
  9249. }
  9250. var ob = (target).__ob__;
  9251. if (target._isVue || (ob && ob.vmCount)) {
  9252. true && warn(
  9253. 'Avoid deleting properties on a Vue instance or its root $data ' +
  9254. '- just set it to null.'
  9255. );
  9256. return
  9257. }
  9258. if (!hasOwn(target, key)) {
  9259. return
  9260. }
  9261. delete target[key];
  9262. if (!ob) {
  9263. return
  9264. }
  9265. ob.dep.notify();
  9266. }
  9267. /**
  9268. * Collect dependencies on array elements when the array is touched, since
  9269. * we cannot intercept array element access like property getters.
  9270. */
  9271. function dependArray (value) {
  9272. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  9273. e = value[i];
  9274. e && e.__ob__ && e.__ob__.dep.depend();
  9275. if (Array.isArray(e)) {
  9276. dependArray(e);
  9277. }
  9278. }
  9279. }
  9280. /* */
  9281. /**
  9282. * Option overwriting strategies are functions that handle
  9283. * how to merge a parent option value and a child option
  9284. * value into the final value.
  9285. */
  9286. var strats = config.optionMergeStrategies;
  9287. /**
  9288. * Options with restrictions
  9289. */
  9290. if (true) {
  9291. strats.el = strats.propsData = function (parent, child, vm, key) {
  9292. if (!vm) {
  9293. warn(
  9294. "option \"" + key + "\" can only be used during instance " +
  9295. 'creation with the `new` keyword.'
  9296. );
  9297. }
  9298. return defaultStrat(parent, child)
  9299. };
  9300. }
  9301. /**
  9302. * Helper that recursively merges two data objects together.
  9303. */
  9304. function mergeData (to, from) {
  9305. if (!from) { return to }
  9306. var key, toVal, fromVal;
  9307. var keys = hasSymbol
  9308. ? Reflect.ownKeys(from)
  9309. : Object.keys(from);
  9310. for (var i = 0; i < keys.length; i++) {
  9311. key = keys[i];
  9312. // in case the object is already observed...
  9313. if (key === '__ob__') { continue }
  9314. toVal = to[key];
  9315. fromVal = from[key];
  9316. if (!hasOwn(to, key)) {
  9317. set(to, key, fromVal);
  9318. } else if (
  9319. toVal !== fromVal &&
  9320. isPlainObject(toVal) &&
  9321. isPlainObject(fromVal)
  9322. ) {
  9323. mergeData(toVal, fromVal);
  9324. }
  9325. }
  9326. return to
  9327. }
  9328. /**
  9329. * Data
  9330. */
  9331. function mergeDataOrFn (
  9332. parentVal,
  9333. childVal,
  9334. vm
  9335. ) {
  9336. if (!vm) {
  9337. // in a Vue.extend merge, both should be functions
  9338. if (!childVal) {
  9339. return parentVal
  9340. }
  9341. if (!parentVal) {
  9342. return childVal
  9343. }
  9344. // when parentVal & childVal are both present,
  9345. // we need to return a function that returns the
  9346. // merged result of both functions... no need to
  9347. // check if parentVal is a function here because
  9348. // it has to be a function to pass previous merges.
  9349. return function mergedDataFn () {
  9350. return mergeData(
  9351. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  9352. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  9353. )
  9354. }
  9355. } else {
  9356. return function mergedInstanceDataFn () {
  9357. // instance merge
  9358. var instanceData = typeof childVal === 'function'
  9359. ? childVal.call(vm, vm)
  9360. : childVal;
  9361. var defaultData = typeof parentVal === 'function'
  9362. ? parentVal.call(vm, vm)
  9363. : parentVal;
  9364. if (instanceData) {
  9365. return mergeData(instanceData, defaultData)
  9366. } else {
  9367. return defaultData
  9368. }
  9369. }
  9370. }
  9371. }
  9372. strats.data = function (
  9373. parentVal,
  9374. childVal,
  9375. vm
  9376. ) {
  9377. if (!vm) {
  9378. if (childVal && typeof childVal !== 'function') {
  9379. true && warn(
  9380. 'The "data" option should be a function ' +
  9381. 'that returns a per-instance value in component ' +
  9382. 'definitions.',
  9383. vm
  9384. );
  9385. return parentVal
  9386. }
  9387. return mergeDataOrFn(parentVal, childVal)
  9388. }
  9389. return mergeDataOrFn(parentVal, childVal, vm)
  9390. };
  9391. /**
  9392. * Hooks and props are merged as arrays.
  9393. */
  9394. function mergeHook (
  9395. parentVal,
  9396. childVal
  9397. ) {
  9398. var res = childVal
  9399. ? parentVal
  9400. ? parentVal.concat(childVal)
  9401. : Array.isArray(childVal)
  9402. ? childVal
  9403. : [childVal]
  9404. : parentVal;
  9405. return res
  9406. ? dedupeHooks(res)
  9407. : res
  9408. }
  9409. function dedupeHooks (hooks) {
  9410. var res = [];
  9411. for (var i = 0; i < hooks.length; i++) {
  9412. if (res.indexOf(hooks[i]) === -1) {
  9413. res.push(hooks[i]);
  9414. }
  9415. }
  9416. return res
  9417. }
  9418. LIFECYCLE_HOOKS.forEach(function (hook) {
  9419. strats[hook] = mergeHook;
  9420. });
  9421. /**
  9422. * Assets
  9423. *
  9424. * When a vm is present (instance creation), we need to do
  9425. * a three-way merge between constructor options, instance
  9426. * options and parent options.
  9427. */
  9428. function mergeAssets (
  9429. parentVal,
  9430. childVal,
  9431. vm,
  9432. key
  9433. ) {
  9434. var res = Object.create(parentVal || null);
  9435. if (childVal) {
  9436. true && assertObjectType(key, childVal, vm);
  9437. return extend(res, childVal)
  9438. } else {
  9439. return res
  9440. }
  9441. }
  9442. ASSET_TYPES.forEach(function (type) {
  9443. strats[type + 's'] = mergeAssets;
  9444. });
  9445. /**
  9446. * Watchers.
  9447. *
  9448. * Watchers hashes should not overwrite one
  9449. * another, so we merge them as arrays.
  9450. */
  9451. strats.watch = function (
  9452. parentVal,
  9453. childVal,
  9454. vm,
  9455. key
  9456. ) {
  9457. // work around Firefox's Object.prototype.watch...
  9458. if (parentVal === nativeWatch) { parentVal = undefined; }
  9459. if (childVal === nativeWatch) { childVal = undefined; }
  9460. /* istanbul ignore if */
  9461. if (!childVal) { return Object.create(parentVal || null) }
  9462. if (true) {
  9463. assertObjectType(key, childVal, vm);
  9464. }
  9465. if (!parentVal) { return childVal }
  9466. var ret = {};
  9467. extend(ret, parentVal);
  9468. for (var key$1 in childVal) {
  9469. var parent = ret[key$1];
  9470. var child = childVal[key$1];
  9471. if (parent && !Array.isArray(parent)) {
  9472. parent = [parent];
  9473. }
  9474. ret[key$1] = parent
  9475. ? parent.concat(child)
  9476. : Array.isArray(child) ? child : [child];
  9477. }
  9478. return ret
  9479. };
  9480. /**
  9481. * Other object hashes.
  9482. */
  9483. strats.props =
  9484. strats.methods =
  9485. strats.inject =
  9486. strats.computed = function (
  9487. parentVal,
  9488. childVal,
  9489. vm,
  9490. key
  9491. ) {
  9492. if (childVal && "development" !== 'production') {
  9493. assertObjectType(key, childVal, vm);
  9494. }
  9495. if (!parentVal) { return childVal }
  9496. var ret = Object.create(null);
  9497. extend(ret, parentVal);
  9498. if (childVal) { extend(ret, childVal); }
  9499. return ret
  9500. };
  9501. strats.provide = mergeDataOrFn;
  9502. /**
  9503. * Default strategy.
  9504. */
  9505. var defaultStrat = function (parentVal, childVal) {
  9506. return childVal === undefined
  9507. ? parentVal
  9508. : childVal
  9509. };
  9510. /**
  9511. * Validate component names
  9512. */
  9513. function checkComponents (options) {
  9514. for (var key in options.components) {
  9515. validateComponentName(key);
  9516. }
  9517. }
  9518. function validateComponentName (name) {
  9519. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  9520. warn(
  9521. 'Invalid component name: "' + name + '". Component names ' +
  9522. 'should conform to valid custom element name in html5 specification.'
  9523. );
  9524. }
  9525. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  9526. warn(
  9527. 'Do not use built-in or reserved HTML elements as component ' +
  9528. 'id: ' + name
  9529. );
  9530. }
  9531. }
  9532. /**
  9533. * Ensure all props option syntax are normalized into the
  9534. * Object-based format.
  9535. */
  9536. function normalizeProps (options, vm) {
  9537. var props = options.props;
  9538. if (!props) { return }
  9539. var res = {};
  9540. var i, val, name;
  9541. if (Array.isArray(props)) {
  9542. i = props.length;
  9543. while (i--) {
  9544. val = props[i];
  9545. if (typeof val === 'string') {
  9546. name = camelize(val);
  9547. res[name] = { type: null };
  9548. } else if (true) {
  9549. warn('props must be strings when using array syntax.');
  9550. }
  9551. }
  9552. } else if (isPlainObject(props)) {
  9553. for (var key in props) {
  9554. val = props[key];
  9555. name = camelize(key);
  9556. res[name] = isPlainObject(val)
  9557. ? val
  9558. : { type: val };
  9559. }
  9560. } else if (true) {
  9561. warn(
  9562. "Invalid value for option \"props\": expected an Array or an Object, " +
  9563. "but got " + (toRawType(props)) + ".",
  9564. vm
  9565. );
  9566. }
  9567. options.props = res;
  9568. }
  9569. /**
  9570. * Normalize all injections into Object-based format
  9571. */
  9572. function normalizeInject (options, vm) {
  9573. var inject = options.inject;
  9574. if (!inject) { return }
  9575. var normalized = options.inject = {};
  9576. if (Array.isArray(inject)) {
  9577. for (var i = 0; i < inject.length; i++) {
  9578. normalized[inject[i]] = { from: inject[i] };
  9579. }
  9580. } else if (isPlainObject(inject)) {
  9581. for (var key in inject) {
  9582. var val = inject[key];
  9583. normalized[key] = isPlainObject(val)
  9584. ? extend({ from: key }, val)
  9585. : { from: val };
  9586. }
  9587. } else if (true) {
  9588. warn(
  9589. "Invalid value for option \"inject\": expected an Array or an Object, " +
  9590. "but got " + (toRawType(inject)) + ".",
  9591. vm
  9592. );
  9593. }
  9594. }
  9595. /**
  9596. * Normalize raw function directives into object format.
  9597. */
  9598. function normalizeDirectives (options) {
  9599. var dirs = options.directives;
  9600. if (dirs) {
  9601. for (var key in dirs) {
  9602. var def$$1 = dirs[key];
  9603. if (typeof def$$1 === 'function') {
  9604. dirs[key] = { bind: def$$1, update: def$$1 };
  9605. }
  9606. }
  9607. }
  9608. }
  9609. function assertObjectType (name, value, vm) {
  9610. if (!isPlainObject(value)) {
  9611. warn(
  9612. "Invalid value for option \"" + name + "\": expected an Object, " +
  9613. "but got " + (toRawType(value)) + ".",
  9614. vm
  9615. );
  9616. }
  9617. }
  9618. /**
  9619. * Merge two option objects into a new one.
  9620. * Core utility used in both instantiation and inheritance.
  9621. */
  9622. function mergeOptions (
  9623. parent,
  9624. child,
  9625. vm
  9626. ) {
  9627. if (true) {
  9628. checkComponents(child);
  9629. }
  9630. if (typeof child === 'function') {
  9631. child = child.options;
  9632. }
  9633. normalizeProps(child, vm);
  9634. normalizeInject(child, vm);
  9635. normalizeDirectives(child);
  9636. // Apply extends and mixins on the child options,
  9637. // but only if it is a raw options object that isn't
  9638. // the result of another mergeOptions call.
  9639. // Only merged options has the _base property.
  9640. if (!child._base) {
  9641. if (child.extends) {
  9642. parent = mergeOptions(parent, child.extends, vm);
  9643. }
  9644. if (child.mixins) {
  9645. for (var i = 0, l = child.mixins.length; i < l; i++) {
  9646. parent = mergeOptions(parent, child.mixins[i], vm);
  9647. }
  9648. }
  9649. }
  9650. var options = {};
  9651. var key;
  9652. for (key in parent) {
  9653. mergeField(key);
  9654. }
  9655. for (key in child) {
  9656. if (!hasOwn(parent, key)) {
  9657. mergeField(key);
  9658. }
  9659. }
  9660. function mergeField (key) {
  9661. var strat = strats[key] || defaultStrat;
  9662. options[key] = strat(parent[key], child[key], vm, key);
  9663. }
  9664. return options
  9665. }
  9666. /**
  9667. * Resolve an asset.
  9668. * This function is used because child instances need access
  9669. * to assets defined in its ancestor chain.
  9670. */
  9671. function resolveAsset (
  9672. options,
  9673. type,
  9674. id,
  9675. warnMissing
  9676. ) {
  9677. /* istanbul ignore if */
  9678. if (typeof id !== 'string') {
  9679. return
  9680. }
  9681. var assets = options[type];
  9682. // check local registration variations first
  9683. if (hasOwn(assets, id)) { return assets[id] }
  9684. var camelizedId = camelize(id);
  9685. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  9686. var PascalCaseId = capitalize(camelizedId);
  9687. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  9688. // fallback to prototype chain
  9689. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  9690. if ( true && warnMissing && !res) {
  9691. warn(
  9692. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  9693. options
  9694. );
  9695. }
  9696. return res
  9697. }
  9698. /* */
  9699. function validateProp (
  9700. key,
  9701. propOptions,
  9702. propsData,
  9703. vm
  9704. ) {
  9705. var prop = propOptions[key];
  9706. var absent = !hasOwn(propsData, key);
  9707. var value = propsData[key];
  9708. // boolean casting
  9709. var booleanIndex = getTypeIndex(Boolean, prop.type);
  9710. if (booleanIndex > -1) {
  9711. if (absent && !hasOwn(prop, 'default')) {
  9712. value = false;
  9713. } else if (value === '' || value === hyphenate(key)) {
  9714. // only cast empty string / same name to boolean if
  9715. // boolean has higher priority
  9716. var stringIndex = getTypeIndex(String, prop.type);
  9717. if (stringIndex < 0 || booleanIndex < stringIndex) {
  9718. value = true;
  9719. }
  9720. }
  9721. }
  9722. // check default value
  9723. if (value === undefined) {
  9724. value = getPropDefaultValue(vm, prop, key);
  9725. // since the default value is a fresh copy,
  9726. // make sure to observe it.
  9727. var prevShouldObserve = shouldObserve;
  9728. toggleObserving(true);
  9729. observe(value);
  9730. toggleObserving(prevShouldObserve);
  9731. }
  9732. if (
  9733. true
  9734. ) {
  9735. assertProp(prop, key, value, vm, absent);
  9736. }
  9737. return value
  9738. }
  9739. /**
  9740. * Get the default value of a prop.
  9741. */
  9742. function getPropDefaultValue (vm, prop, key) {
  9743. // no default, return undefined
  9744. if (!hasOwn(prop, 'default')) {
  9745. return undefined
  9746. }
  9747. var def = prop.default;
  9748. // warn against non-factory defaults for Object & Array
  9749. if ( true && isObject(def)) {
  9750. warn(
  9751. 'Invalid default value for prop "' + key + '": ' +
  9752. 'Props with type Object/Array must use a factory function ' +
  9753. 'to return the default value.',
  9754. vm
  9755. );
  9756. }
  9757. // the raw prop value was also undefined from previous render,
  9758. // return previous default value to avoid unnecessary watcher trigger
  9759. if (vm && vm.$options.propsData &&
  9760. vm.$options.propsData[key] === undefined &&
  9761. vm._props[key] !== undefined
  9762. ) {
  9763. return vm._props[key]
  9764. }
  9765. // call factory function for non-Function types
  9766. // a value is Function if its prototype is function even across different execution context
  9767. return typeof def === 'function' && getType(prop.type) !== 'Function'
  9768. ? def.call(vm)
  9769. : def
  9770. }
  9771. /**
  9772. * Assert whether a prop is valid.
  9773. */
  9774. function assertProp (
  9775. prop,
  9776. name,
  9777. value,
  9778. vm,
  9779. absent
  9780. ) {
  9781. if (prop.required && absent) {
  9782. warn(
  9783. 'Missing required prop: "' + name + '"',
  9784. vm
  9785. );
  9786. return
  9787. }
  9788. if (value == null && !prop.required) {
  9789. return
  9790. }
  9791. var type = prop.type;
  9792. var valid = !type || type === true;
  9793. var expectedTypes = [];
  9794. if (type) {
  9795. if (!Array.isArray(type)) {
  9796. type = [type];
  9797. }
  9798. for (var i = 0; i < type.length && !valid; i++) {
  9799. var assertedType = assertType(value, type[i]);
  9800. expectedTypes.push(assertedType.expectedType || '');
  9801. valid = assertedType.valid;
  9802. }
  9803. }
  9804. if (!valid) {
  9805. warn(
  9806. getInvalidTypeMessage(name, value, expectedTypes),
  9807. vm
  9808. );
  9809. return
  9810. }
  9811. var validator = prop.validator;
  9812. if (validator) {
  9813. if (!validator(value)) {
  9814. warn(
  9815. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  9816. vm
  9817. );
  9818. }
  9819. }
  9820. }
  9821. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  9822. function assertType (value, type) {
  9823. var valid;
  9824. var expectedType = getType(type);
  9825. if (simpleCheckRE.test(expectedType)) {
  9826. var t = typeof value;
  9827. valid = t === expectedType.toLowerCase();
  9828. // for primitive wrapper objects
  9829. if (!valid && t === 'object') {
  9830. valid = value instanceof type;
  9831. }
  9832. } else if (expectedType === 'Object') {
  9833. valid = isPlainObject(value);
  9834. } else if (expectedType === 'Array') {
  9835. valid = Array.isArray(value);
  9836. } else {
  9837. valid = value instanceof type;
  9838. }
  9839. return {
  9840. valid: valid,
  9841. expectedType: expectedType
  9842. }
  9843. }
  9844. /**
  9845. * Use function string name to check built-in types,
  9846. * because a simple equality check will fail when running
  9847. * across different vms / iframes.
  9848. */
  9849. function getType (fn) {
  9850. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  9851. return match ? match[1] : ''
  9852. }
  9853. function isSameType (a, b) {
  9854. return getType(a) === getType(b)
  9855. }
  9856. function getTypeIndex (type, expectedTypes) {
  9857. if (!Array.isArray(expectedTypes)) {
  9858. return isSameType(expectedTypes, type) ? 0 : -1
  9859. }
  9860. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  9861. if (isSameType(expectedTypes[i], type)) {
  9862. return i
  9863. }
  9864. }
  9865. return -1
  9866. }
  9867. function getInvalidTypeMessage (name, value, expectedTypes) {
  9868. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  9869. " Expected " + (expectedTypes.map(capitalize).join(', '));
  9870. var expectedType = expectedTypes[0];
  9871. var receivedType = toRawType(value);
  9872. var expectedValue = styleValue(value, expectedType);
  9873. var receivedValue = styleValue(value, receivedType);
  9874. // check if we need to specify expected value
  9875. if (expectedTypes.length === 1 &&
  9876. isExplicable(expectedType) &&
  9877. !isBoolean(expectedType, receivedType)) {
  9878. message += " with value " + expectedValue;
  9879. }
  9880. message += ", got " + receivedType + " ";
  9881. // check if we need to specify received value
  9882. if (isExplicable(receivedType)) {
  9883. message += "with value " + receivedValue + ".";
  9884. }
  9885. return message
  9886. }
  9887. function styleValue (value, type) {
  9888. if (type === 'String') {
  9889. return ("\"" + value + "\"")
  9890. } else if (type === 'Number') {
  9891. return ("" + (Number(value)))
  9892. } else {
  9893. return ("" + value)
  9894. }
  9895. }
  9896. function isExplicable (value) {
  9897. var explicitTypes = ['string', 'number', 'boolean'];
  9898. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  9899. }
  9900. function isBoolean () {
  9901. var args = [], len = arguments.length;
  9902. while ( len-- ) args[ len ] = arguments[ len ];
  9903. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  9904. }
  9905. /* */
  9906. function handleError (err, vm, info) {
  9907. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  9908. // See: https://github.com/vuejs/vuex/issues/1505
  9909. pushTarget();
  9910. try {
  9911. if (vm) {
  9912. var cur = vm;
  9913. while ((cur = cur.$parent)) {
  9914. var hooks = cur.$options.errorCaptured;
  9915. if (hooks) {
  9916. for (var i = 0; i < hooks.length; i++) {
  9917. try {
  9918. var capture = hooks[i].call(cur, err, vm, info) === false;
  9919. if (capture) { return }
  9920. } catch (e) {
  9921. globalHandleError(e, cur, 'errorCaptured hook');
  9922. }
  9923. }
  9924. }
  9925. }
  9926. }
  9927. globalHandleError(err, vm, info);
  9928. } finally {
  9929. popTarget();
  9930. }
  9931. }
  9932. function invokeWithErrorHandling (
  9933. handler,
  9934. context,
  9935. args,
  9936. vm,
  9937. info
  9938. ) {
  9939. var res;
  9940. try {
  9941. res = args ? handler.apply(context, args) : handler.call(context);
  9942. if (res && !res._isVue && isPromise(res) && !res._handled) {
  9943. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  9944. // issue #9511
  9945. // avoid catch triggering multiple times when nested calls
  9946. res._handled = true;
  9947. }
  9948. } catch (e) {
  9949. handleError(e, vm, info);
  9950. }
  9951. return res
  9952. }
  9953. function globalHandleError (err, vm, info) {
  9954. if (config.errorHandler) {
  9955. try {
  9956. return config.errorHandler.call(null, err, vm, info)
  9957. } catch (e) {
  9958. // if the user intentionally throws the original error in the handler,
  9959. // do not log it twice
  9960. if (e !== err) {
  9961. logError(e, null, 'config.errorHandler');
  9962. }
  9963. }
  9964. }
  9965. logError(err, vm, info);
  9966. }
  9967. function logError (err, vm, info) {
  9968. if (true) {
  9969. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  9970. }
  9971. /* istanbul ignore else */
  9972. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  9973. console.error(err);
  9974. } else {
  9975. throw err
  9976. }
  9977. }
  9978. /* */
  9979. var callbacks = [];
  9980. var pending = false;
  9981. function flushCallbacks () {
  9982. pending = false;
  9983. var copies = callbacks.slice(0);
  9984. callbacks.length = 0;
  9985. for (var i = 0; i < copies.length; i++) {
  9986. copies[i]();
  9987. }
  9988. }
  9989. // Here we have async deferring wrappers using microtasks.
  9990. // In 2.5 we used (macro) tasks (in combination with microtasks).
  9991. // However, it has subtle problems when state is changed right before repaint
  9992. // (e.g. #6813, out-in transitions).
  9993. // Also, using (macro) tasks in event handler would cause some weird behaviors
  9994. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  9995. // So we now use microtasks everywhere, again.
  9996. // A major drawback of this tradeoff is that there are some scenarios
  9997. // where microtasks have too high a priority and fire in between supposedly
  9998. // sequential events (e.g. #4521, #6690, which have workarounds)
  9999. // or even between bubbling of the same event (#6566).
  10000. var timerFunc;
  10001. // The nextTick behavior leverages the microtask queue, which can be accessed
  10002. // via either native Promise.then or MutationObserver.
  10003. // MutationObserver has wider support, however it is seriously bugged in
  10004. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  10005. // completely stops working after triggering a few times... so, if native
  10006. // Promise is available, we will use it:
  10007. /* istanbul ignore next, $flow-disable-line */
  10008. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  10009. var p = Promise.resolve();
  10010. timerFunc = function () {
  10011. p.then(flushCallbacks);
  10012. // In problematic UIWebViews, Promise.then doesn't completely break, but
  10013. // it can get stuck in a weird state where callbacks are pushed into the
  10014. // microtask queue but the queue isn't being flushed, until the browser
  10015. // needs to do some other work, e.g. handle a timer. Therefore we can
  10016. // "force" the microtask queue to be flushed by adding an empty timer.
  10017. if (isIOS) { setTimeout(noop); }
  10018. };
  10019. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  10020. isNative(MutationObserver) ||
  10021. // PhantomJS and iOS 7.x
  10022. MutationObserver.toString() === '[object MutationObserverConstructor]'
  10023. )) {
  10024. // Use MutationObserver where native Promise is not available,
  10025. // e.g. PhantomJS, iOS7, Android 4.4
  10026. // (#6466 MutationObserver is unreliable in IE11)
  10027. var counter = 1;
  10028. var observer = new MutationObserver(flushCallbacks);
  10029. var textNode = document.createTextNode(String(counter));
  10030. observer.observe(textNode, {
  10031. characterData: true
  10032. });
  10033. timerFunc = function () {
  10034. counter = (counter + 1) % 2;
  10035. textNode.data = String(counter);
  10036. };
  10037. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  10038. // Fallback to setImmediate.
  10039. // Technically it leverages the (macro) task queue,
  10040. // but it is still a better choice than setTimeout.
  10041. timerFunc = function () {
  10042. setImmediate(flushCallbacks);
  10043. };
  10044. } else {
  10045. // Fallback to setTimeout.
  10046. timerFunc = function () {
  10047. setTimeout(flushCallbacks, 0);
  10048. };
  10049. }
  10050. function nextTick (cb, ctx) {
  10051. var _resolve;
  10052. callbacks.push(function () {
  10053. if (cb) {
  10054. try {
  10055. cb.call(ctx);
  10056. } catch (e) {
  10057. handleError(e, ctx, 'nextTick');
  10058. }
  10059. } else if (_resolve) {
  10060. _resolve(ctx);
  10061. }
  10062. });
  10063. if (!pending) {
  10064. pending = true;
  10065. timerFunc();
  10066. }
  10067. // $flow-disable-line
  10068. if (!cb && typeof Promise !== 'undefined') {
  10069. return new Promise(function (resolve) {
  10070. _resolve = resolve;
  10071. })
  10072. }
  10073. }
  10074. /* */
  10075. /* not type checking this file because flow doesn't play well with Proxy */
  10076. var initProxy;
  10077. if (true) {
  10078. var allowedGlobals = makeMap(
  10079. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  10080. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  10081. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  10082. 'require' // for Webpack/Browserify
  10083. );
  10084. var warnNonPresent = function (target, key) {
  10085. warn(
  10086. "Property or method \"" + key + "\" is not defined on the instance but " +
  10087. 'referenced during render. Make sure that this property is reactive, ' +
  10088. 'either in the data option, or for class-based components, by ' +
  10089. 'initializing the property. ' +
  10090. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  10091. target
  10092. );
  10093. };
  10094. var warnReservedPrefix = function (target, key) {
  10095. warn(
  10096. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  10097. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  10098. 'prevent conflicts with Vue internals. ' +
  10099. 'See: https://vuejs.org/v2/api/#data',
  10100. target
  10101. );
  10102. };
  10103. var hasProxy =
  10104. typeof Proxy !== 'undefined' && isNative(Proxy);
  10105. if (hasProxy) {
  10106. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  10107. config.keyCodes = new Proxy(config.keyCodes, {
  10108. set: function set (target, key, value) {
  10109. if (isBuiltInModifier(key)) {
  10110. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  10111. return false
  10112. } else {
  10113. target[key] = value;
  10114. return true
  10115. }
  10116. }
  10117. });
  10118. }
  10119. var hasHandler = {
  10120. has: function has (target, key) {
  10121. var has = key in target;
  10122. var isAllowed = allowedGlobals(key) ||
  10123. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  10124. if (!has && !isAllowed) {
  10125. if (key in target.$data) { warnReservedPrefix(target, key); }
  10126. else { warnNonPresent(target, key); }
  10127. }
  10128. return has || !isAllowed
  10129. }
  10130. };
  10131. var getHandler = {
  10132. get: function get (target, key) {
  10133. if (typeof key === 'string' && !(key in target)) {
  10134. if (key in target.$data) { warnReservedPrefix(target, key); }
  10135. else { warnNonPresent(target, key); }
  10136. }
  10137. return target[key]
  10138. }
  10139. };
  10140. initProxy = function initProxy (vm) {
  10141. if (hasProxy) {
  10142. // determine which proxy handler to use
  10143. var options = vm.$options;
  10144. var handlers = options.render && options.render._withStripped
  10145. ? getHandler
  10146. : hasHandler;
  10147. vm._renderProxy = new Proxy(vm, handlers);
  10148. } else {
  10149. vm._renderProxy = vm;
  10150. }
  10151. };
  10152. }
  10153. /* */
  10154. var seenObjects = new _Set();
  10155. /**
  10156. * Recursively traverse an object to evoke all converted
  10157. * getters, so that every nested property inside the object
  10158. * is collected as a "deep" dependency.
  10159. */
  10160. function traverse (val) {
  10161. _traverse(val, seenObjects);
  10162. seenObjects.clear();
  10163. }
  10164. function _traverse (val, seen) {
  10165. var i, keys;
  10166. var isA = Array.isArray(val);
  10167. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  10168. return
  10169. }
  10170. if (val.__ob__) {
  10171. var depId = val.__ob__.dep.id;
  10172. if (seen.has(depId)) {
  10173. return
  10174. }
  10175. seen.add(depId);
  10176. }
  10177. if (isA) {
  10178. i = val.length;
  10179. while (i--) { _traverse(val[i], seen); }
  10180. } else {
  10181. keys = Object.keys(val);
  10182. i = keys.length;
  10183. while (i--) { _traverse(val[keys[i]], seen); }
  10184. }
  10185. }
  10186. var mark;
  10187. var measure;
  10188. if (true) {
  10189. var perf = inBrowser && window.performance;
  10190. /* istanbul ignore if */
  10191. if (
  10192. perf &&
  10193. perf.mark &&
  10194. perf.measure &&
  10195. perf.clearMarks &&
  10196. perf.clearMeasures
  10197. ) {
  10198. mark = function (tag) { return perf.mark(tag); };
  10199. measure = function (name, startTag, endTag) {
  10200. perf.measure(name, startTag, endTag);
  10201. perf.clearMarks(startTag);
  10202. perf.clearMarks(endTag);
  10203. // perf.clearMeasures(name)
  10204. };
  10205. }
  10206. }
  10207. /* */
  10208. var normalizeEvent = cached(function (name) {
  10209. var passive = name.charAt(0) === '&';
  10210. name = passive ? name.slice(1) : name;
  10211. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  10212. name = once$$1 ? name.slice(1) : name;
  10213. var capture = name.charAt(0) === '!';
  10214. name = capture ? name.slice(1) : name;
  10215. return {
  10216. name: name,
  10217. once: once$$1,
  10218. capture: capture,
  10219. passive: passive
  10220. }
  10221. });
  10222. function createFnInvoker (fns, vm) {
  10223. function invoker () {
  10224. var arguments$1 = arguments;
  10225. var fns = invoker.fns;
  10226. if (Array.isArray(fns)) {
  10227. var cloned = fns.slice();
  10228. for (var i = 0; i < cloned.length; i++) {
  10229. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  10230. }
  10231. } else {
  10232. // return handler return value for single handlers
  10233. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  10234. }
  10235. }
  10236. invoker.fns = fns;
  10237. return invoker
  10238. }
  10239. function updateListeners (
  10240. on,
  10241. oldOn,
  10242. add,
  10243. remove$$1,
  10244. createOnceHandler,
  10245. vm
  10246. ) {
  10247. var name, def$$1, cur, old, event;
  10248. for (name in on) {
  10249. def$$1 = cur = on[name];
  10250. old = oldOn[name];
  10251. event = normalizeEvent(name);
  10252. if (isUndef(cur)) {
  10253. true && warn(
  10254. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  10255. vm
  10256. );
  10257. } else if (isUndef(old)) {
  10258. if (isUndef(cur.fns)) {
  10259. cur = on[name] = createFnInvoker(cur, vm);
  10260. }
  10261. if (isTrue(event.once)) {
  10262. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  10263. }
  10264. add(event.name, cur, event.capture, event.passive, event.params);
  10265. } else if (cur !== old) {
  10266. old.fns = cur;
  10267. on[name] = old;
  10268. }
  10269. }
  10270. for (name in oldOn) {
  10271. if (isUndef(on[name])) {
  10272. event = normalizeEvent(name);
  10273. remove$$1(event.name, oldOn[name], event.capture);
  10274. }
  10275. }
  10276. }
  10277. /* */
  10278. /* */
  10279. // fixed by xxxxxx (mp properties)
  10280. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  10281. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  10282. if (isUndef(propOptions)) {
  10283. return res
  10284. }
  10285. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  10286. var attrs = data.attrs;
  10287. var props = data.props;
  10288. if (isDef(attrs) || isDef(props)) {
  10289. for (var key in propOptions) {
  10290. var altKey = hyphenate(key);
  10291. var result = checkProp(res, props, key, altKey, true) ||
  10292. checkProp(res, attrs, key, altKey, false);
  10293. // externalClass
  10294. if (
  10295. result &&
  10296. res[key] &&
  10297. externalClasses.indexOf(altKey) !== -1 &&
  10298. context[camelize(res[key])]
  10299. ) {
  10300. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  10301. res[key] = context[camelize(res[key])];
  10302. }
  10303. }
  10304. }
  10305. return res
  10306. }
  10307. function extractPropsFromVNodeData (
  10308. data,
  10309. Ctor,
  10310. tag,
  10311. context// fixed by xxxxxx
  10312. ) {
  10313. // we are only extracting raw values here.
  10314. // validation and default values are handled in the child
  10315. // component itself.
  10316. var propOptions = Ctor.options.props;
  10317. if (isUndef(propOptions)) {
  10318. // fixed by xxxxxx
  10319. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  10320. }
  10321. var res = {};
  10322. var attrs = data.attrs;
  10323. var props = data.props;
  10324. if (isDef(attrs) || isDef(props)) {
  10325. for (var key in propOptions) {
  10326. var altKey = hyphenate(key);
  10327. if (true) {
  10328. var keyInLowerCase = key.toLowerCase();
  10329. if (
  10330. key !== keyInLowerCase &&
  10331. attrs && hasOwn(attrs, keyInLowerCase)
  10332. ) {
  10333. tip(
  10334. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  10335. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  10336. " \"" + key + "\". " +
  10337. "Note that HTML attributes are case-insensitive and camelCased " +
  10338. "props need to use their kebab-case equivalents when using in-DOM " +
  10339. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  10340. );
  10341. }
  10342. }
  10343. checkProp(res, props, key, altKey, true) ||
  10344. checkProp(res, attrs, key, altKey, false);
  10345. }
  10346. }
  10347. // fixed by xxxxxx
  10348. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  10349. }
  10350. function checkProp (
  10351. res,
  10352. hash,
  10353. key,
  10354. altKey,
  10355. preserve
  10356. ) {
  10357. if (isDef(hash)) {
  10358. if (hasOwn(hash, key)) {
  10359. res[key] = hash[key];
  10360. if (!preserve) {
  10361. delete hash[key];
  10362. }
  10363. return true
  10364. } else if (hasOwn(hash, altKey)) {
  10365. res[key] = hash[altKey];
  10366. if (!preserve) {
  10367. delete hash[altKey];
  10368. }
  10369. return true
  10370. }
  10371. }
  10372. return false
  10373. }
  10374. /* */
  10375. // The template compiler attempts to minimize the need for normalization by
  10376. // statically analyzing the template at compile time.
  10377. //
  10378. // For plain HTML markup, normalization can be completely skipped because the
  10379. // generated render function is guaranteed to return Array<VNode>. There are
  10380. // two cases where extra normalization is needed:
  10381. // 1. When the children contains components - because a functional component
  10382. // may return an Array instead of a single root. In this case, just a simple
  10383. // normalization is needed - if any child is an Array, we flatten the whole
  10384. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  10385. // because functional components already normalize their own children.
  10386. function simpleNormalizeChildren (children) {
  10387. for (var i = 0; i < children.length; i++) {
  10388. if (Array.isArray(children[i])) {
  10389. return Array.prototype.concat.apply([], children)
  10390. }
  10391. }
  10392. return children
  10393. }
  10394. // 2. When the children contains constructs that always generated nested Arrays,
  10395. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  10396. // with hand-written render functions / JSX. In such cases a full normalization
  10397. // is needed to cater to all possible types of children values.
  10398. function normalizeChildren (children) {
  10399. return isPrimitive(children)
  10400. ? [createTextVNode(children)]
  10401. : Array.isArray(children)
  10402. ? normalizeArrayChildren(children)
  10403. : undefined
  10404. }
  10405. function isTextNode (node) {
  10406. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  10407. }
  10408. function normalizeArrayChildren (children, nestedIndex) {
  10409. var res = [];
  10410. var i, c, lastIndex, last;
  10411. for (i = 0; i < children.length; i++) {
  10412. c = children[i];
  10413. if (isUndef(c) || typeof c === 'boolean') { continue }
  10414. lastIndex = res.length - 1;
  10415. last = res[lastIndex];
  10416. // nested
  10417. if (Array.isArray(c)) {
  10418. if (c.length > 0) {
  10419. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  10420. // merge adjacent text nodes
  10421. if (isTextNode(c[0]) && isTextNode(last)) {
  10422. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  10423. c.shift();
  10424. }
  10425. res.push.apply(res, c);
  10426. }
  10427. } else if (isPrimitive(c)) {
  10428. if (isTextNode(last)) {
  10429. // merge adjacent text nodes
  10430. // this is necessary for SSR hydration because text nodes are
  10431. // essentially merged when rendered to HTML strings
  10432. res[lastIndex] = createTextVNode(last.text + c);
  10433. } else if (c !== '') {
  10434. // convert primitive to vnode
  10435. res.push(createTextVNode(c));
  10436. }
  10437. } else {
  10438. if (isTextNode(c) && isTextNode(last)) {
  10439. // merge adjacent text nodes
  10440. res[lastIndex] = createTextVNode(last.text + c.text);
  10441. } else {
  10442. // default key for nested array children (likely generated by v-for)
  10443. if (isTrue(children._isVList) &&
  10444. isDef(c.tag) &&
  10445. isUndef(c.key) &&
  10446. isDef(nestedIndex)) {
  10447. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  10448. }
  10449. res.push(c);
  10450. }
  10451. }
  10452. }
  10453. return res
  10454. }
  10455. /* */
  10456. function initProvide (vm) {
  10457. var provide = vm.$options.provide;
  10458. if (provide) {
  10459. vm._provided = typeof provide === 'function'
  10460. ? provide.call(vm)
  10461. : provide;
  10462. }
  10463. }
  10464. function initInjections (vm) {
  10465. var result = resolveInject(vm.$options.inject, vm);
  10466. if (result) {
  10467. toggleObserving(false);
  10468. Object.keys(result).forEach(function (key) {
  10469. /* istanbul ignore else */
  10470. if (true) {
  10471. defineReactive$$1(vm, key, result[key], function () {
  10472. warn(
  10473. "Avoid mutating an injected value directly since the changes will be " +
  10474. "overwritten whenever the provided component re-renders. " +
  10475. "injection being mutated: \"" + key + "\"",
  10476. vm
  10477. );
  10478. });
  10479. } else {}
  10480. });
  10481. toggleObserving(true);
  10482. }
  10483. }
  10484. function resolveInject (inject, vm) {
  10485. if (inject) {
  10486. // inject is :any because flow is not smart enough to figure out cached
  10487. var result = Object.create(null);
  10488. var keys = hasSymbol
  10489. ? Reflect.ownKeys(inject)
  10490. : Object.keys(inject);
  10491. for (var i = 0; i < keys.length; i++) {
  10492. var key = keys[i];
  10493. // #6574 in case the inject object is observed...
  10494. if (key === '__ob__') { continue }
  10495. var provideKey = inject[key].from;
  10496. var source = vm;
  10497. while (source) {
  10498. if (source._provided && hasOwn(source._provided, provideKey)) {
  10499. result[key] = source._provided[provideKey];
  10500. break
  10501. }
  10502. source = source.$parent;
  10503. }
  10504. if (!source) {
  10505. if ('default' in inject[key]) {
  10506. var provideDefault = inject[key].default;
  10507. result[key] = typeof provideDefault === 'function'
  10508. ? provideDefault.call(vm)
  10509. : provideDefault;
  10510. } else if (true) {
  10511. warn(("Injection \"" + key + "\" not found"), vm);
  10512. }
  10513. }
  10514. }
  10515. return result
  10516. }
  10517. }
  10518. /* */
  10519. /**
  10520. * Runtime helper for resolving raw children VNodes into a slot object.
  10521. */
  10522. function resolveSlots (
  10523. children,
  10524. context
  10525. ) {
  10526. if (!children || !children.length) {
  10527. return {}
  10528. }
  10529. var slots = {};
  10530. for (var i = 0, l = children.length; i < l; i++) {
  10531. var child = children[i];
  10532. var data = child.data;
  10533. // remove slot attribute if the node is resolved as a Vue slot node
  10534. if (data && data.attrs && data.attrs.slot) {
  10535. delete data.attrs.slot;
  10536. }
  10537. // named slots should only be respected if the vnode was rendered in the
  10538. // same context.
  10539. if ((child.context === context || child.fnContext === context) &&
  10540. data && data.slot != null
  10541. ) {
  10542. var name = data.slot;
  10543. var slot = (slots[name] || (slots[name] = []));
  10544. if (child.tag === 'template') {
  10545. slot.push.apply(slot, child.children || []);
  10546. } else {
  10547. slot.push(child);
  10548. }
  10549. } else {
  10550. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  10551. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  10552. (slots['page'] || (slots['page'] = [])).push(child);
  10553. }else{
  10554. (slots.default || (slots.default = [])).push(child);
  10555. }
  10556. }
  10557. }
  10558. // ignore slots that contains only whitespace
  10559. for (var name$1 in slots) {
  10560. if (slots[name$1].every(isWhitespace)) {
  10561. delete slots[name$1];
  10562. }
  10563. }
  10564. return slots
  10565. }
  10566. function isWhitespace (node) {
  10567. return (node.isComment && !node.asyncFactory) || node.text === ' '
  10568. }
  10569. /* */
  10570. function normalizeScopedSlots (
  10571. slots,
  10572. normalSlots,
  10573. prevSlots
  10574. ) {
  10575. var res;
  10576. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  10577. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  10578. var key = slots && slots.$key;
  10579. if (!slots) {
  10580. res = {};
  10581. } else if (slots._normalized) {
  10582. // fast path 1: child component re-render only, parent did not change
  10583. return slots._normalized
  10584. } else if (
  10585. isStable &&
  10586. prevSlots &&
  10587. prevSlots !== emptyObject &&
  10588. key === prevSlots.$key &&
  10589. !hasNormalSlots &&
  10590. !prevSlots.$hasNormal
  10591. ) {
  10592. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  10593. // only need to normalize once
  10594. return prevSlots
  10595. } else {
  10596. res = {};
  10597. for (var key$1 in slots) {
  10598. if (slots[key$1] && key$1[0] !== '$') {
  10599. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  10600. }
  10601. }
  10602. }
  10603. // expose normal slots on scopedSlots
  10604. for (var key$2 in normalSlots) {
  10605. if (!(key$2 in res)) {
  10606. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  10607. }
  10608. }
  10609. // avoriaz seems to mock a non-extensible $scopedSlots object
  10610. // and when that is passed down this would cause an error
  10611. if (slots && Object.isExtensible(slots)) {
  10612. (slots)._normalized = res;
  10613. }
  10614. def(res, '$stable', isStable);
  10615. def(res, '$key', key);
  10616. def(res, '$hasNormal', hasNormalSlots);
  10617. return res
  10618. }
  10619. function normalizeScopedSlot(normalSlots, key, fn) {
  10620. var normalized = function () {
  10621. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  10622. res = res && typeof res === 'object' && !Array.isArray(res)
  10623. ? [res] // single vnode
  10624. : normalizeChildren(res);
  10625. return res && (
  10626. res.length === 0 ||
  10627. (res.length === 1 && res[0].isComment) // #9658
  10628. ) ? undefined
  10629. : res
  10630. };
  10631. // this is a slot using the new v-slot syntax without scope. although it is
  10632. // compiled as a scoped slot, render fn users would expect it to be present
  10633. // on this.$slots because the usage is semantically a normal slot.
  10634. if (fn.proxy) {
  10635. Object.defineProperty(normalSlots, key, {
  10636. get: normalized,
  10637. enumerable: true,
  10638. configurable: true
  10639. });
  10640. }
  10641. return normalized
  10642. }
  10643. function proxyNormalSlot(slots, key) {
  10644. return function () { return slots[key]; }
  10645. }
  10646. /* */
  10647. /**
  10648. * Runtime helper for rendering v-for lists.
  10649. */
  10650. function renderList (
  10651. val,
  10652. render
  10653. ) {
  10654. var ret, i, l, keys, key;
  10655. if (Array.isArray(val) || typeof val === 'string') {
  10656. ret = new Array(val.length);
  10657. for (i = 0, l = val.length; i < l; i++) {
  10658. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  10659. }
  10660. } else if (typeof val === 'number') {
  10661. ret = new Array(val);
  10662. for (i = 0; i < val; i++) {
  10663. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  10664. }
  10665. } else if (isObject(val)) {
  10666. if (hasSymbol && val[Symbol.iterator]) {
  10667. ret = [];
  10668. var iterator = val[Symbol.iterator]();
  10669. var result = iterator.next();
  10670. while (!result.done) {
  10671. ret.push(render(result.value, ret.length, i, i++)); // fixed by xxxxxx
  10672. result = iterator.next();
  10673. }
  10674. } else {
  10675. keys = Object.keys(val);
  10676. ret = new Array(keys.length);
  10677. for (i = 0, l = keys.length; i < l; i++) {
  10678. key = keys[i];
  10679. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  10680. }
  10681. }
  10682. }
  10683. if (!isDef(ret)) {
  10684. ret = [];
  10685. }
  10686. (ret)._isVList = true;
  10687. return ret
  10688. }
  10689. /* */
  10690. /**
  10691. * Runtime helper for rendering <slot>
  10692. */
  10693. function renderSlot (
  10694. name,
  10695. fallback,
  10696. props,
  10697. bindObject
  10698. ) {
  10699. var scopedSlotFn = this.$scopedSlots[name];
  10700. var nodes;
  10701. if (scopedSlotFn) { // scoped slot
  10702. props = props || {};
  10703. if (bindObject) {
  10704. if ( true && !isObject(bindObject)) {
  10705. warn(
  10706. 'slot v-bind without argument expects an Object',
  10707. this
  10708. );
  10709. }
  10710. props = extend(extend({}, bindObject), props);
  10711. }
  10712. // fixed by xxxxxx app-plus scopedSlot
  10713. nodes = scopedSlotFn(props, this, props._i) || fallback;
  10714. } else {
  10715. nodes = this.$slots[name] || fallback;
  10716. }
  10717. var target = props && props.slot;
  10718. if (target) {
  10719. return this.$createElement('template', { slot: target }, nodes)
  10720. } else {
  10721. return nodes
  10722. }
  10723. }
  10724. /* */
  10725. /**
  10726. * Runtime helper for resolving filters
  10727. */
  10728. function resolveFilter (id) {
  10729. return resolveAsset(this.$options, 'filters', id, true) || identity
  10730. }
  10731. /* */
  10732. function isKeyNotMatch (expect, actual) {
  10733. if (Array.isArray(expect)) {
  10734. return expect.indexOf(actual) === -1
  10735. } else {
  10736. return expect !== actual
  10737. }
  10738. }
  10739. /**
  10740. * Runtime helper for checking keyCodes from config.
  10741. * exposed as Vue.prototype._k
  10742. * passing in eventKeyName as last argument separately for backwards compat
  10743. */
  10744. function checkKeyCodes (
  10745. eventKeyCode,
  10746. key,
  10747. builtInKeyCode,
  10748. eventKeyName,
  10749. builtInKeyName
  10750. ) {
  10751. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  10752. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  10753. return isKeyNotMatch(builtInKeyName, eventKeyName)
  10754. } else if (mappedKeyCode) {
  10755. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  10756. } else if (eventKeyName) {
  10757. return hyphenate(eventKeyName) !== key
  10758. }
  10759. }
  10760. /* */
  10761. /**
  10762. * Runtime helper for merging v-bind="object" into a VNode's data.
  10763. */
  10764. function bindObjectProps (
  10765. data,
  10766. tag,
  10767. value,
  10768. asProp,
  10769. isSync
  10770. ) {
  10771. if (value) {
  10772. if (!isObject(value)) {
  10773. true && warn(
  10774. 'v-bind without argument expects an Object or Array value',
  10775. this
  10776. );
  10777. } else {
  10778. if (Array.isArray(value)) {
  10779. value = toObject(value);
  10780. }
  10781. var hash;
  10782. var loop = function ( key ) {
  10783. if (
  10784. key === 'class' ||
  10785. key === 'style' ||
  10786. isReservedAttribute(key)
  10787. ) {
  10788. hash = data;
  10789. } else {
  10790. var type = data.attrs && data.attrs.type;
  10791. hash = asProp || config.mustUseProp(tag, type, key)
  10792. ? data.domProps || (data.domProps = {})
  10793. : data.attrs || (data.attrs = {});
  10794. }
  10795. var camelizedKey = camelize(key);
  10796. var hyphenatedKey = hyphenate(key);
  10797. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  10798. hash[key] = value[key];
  10799. if (isSync) {
  10800. var on = data.on || (data.on = {});
  10801. on[("update:" + key)] = function ($event) {
  10802. value[key] = $event;
  10803. };
  10804. }
  10805. }
  10806. };
  10807. for (var key in value) loop( key );
  10808. }
  10809. }
  10810. return data
  10811. }
  10812. /* */
  10813. /**
  10814. * Runtime helper for rendering static trees.
  10815. */
  10816. function renderStatic (
  10817. index,
  10818. isInFor
  10819. ) {
  10820. var cached = this._staticTrees || (this._staticTrees = []);
  10821. var tree = cached[index];
  10822. // if has already-rendered static tree and not inside v-for,
  10823. // we can reuse the same tree.
  10824. if (tree && !isInFor) {
  10825. return tree
  10826. }
  10827. // otherwise, render a fresh tree.
  10828. tree = cached[index] = this.$options.staticRenderFns[index].call(
  10829. this._renderProxy,
  10830. null,
  10831. this // for render fns generated for functional component templates
  10832. );
  10833. markStatic(tree, ("__static__" + index), false);
  10834. return tree
  10835. }
  10836. /**
  10837. * Runtime helper for v-once.
  10838. * Effectively it means marking the node as static with a unique key.
  10839. */
  10840. function markOnce (
  10841. tree,
  10842. index,
  10843. key
  10844. ) {
  10845. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  10846. return tree
  10847. }
  10848. function markStatic (
  10849. tree,
  10850. key,
  10851. isOnce
  10852. ) {
  10853. if (Array.isArray(tree)) {
  10854. for (var i = 0; i < tree.length; i++) {
  10855. if (tree[i] && typeof tree[i] !== 'string') {
  10856. markStaticNode(tree[i], (key + "_" + i), isOnce);
  10857. }
  10858. }
  10859. } else {
  10860. markStaticNode(tree, key, isOnce);
  10861. }
  10862. }
  10863. function markStaticNode (node, key, isOnce) {
  10864. node.isStatic = true;
  10865. node.key = key;
  10866. node.isOnce = isOnce;
  10867. }
  10868. /* */
  10869. function bindObjectListeners (data, value) {
  10870. if (value) {
  10871. if (!isPlainObject(value)) {
  10872. true && warn(
  10873. 'v-on without argument expects an Object value',
  10874. this
  10875. );
  10876. } else {
  10877. var on = data.on = data.on ? extend({}, data.on) : {};
  10878. for (var key in value) {
  10879. var existing = on[key];
  10880. var ours = value[key];
  10881. on[key] = existing ? [].concat(existing, ours) : ours;
  10882. }
  10883. }
  10884. }
  10885. return data
  10886. }
  10887. /* */
  10888. function resolveScopedSlots (
  10889. fns, // see flow/vnode
  10890. res,
  10891. // the following are added in 2.6
  10892. hasDynamicKeys,
  10893. contentHashKey
  10894. ) {
  10895. res = res || { $stable: !hasDynamicKeys };
  10896. for (var i = 0; i < fns.length; i++) {
  10897. var slot = fns[i];
  10898. if (Array.isArray(slot)) {
  10899. resolveScopedSlots(slot, res, hasDynamicKeys);
  10900. } else if (slot) {
  10901. // marker for reverse proxying v-slot without scope on this.$slots
  10902. if (slot.proxy) {
  10903. slot.fn.proxy = true;
  10904. }
  10905. res[slot.key] = slot.fn;
  10906. }
  10907. }
  10908. if (contentHashKey) {
  10909. (res).$key = contentHashKey;
  10910. }
  10911. return res
  10912. }
  10913. /* */
  10914. function bindDynamicKeys (baseObj, values) {
  10915. for (var i = 0; i < values.length; i += 2) {
  10916. var key = values[i];
  10917. if (typeof key === 'string' && key) {
  10918. baseObj[values[i]] = values[i + 1];
  10919. } else if ( true && key !== '' && key !== null) {
  10920. // null is a special value for explicitly removing a binding
  10921. warn(
  10922. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  10923. this
  10924. );
  10925. }
  10926. }
  10927. return baseObj
  10928. }
  10929. // helper to dynamically append modifier runtime markers to event names.
  10930. // ensure only append when value is already string, otherwise it will be cast
  10931. // to string and cause the type check to miss.
  10932. function prependModifier (value, symbol) {
  10933. return typeof value === 'string' ? symbol + value : value
  10934. }
  10935. /* */
  10936. function installRenderHelpers (target) {
  10937. target._o = markOnce;
  10938. target._n = toNumber;
  10939. target._s = toString;
  10940. target._l = renderList;
  10941. target._t = renderSlot;
  10942. target._q = looseEqual;
  10943. target._i = looseIndexOf;
  10944. target._m = renderStatic;
  10945. target._f = resolveFilter;
  10946. target._k = checkKeyCodes;
  10947. target._b = bindObjectProps;
  10948. target._v = createTextVNode;
  10949. target._e = createEmptyVNode;
  10950. target._u = resolveScopedSlots;
  10951. target._g = bindObjectListeners;
  10952. target._d = bindDynamicKeys;
  10953. target._p = prependModifier;
  10954. }
  10955. /* */
  10956. function FunctionalRenderContext (
  10957. data,
  10958. props,
  10959. children,
  10960. parent,
  10961. Ctor
  10962. ) {
  10963. var this$1 = this;
  10964. var options = Ctor.options;
  10965. // ensure the createElement function in functional components
  10966. // gets a unique context - this is necessary for correct named slot check
  10967. var contextVm;
  10968. if (hasOwn(parent, '_uid')) {
  10969. contextVm = Object.create(parent);
  10970. // $flow-disable-line
  10971. contextVm._original = parent;
  10972. } else {
  10973. // the context vm passed in is a functional context as well.
  10974. // in this case we want to make sure we are able to get a hold to the
  10975. // real context instance.
  10976. contextVm = parent;
  10977. // $flow-disable-line
  10978. parent = parent._original;
  10979. }
  10980. var isCompiled = isTrue(options._compiled);
  10981. var needNormalization = !isCompiled;
  10982. this.data = data;
  10983. this.props = props;
  10984. this.children = children;
  10985. this.parent = parent;
  10986. this.listeners = data.on || emptyObject;
  10987. this.injections = resolveInject(options.inject, parent);
  10988. this.slots = function () {
  10989. if (!this$1.$slots) {
  10990. normalizeScopedSlots(
  10991. data.scopedSlots,
  10992. this$1.$slots = resolveSlots(children, parent)
  10993. );
  10994. }
  10995. return this$1.$slots
  10996. };
  10997. Object.defineProperty(this, 'scopedSlots', ({
  10998. enumerable: true,
  10999. get: function get () {
  11000. return normalizeScopedSlots(data.scopedSlots, this.slots())
  11001. }
  11002. }));
  11003. // support for compiled functional template
  11004. if (isCompiled) {
  11005. // exposing $options for renderStatic()
  11006. this.$options = options;
  11007. // pre-resolve slots for renderSlot()
  11008. this.$slots = this.slots();
  11009. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  11010. }
  11011. if (options._scopeId) {
  11012. this._c = function (a, b, c, d) {
  11013. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  11014. if (vnode && !Array.isArray(vnode)) {
  11015. vnode.fnScopeId = options._scopeId;
  11016. vnode.fnContext = parent;
  11017. }
  11018. return vnode
  11019. };
  11020. } else {
  11021. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  11022. }
  11023. }
  11024. installRenderHelpers(FunctionalRenderContext.prototype);
  11025. function createFunctionalComponent (
  11026. Ctor,
  11027. propsData,
  11028. data,
  11029. contextVm,
  11030. children
  11031. ) {
  11032. var options = Ctor.options;
  11033. var props = {};
  11034. var propOptions = options.props;
  11035. if (isDef(propOptions)) {
  11036. for (var key in propOptions) {
  11037. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  11038. }
  11039. } else {
  11040. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  11041. if (isDef(data.props)) { mergeProps(props, data.props); }
  11042. }
  11043. var renderContext = new FunctionalRenderContext(
  11044. data,
  11045. props,
  11046. children,
  11047. contextVm,
  11048. Ctor
  11049. );
  11050. var vnode = options.render.call(null, renderContext._c, renderContext);
  11051. if (vnode instanceof VNode) {
  11052. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  11053. } else if (Array.isArray(vnode)) {
  11054. var vnodes = normalizeChildren(vnode) || [];
  11055. var res = new Array(vnodes.length);
  11056. for (var i = 0; i < vnodes.length; i++) {
  11057. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  11058. }
  11059. return res
  11060. }
  11061. }
  11062. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  11063. // #7817 clone node before setting fnContext, otherwise if the node is reused
  11064. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  11065. // that should not be matched to match.
  11066. var clone = cloneVNode(vnode);
  11067. clone.fnContext = contextVm;
  11068. clone.fnOptions = options;
  11069. if (true) {
  11070. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  11071. }
  11072. if (data.slot) {
  11073. (clone.data || (clone.data = {})).slot = data.slot;
  11074. }
  11075. return clone
  11076. }
  11077. function mergeProps (to, from) {
  11078. for (var key in from) {
  11079. to[camelize(key)] = from[key];
  11080. }
  11081. }
  11082. /* */
  11083. /* */
  11084. /* */
  11085. /* */
  11086. // inline hooks to be invoked on component VNodes during patch
  11087. var componentVNodeHooks = {
  11088. init: function init (vnode, hydrating) {
  11089. if (
  11090. vnode.componentInstance &&
  11091. !vnode.componentInstance._isDestroyed &&
  11092. vnode.data.keepAlive
  11093. ) {
  11094. // kept-alive components, treat as a patch
  11095. var mountedNode = vnode; // work around flow
  11096. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  11097. } else {
  11098. var child = vnode.componentInstance = createComponentInstanceForVnode(
  11099. vnode,
  11100. activeInstance
  11101. );
  11102. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  11103. }
  11104. },
  11105. prepatch: function prepatch (oldVnode, vnode) {
  11106. var options = vnode.componentOptions;
  11107. var child = vnode.componentInstance = oldVnode.componentInstance;
  11108. updateChildComponent(
  11109. child,
  11110. options.propsData, // updated props
  11111. options.listeners, // updated listeners
  11112. vnode, // new parent vnode
  11113. options.children // new children
  11114. );
  11115. },
  11116. insert: function insert (vnode) {
  11117. var context = vnode.context;
  11118. var componentInstance = vnode.componentInstance;
  11119. if (!componentInstance._isMounted) {
  11120. callHook(componentInstance, 'onServiceCreated');
  11121. callHook(componentInstance, 'onServiceAttached');
  11122. componentInstance._isMounted = true;
  11123. callHook(componentInstance, 'mounted');
  11124. }
  11125. if (vnode.data.keepAlive) {
  11126. if (context._isMounted) {
  11127. // vue-router#1212
  11128. // During updates, a kept-alive component's child components may
  11129. // change, so directly walking the tree here may call activated hooks
  11130. // on incorrect children. Instead we push them into a queue which will
  11131. // be processed after the whole patch process ended.
  11132. queueActivatedComponent(componentInstance);
  11133. } else {
  11134. activateChildComponent(componentInstance, true /* direct */);
  11135. }
  11136. }
  11137. },
  11138. destroy: function destroy (vnode) {
  11139. var componentInstance = vnode.componentInstance;
  11140. if (!componentInstance._isDestroyed) {
  11141. if (!vnode.data.keepAlive) {
  11142. componentInstance.$destroy();
  11143. } else {
  11144. deactivateChildComponent(componentInstance, true /* direct */);
  11145. }
  11146. }
  11147. }
  11148. };
  11149. var hooksToMerge = Object.keys(componentVNodeHooks);
  11150. function createComponent (
  11151. Ctor,
  11152. data,
  11153. context,
  11154. children,
  11155. tag
  11156. ) {
  11157. if (isUndef(Ctor)) {
  11158. return
  11159. }
  11160. var baseCtor = context.$options._base;
  11161. // plain options object: turn it into a constructor
  11162. if (isObject(Ctor)) {
  11163. Ctor = baseCtor.extend(Ctor);
  11164. }
  11165. // if at this stage it's not a constructor or an async component factory,
  11166. // reject.
  11167. if (typeof Ctor !== 'function') {
  11168. if (true) {
  11169. warn(("Invalid Component definition: " + (String(Ctor))), context);
  11170. }
  11171. return
  11172. }
  11173. // async component
  11174. var asyncFactory;
  11175. if (isUndef(Ctor.cid)) {
  11176. asyncFactory = Ctor;
  11177. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  11178. if (Ctor === undefined) {
  11179. // return a placeholder node for async component, which is rendered
  11180. // as a comment node but preserves all the raw information for the node.
  11181. // the information will be used for async server-rendering and hydration.
  11182. return createAsyncPlaceholder(
  11183. asyncFactory,
  11184. data,
  11185. context,
  11186. children,
  11187. tag
  11188. )
  11189. }
  11190. }
  11191. data = data || {};
  11192. // resolve constructor options in case global mixins are applied after
  11193. // component constructor creation
  11194. resolveConstructorOptions(Ctor);
  11195. // transform component v-model data into props & events
  11196. if (isDef(data.model)) {
  11197. transformModel(Ctor.options, data);
  11198. }
  11199. // extract props
  11200. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  11201. // functional component
  11202. if (isTrue(Ctor.options.functional)) {
  11203. return createFunctionalComponent(Ctor, propsData, data, context, children)
  11204. }
  11205. // extract listeners, since these needs to be treated as
  11206. // child component listeners instead of DOM listeners
  11207. var listeners = data.on;
  11208. // replace with listeners with .native modifier
  11209. // so it gets processed during parent component patch.
  11210. data.on = data.nativeOn;
  11211. if (isTrue(Ctor.options.abstract)) {
  11212. // abstract components do not keep anything
  11213. // other than props & listeners & slot
  11214. // work around flow
  11215. var slot = data.slot;
  11216. data = {};
  11217. if (slot) {
  11218. data.slot = slot;
  11219. }
  11220. }
  11221. // install component management hooks onto the placeholder node
  11222. installComponentHooks(data);
  11223. // return a placeholder vnode
  11224. var name = Ctor.options.name || tag;
  11225. var vnode = new VNode(
  11226. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  11227. data, undefined, undefined, undefined, context,
  11228. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  11229. asyncFactory
  11230. );
  11231. return vnode
  11232. }
  11233. function createComponentInstanceForVnode (
  11234. vnode, // we know it's MountedComponentVNode but flow doesn't
  11235. parent // activeInstance in lifecycle state
  11236. ) {
  11237. var options = {
  11238. _isComponent: true,
  11239. _parentVnode: vnode,
  11240. parent: parent
  11241. };
  11242. // check inline-template render functions
  11243. var inlineTemplate = vnode.data.inlineTemplate;
  11244. if (isDef(inlineTemplate)) {
  11245. options.render = inlineTemplate.render;
  11246. options.staticRenderFns = inlineTemplate.staticRenderFns;
  11247. }
  11248. return new vnode.componentOptions.Ctor(options)
  11249. }
  11250. function installComponentHooks (data) {
  11251. var hooks = data.hook || (data.hook = {});
  11252. for (var i = 0; i < hooksToMerge.length; i++) {
  11253. var key = hooksToMerge[i];
  11254. var existing = hooks[key];
  11255. var toMerge = componentVNodeHooks[key];
  11256. if (existing !== toMerge && !(existing && existing._merged)) {
  11257. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  11258. }
  11259. }
  11260. }
  11261. function mergeHook$1 (f1, f2) {
  11262. var merged = function (a, b) {
  11263. // flow complains about extra args which is why we use any
  11264. f1(a, b);
  11265. f2(a, b);
  11266. };
  11267. merged._merged = true;
  11268. return merged
  11269. }
  11270. // transform component v-model info (value and callback) into
  11271. // prop and event handler respectively.
  11272. function transformModel (options, data) {
  11273. var prop = (options.model && options.model.prop) || 'value';
  11274. var event = (options.model && options.model.event) || 'input'
  11275. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  11276. var on = data.on || (data.on = {});
  11277. var existing = on[event];
  11278. var callback = data.model.callback;
  11279. if (isDef(existing)) {
  11280. if (
  11281. Array.isArray(existing)
  11282. ? existing.indexOf(callback) === -1
  11283. : existing !== callback
  11284. ) {
  11285. on[event] = [callback].concat(existing);
  11286. }
  11287. } else {
  11288. on[event] = callback;
  11289. }
  11290. }
  11291. /* */
  11292. var SIMPLE_NORMALIZE = 1;
  11293. var ALWAYS_NORMALIZE = 2;
  11294. // wrapper function for providing a more flexible interface
  11295. // without getting yelled at by flow
  11296. function createElement (
  11297. context,
  11298. tag,
  11299. data,
  11300. children,
  11301. normalizationType,
  11302. alwaysNormalize
  11303. ) {
  11304. if (Array.isArray(data) || isPrimitive(data)) {
  11305. normalizationType = children;
  11306. children = data;
  11307. data = undefined;
  11308. }
  11309. if (isTrue(alwaysNormalize)) {
  11310. normalizationType = ALWAYS_NORMALIZE;
  11311. }
  11312. return _createElement(context, tag, data, children, normalizationType)
  11313. }
  11314. function _createElement (
  11315. context,
  11316. tag,
  11317. data,
  11318. children,
  11319. normalizationType
  11320. ) {
  11321. if (isDef(data) && isDef((data).__ob__)) {
  11322. true && warn(
  11323. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  11324. 'Always create fresh vnode data objects in each render!',
  11325. context
  11326. );
  11327. return createEmptyVNode()
  11328. }
  11329. // object syntax in v-bind
  11330. if (isDef(data) && isDef(data.is)) {
  11331. tag = data.is;
  11332. }
  11333. if (!tag) {
  11334. // in case of component :is set to falsy value
  11335. return createEmptyVNode()
  11336. }
  11337. // warn against non-primitive key
  11338. if ( true &&
  11339. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  11340. ) {
  11341. {
  11342. warn(
  11343. 'Avoid using non-primitive value as key, ' +
  11344. 'use string/number value instead.',
  11345. context
  11346. );
  11347. }
  11348. }
  11349. // support single function children as default scoped slot
  11350. if (Array.isArray(children) &&
  11351. typeof children[0] === 'function'
  11352. ) {
  11353. data = data || {};
  11354. data.scopedSlots = { default: children[0] };
  11355. children.length = 0;
  11356. }
  11357. if (normalizationType === ALWAYS_NORMALIZE) {
  11358. children = normalizeChildren(children);
  11359. } else if (normalizationType === SIMPLE_NORMALIZE) {
  11360. children = simpleNormalizeChildren(children);
  11361. }
  11362. var vnode, ns;
  11363. if (typeof tag === 'string') {
  11364. var Ctor;
  11365. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  11366. if (config.isReservedTag(tag)) {
  11367. // platform built-in elements
  11368. if ( true && isDef(data) && isDef(data.nativeOn)) {
  11369. warn(
  11370. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  11371. context
  11372. );
  11373. }
  11374. vnode = new VNode(
  11375. config.parsePlatformTagName(tag), data, children,
  11376. undefined, undefined, context
  11377. );
  11378. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  11379. // component
  11380. vnode = createComponent(Ctor, data, context, children, tag);
  11381. } else {
  11382. // unknown or unlisted namespaced elements
  11383. // check at runtime because it may get assigned a namespace when its
  11384. // parent normalizes children
  11385. vnode = new VNode(
  11386. tag, data, children,
  11387. undefined, undefined, context
  11388. );
  11389. }
  11390. } else {
  11391. // direct component options / constructor
  11392. vnode = createComponent(tag, data, context, children);
  11393. }
  11394. if (Array.isArray(vnode)) {
  11395. return vnode
  11396. } else if (isDef(vnode)) {
  11397. if (isDef(ns)) { applyNS(vnode, ns); }
  11398. if (isDef(data)) { registerDeepBindings(data); }
  11399. return vnode
  11400. } else {
  11401. return createEmptyVNode()
  11402. }
  11403. }
  11404. function applyNS (vnode, ns, force) {
  11405. vnode.ns = ns;
  11406. if (vnode.tag === 'foreignObject') {
  11407. // use default namespace inside foreignObject
  11408. ns = undefined;
  11409. force = true;
  11410. }
  11411. if (isDef(vnode.children)) {
  11412. for (var i = 0, l = vnode.children.length; i < l; i++) {
  11413. var child = vnode.children[i];
  11414. if (isDef(child.tag) && (
  11415. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  11416. applyNS(child, ns, force);
  11417. }
  11418. }
  11419. }
  11420. }
  11421. // ref #5318
  11422. // necessary to ensure parent re-render when deep bindings like :style and
  11423. // :class are used on slot nodes
  11424. function registerDeepBindings (data) {
  11425. if (isObject(data.style)) {
  11426. traverse(data.style);
  11427. }
  11428. if (isObject(data.class)) {
  11429. traverse(data.class);
  11430. }
  11431. }
  11432. /* */
  11433. function initRender (vm) {
  11434. vm._vnode = null; // the root of the child tree
  11435. vm._staticTrees = null; // v-once cached trees
  11436. var options = vm.$options;
  11437. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  11438. var renderContext = parentVnode && parentVnode.context;
  11439. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  11440. vm.$scopedSlots = emptyObject;
  11441. // bind the createElement fn to this instance
  11442. // so that we get proper render context inside it.
  11443. // args order: tag, data, children, normalizationType, alwaysNormalize
  11444. // internal version is used by render functions compiled from templates
  11445. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  11446. // normalization is always applied for the public version, used in
  11447. // user-written render functions.
  11448. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  11449. // $attrs & $listeners are exposed for easier HOC creation.
  11450. // they need to be reactive so that HOCs using them are always updated
  11451. var parentData = parentVnode && parentVnode.data;
  11452. /* istanbul ignore else */
  11453. if (true) {
  11454. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  11455. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  11456. }, true);
  11457. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  11458. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  11459. }, true);
  11460. } else {}
  11461. }
  11462. var currentRenderingInstance = null;
  11463. function renderMixin (Vue) {
  11464. // install runtime convenience helpers
  11465. installRenderHelpers(Vue.prototype);
  11466. Vue.prototype.$nextTick = function (fn) {
  11467. return nextTick(fn, this)
  11468. };
  11469. Vue.prototype._render = function () {
  11470. var vm = this;
  11471. var ref = vm.$options;
  11472. var render = ref.render;
  11473. var _parentVnode = ref._parentVnode;
  11474. if (_parentVnode) {
  11475. vm.$scopedSlots = normalizeScopedSlots(
  11476. _parentVnode.data.scopedSlots,
  11477. vm.$slots,
  11478. vm.$scopedSlots
  11479. );
  11480. }
  11481. // set parent vnode. this allows render functions to have access
  11482. // to the data on the placeholder node.
  11483. vm.$vnode = _parentVnode;
  11484. // render self
  11485. var vnode;
  11486. try {
  11487. // There's no need to maintain a stack because all render fns are called
  11488. // separately from one another. Nested component's render fns are called
  11489. // when parent component is patched.
  11490. currentRenderingInstance = vm;
  11491. vnode = render.call(vm._renderProxy, vm.$createElement);
  11492. } catch (e) {
  11493. handleError(e, vm, "render");
  11494. // return error render result,
  11495. // or previous vnode to prevent render error causing blank component
  11496. /* istanbul ignore else */
  11497. if ( true && vm.$options.renderError) {
  11498. try {
  11499. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  11500. } catch (e) {
  11501. handleError(e, vm, "renderError");
  11502. vnode = vm._vnode;
  11503. }
  11504. } else {
  11505. vnode = vm._vnode;
  11506. }
  11507. } finally {
  11508. currentRenderingInstance = null;
  11509. }
  11510. // if the returned array contains only a single node, allow it
  11511. if (Array.isArray(vnode) && vnode.length === 1) {
  11512. vnode = vnode[0];
  11513. }
  11514. // return empty vnode in case the render function errored out
  11515. if (!(vnode instanceof VNode)) {
  11516. if ( true && Array.isArray(vnode)) {
  11517. warn(
  11518. 'Multiple root nodes returned from render function. Render function ' +
  11519. 'should return a single root node.',
  11520. vm
  11521. );
  11522. }
  11523. vnode = createEmptyVNode();
  11524. }
  11525. // set parent
  11526. vnode.parent = _parentVnode;
  11527. return vnode
  11528. };
  11529. }
  11530. /* */
  11531. function ensureCtor (comp, base) {
  11532. if (
  11533. comp.__esModule ||
  11534. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  11535. ) {
  11536. comp = comp.default;
  11537. }
  11538. return isObject(comp)
  11539. ? base.extend(comp)
  11540. : comp
  11541. }
  11542. function createAsyncPlaceholder (
  11543. factory,
  11544. data,
  11545. context,
  11546. children,
  11547. tag
  11548. ) {
  11549. var node = createEmptyVNode();
  11550. node.asyncFactory = factory;
  11551. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  11552. return node
  11553. }
  11554. function resolveAsyncComponent (
  11555. factory,
  11556. baseCtor
  11557. ) {
  11558. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  11559. return factory.errorComp
  11560. }
  11561. if (isDef(factory.resolved)) {
  11562. return factory.resolved
  11563. }
  11564. var owner = currentRenderingInstance;
  11565. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  11566. // already pending
  11567. factory.owners.push(owner);
  11568. }
  11569. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  11570. return factory.loadingComp
  11571. }
  11572. if (owner && !isDef(factory.owners)) {
  11573. var owners = factory.owners = [owner];
  11574. var sync = true;
  11575. var timerLoading = null;
  11576. var timerTimeout = null
  11577. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  11578. var forceRender = function (renderCompleted) {
  11579. for (var i = 0, l = owners.length; i < l; i++) {
  11580. (owners[i]).$forceUpdate();
  11581. }
  11582. if (renderCompleted) {
  11583. owners.length = 0;
  11584. if (timerLoading !== null) {
  11585. clearTimeout(timerLoading);
  11586. timerLoading = null;
  11587. }
  11588. if (timerTimeout !== null) {
  11589. clearTimeout(timerTimeout);
  11590. timerTimeout = null;
  11591. }
  11592. }
  11593. };
  11594. var resolve = once(function (res) {
  11595. // cache resolved
  11596. factory.resolved = ensureCtor(res, baseCtor);
  11597. // invoke callbacks only if this is not a synchronous resolve
  11598. // (async resolves are shimmed as synchronous during SSR)
  11599. if (!sync) {
  11600. forceRender(true);
  11601. } else {
  11602. owners.length = 0;
  11603. }
  11604. });
  11605. var reject = once(function (reason) {
  11606. true && warn(
  11607. "Failed to resolve async component: " + (String(factory)) +
  11608. (reason ? ("\nReason: " + reason) : '')
  11609. );
  11610. if (isDef(factory.errorComp)) {
  11611. factory.error = true;
  11612. forceRender(true);
  11613. }
  11614. });
  11615. var res = factory(resolve, reject);
  11616. if (isObject(res)) {
  11617. if (isPromise(res)) {
  11618. // () => Promise
  11619. if (isUndef(factory.resolved)) {
  11620. res.then(resolve, reject);
  11621. }
  11622. } else if (isPromise(res.component)) {
  11623. res.component.then(resolve, reject);
  11624. if (isDef(res.error)) {
  11625. factory.errorComp = ensureCtor(res.error, baseCtor);
  11626. }
  11627. if (isDef(res.loading)) {
  11628. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  11629. if (res.delay === 0) {
  11630. factory.loading = true;
  11631. } else {
  11632. timerLoading = setTimeout(function () {
  11633. timerLoading = null;
  11634. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  11635. factory.loading = true;
  11636. forceRender(false);
  11637. }
  11638. }, res.delay || 200);
  11639. }
  11640. }
  11641. if (isDef(res.timeout)) {
  11642. timerTimeout = setTimeout(function () {
  11643. timerTimeout = null;
  11644. if (isUndef(factory.resolved)) {
  11645. reject(
  11646. true
  11647. ? ("timeout (" + (res.timeout) + "ms)")
  11648. : undefined
  11649. );
  11650. }
  11651. }, res.timeout);
  11652. }
  11653. }
  11654. }
  11655. sync = false;
  11656. // return in case resolved synchronously
  11657. return factory.loading
  11658. ? factory.loadingComp
  11659. : factory.resolved
  11660. }
  11661. }
  11662. /* */
  11663. function isAsyncPlaceholder (node) {
  11664. return node.isComment && node.asyncFactory
  11665. }
  11666. /* */
  11667. function getFirstComponentChild (children) {
  11668. if (Array.isArray(children)) {
  11669. for (var i = 0; i < children.length; i++) {
  11670. var c = children[i];
  11671. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  11672. return c
  11673. }
  11674. }
  11675. }
  11676. }
  11677. /* */
  11678. /* */
  11679. function initEvents (vm) {
  11680. vm._events = Object.create(null);
  11681. vm._hasHookEvent = false;
  11682. // init parent attached events
  11683. var listeners = vm.$options._parentListeners;
  11684. if (listeners) {
  11685. updateComponentListeners(vm, listeners);
  11686. }
  11687. }
  11688. var target;
  11689. function add (event, fn) {
  11690. target.$on(event, fn);
  11691. }
  11692. function remove$1 (event, fn) {
  11693. target.$off(event, fn);
  11694. }
  11695. function createOnceHandler (event, fn) {
  11696. var _target = target;
  11697. return function onceHandler () {
  11698. var res = fn.apply(null, arguments);
  11699. if (res !== null) {
  11700. _target.$off(event, onceHandler);
  11701. }
  11702. }
  11703. }
  11704. function updateComponentListeners (
  11705. vm,
  11706. listeners,
  11707. oldListeners
  11708. ) {
  11709. target = vm;
  11710. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  11711. target = undefined;
  11712. }
  11713. function eventsMixin (Vue) {
  11714. var hookRE = /^hook:/;
  11715. Vue.prototype.$on = function (event, fn) {
  11716. var vm = this;
  11717. if (Array.isArray(event)) {
  11718. for (var i = 0, l = event.length; i < l; i++) {
  11719. vm.$on(event[i], fn);
  11720. }
  11721. } else {
  11722. (vm._events[event] || (vm._events[event] = [])).push(fn);
  11723. // optimize hook:event cost by using a boolean flag marked at registration
  11724. // instead of a hash lookup
  11725. if (hookRE.test(event)) {
  11726. vm._hasHookEvent = true;
  11727. }
  11728. }
  11729. return vm
  11730. };
  11731. Vue.prototype.$once = function (event, fn) {
  11732. var vm = this;
  11733. function on () {
  11734. vm.$off(event, on);
  11735. fn.apply(vm, arguments);
  11736. }
  11737. on.fn = fn;
  11738. vm.$on(event, on);
  11739. return vm
  11740. };
  11741. Vue.prototype.$off = function (event, fn) {
  11742. var vm = this;
  11743. // all
  11744. if (!arguments.length) {
  11745. vm._events = Object.create(null);
  11746. return vm
  11747. }
  11748. // array of events
  11749. if (Array.isArray(event)) {
  11750. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  11751. vm.$off(event[i$1], fn);
  11752. }
  11753. return vm
  11754. }
  11755. // specific event
  11756. var cbs = vm._events[event];
  11757. if (!cbs) {
  11758. return vm
  11759. }
  11760. if (!fn) {
  11761. vm._events[event] = null;
  11762. return vm
  11763. }
  11764. // specific handler
  11765. var cb;
  11766. var i = cbs.length;
  11767. while (i--) {
  11768. cb = cbs[i];
  11769. if (cb === fn || cb.fn === fn) {
  11770. cbs.splice(i, 1);
  11771. break
  11772. }
  11773. }
  11774. return vm
  11775. };
  11776. Vue.prototype.$emit = function (event) {
  11777. var vm = this;
  11778. if (true) {
  11779. var lowerCaseEvent = event.toLowerCase();
  11780. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  11781. tip(
  11782. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  11783. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  11784. "Note that HTML attributes are case-insensitive and you cannot use " +
  11785. "v-on to listen to camelCase events when using in-DOM templates. " +
  11786. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  11787. );
  11788. }
  11789. }
  11790. var cbs = vm._events[event];
  11791. if (cbs) {
  11792. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  11793. var args = toArray(arguments, 1);
  11794. var info = "event handler for \"" + event + "\"";
  11795. for (var i = 0, l = cbs.length; i < l; i++) {
  11796. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  11797. }
  11798. }
  11799. return vm
  11800. };
  11801. }
  11802. /* */
  11803. var activeInstance = null;
  11804. var isUpdatingChildComponent = false;
  11805. function setActiveInstance(vm) {
  11806. var prevActiveInstance = activeInstance;
  11807. activeInstance = vm;
  11808. return function () {
  11809. activeInstance = prevActiveInstance;
  11810. }
  11811. }
  11812. function initLifecycle (vm) {
  11813. var options = vm.$options;
  11814. // locate first non-abstract parent
  11815. var parent = options.parent;
  11816. if (parent && !options.abstract) {
  11817. while (parent.$options.abstract && parent.$parent) {
  11818. parent = parent.$parent;
  11819. }
  11820. parent.$children.push(vm);
  11821. }
  11822. vm.$parent = parent;
  11823. vm.$root = parent ? parent.$root : vm;
  11824. vm.$children = [];
  11825. vm.$refs = {};
  11826. vm._watcher = null;
  11827. vm._inactive = null;
  11828. vm._directInactive = false;
  11829. vm._isMounted = false;
  11830. vm._isDestroyed = false;
  11831. vm._isBeingDestroyed = false;
  11832. }
  11833. function lifecycleMixin (Vue) {
  11834. Vue.prototype._update = function (vnode, hydrating) {
  11835. var vm = this;
  11836. var prevEl = vm.$el;
  11837. var prevVnode = vm._vnode;
  11838. var restoreActiveInstance = setActiveInstance(vm);
  11839. vm._vnode = vnode;
  11840. // Vue.prototype.__patch__ is injected in entry points
  11841. // based on the rendering backend used.
  11842. if (!prevVnode) {
  11843. // initial render
  11844. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  11845. } else {
  11846. // updates
  11847. vm.$el = vm.__patch__(prevVnode, vnode);
  11848. }
  11849. restoreActiveInstance();
  11850. // update __vue__ reference
  11851. if (prevEl) {
  11852. prevEl.__vue__ = null;
  11853. }
  11854. if (vm.$el) {
  11855. vm.$el.__vue__ = vm;
  11856. }
  11857. // if parent is an HOC, update its $el as well
  11858. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  11859. vm.$parent.$el = vm.$el;
  11860. }
  11861. // updated hook is called by the scheduler to ensure that children are
  11862. // updated in a parent's updated hook.
  11863. };
  11864. Vue.prototype.$forceUpdate = function () {
  11865. var vm = this;
  11866. if (vm._watcher) {
  11867. vm._watcher.update();
  11868. }
  11869. };
  11870. Vue.prototype.$destroy = function () {
  11871. var vm = this;
  11872. if (vm._isBeingDestroyed) {
  11873. return
  11874. }
  11875. callHook(vm, 'beforeDestroy');
  11876. vm._isBeingDestroyed = true;
  11877. // remove self from parent
  11878. var parent = vm.$parent;
  11879. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  11880. remove(parent.$children, vm);
  11881. }
  11882. // teardown watchers
  11883. if (vm._watcher) {
  11884. vm._watcher.teardown();
  11885. }
  11886. var i = vm._watchers.length;
  11887. while (i--) {
  11888. vm._watchers[i].teardown();
  11889. }
  11890. // remove reference from data ob
  11891. // frozen object may not have observer.
  11892. if (vm._data.__ob__) {
  11893. vm._data.__ob__.vmCount--;
  11894. }
  11895. // call the last hook...
  11896. vm._isDestroyed = true;
  11897. // invoke destroy hooks on current rendered tree
  11898. vm.__patch__(vm._vnode, null);
  11899. // fire destroyed hook
  11900. callHook(vm, 'destroyed');
  11901. // turn off all instance listeners.
  11902. vm.$off();
  11903. // remove __vue__ reference
  11904. if (vm.$el) {
  11905. vm.$el.__vue__ = null;
  11906. }
  11907. // release circular reference (#6759)
  11908. if (vm.$vnode) {
  11909. vm.$vnode.parent = null;
  11910. }
  11911. };
  11912. }
  11913. function updateChildComponent (
  11914. vm,
  11915. propsData,
  11916. listeners,
  11917. parentVnode,
  11918. renderChildren
  11919. ) {
  11920. if (true) {
  11921. isUpdatingChildComponent = true;
  11922. }
  11923. // determine whether component has slot children
  11924. // we need to do this before overwriting $options._renderChildren.
  11925. // check if there are dynamic scopedSlots (hand-written or compiled but with
  11926. // dynamic slot names). Static scoped slots compiled from template has the
  11927. // "$stable" marker.
  11928. var newScopedSlots = parentVnode.data.scopedSlots;
  11929. var oldScopedSlots = vm.$scopedSlots;
  11930. var hasDynamicScopedSlot = !!(
  11931. (newScopedSlots && !newScopedSlots.$stable) ||
  11932. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  11933. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  11934. );
  11935. // Any static slot children from the parent may have changed during parent's
  11936. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  11937. // update is necessary to ensure correctness.
  11938. var needsForceUpdate = !!(
  11939. renderChildren || // has new static slots
  11940. vm.$options._renderChildren || // has old static slots
  11941. hasDynamicScopedSlot
  11942. );
  11943. vm.$options._parentVnode = parentVnode;
  11944. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  11945. if (vm._vnode) { // update child tree's parent
  11946. vm._vnode.parent = parentVnode;
  11947. }
  11948. vm.$options._renderChildren = renderChildren;
  11949. // update $attrs and $listeners hash
  11950. // these are also reactive so they may trigger child update if the child
  11951. // used them during render
  11952. vm.$attrs = parentVnode.data.attrs || emptyObject;
  11953. vm.$listeners = listeners || emptyObject;
  11954. // update props
  11955. if (propsData && vm.$options.props) {
  11956. toggleObserving(false);
  11957. var props = vm._props;
  11958. var propKeys = vm.$options._propKeys || [];
  11959. for (var i = 0; i < propKeys.length; i++) {
  11960. var key = propKeys[i];
  11961. var propOptions = vm.$options.props; // wtf flow?
  11962. props[key] = validateProp(key, propOptions, propsData, vm);
  11963. }
  11964. toggleObserving(true);
  11965. // keep a copy of raw propsData
  11966. vm.$options.propsData = propsData;
  11967. }
  11968. // fixed by xxxxxx update properties(mp runtime)
  11969. vm._$updateProperties && vm._$updateProperties(vm);
  11970. // update listeners
  11971. listeners = listeners || emptyObject;
  11972. var oldListeners = vm.$options._parentListeners;
  11973. vm.$options._parentListeners = listeners;
  11974. updateComponentListeners(vm, listeners, oldListeners);
  11975. // resolve slots + force update if has children
  11976. if (needsForceUpdate) {
  11977. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  11978. vm.$forceUpdate();
  11979. }
  11980. if (true) {
  11981. isUpdatingChildComponent = false;
  11982. }
  11983. }
  11984. function isInInactiveTree (vm) {
  11985. while (vm && (vm = vm.$parent)) {
  11986. if (vm._inactive) { return true }
  11987. }
  11988. return false
  11989. }
  11990. function activateChildComponent (vm, direct) {
  11991. if (direct) {
  11992. vm._directInactive = false;
  11993. if (isInInactiveTree(vm)) {
  11994. return
  11995. }
  11996. } else if (vm._directInactive) {
  11997. return
  11998. }
  11999. if (vm._inactive || vm._inactive === null) {
  12000. vm._inactive = false;
  12001. for (var i = 0; i < vm.$children.length; i++) {
  12002. activateChildComponent(vm.$children[i]);
  12003. }
  12004. callHook(vm, 'activated');
  12005. }
  12006. }
  12007. function deactivateChildComponent (vm, direct) {
  12008. if (direct) {
  12009. vm._directInactive = true;
  12010. if (isInInactiveTree(vm)) {
  12011. return
  12012. }
  12013. }
  12014. if (!vm._inactive) {
  12015. vm._inactive = true;
  12016. for (var i = 0; i < vm.$children.length; i++) {
  12017. deactivateChildComponent(vm.$children[i]);
  12018. }
  12019. callHook(vm, 'deactivated');
  12020. }
  12021. }
  12022. function callHook (vm, hook) {
  12023. // #7573 disable dep collection when invoking lifecycle hooks
  12024. pushTarget();
  12025. var handlers = vm.$options[hook];
  12026. var info = hook + " hook";
  12027. if (handlers) {
  12028. for (var i = 0, j = handlers.length; i < j; i++) {
  12029. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  12030. }
  12031. }
  12032. if (vm._hasHookEvent) {
  12033. vm.$emit('hook:' + hook);
  12034. }
  12035. popTarget();
  12036. }
  12037. /* */
  12038. var MAX_UPDATE_COUNT = 100;
  12039. var queue = [];
  12040. var activatedChildren = [];
  12041. var has = {};
  12042. var circular = {};
  12043. var waiting = false;
  12044. var flushing = false;
  12045. var index = 0;
  12046. /**
  12047. * Reset the scheduler's state.
  12048. */
  12049. function resetSchedulerState () {
  12050. index = queue.length = activatedChildren.length = 0;
  12051. has = {};
  12052. if (true) {
  12053. circular = {};
  12054. }
  12055. waiting = flushing = false;
  12056. }
  12057. // Async edge case #6566 requires saving the timestamp when event listeners are
  12058. // attached. However, calling performance.now() has a perf overhead especially
  12059. // if the page has thousands of event listeners. Instead, we take a timestamp
  12060. // every time the scheduler flushes and use that for all event listeners
  12061. // attached during that flush.
  12062. var currentFlushTimestamp = 0;
  12063. // Async edge case fix requires storing an event listener's attach timestamp.
  12064. var getNow = Date.now;
  12065. // Determine what event timestamp the browser is using. Annoyingly, the
  12066. // timestamp can either be hi-res (relative to page load) or low-res
  12067. // (relative to UNIX epoch), so in order to compare time we have to use the
  12068. // same timestamp type when saving the flush timestamp.
  12069. // All IE versions use low-res event timestamps, and have problematic clock
  12070. // implementations (#9632)
  12071. if (inBrowser && !isIE) {
  12072. var performance = window.performance;
  12073. if (
  12074. performance &&
  12075. typeof performance.now === 'function' &&
  12076. getNow() > document.createEvent('Event').timeStamp
  12077. ) {
  12078. // if the event timestamp, although evaluated AFTER the Date.now(), is
  12079. // smaller than it, it means the event is using a hi-res timestamp,
  12080. // and we need to use the hi-res version for event listener timestamps as
  12081. // well.
  12082. getNow = function () { return performance.now(); };
  12083. }
  12084. }
  12085. /**
  12086. * Flush both queues and run the watchers.
  12087. */
  12088. function flushSchedulerQueue () {
  12089. currentFlushTimestamp = getNow();
  12090. flushing = true;
  12091. var watcher, id;
  12092. // Sort queue before flush.
  12093. // This ensures that:
  12094. // 1. Components are updated from parent to child. (because parent is always
  12095. // created before the child)
  12096. // 2. A component's user watchers are run before its render watcher (because
  12097. // user watchers are created before the render watcher)
  12098. // 3. If a component is destroyed during a parent component's watcher run,
  12099. // its watchers can be skipped.
  12100. queue.sort(function (a, b) { return a.id - b.id; });
  12101. // do not cache length because more watchers might be pushed
  12102. // as we run existing watchers
  12103. for (index = 0; index < queue.length; index++) {
  12104. watcher = queue[index];
  12105. if (watcher.before) {
  12106. watcher.before();
  12107. }
  12108. id = watcher.id;
  12109. has[id] = null;
  12110. watcher.run();
  12111. // in dev build, check and stop circular updates.
  12112. if ( true && has[id] != null) {
  12113. circular[id] = (circular[id] || 0) + 1;
  12114. if (circular[id] > MAX_UPDATE_COUNT) {
  12115. warn(
  12116. 'You may have an infinite update loop ' + (
  12117. watcher.user
  12118. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  12119. : "in a component render function."
  12120. ),
  12121. watcher.vm
  12122. );
  12123. break
  12124. }
  12125. }
  12126. }
  12127. // keep copies of post queues before resetting state
  12128. var activatedQueue = activatedChildren.slice();
  12129. var updatedQueue = queue.slice();
  12130. resetSchedulerState();
  12131. // call component updated and activated hooks
  12132. callActivatedHooks(activatedQueue);
  12133. callUpdatedHooks(updatedQueue);
  12134. // devtool hook
  12135. /* istanbul ignore if */
  12136. if (devtools && config.devtools) {
  12137. devtools.emit('flush');
  12138. }
  12139. }
  12140. function callUpdatedHooks (queue) {
  12141. var i = queue.length;
  12142. while (i--) {
  12143. var watcher = queue[i];
  12144. var vm = watcher.vm;
  12145. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  12146. callHook(vm, 'updated');
  12147. }
  12148. }
  12149. }
  12150. /**
  12151. * Queue a kept-alive component that was activated during patch.
  12152. * The queue will be processed after the entire tree has been patched.
  12153. */
  12154. function queueActivatedComponent (vm) {
  12155. // setting _inactive to false here so that a render function can
  12156. // rely on checking whether it's in an inactive tree (e.g. router-view)
  12157. vm._inactive = false;
  12158. activatedChildren.push(vm);
  12159. }
  12160. function callActivatedHooks (queue) {
  12161. for (var i = 0; i < queue.length; i++) {
  12162. queue[i]._inactive = true;
  12163. activateChildComponent(queue[i], true /* true */);
  12164. }
  12165. }
  12166. /**
  12167. * Push a watcher into the watcher queue.
  12168. * Jobs with duplicate IDs will be skipped unless it's
  12169. * pushed when the queue is being flushed.
  12170. */
  12171. function queueWatcher (watcher) {
  12172. var id = watcher.id;
  12173. if (has[id] == null) {
  12174. has[id] = true;
  12175. if (!flushing) {
  12176. queue.push(watcher);
  12177. } else {
  12178. // if already flushing, splice the watcher based on its id
  12179. // if already past its id, it will be run next immediately.
  12180. var i = queue.length - 1;
  12181. while (i > index && queue[i].id > watcher.id) {
  12182. i--;
  12183. }
  12184. queue.splice(i + 1, 0, watcher);
  12185. }
  12186. // queue the flush
  12187. if (!waiting) {
  12188. waiting = true;
  12189. if ( true && !config.async) {
  12190. flushSchedulerQueue();
  12191. return
  12192. }
  12193. nextTick(flushSchedulerQueue);
  12194. }
  12195. }
  12196. }
  12197. /* */
  12198. var uid$2 = 0;
  12199. /**
  12200. * A watcher parses an expression, collects dependencies,
  12201. * and fires callback when the expression value changes.
  12202. * This is used for both the $watch() api and directives.
  12203. */
  12204. var Watcher = function Watcher (
  12205. vm,
  12206. expOrFn,
  12207. cb,
  12208. options,
  12209. isRenderWatcher
  12210. ) {
  12211. this.vm = vm;
  12212. if (isRenderWatcher) {
  12213. vm._watcher = this;
  12214. }
  12215. vm._watchers.push(this);
  12216. // options
  12217. if (options) {
  12218. this.deep = !!options.deep;
  12219. this.user = !!options.user;
  12220. this.lazy = !!options.lazy;
  12221. this.sync = !!options.sync;
  12222. this.before = options.before;
  12223. } else {
  12224. this.deep = this.user = this.lazy = this.sync = false;
  12225. }
  12226. this.cb = cb;
  12227. this.id = ++uid$2; // uid for batching
  12228. this.active = true;
  12229. this.dirty = this.lazy; // for lazy watchers
  12230. this.deps = [];
  12231. this.newDeps = [];
  12232. this.depIds = new _Set();
  12233. this.newDepIds = new _Set();
  12234. this.expression = true
  12235. ? expOrFn.toString()
  12236. : undefined;
  12237. // parse expression for getter
  12238. if (typeof expOrFn === 'function') {
  12239. this.getter = expOrFn;
  12240. } else {
  12241. this.getter = parsePath(expOrFn);
  12242. if (!this.getter) {
  12243. this.getter = noop;
  12244. true && warn(
  12245. "Failed watching path: \"" + expOrFn + "\" " +
  12246. 'Watcher only accepts simple dot-delimited paths. ' +
  12247. 'For full control, use a function instead.',
  12248. vm
  12249. );
  12250. }
  12251. }
  12252. this.value = this.lazy
  12253. ? undefined
  12254. : this.get();
  12255. };
  12256. /**
  12257. * Evaluate the getter, and re-collect dependencies.
  12258. */
  12259. Watcher.prototype.get = function get () {
  12260. pushTarget(this);
  12261. var value;
  12262. var vm = this.vm;
  12263. try {
  12264. value = this.getter.call(vm, vm);
  12265. } catch (e) {
  12266. if (this.user) {
  12267. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  12268. } else {
  12269. throw e
  12270. }
  12271. } finally {
  12272. // "touch" every property so they are all tracked as
  12273. // dependencies for deep watching
  12274. if (this.deep) {
  12275. traverse(value);
  12276. }
  12277. popTarget();
  12278. this.cleanupDeps();
  12279. }
  12280. return value
  12281. };
  12282. /**
  12283. * Add a dependency to this directive.
  12284. */
  12285. Watcher.prototype.addDep = function addDep (dep) {
  12286. var id = dep.id;
  12287. if (!this.newDepIds.has(id)) {
  12288. this.newDepIds.add(id);
  12289. this.newDeps.push(dep);
  12290. if (!this.depIds.has(id)) {
  12291. dep.addSub(this);
  12292. }
  12293. }
  12294. };
  12295. /**
  12296. * Clean up for dependency collection.
  12297. */
  12298. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  12299. var i = this.deps.length;
  12300. while (i--) {
  12301. var dep = this.deps[i];
  12302. if (!this.newDepIds.has(dep.id)) {
  12303. dep.removeSub(this);
  12304. }
  12305. }
  12306. var tmp = this.depIds;
  12307. this.depIds = this.newDepIds;
  12308. this.newDepIds = tmp;
  12309. this.newDepIds.clear();
  12310. tmp = this.deps;
  12311. this.deps = this.newDeps;
  12312. this.newDeps = tmp;
  12313. this.newDeps.length = 0;
  12314. };
  12315. /**
  12316. * Subscriber interface.
  12317. * Will be called when a dependency changes.
  12318. */
  12319. Watcher.prototype.update = function update () {
  12320. /* istanbul ignore else */
  12321. if (this.lazy) {
  12322. this.dirty = true;
  12323. } else if (this.sync) {
  12324. this.run();
  12325. } else {
  12326. queueWatcher(this);
  12327. }
  12328. };
  12329. /**
  12330. * Scheduler job interface.
  12331. * Will be called by the scheduler.
  12332. */
  12333. Watcher.prototype.run = function run () {
  12334. if (this.active) {
  12335. var value = this.get();
  12336. if (
  12337. value !== this.value ||
  12338. // Deep watchers and watchers on Object/Arrays should fire even
  12339. // when the value is the same, because the value may
  12340. // have mutated.
  12341. isObject(value) ||
  12342. this.deep
  12343. ) {
  12344. // set new value
  12345. var oldValue = this.value;
  12346. this.value = value;
  12347. if (this.user) {
  12348. try {
  12349. this.cb.call(this.vm, value, oldValue);
  12350. } catch (e) {
  12351. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  12352. }
  12353. } else {
  12354. this.cb.call(this.vm, value, oldValue);
  12355. }
  12356. }
  12357. }
  12358. };
  12359. /**
  12360. * Evaluate the value of the watcher.
  12361. * This only gets called for lazy watchers.
  12362. */
  12363. Watcher.prototype.evaluate = function evaluate () {
  12364. this.value = this.get();
  12365. this.dirty = false;
  12366. };
  12367. /**
  12368. * Depend on all deps collected by this watcher.
  12369. */
  12370. Watcher.prototype.depend = function depend () {
  12371. var i = this.deps.length;
  12372. while (i--) {
  12373. this.deps[i].depend();
  12374. }
  12375. };
  12376. /**
  12377. * Remove self from all dependencies' subscriber list.
  12378. */
  12379. Watcher.prototype.teardown = function teardown () {
  12380. if (this.active) {
  12381. // remove self from vm's watcher list
  12382. // this is a somewhat expensive operation so we skip it
  12383. // if the vm is being destroyed.
  12384. if (!this.vm._isBeingDestroyed) {
  12385. remove(this.vm._watchers, this);
  12386. }
  12387. var i = this.deps.length;
  12388. while (i--) {
  12389. this.deps[i].removeSub(this);
  12390. }
  12391. this.active = false;
  12392. }
  12393. };
  12394. /* */
  12395. var sharedPropertyDefinition = {
  12396. enumerable: true,
  12397. configurable: true,
  12398. get: noop,
  12399. set: noop
  12400. };
  12401. function proxy (target, sourceKey, key) {
  12402. sharedPropertyDefinition.get = function proxyGetter () {
  12403. return this[sourceKey][key]
  12404. };
  12405. sharedPropertyDefinition.set = function proxySetter (val) {
  12406. this[sourceKey][key] = val;
  12407. };
  12408. Object.defineProperty(target, key, sharedPropertyDefinition);
  12409. }
  12410. function initState (vm) {
  12411. vm._watchers = [];
  12412. var opts = vm.$options;
  12413. if (opts.props) { initProps(vm, opts.props); }
  12414. if (opts.methods) { initMethods(vm, opts.methods); }
  12415. if (opts.data) {
  12416. initData(vm);
  12417. } else {
  12418. observe(vm._data = {}, true /* asRootData */);
  12419. }
  12420. if (opts.computed) { initComputed(vm, opts.computed); }
  12421. if (opts.watch && opts.watch !== nativeWatch) {
  12422. initWatch(vm, opts.watch);
  12423. }
  12424. }
  12425. function initProps (vm, propsOptions) {
  12426. var propsData = vm.$options.propsData || {};
  12427. var props = vm._props = {};
  12428. // cache prop keys so that future props updates can iterate using Array
  12429. // instead of dynamic object key enumeration.
  12430. var keys = vm.$options._propKeys = [];
  12431. var isRoot = !vm.$parent;
  12432. // root instance props should be converted
  12433. if (!isRoot) {
  12434. toggleObserving(false);
  12435. }
  12436. var loop = function ( key ) {
  12437. keys.push(key);
  12438. var value = validateProp(key, propsOptions, propsData, vm);
  12439. /* istanbul ignore else */
  12440. if (true) {
  12441. var hyphenatedKey = hyphenate(key);
  12442. if (isReservedAttribute(hyphenatedKey) ||
  12443. config.isReservedAttr(hyphenatedKey)) {
  12444. warn(
  12445. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  12446. vm
  12447. );
  12448. }
  12449. defineReactive$$1(props, key, value, function () {
  12450. if (!isRoot && !isUpdatingChildComponent) {
  12451. {
  12452. if(vm.mpHost === 'mp-baidu' || vm.mpHost === 'mp-kuaishou' || vm.mpHost === 'mp-xhs'){//百度、快手、小红书 observer 在 setData callback 之后触发,直接忽略该 warn
  12453. return
  12454. }
  12455. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  12456. if(
  12457. key === 'value' &&
  12458. Array.isArray(vm.$options.behaviors) &&
  12459. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  12460. ){
  12461. return
  12462. }
  12463. if(vm._getFormData){
  12464. return
  12465. }
  12466. var $parent = vm.$parent;
  12467. while($parent){
  12468. if($parent.__next_tick_pending){
  12469. return
  12470. }
  12471. $parent = $parent.$parent;
  12472. }
  12473. }
  12474. warn(
  12475. "Avoid mutating a prop directly since the value will be " +
  12476. "overwritten whenever the parent component re-renders. " +
  12477. "Instead, use a data or computed property based on the prop's " +
  12478. "value. Prop being mutated: \"" + key + "\"",
  12479. vm
  12480. );
  12481. }
  12482. });
  12483. } else {}
  12484. // static props are already proxied on the component's prototype
  12485. // during Vue.extend(). We only need to proxy props defined at
  12486. // instantiation here.
  12487. if (!(key in vm)) {
  12488. proxy(vm, "_props", key);
  12489. }
  12490. };
  12491. for (var key in propsOptions) loop( key );
  12492. toggleObserving(true);
  12493. }
  12494. function initData (vm) {
  12495. var data = vm.$options.data;
  12496. data = vm._data = typeof data === 'function'
  12497. ? getData(data, vm)
  12498. : data || {};
  12499. if (!isPlainObject(data)) {
  12500. data = {};
  12501. true && warn(
  12502. 'data functions should return an object:\n' +
  12503. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  12504. vm
  12505. );
  12506. }
  12507. // proxy data on instance
  12508. var keys = Object.keys(data);
  12509. var props = vm.$options.props;
  12510. var methods = vm.$options.methods;
  12511. var i = keys.length;
  12512. while (i--) {
  12513. var key = keys[i];
  12514. if (true) {
  12515. if (methods && hasOwn(methods, key)) {
  12516. warn(
  12517. ("Method \"" + key + "\" has already been defined as a data property."),
  12518. vm
  12519. );
  12520. }
  12521. }
  12522. if (props && hasOwn(props, key)) {
  12523. true && warn(
  12524. "The data property \"" + key + "\" is already declared as a prop. " +
  12525. "Use prop default value instead.",
  12526. vm
  12527. );
  12528. } else if (!isReserved(key)) {
  12529. proxy(vm, "_data", key);
  12530. }
  12531. }
  12532. // observe data
  12533. observe(data, true /* asRootData */);
  12534. }
  12535. function getData (data, vm) {
  12536. // #7573 disable dep collection when invoking data getters
  12537. pushTarget();
  12538. try {
  12539. return data.call(vm, vm)
  12540. } catch (e) {
  12541. handleError(e, vm, "data()");
  12542. return {}
  12543. } finally {
  12544. popTarget();
  12545. }
  12546. }
  12547. var computedWatcherOptions = { lazy: true };
  12548. function initComputed (vm, computed) {
  12549. // $flow-disable-line
  12550. var watchers = vm._computedWatchers = Object.create(null);
  12551. // computed properties are just getters during SSR
  12552. var isSSR = isServerRendering();
  12553. for (var key in computed) {
  12554. var userDef = computed[key];
  12555. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  12556. if ( true && getter == null) {
  12557. warn(
  12558. ("Getter is missing for computed property \"" + key + "\"."),
  12559. vm
  12560. );
  12561. }
  12562. if (!isSSR) {
  12563. // create internal watcher for the computed property.
  12564. watchers[key] = new Watcher(
  12565. vm,
  12566. getter || noop,
  12567. noop,
  12568. computedWatcherOptions
  12569. );
  12570. }
  12571. // component-defined computed properties are already defined on the
  12572. // component prototype. We only need to define computed properties defined
  12573. // at instantiation here.
  12574. if (!(key in vm)) {
  12575. defineComputed(vm, key, userDef);
  12576. } else if (true) {
  12577. if (key in vm.$data) {
  12578. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  12579. } else if (vm.$options.props && key in vm.$options.props) {
  12580. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  12581. }
  12582. }
  12583. }
  12584. }
  12585. function defineComputed (
  12586. target,
  12587. key,
  12588. userDef
  12589. ) {
  12590. var shouldCache = !isServerRendering();
  12591. if (typeof userDef === 'function') {
  12592. sharedPropertyDefinition.get = shouldCache
  12593. ? createComputedGetter(key)
  12594. : createGetterInvoker(userDef);
  12595. sharedPropertyDefinition.set = noop;
  12596. } else {
  12597. sharedPropertyDefinition.get = userDef.get
  12598. ? shouldCache && userDef.cache !== false
  12599. ? createComputedGetter(key)
  12600. : createGetterInvoker(userDef.get)
  12601. : noop;
  12602. sharedPropertyDefinition.set = userDef.set || noop;
  12603. }
  12604. if ( true &&
  12605. sharedPropertyDefinition.set === noop) {
  12606. sharedPropertyDefinition.set = function () {
  12607. warn(
  12608. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  12609. this
  12610. );
  12611. };
  12612. }
  12613. Object.defineProperty(target, key, sharedPropertyDefinition);
  12614. }
  12615. function createComputedGetter (key) {
  12616. return function computedGetter () {
  12617. var watcher = this._computedWatchers && this._computedWatchers[key];
  12618. if (watcher) {
  12619. if (watcher.dirty) {
  12620. watcher.evaluate();
  12621. }
  12622. if (Dep.SharedObject.target) {// fixed by xxxxxx
  12623. watcher.depend();
  12624. }
  12625. return watcher.value
  12626. }
  12627. }
  12628. }
  12629. function createGetterInvoker(fn) {
  12630. return function computedGetter () {
  12631. return fn.call(this, this)
  12632. }
  12633. }
  12634. function initMethods (vm, methods) {
  12635. var props = vm.$options.props;
  12636. for (var key in methods) {
  12637. if (true) {
  12638. if (typeof methods[key] !== 'function') {
  12639. warn(
  12640. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  12641. "Did you reference the function correctly?",
  12642. vm
  12643. );
  12644. }
  12645. if (props && hasOwn(props, key)) {
  12646. warn(
  12647. ("Method \"" + key + "\" has already been defined as a prop."),
  12648. vm
  12649. );
  12650. }
  12651. if ((key in vm) && isReserved(key)) {
  12652. warn(
  12653. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  12654. "Avoid defining component methods that start with _ or $."
  12655. );
  12656. }
  12657. }
  12658. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  12659. }
  12660. }
  12661. function initWatch (vm, watch) {
  12662. for (var key in watch) {
  12663. var handler = watch[key];
  12664. if (Array.isArray(handler)) {
  12665. for (var i = 0; i < handler.length; i++) {
  12666. createWatcher(vm, key, handler[i]);
  12667. }
  12668. } else {
  12669. createWatcher(vm, key, handler);
  12670. }
  12671. }
  12672. }
  12673. function createWatcher (
  12674. vm,
  12675. expOrFn,
  12676. handler,
  12677. options
  12678. ) {
  12679. if (isPlainObject(handler)) {
  12680. options = handler;
  12681. handler = handler.handler;
  12682. }
  12683. if (typeof handler === 'string') {
  12684. handler = vm[handler];
  12685. }
  12686. return vm.$watch(expOrFn, handler, options)
  12687. }
  12688. function stateMixin (Vue) {
  12689. // flow somehow has problems with directly declared definition object
  12690. // when using Object.defineProperty, so we have to procedurally build up
  12691. // the object here.
  12692. var dataDef = {};
  12693. dataDef.get = function () { return this._data };
  12694. var propsDef = {};
  12695. propsDef.get = function () { return this._props };
  12696. if (true) {
  12697. dataDef.set = function () {
  12698. warn(
  12699. 'Avoid replacing instance root $data. ' +
  12700. 'Use nested data properties instead.',
  12701. this
  12702. );
  12703. };
  12704. propsDef.set = function () {
  12705. warn("$props is readonly.", this);
  12706. };
  12707. }
  12708. Object.defineProperty(Vue.prototype, '$data', dataDef);
  12709. Object.defineProperty(Vue.prototype, '$props', propsDef);
  12710. Vue.prototype.$set = set;
  12711. Vue.prototype.$delete = del;
  12712. Vue.prototype.$watch = function (
  12713. expOrFn,
  12714. cb,
  12715. options
  12716. ) {
  12717. var vm = this;
  12718. if (isPlainObject(cb)) {
  12719. return createWatcher(vm, expOrFn, cb, options)
  12720. }
  12721. options = options || {};
  12722. options.user = true;
  12723. var watcher = new Watcher(vm, expOrFn, cb, options);
  12724. if (options.immediate) {
  12725. try {
  12726. cb.call(vm, watcher.value);
  12727. } catch (error) {
  12728. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  12729. }
  12730. }
  12731. return function unwatchFn () {
  12732. watcher.teardown();
  12733. }
  12734. };
  12735. }
  12736. /* */
  12737. var uid$3 = 0;
  12738. function initMixin (Vue) {
  12739. Vue.prototype._init = function (options) {
  12740. var vm = this;
  12741. // a uid
  12742. vm._uid = uid$3++;
  12743. var startTag, endTag;
  12744. /* istanbul ignore if */
  12745. if ( true && config.performance && mark) {
  12746. startTag = "vue-perf-start:" + (vm._uid);
  12747. endTag = "vue-perf-end:" + (vm._uid);
  12748. mark(startTag);
  12749. }
  12750. // a flag to avoid this being observed
  12751. vm._isVue = true;
  12752. // merge options
  12753. if (options && options._isComponent) {
  12754. // optimize internal component instantiation
  12755. // since dynamic options merging is pretty slow, and none of the
  12756. // internal component options needs special treatment.
  12757. initInternalComponent(vm, options);
  12758. } else {
  12759. vm.$options = mergeOptions(
  12760. resolveConstructorOptions(vm.constructor),
  12761. options || {},
  12762. vm
  12763. );
  12764. }
  12765. /* istanbul ignore else */
  12766. if (true) {
  12767. initProxy(vm);
  12768. } else {}
  12769. // expose real self
  12770. vm._self = vm;
  12771. initLifecycle(vm);
  12772. initEvents(vm);
  12773. initRender(vm);
  12774. callHook(vm, 'beforeCreate');
  12775. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  12776. initState(vm);
  12777. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  12778. !vm._$fallback && callHook(vm, 'created');
  12779. /* istanbul ignore if */
  12780. if ( true && config.performance && mark) {
  12781. vm._name = formatComponentName(vm, false);
  12782. mark(endTag);
  12783. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  12784. }
  12785. if (vm.$options.el) {
  12786. vm.$mount(vm.$options.el);
  12787. }
  12788. };
  12789. }
  12790. function initInternalComponent (vm, options) {
  12791. var opts = vm.$options = Object.create(vm.constructor.options);
  12792. // doing this because it's faster than dynamic enumeration.
  12793. var parentVnode = options._parentVnode;
  12794. opts.parent = options.parent;
  12795. opts._parentVnode = parentVnode;
  12796. var vnodeComponentOptions = parentVnode.componentOptions;
  12797. opts.propsData = vnodeComponentOptions.propsData;
  12798. opts._parentListeners = vnodeComponentOptions.listeners;
  12799. opts._renderChildren = vnodeComponentOptions.children;
  12800. opts._componentTag = vnodeComponentOptions.tag;
  12801. if (options.render) {
  12802. opts.render = options.render;
  12803. opts.staticRenderFns = options.staticRenderFns;
  12804. }
  12805. }
  12806. function resolveConstructorOptions (Ctor) {
  12807. var options = Ctor.options;
  12808. if (Ctor.super) {
  12809. var superOptions = resolveConstructorOptions(Ctor.super);
  12810. var cachedSuperOptions = Ctor.superOptions;
  12811. if (superOptions !== cachedSuperOptions) {
  12812. // super option changed,
  12813. // need to resolve new options.
  12814. Ctor.superOptions = superOptions;
  12815. // check if there are any late-modified/attached options (#4976)
  12816. var modifiedOptions = resolveModifiedOptions(Ctor);
  12817. // update base extend options
  12818. if (modifiedOptions) {
  12819. extend(Ctor.extendOptions, modifiedOptions);
  12820. }
  12821. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  12822. if (options.name) {
  12823. options.components[options.name] = Ctor;
  12824. }
  12825. }
  12826. }
  12827. return options
  12828. }
  12829. function resolveModifiedOptions (Ctor) {
  12830. var modified;
  12831. var latest = Ctor.options;
  12832. var sealed = Ctor.sealedOptions;
  12833. for (var key in latest) {
  12834. if (latest[key] !== sealed[key]) {
  12835. if (!modified) { modified = {}; }
  12836. modified[key] = latest[key];
  12837. }
  12838. }
  12839. return modified
  12840. }
  12841. function Vue (options) {
  12842. if ( true &&
  12843. !(this instanceof Vue)
  12844. ) {
  12845. warn('Vue is a constructor and should be called with the `new` keyword');
  12846. }
  12847. this._init(options);
  12848. }
  12849. initMixin(Vue);
  12850. stateMixin(Vue);
  12851. eventsMixin(Vue);
  12852. lifecycleMixin(Vue);
  12853. renderMixin(Vue);
  12854. /* */
  12855. function initUse (Vue) {
  12856. Vue.use = function (plugin) {
  12857. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  12858. if (installedPlugins.indexOf(plugin) > -1) {
  12859. return this
  12860. }
  12861. // additional parameters
  12862. var args = toArray(arguments, 1);
  12863. args.unshift(this);
  12864. if (typeof plugin.install === 'function') {
  12865. plugin.install.apply(plugin, args);
  12866. } else if (typeof plugin === 'function') {
  12867. plugin.apply(null, args);
  12868. }
  12869. installedPlugins.push(plugin);
  12870. return this
  12871. };
  12872. }
  12873. /* */
  12874. function initMixin$1 (Vue) {
  12875. Vue.mixin = function (mixin) {
  12876. this.options = mergeOptions(this.options, mixin);
  12877. return this
  12878. };
  12879. }
  12880. /* */
  12881. function initExtend (Vue) {
  12882. /**
  12883. * Each instance constructor, including Vue, has a unique
  12884. * cid. This enables us to create wrapped "child
  12885. * constructors" for prototypal inheritance and cache them.
  12886. */
  12887. Vue.cid = 0;
  12888. var cid = 1;
  12889. /**
  12890. * Class inheritance
  12891. */
  12892. Vue.extend = function (extendOptions) {
  12893. extendOptions = extendOptions || {};
  12894. var Super = this;
  12895. var SuperId = Super.cid;
  12896. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  12897. if (cachedCtors[SuperId]) {
  12898. return cachedCtors[SuperId]
  12899. }
  12900. var name = extendOptions.name || Super.options.name;
  12901. if ( true && name) {
  12902. validateComponentName(name);
  12903. }
  12904. var Sub = function VueComponent (options) {
  12905. this._init(options);
  12906. };
  12907. Sub.prototype = Object.create(Super.prototype);
  12908. Sub.prototype.constructor = Sub;
  12909. Sub.cid = cid++;
  12910. Sub.options = mergeOptions(
  12911. Super.options,
  12912. extendOptions
  12913. );
  12914. Sub['super'] = Super;
  12915. // For props and computed properties, we define the proxy getters on
  12916. // the Vue instances at extension time, on the extended prototype. This
  12917. // avoids Object.defineProperty calls for each instance created.
  12918. if (Sub.options.props) {
  12919. initProps$1(Sub);
  12920. }
  12921. if (Sub.options.computed) {
  12922. initComputed$1(Sub);
  12923. }
  12924. // allow further extension/mixin/plugin usage
  12925. Sub.extend = Super.extend;
  12926. Sub.mixin = Super.mixin;
  12927. Sub.use = Super.use;
  12928. // create asset registers, so extended classes
  12929. // can have their private assets too.
  12930. ASSET_TYPES.forEach(function (type) {
  12931. Sub[type] = Super[type];
  12932. });
  12933. // enable recursive self-lookup
  12934. if (name) {
  12935. Sub.options.components[name] = Sub;
  12936. }
  12937. // keep a reference to the super options at extension time.
  12938. // later at instantiation we can check if Super's options have
  12939. // been updated.
  12940. Sub.superOptions = Super.options;
  12941. Sub.extendOptions = extendOptions;
  12942. Sub.sealedOptions = extend({}, Sub.options);
  12943. // cache constructor
  12944. cachedCtors[SuperId] = Sub;
  12945. return Sub
  12946. };
  12947. }
  12948. function initProps$1 (Comp) {
  12949. var props = Comp.options.props;
  12950. for (var key in props) {
  12951. proxy(Comp.prototype, "_props", key);
  12952. }
  12953. }
  12954. function initComputed$1 (Comp) {
  12955. var computed = Comp.options.computed;
  12956. for (var key in computed) {
  12957. defineComputed(Comp.prototype, key, computed[key]);
  12958. }
  12959. }
  12960. /* */
  12961. function initAssetRegisters (Vue) {
  12962. /**
  12963. * Create asset registration methods.
  12964. */
  12965. ASSET_TYPES.forEach(function (type) {
  12966. Vue[type] = function (
  12967. id,
  12968. definition
  12969. ) {
  12970. if (!definition) {
  12971. return this.options[type + 's'][id]
  12972. } else {
  12973. /* istanbul ignore if */
  12974. if ( true && type === 'component') {
  12975. validateComponentName(id);
  12976. }
  12977. if (type === 'component' && isPlainObject(definition)) {
  12978. definition.name = definition.name || id;
  12979. definition = this.options._base.extend(definition);
  12980. }
  12981. if (type === 'directive' && typeof definition === 'function') {
  12982. definition = { bind: definition, update: definition };
  12983. }
  12984. this.options[type + 's'][id] = definition;
  12985. return definition
  12986. }
  12987. };
  12988. });
  12989. }
  12990. /* */
  12991. function getComponentName (opts) {
  12992. return opts && (opts.Ctor.options.name || opts.tag)
  12993. }
  12994. function matches (pattern, name) {
  12995. if (Array.isArray(pattern)) {
  12996. return pattern.indexOf(name) > -1
  12997. } else if (typeof pattern === 'string') {
  12998. return pattern.split(',').indexOf(name) > -1
  12999. } else if (isRegExp(pattern)) {
  13000. return pattern.test(name)
  13001. }
  13002. /* istanbul ignore next */
  13003. return false
  13004. }
  13005. function pruneCache (keepAliveInstance, filter) {
  13006. var cache = keepAliveInstance.cache;
  13007. var keys = keepAliveInstance.keys;
  13008. var _vnode = keepAliveInstance._vnode;
  13009. for (var key in cache) {
  13010. var cachedNode = cache[key];
  13011. if (cachedNode) {
  13012. var name = getComponentName(cachedNode.componentOptions);
  13013. if (name && !filter(name)) {
  13014. pruneCacheEntry(cache, key, keys, _vnode);
  13015. }
  13016. }
  13017. }
  13018. }
  13019. function pruneCacheEntry (
  13020. cache,
  13021. key,
  13022. keys,
  13023. current
  13024. ) {
  13025. var cached$$1 = cache[key];
  13026. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  13027. cached$$1.componentInstance.$destroy();
  13028. }
  13029. cache[key] = null;
  13030. remove(keys, key);
  13031. }
  13032. var patternTypes = [String, RegExp, Array];
  13033. var KeepAlive = {
  13034. name: 'keep-alive',
  13035. abstract: true,
  13036. props: {
  13037. include: patternTypes,
  13038. exclude: patternTypes,
  13039. max: [String, Number]
  13040. },
  13041. created: function created () {
  13042. this.cache = Object.create(null);
  13043. this.keys = [];
  13044. },
  13045. destroyed: function destroyed () {
  13046. for (var key in this.cache) {
  13047. pruneCacheEntry(this.cache, key, this.keys);
  13048. }
  13049. },
  13050. mounted: function mounted () {
  13051. var this$1 = this;
  13052. this.$watch('include', function (val) {
  13053. pruneCache(this$1, function (name) { return matches(val, name); });
  13054. });
  13055. this.$watch('exclude', function (val) {
  13056. pruneCache(this$1, function (name) { return !matches(val, name); });
  13057. });
  13058. },
  13059. render: function render () {
  13060. var slot = this.$slots.default;
  13061. var vnode = getFirstComponentChild(slot);
  13062. var componentOptions = vnode && vnode.componentOptions;
  13063. if (componentOptions) {
  13064. // check pattern
  13065. var name = getComponentName(componentOptions);
  13066. var ref = this;
  13067. var include = ref.include;
  13068. var exclude = ref.exclude;
  13069. if (
  13070. // not included
  13071. (include && (!name || !matches(include, name))) ||
  13072. // excluded
  13073. (exclude && name && matches(exclude, name))
  13074. ) {
  13075. return vnode
  13076. }
  13077. var ref$1 = this;
  13078. var cache = ref$1.cache;
  13079. var keys = ref$1.keys;
  13080. var key = vnode.key == null
  13081. // same constructor may get registered as different local components
  13082. // so cid alone is not enough (#3269)
  13083. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  13084. : vnode.key;
  13085. if (cache[key]) {
  13086. vnode.componentInstance = cache[key].componentInstance;
  13087. // make current key freshest
  13088. remove(keys, key);
  13089. keys.push(key);
  13090. } else {
  13091. cache[key] = vnode;
  13092. keys.push(key);
  13093. // prune oldest entry
  13094. if (this.max && keys.length > parseInt(this.max)) {
  13095. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  13096. }
  13097. }
  13098. vnode.data.keepAlive = true;
  13099. }
  13100. return vnode || (slot && slot[0])
  13101. }
  13102. };
  13103. var builtInComponents = {
  13104. KeepAlive: KeepAlive
  13105. };
  13106. /* */
  13107. function initGlobalAPI (Vue) {
  13108. // config
  13109. var configDef = {};
  13110. configDef.get = function () { return config; };
  13111. if (true) {
  13112. configDef.set = function () {
  13113. warn(
  13114. 'Do not replace the Vue.config object, set individual fields instead.'
  13115. );
  13116. };
  13117. }
  13118. Object.defineProperty(Vue, 'config', configDef);
  13119. // exposed util methods.
  13120. // NOTE: these are not considered part of the public API - avoid relying on
  13121. // them unless you are aware of the risk.
  13122. Vue.util = {
  13123. warn: warn,
  13124. extend: extend,
  13125. mergeOptions: mergeOptions,
  13126. defineReactive: defineReactive$$1
  13127. };
  13128. Vue.set = set;
  13129. Vue.delete = del;
  13130. Vue.nextTick = nextTick;
  13131. // 2.6 explicit observable API
  13132. Vue.observable = function (obj) {
  13133. observe(obj);
  13134. return obj
  13135. };
  13136. Vue.options = Object.create(null);
  13137. ASSET_TYPES.forEach(function (type) {
  13138. Vue.options[type + 's'] = Object.create(null);
  13139. });
  13140. // this is used to identify the "base" constructor to extend all plain-object
  13141. // components with in Weex's multi-instance scenarios.
  13142. Vue.options._base = Vue;
  13143. extend(Vue.options.components, builtInComponents);
  13144. initUse(Vue);
  13145. initMixin$1(Vue);
  13146. initExtend(Vue);
  13147. initAssetRegisters(Vue);
  13148. }
  13149. initGlobalAPI(Vue);
  13150. Object.defineProperty(Vue.prototype, '$isServer', {
  13151. get: isServerRendering
  13152. });
  13153. Object.defineProperty(Vue.prototype, '$ssrContext', {
  13154. get: function get () {
  13155. /* istanbul ignore next */
  13156. return this.$vnode && this.$vnode.ssrContext
  13157. }
  13158. });
  13159. // expose FunctionalRenderContext for ssr runtime helper installation
  13160. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  13161. value: FunctionalRenderContext
  13162. });
  13163. Vue.version = '2.6.11';
  13164. /**
  13165. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  13166. */
  13167. var ARRAYTYPE = '[object Array]';
  13168. var OBJECTTYPE = '[object Object]';
  13169. // const FUNCTIONTYPE = '[object Function]'
  13170. function diff(current, pre) {
  13171. var result = {};
  13172. syncKeys(current, pre);
  13173. _diff(current, pre, '', result);
  13174. return result
  13175. }
  13176. function syncKeys(current, pre) {
  13177. if (current === pre) { return }
  13178. var rootCurrentType = type(current);
  13179. var rootPreType = type(pre);
  13180. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  13181. if(Object.keys(current).length >= Object.keys(pre).length){
  13182. for (var key in pre) {
  13183. var currentValue = current[key];
  13184. if (currentValue === undefined) {
  13185. current[key] = null;
  13186. } else {
  13187. syncKeys(currentValue, pre[key]);
  13188. }
  13189. }
  13190. }
  13191. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  13192. if (current.length >= pre.length) {
  13193. pre.forEach(function (item, index) {
  13194. syncKeys(current[index], item);
  13195. });
  13196. }
  13197. }
  13198. }
  13199. function _diff(current, pre, path, result) {
  13200. if (current === pre) { return }
  13201. var rootCurrentType = type(current);
  13202. var rootPreType = type(pre);
  13203. if (rootCurrentType == OBJECTTYPE) {
  13204. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  13205. setResult(result, path, current);
  13206. } else {
  13207. var loop = function ( key ) {
  13208. var currentValue = current[key];
  13209. var preValue = pre[key];
  13210. var currentType = type(currentValue);
  13211. var preType = type(preValue);
  13212. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  13213. if (currentValue !== pre[key]) {
  13214. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13215. }
  13216. } else if (currentType == ARRAYTYPE) {
  13217. if (preType != ARRAYTYPE) {
  13218. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13219. } else {
  13220. if (currentValue.length < preValue.length) {
  13221. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13222. } else {
  13223. currentValue.forEach(function (item, index) {
  13224. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  13225. });
  13226. }
  13227. }
  13228. } else if (currentType == OBJECTTYPE) {
  13229. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  13230. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  13231. } else {
  13232. for (var subKey in currentValue) {
  13233. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  13234. }
  13235. }
  13236. }
  13237. };
  13238. for (var key in current) loop( key );
  13239. }
  13240. } else if (rootCurrentType == ARRAYTYPE) {
  13241. if (rootPreType != ARRAYTYPE) {
  13242. setResult(result, path, current);
  13243. } else {
  13244. if (current.length < pre.length) {
  13245. setResult(result, path, current);
  13246. } else {
  13247. current.forEach(function (item, index) {
  13248. _diff(item, pre[index], path + '[' + index + ']', result);
  13249. });
  13250. }
  13251. }
  13252. } else {
  13253. setResult(result, path, current);
  13254. }
  13255. }
  13256. function setResult(result, k, v) {
  13257. // if (type(v) != FUNCTIONTYPE) {
  13258. result[k] = v;
  13259. // }
  13260. }
  13261. function type(obj) {
  13262. return Object.prototype.toString.call(obj)
  13263. }
  13264. /* */
  13265. function flushCallbacks$1(vm) {
  13266. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  13267. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  13268. var mpInstance = vm.$scope;
  13269. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  13270. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  13271. }
  13272. var copies = vm.__next_tick_callbacks.slice(0);
  13273. vm.__next_tick_callbacks.length = 0;
  13274. for (var i = 0; i < copies.length; i++) {
  13275. copies[i]();
  13276. }
  13277. }
  13278. }
  13279. function hasRenderWatcher(vm) {
  13280. return queue.find(function (watcher) { return vm._watcher === watcher; })
  13281. }
  13282. function nextTick$1(vm, cb) {
  13283. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  13284. //2.nextTick 之前存在 render watcher
  13285. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  13286. if(Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  13287. var mpInstance = vm.$scope;
  13288. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  13289. ']:nextVueTick');
  13290. }
  13291. return nextTick(cb, vm)
  13292. }else{
  13293. if(Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG){
  13294. var mpInstance$1 = vm.$scope;
  13295. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  13296. ']:nextMPTick');
  13297. }
  13298. }
  13299. var _resolve;
  13300. if (!vm.__next_tick_callbacks) {
  13301. vm.__next_tick_callbacks = [];
  13302. }
  13303. vm.__next_tick_callbacks.push(function () {
  13304. if (cb) {
  13305. try {
  13306. cb.call(vm);
  13307. } catch (e) {
  13308. handleError(e, vm, 'nextTick');
  13309. }
  13310. } else if (_resolve) {
  13311. _resolve(vm);
  13312. }
  13313. });
  13314. // $flow-disable-line
  13315. if (!cb && typeof Promise !== 'undefined') {
  13316. return new Promise(function (resolve) {
  13317. _resolve = resolve;
  13318. })
  13319. }
  13320. }
  13321. /* */
  13322. function cloneWithData(vm) {
  13323. // 确保当前 vm 所有数据被同步
  13324. var ret = Object.create(null);
  13325. var dataKeys = [].concat(
  13326. Object.keys(vm._data || {}),
  13327. Object.keys(vm._computedWatchers || {}));
  13328. dataKeys.reduce(function(ret, key) {
  13329. ret[key] = vm[key];
  13330. return ret
  13331. }, ret);
  13332. // vue-composition-api
  13333. var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
  13334. var rawBindings = compositionApiState && compositionApiState.rawBindings;
  13335. if (rawBindings) {
  13336. Object.keys(rawBindings).forEach(function (key) {
  13337. ret[key] = vm[key];
  13338. });
  13339. }
  13340. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  13341. Object.assign(ret, vm.$mp.data || {});
  13342. if (
  13343. Array.isArray(vm.$options.behaviors) &&
  13344. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  13345. ) { //form-field
  13346. ret['name'] = vm.name;
  13347. ret['value'] = vm.value;
  13348. }
  13349. return JSON.parse(JSON.stringify(ret))
  13350. }
  13351. var patch = function(oldVnode, vnode) {
  13352. var this$1 = this;
  13353. if (vnode === null) { //destroy
  13354. return
  13355. }
  13356. if (this.mpType === 'page' || this.mpType === 'component') {
  13357. var mpInstance = this.$scope;
  13358. var data = Object.create(null);
  13359. try {
  13360. data = cloneWithData(this);
  13361. } catch (err) {
  13362. console.error(err);
  13363. }
  13364. data.__webviewId__ = mpInstance.data.__webviewId__;
  13365. var mpData = Object.create(null);
  13366. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  13367. mpData[key] = mpInstance.data[key];
  13368. });
  13369. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  13370. if (Object.keys(diffData).length) {
  13371. if (Object({"VUE_APP_NAME":"vrv-platform","VUE_APP_PLATFORM":"mp-weixin","NODE_ENV":"development","BASE_URL":"/"}).VUE_APP_DEBUG) {
  13372. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  13373. ']差量更新',
  13374. JSON.stringify(diffData));
  13375. }
  13376. this.__next_tick_pending = true;
  13377. mpInstance.setData(diffData, function () {
  13378. this$1.__next_tick_pending = false;
  13379. flushCallbacks$1(this$1);
  13380. });
  13381. } else {
  13382. flushCallbacks$1(this);
  13383. }
  13384. }
  13385. };
  13386. /* */
  13387. function createEmptyRender() {
  13388. }
  13389. function mountComponent$1(
  13390. vm,
  13391. el,
  13392. hydrating
  13393. ) {
  13394. if (!vm.mpType) {//main.js 中的 new Vue
  13395. return vm
  13396. }
  13397. if (vm.mpType === 'app') {
  13398. vm.$options.render = createEmptyRender;
  13399. }
  13400. if (!vm.$options.render) {
  13401. vm.$options.render = createEmptyRender;
  13402. if (true) {
  13403. /* istanbul ignore if */
  13404. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  13405. vm.$options.el || el) {
  13406. warn(
  13407. 'You are using the runtime-only build of Vue where the template ' +
  13408. 'compiler is not available. Either pre-compile the templates into ' +
  13409. 'render functions, or use the compiler-included build.',
  13410. vm
  13411. );
  13412. } else {
  13413. warn(
  13414. 'Failed to mount component: template or render function not defined.',
  13415. vm
  13416. );
  13417. }
  13418. }
  13419. }
  13420. !vm._$fallback && callHook(vm, 'beforeMount');
  13421. var updateComponent = function () {
  13422. vm._update(vm._render(), hydrating);
  13423. };
  13424. // we set this to vm._watcher inside the watcher's constructor
  13425. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  13426. // component's mounted hook), which relies on vm._watcher being already defined
  13427. new Watcher(vm, updateComponent, noop, {
  13428. before: function before() {
  13429. if (vm._isMounted && !vm._isDestroyed) {
  13430. callHook(vm, 'beforeUpdate');
  13431. }
  13432. }
  13433. }, true /* isRenderWatcher */);
  13434. hydrating = false;
  13435. return vm
  13436. }
  13437. /* */
  13438. function renderClass (
  13439. staticClass,
  13440. dynamicClass
  13441. ) {
  13442. if (isDef(staticClass) || isDef(dynamicClass)) {
  13443. return concat(staticClass, stringifyClass(dynamicClass))
  13444. }
  13445. /* istanbul ignore next */
  13446. return ''
  13447. }
  13448. function concat (a, b) {
  13449. return a ? b ? (a + ' ' + b) : a : (b || '')
  13450. }
  13451. function stringifyClass (value) {
  13452. if (Array.isArray(value)) {
  13453. return stringifyArray(value)
  13454. }
  13455. if (isObject(value)) {
  13456. return stringifyObject(value)
  13457. }
  13458. if (typeof value === 'string') {
  13459. return value
  13460. }
  13461. /* istanbul ignore next */
  13462. return ''
  13463. }
  13464. function stringifyArray (value) {
  13465. var res = '';
  13466. var stringified;
  13467. for (var i = 0, l = value.length; i < l; i++) {
  13468. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  13469. if (res) { res += ' '; }
  13470. res += stringified;
  13471. }
  13472. }
  13473. return res
  13474. }
  13475. function stringifyObject (value) {
  13476. var res = '';
  13477. for (var key in value) {
  13478. if (value[key]) {
  13479. if (res) { res += ' '; }
  13480. res += key;
  13481. }
  13482. }
  13483. return res
  13484. }
  13485. /* */
  13486. var parseStyleText = cached(function (cssText) {
  13487. var res = {};
  13488. var listDelimiter = /;(?![^(]*\))/g;
  13489. var propertyDelimiter = /:(.+)/;
  13490. cssText.split(listDelimiter).forEach(function (item) {
  13491. if (item) {
  13492. var tmp = item.split(propertyDelimiter);
  13493. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  13494. }
  13495. });
  13496. return res
  13497. });
  13498. // normalize possible array / string values into Object
  13499. function normalizeStyleBinding (bindingStyle) {
  13500. if (Array.isArray(bindingStyle)) {
  13501. return toObject(bindingStyle)
  13502. }
  13503. if (typeof bindingStyle === 'string') {
  13504. return parseStyleText(bindingStyle)
  13505. }
  13506. return bindingStyle
  13507. }
  13508. /* */
  13509. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  13510. function getTarget(obj, path) {
  13511. var parts = path.split('.');
  13512. var key = parts[0];
  13513. if (key.indexOf('__$n') === 0) { //number index
  13514. key = parseInt(key.replace('__$n', ''));
  13515. }
  13516. if (parts.length === 1) {
  13517. return obj[key]
  13518. }
  13519. return getTarget(obj[key], parts.slice(1).join('.'))
  13520. }
  13521. function internalMixin(Vue) {
  13522. Vue.config.errorHandler = function(err, vm, info) {
  13523. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  13524. console.error(err);
  13525. /* eslint-disable no-undef */
  13526. var app = typeof getApp === 'function' && getApp();
  13527. if (app && app.onError) {
  13528. app.onError(err);
  13529. }
  13530. };
  13531. var oldEmit = Vue.prototype.$emit;
  13532. Vue.prototype.$emit = function(event) {
  13533. if (this.$scope && event) {
  13534. (this.$scope['_triggerEvent'] || this.$scope['triggerEvent']).call(this.$scope, event, {
  13535. __args__: toArray(arguments, 1)
  13536. });
  13537. }
  13538. return oldEmit.apply(this, arguments)
  13539. };
  13540. Vue.prototype.$nextTick = function(fn) {
  13541. return nextTick$1(this, fn)
  13542. };
  13543. MP_METHODS.forEach(function (method) {
  13544. Vue.prototype[method] = function(args) {
  13545. if (this.$scope && this.$scope[method]) {
  13546. return this.$scope[method](args)
  13547. }
  13548. // mp-alipay
  13549. if (typeof my === 'undefined') {
  13550. return
  13551. }
  13552. if (method === 'createSelectorQuery') {
  13553. /* eslint-disable no-undef */
  13554. return my.createSelectorQuery(args)
  13555. } else if (method === 'createIntersectionObserver') {
  13556. /* eslint-disable no-undef */
  13557. return my.createIntersectionObserver(args)
  13558. }
  13559. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  13560. };
  13561. });
  13562. Vue.prototype.__init_provide = initProvide;
  13563. Vue.prototype.__init_injections = initInjections;
  13564. Vue.prototype.__call_hook = function(hook, args) {
  13565. var vm = this;
  13566. // #7573 disable dep collection when invoking lifecycle hooks
  13567. pushTarget();
  13568. var handlers = vm.$options[hook];
  13569. var info = hook + " hook";
  13570. var ret;
  13571. if (handlers) {
  13572. for (var i = 0, j = handlers.length; i < j; i++) {
  13573. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  13574. }
  13575. }
  13576. if (vm._hasHookEvent) {
  13577. vm.$emit('hook:' + hook, args);
  13578. }
  13579. popTarget();
  13580. return ret
  13581. };
  13582. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  13583. if (Array.isArray(modifiers)) {
  13584. if (modifiers.indexOf('trim') !== -1) {
  13585. value = value.trim();
  13586. }
  13587. if (modifiers.indexOf('number') !== -1) {
  13588. value = this._n(value);
  13589. }
  13590. }
  13591. if (!target) {
  13592. target = this;
  13593. }
  13594. // 解决动态属性添加
  13595. Vue.set(target, key, value);
  13596. };
  13597. Vue.prototype.__set_sync = function(target, key, value) {
  13598. if (!target) {
  13599. target = this;
  13600. }
  13601. // 解决动态属性添加
  13602. Vue.set(target, key, value);
  13603. };
  13604. Vue.prototype.__get_orig = function(item) {
  13605. if (isPlainObject(item)) {
  13606. return item['$orig'] || item
  13607. }
  13608. return item
  13609. };
  13610. Vue.prototype.__get_value = function(dataPath, target) {
  13611. return getTarget(target || this, dataPath)
  13612. };
  13613. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  13614. return renderClass(staticClass, dynamicClass)
  13615. };
  13616. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  13617. if (!dynamicStyle && !staticStyle) {
  13618. return ''
  13619. }
  13620. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  13621. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  13622. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  13623. };
  13624. Vue.prototype.__map = function(val, iteratee) {
  13625. //TODO 暂不考虑 string
  13626. var ret, i, l, keys, key;
  13627. if (Array.isArray(val)) {
  13628. ret = new Array(val.length);
  13629. for (i = 0, l = val.length; i < l; i++) {
  13630. ret[i] = iteratee(val[i], i);
  13631. }
  13632. return ret
  13633. } else if (isObject(val)) {
  13634. keys = Object.keys(val);
  13635. ret = Object.create(null);
  13636. for (i = 0, l = keys.length; i < l; i++) {
  13637. key = keys[i];
  13638. ret[key] = iteratee(val[key], key, i);
  13639. }
  13640. return ret
  13641. } else if (typeof val === 'number') {
  13642. ret = new Array(val);
  13643. for (i = 0, l = val; i < l; i++) {
  13644. // 第一个参数暂时仍和小程序一致
  13645. ret[i] = iteratee(i, i);
  13646. }
  13647. return ret
  13648. }
  13649. return []
  13650. };
  13651. }
  13652. /* */
  13653. var LIFECYCLE_HOOKS$1 = [
  13654. //App
  13655. 'onLaunch',
  13656. 'onShow',
  13657. 'onHide',
  13658. 'onUniNViewMessage',
  13659. 'onPageNotFound',
  13660. 'onThemeChange',
  13661. 'onError',
  13662. 'onUnhandledRejection',
  13663. //Page
  13664. 'onInit',
  13665. 'onLoad',
  13666. // 'onShow',
  13667. 'onReady',
  13668. // 'onHide',
  13669. 'onUnload',
  13670. 'onPullDownRefresh',
  13671. 'onReachBottom',
  13672. 'onTabItemTap',
  13673. 'onAddToFavorites',
  13674. 'onShareTimeline',
  13675. 'onShareAppMessage',
  13676. 'onResize',
  13677. 'onPageScroll',
  13678. 'onNavigationBarButtonTap',
  13679. 'onBackPress',
  13680. 'onNavigationBarSearchInputChanged',
  13681. 'onNavigationBarSearchInputConfirmed',
  13682. 'onNavigationBarSearchInputClicked',
  13683. //Component
  13684. // 'onReady', // 兼容旧版本,应该移除该事件
  13685. 'onPageShow',
  13686. 'onPageHide',
  13687. 'onPageResize'
  13688. ];
  13689. function lifecycleMixin$1(Vue) {
  13690. //fixed vue-class-component
  13691. var oldExtend = Vue.extend;
  13692. Vue.extend = function(extendOptions) {
  13693. extendOptions = extendOptions || {};
  13694. var methods = extendOptions.methods;
  13695. if (methods) {
  13696. Object.keys(methods).forEach(function (methodName) {
  13697. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  13698. extendOptions[methodName] = methods[methodName];
  13699. delete methods[methodName];
  13700. }
  13701. });
  13702. }
  13703. return oldExtend.call(this, extendOptions)
  13704. };
  13705. var strategies = Vue.config.optionMergeStrategies;
  13706. var mergeHook = strategies.created;
  13707. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  13708. strategies[hook] = mergeHook;
  13709. });
  13710. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  13711. }
  13712. /* */
  13713. // install platform patch function
  13714. Vue.prototype.__patch__ = patch;
  13715. // public mount method
  13716. Vue.prototype.$mount = function(
  13717. el ,
  13718. hydrating
  13719. ) {
  13720. return mountComponent$1(this, el, hydrating)
  13721. };
  13722. lifecycleMixin$1(Vue);
  13723. internalMixin(Vue);
  13724. /* */
  13725. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  13726. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 2)))
  13727. /***/ }),
  13728. /***/ 5:
  13729. /*!***************************************************************************************!*\
  13730. !*** C:/Users/askin/IdeaProjects/airconditioner/sources/client/vrv-moblie/pages.json ***!
  13731. \***************************************************************************************/
  13732. /*! no static exports found */
  13733. /***/ (function(module, exports) {
  13734. /***/ })
  13735. }]);
  13736. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map