足力健前端,vue版本

service.runtime.esm.prod.js 166KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526
  1. export default function vueFactory (exports, SharedObject) {
  2. /* */
  3. var emptyObject = Object.freeze({});
  4. // These helpers produce better VM code in JS engines due to their
  5. // explicitness and function inlining.
  6. function isUndef (v) {
  7. return v === undefined || v === null
  8. }
  9. function isDef (v) {
  10. return v !== undefined && v !== null
  11. }
  12. function isTrue (v) {
  13. return v === true
  14. }
  15. function isFalse (v) {
  16. return v === false
  17. }
  18. /**
  19. * Check if value is primitive.
  20. */
  21. function isPrimitive (value) {
  22. return (
  23. typeof value === 'string' ||
  24. typeof value === 'number' ||
  25. // $flow-disable-line
  26. typeof value === 'symbol' ||
  27. typeof value === 'boolean'
  28. )
  29. }
  30. /**
  31. * Quick object check - this is primarily used to tell
  32. * Objects from primitive values when we know the value
  33. * is a JSON-compliant type.
  34. */
  35. function isObject (obj) {
  36. return obj !== null && typeof obj === 'object'
  37. }
  38. /**
  39. * Get the raw type string of a value, e.g., [object Object].
  40. */
  41. var _toString = Object.prototype.toString;
  42. function toRawType (value) {
  43. return _toString.call(value).slice(8, -1)
  44. }
  45. /**
  46. * Strict object type check. Only returns true
  47. * for plain JavaScript objects.
  48. */
  49. function isPlainObject (obj) {
  50. return _toString.call(obj) === '[object Object]'
  51. }
  52. function isRegExp (v) {
  53. return _toString.call(v) === '[object RegExp]'
  54. }
  55. /**
  56. * Check if val is a valid array index.
  57. */
  58. function isValidArrayIndex (val) {
  59. var n = parseFloat(String(val));
  60. return n >= 0 && Math.floor(n) === n && isFinite(val)
  61. }
  62. function isPromise (val) {
  63. return (
  64. isDef(val) &&
  65. typeof val.then === 'function' &&
  66. typeof val.catch === 'function'
  67. )
  68. }
  69. /**
  70. * Convert a value to a string that is actually rendered.
  71. */
  72. function toString (val) {
  73. return val == null
  74. ? ''
  75. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  76. ? JSON.stringify(val, null, 2)
  77. : String(val)
  78. }
  79. /**
  80. * Convert an input value to a number for persistence.
  81. * If the conversion fails, return original string.
  82. */
  83. function toNumber (val) {
  84. var n = parseFloat(val);
  85. return isNaN(n) ? val : n
  86. }
  87. /**
  88. * Make a map and return a function for checking if a key
  89. * is in that map.
  90. */
  91. function makeMap (
  92. str,
  93. expectsLowerCase
  94. ) {
  95. var map = Object.create(null);
  96. var list = str.split(',');
  97. for (var i = 0; i < list.length; i++) {
  98. map[list[i]] = true;
  99. }
  100. return expectsLowerCase
  101. ? function (val) { return map[val.toLowerCase()]; }
  102. : function (val) { return map[val]; }
  103. }
  104. /**
  105. * Check if a tag is a built-in tag.
  106. */
  107. var isBuiltInTag = makeMap('slot,component', true);
  108. /**
  109. * Check if an attribute is a reserved attribute.
  110. */
  111. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  112. /**
  113. * Remove an item from an array.
  114. */
  115. function remove (arr, item) {
  116. if (arr.length) {
  117. var index = arr.indexOf(item);
  118. if (index > -1) {
  119. return arr.splice(index, 1)
  120. }
  121. }
  122. }
  123. /**
  124. * Check whether an object has the property.
  125. */
  126. var hasOwnProperty = Object.prototype.hasOwnProperty;
  127. function hasOwn (obj, key) {
  128. return hasOwnProperty.call(obj, key)
  129. }
  130. /**
  131. * Create a cached version of a pure function.
  132. */
  133. function cached (fn) {
  134. var cache = Object.create(null);
  135. return (function cachedFn (str) {
  136. var hit = cache[str];
  137. return hit || (cache[str] = fn(str))
  138. })
  139. }
  140. /**
  141. * Camelize a hyphen-delimited string.
  142. */
  143. var camelizeRE = /-(\w)/g;
  144. var camelize = cached(function (str) {
  145. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  146. });
  147. /**
  148. * Capitalize a string.
  149. */
  150. var capitalize = cached(function (str) {
  151. return str.charAt(0).toUpperCase() + str.slice(1)
  152. });
  153. /**
  154. * Hyphenate a camelCase string.
  155. */
  156. var hyphenateRE = /\B([A-Z])/g;
  157. var hyphenate = cached(function (str) {
  158. return str.replace(hyphenateRE, '-$1').toLowerCase()
  159. });
  160. /**
  161. * Simple bind polyfill for environments that do not support it,
  162. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  163. * since native bind is now performant enough in most browsers.
  164. * But removing it would mean breaking code that was able to run in
  165. * PhantomJS 1.x, so this must be kept for backward compatibility.
  166. */
  167. /* istanbul ignore next */
  168. function polyfillBind (fn, ctx) {
  169. function boundFn (a) {
  170. var l = arguments.length;
  171. return l
  172. ? l > 1
  173. ? fn.apply(ctx, arguments)
  174. : fn.call(ctx, a)
  175. : fn.call(ctx)
  176. }
  177. boundFn._length = fn.length;
  178. return boundFn
  179. }
  180. function nativeBind (fn, ctx) {
  181. return fn.bind(ctx)
  182. }
  183. var bind = Function.prototype.bind
  184. ? nativeBind
  185. : polyfillBind;
  186. /**
  187. * Convert an Array-like object to a real Array.
  188. */
  189. function toArray (list, start) {
  190. start = start || 0;
  191. var i = list.length - start;
  192. var ret = new Array(i);
  193. while (i--) {
  194. ret[i] = list[i + start];
  195. }
  196. return ret
  197. }
  198. /**
  199. * Mix properties into target object.
  200. */
  201. function extend (to, _from) {
  202. for (var key in _from) {
  203. to[key] = _from[key];
  204. }
  205. return to
  206. }
  207. /**
  208. * Merge an Array of Objects into a single Object.
  209. */
  210. function toObject (arr) {
  211. var res = {};
  212. for (var i = 0; i < arr.length; i++) {
  213. if (arr[i]) {
  214. extend(res, arr[i]);
  215. }
  216. }
  217. return res
  218. }
  219. /* eslint-disable no-unused-vars */
  220. /**
  221. * Perform no operation.
  222. * Stubbing args to make Flow happy without leaving useless transpiled code
  223. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  224. */
  225. function noop (a, b, c) {}
  226. /**
  227. * Always return false.
  228. */
  229. var no = function (a, b, c) { return false; };
  230. /* eslint-enable no-unused-vars */
  231. /**
  232. * Return the same value.
  233. */
  234. var identity = function (_) { return _; };
  235. /**
  236. * Check if two values are loosely equal - that is,
  237. * if they are plain objects, do they have the same shape?
  238. */
  239. function looseEqual (a, b) {
  240. if (a === b) { return true }
  241. var isObjectA = isObject(a);
  242. var isObjectB = isObject(b);
  243. if (isObjectA && isObjectB) {
  244. try {
  245. var isArrayA = Array.isArray(a);
  246. var isArrayB = Array.isArray(b);
  247. if (isArrayA && isArrayB) {
  248. return a.length === b.length && a.every(function (e, i) {
  249. return looseEqual(e, b[i])
  250. })
  251. } else if (a instanceof Date && b instanceof Date) {
  252. return a.getTime() === b.getTime()
  253. } else if (!isArrayA && !isArrayB) {
  254. var keysA = Object.keys(a);
  255. var keysB = Object.keys(b);
  256. return keysA.length === keysB.length && keysA.every(function (key) {
  257. return looseEqual(a[key], b[key])
  258. })
  259. } else {
  260. /* istanbul ignore next */
  261. return false
  262. }
  263. } catch (e) {
  264. /* istanbul ignore next */
  265. return false
  266. }
  267. } else if (!isObjectA && !isObjectB) {
  268. return String(a) === String(b)
  269. } else {
  270. return false
  271. }
  272. }
  273. /**
  274. * Return the first index at which a loosely equal value can be
  275. * found in the array (if value is a plain object, the array must
  276. * contain an object of the same shape), or -1 if it is not present.
  277. */
  278. function looseIndexOf (arr, val) {
  279. for (var i = 0; i < arr.length; i++) {
  280. if (looseEqual(arr[i], val)) { return i }
  281. }
  282. return -1
  283. }
  284. /**
  285. * Ensure a function is called only once.
  286. */
  287. function once (fn) {
  288. var called = false;
  289. return function () {
  290. if (!called) {
  291. called = true;
  292. fn.apply(this, arguments);
  293. }
  294. }
  295. }
  296. var SSR_ATTR = 'data-server-rendered';
  297. var ASSET_TYPES = [
  298. 'component',
  299. 'directive',
  300. 'filter'
  301. ];
  302. var LIFECYCLE_HOOKS = [
  303. 'beforeCreate',
  304. 'created',
  305. 'beforeMount',
  306. 'mounted',
  307. 'beforeUpdate',
  308. 'updated',
  309. 'beforeDestroy',
  310. 'destroyed',
  311. 'activated',
  312. 'deactivated',
  313. 'errorCaptured',
  314. 'serverPrefetch'
  315. ];
  316. /* */
  317. var config = ({
  318. /**
  319. * Option merge strategies (used in core/util/options)
  320. */
  321. // $flow-disable-line
  322. optionMergeStrategies: Object.create(null),
  323. /**
  324. * Whether to suppress warnings.
  325. */
  326. silent: false,
  327. /**
  328. * Show production mode tip message on boot?
  329. */
  330. productionTip: "production" !== 'production',
  331. /**
  332. * Whether to enable devtools
  333. */
  334. devtools: "production" !== 'production',
  335. /**
  336. * Whether to record perf
  337. */
  338. performance: false,
  339. /**
  340. * Error handler for watcher errors
  341. */
  342. errorHandler: null,
  343. /**
  344. * Warn handler for watcher warns
  345. */
  346. warnHandler: null,
  347. /**
  348. * Ignore certain custom elements
  349. */
  350. ignoredElements: [],
  351. /**
  352. * Custom user key aliases for v-on
  353. */
  354. // $flow-disable-line
  355. keyCodes: Object.create(null),
  356. /**
  357. * Check if a tag is reserved so that it cannot be registered as a
  358. * component. This is platform-dependent and may be overwritten.
  359. */
  360. isReservedTag: no,
  361. /**
  362. * Check if an attribute is reserved so that it cannot be used as a component
  363. * prop. This is platform-dependent and may be overwritten.
  364. */
  365. isReservedAttr: no,
  366. /**
  367. * Check if a tag is an unknown element.
  368. * Platform-dependent.
  369. */
  370. isUnknownElement: no,
  371. /**
  372. * Get the namespace of an element
  373. */
  374. getTagNamespace: noop,
  375. /**
  376. * Parse the real tag name for the specific platform.
  377. */
  378. parsePlatformTagName: identity,
  379. /**
  380. * Check if an attribute must be bound using property, e.g. value
  381. * Platform-dependent.
  382. */
  383. mustUseProp: no,
  384. /**
  385. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  386. * This will significantly reduce performance if set to false.
  387. */
  388. async: true,
  389. /**
  390. * Exposed for legacy reasons
  391. */
  392. _lifecycleHooks: LIFECYCLE_HOOKS
  393. });
  394. /* */
  395. /**
  396. * unicode letters used for parsing html tags, component names and property paths.
  397. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  398. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  399. */
  400. 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/;
  401. /**
  402. * Check if a string starts with $ or _
  403. */
  404. function isReserved (str) {
  405. var c = (str + '').charCodeAt(0);
  406. return c === 0x24 || c === 0x5F
  407. }
  408. /**
  409. * Define a property.
  410. */
  411. function def (obj, key, val, enumerable) {
  412. Object.defineProperty(obj, key, {
  413. value: val,
  414. enumerable: !!enumerable,
  415. writable: true,
  416. configurable: true
  417. });
  418. }
  419. /**
  420. * Parse simple path.
  421. */
  422. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  423. function parsePath (path) {
  424. if (bailRE.test(path)) {
  425. return
  426. }
  427. var segments = path.split('.');
  428. return function (obj) {
  429. for (var i = 0; i < segments.length; i++) {
  430. if (!obj) { return }
  431. obj = obj[segments[i]];
  432. }
  433. return obj
  434. }
  435. }
  436. /* */
  437. // can we use __proto__?
  438. var hasProto = '__proto__' in {};
  439. // Browser environment sniffing
  440. var inBrowser = typeof window !== 'undefined';
  441. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  442. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  443. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  444. var isIE = UA && /msie|trident/.test(UA);
  445. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  446. var isEdge = UA && UA.indexOf('edge/') > 0;
  447. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  448. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  449. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  450. var isPhantomJS = UA && /phantomjs/.test(UA);
  451. var isFF = UA && UA.match(/firefox\/(\d+)/);
  452. // Firefox has a "watch" function on Object.prototype...
  453. var nativeWatch = ({}).watch;
  454. if (inBrowser) {
  455. try {
  456. var opts = {};
  457. Object.defineProperty(opts, 'passive', ({
  458. get: function get () {
  459. }
  460. })); // https://github.com/facebook/flow/issues/285
  461. window.addEventListener('test-passive', null, opts);
  462. } catch (e) {}
  463. }
  464. // this needs to be lazy-evaled because vue may be required before
  465. // vue-server-renderer can set VUE_ENV
  466. var _isServer;
  467. var isServerRendering = function () {
  468. if (_isServer === undefined) {
  469. /* istanbul ignore if */
  470. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  471. // detect presence of vue-server-renderer and avoid
  472. // Webpack shimming the process
  473. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  474. } else {
  475. _isServer = false;
  476. }
  477. }
  478. return _isServer
  479. };
  480. // detect devtools
  481. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  482. /* istanbul ignore next */
  483. function isNative (Ctor) {
  484. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  485. }
  486. var hasSymbol =
  487. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  488. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  489. var _Set;
  490. /* istanbul ignore if */ // $flow-disable-line
  491. if (typeof Set !== 'undefined' && isNative(Set)) {
  492. // use native Set when available.
  493. _Set = Set;
  494. } else {
  495. // a non-standard Set polyfill that only works with primitive keys.
  496. _Set = /*@__PURE__*/(function () {
  497. function Set () {
  498. this.set = Object.create(null);
  499. }
  500. Set.prototype.has = function has (key) {
  501. return this.set[key] === true
  502. };
  503. Set.prototype.add = function add (key) {
  504. this.set[key] = true;
  505. };
  506. Set.prototype.clear = function clear () {
  507. this.set = Object.create(null);
  508. };
  509. return Set;
  510. }());
  511. }
  512. /* */
  513. var warn = noop;
  514. /* */
  515. var uid = 0;
  516. /**
  517. * A dep is an observable that can have multiple
  518. * directives subscribing to it.
  519. */
  520. var Dep = function Dep () {
  521. // fixed by xxxxxx (nvue vuex)
  522. /* eslint-disable no-undef */
  523. if(typeof SharedObject !== 'undefined'){
  524. this.id = SharedObject.uid++;
  525. } else {
  526. this.id = uid++;
  527. }
  528. this.subs = [];
  529. };
  530. Dep.prototype.addSub = function addSub (sub) {
  531. this.subs.push(sub);
  532. };
  533. Dep.prototype.removeSub = function removeSub (sub) {
  534. remove(this.subs, sub);
  535. };
  536. Dep.prototype.depend = function depend () {
  537. if (Dep.SharedObject.target) { // fixed by xxxxxx
  538. Dep.SharedObject.target.addDep(this);
  539. }
  540. };
  541. Dep.prototype.notify = function notify () {
  542. // stabilize the subscriber list first
  543. var subs = this.subs.slice();
  544. for (var i = 0, l = subs.length; i < l; i++) {
  545. subs[i].update();
  546. }
  547. };
  548. // The current target watcher being evaluated.
  549. // This is globally unique because only one watcher
  550. // can be evaluated at a time.
  551. // fixed by xxxxxx (nvue shared vuex)
  552. /* eslint-disable no-undef */
  553. Dep.SharedObject = typeof SharedObject !== 'undefined' ? SharedObject : {};
  554. Dep.SharedObject.target = null;
  555. Dep.SharedObject.targetStack = [];
  556. function pushTarget (target) {
  557. Dep.SharedObject.targetStack.push(target);
  558. Dep.SharedObject.target = target;
  559. }
  560. function popTarget () {
  561. Dep.SharedObject.targetStack.pop();
  562. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  563. }
  564. /* */
  565. var VNode = function VNode (
  566. tag,
  567. data,
  568. children,
  569. text,
  570. elm,
  571. context,
  572. componentOptions,
  573. asyncFactory
  574. ) {
  575. this.tag = tag;
  576. this.data = data;
  577. this.children = children;
  578. this.text = text;
  579. this.elm = elm;
  580. this.ns = undefined;
  581. this.context = context;
  582. this.fnContext = undefined;
  583. this.fnOptions = undefined;
  584. this.fnScopeId = undefined;
  585. this.key = data && data.key;
  586. this.componentOptions = componentOptions;
  587. this.componentInstance = undefined;
  588. this.parent = undefined;
  589. this.raw = false;
  590. this.isStatic = false;
  591. this.isRootInsert = true;
  592. this.isComment = false;
  593. this.isCloned = false;
  594. this.isOnce = false;
  595. this.asyncFactory = asyncFactory;
  596. this.asyncMeta = undefined;
  597. this.isAsyncPlaceholder = false;
  598. };
  599. var prototypeAccessors = { child: { configurable: true } };
  600. // DEPRECATED: alias for componentInstance for backwards compat.
  601. /* istanbul ignore next */
  602. prototypeAccessors.child.get = function () {
  603. return this.componentInstance
  604. };
  605. Object.defineProperties( VNode.prototype, prototypeAccessors );
  606. var createEmptyVNode = function (text) {
  607. if ( text === void 0 ) text = '';
  608. var node = new VNode();
  609. node.text = text;
  610. node.isComment = true;
  611. return node
  612. };
  613. function createTextVNode (val) {
  614. return new VNode(undefined, undefined, undefined, String(val))
  615. }
  616. // optimized shallow clone
  617. // used for static nodes and slot nodes because they may be reused across
  618. // multiple renders, cloning them avoids errors when DOM manipulations rely
  619. // on their elm reference.
  620. function cloneVNode (vnode) {
  621. var cloned = new VNode(
  622. vnode.tag,
  623. vnode.data,
  624. // #7975
  625. // clone children array to avoid mutating original in case of cloning
  626. // a child.
  627. vnode.children && vnode.children.slice(),
  628. vnode.text,
  629. vnode.elm,
  630. vnode.context,
  631. vnode.componentOptions,
  632. vnode.asyncFactory
  633. );
  634. cloned.ns = vnode.ns;
  635. cloned.isStatic = vnode.isStatic;
  636. cloned.key = vnode.key;
  637. cloned.isComment = vnode.isComment;
  638. cloned.fnContext = vnode.fnContext;
  639. cloned.fnOptions = vnode.fnOptions;
  640. cloned.fnScopeId = vnode.fnScopeId;
  641. cloned.asyncMeta = vnode.asyncMeta;
  642. cloned.isCloned = true;
  643. return cloned
  644. }
  645. /*
  646. * not type checking this file because flow doesn't play well with
  647. * dynamically accessing methods on Array prototype
  648. */
  649. var arrayProto = Array.prototype;
  650. var arrayMethods = Object.create(arrayProto);
  651. var methodsToPatch = [
  652. 'push',
  653. 'pop',
  654. 'shift',
  655. 'unshift',
  656. 'splice',
  657. 'sort',
  658. 'reverse'
  659. ];
  660. /**
  661. * Intercept mutating methods and emit events
  662. */
  663. methodsToPatch.forEach(function (method) {
  664. // cache original method
  665. var original = arrayProto[method];
  666. def(arrayMethods, method, function mutator () {
  667. var args = [], len = arguments.length;
  668. while ( len-- ) args[ len ] = arguments[ len ];
  669. var result = original.apply(this, args);
  670. var ob = this.__ob__;
  671. var inserted;
  672. switch (method) {
  673. case 'push':
  674. case 'unshift':
  675. inserted = args;
  676. break
  677. case 'splice':
  678. inserted = args.slice(2);
  679. break
  680. }
  681. if (inserted) { ob.observeArray(inserted); }
  682. // notify change
  683. ob.dep.notify();
  684. return result
  685. });
  686. });
  687. /* */
  688. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  689. /**
  690. * In some cases we may want to disable observation inside a component's
  691. * update computation.
  692. */
  693. var shouldObserve = true;
  694. function toggleObserving (value) {
  695. shouldObserve = value;
  696. }
  697. /**
  698. * Observer class that is attached to each observed
  699. * object. Once attached, the observer converts the target
  700. * object's property keys into getter/setters that
  701. * collect dependencies and dispatch updates.
  702. */
  703. var Observer = function Observer (value) {
  704. this.value = value;
  705. this.dep = new Dep();
  706. this.vmCount = 0;
  707. def(value, '__ob__', this);
  708. if (Array.isArray(value)) {
  709. if (hasProto) {
  710. protoAugment(value, arrayMethods);
  711. } else {
  712. copyAugment(value, arrayMethods, arrayKeys);
  713. }
  714. this.observeArray(value);
  715. } else {
  716. this.walk(value);
  717. }
  718. };
  719. /**
  720. * Walk through all properties and convert them into
  721. * getter/setters. This method should only be called when
  722. * value type is Object.
  723. */
  724. Observer.prototype.walk = function walk (obj) {
  725. var keys = Object.keys(obj);
  726. for (var i = 0; i < keys.length; i++) {
  727. defineReactive$$1(obj, keys[i]);
  728. }
  729. };
  730. /**
  731. * Observe a list of Array items.
  732. */
  733. Observer.prototype.observeArray = function observeArray (items) {
  734. for (var i = 0, l = items.length; i < l; i++) {
  735. observe(items[i]);
  736. }
  737. };
  738. // helpers
  739. /**
  740. * Augment a target Object or Array by intercepting
  741. * the prototype chain using __proto__
  742. */
  743. function protoAugment (target, src) {
  744. /* eslint-disable no-proto */
  745. target.__proto__ = src;
  746. /* eslint-enable no-proto */
  747. }
  748. /**
  749. * Augment a target Object or Array by defining
  750. * hidden properties.
  751. */
  752. /* istanbul ignore next */
  753. function copyAugment (target, src, keys) {
  754. for (var i = 0, l = keys.length; i < l; i++) {
  755. var key = keys[i];
  756. def(target, key, src[key]);
  757. }
  758. }
  759. /**
  760. * Attempt to create an observer instance for a value,
  761. * returns the new observer if successfully observed,
  762. * or the existing observer if the value already has one.
  763. */
  764. function observe (value, asRootData) {
  765. if (!isObject(value) || value instanceof VNode) {
  766. return
  767. }
  768. var ob;
  769. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  770. ob = value.__ob__;
  771. } else if (
  772. shouldObserve &&
  773. !isServerRendering() &&
  774. (Array.isArray(value) || isPlainObject(value)) &&
  775. Object.isExtensible(value) &&
  776. !value._isVue
  777. ) {
  778. ob = new Observer(value);
  779. }
  780. if (asRootData && ob) {
  781. ob.vmCount++;
  782. }
  783. return ob
  784. }
  785. /**
  786. * Define a reactive property on an Object.
  787. */
  788. function defineReactive$$1 (
  789. obj,
  790. key,
  791. val,
  792. customSetter,
  793. shallow
  794. ) {
  795. var dep = new Dep();
  796. var property = Object.getOwnPropertyDescriptor(obj, key);
  797. if (property && property.configurable === false) {
  798. return
  799. }
  800. // cater for pre-defined getter/setters
  801. var getter = property && property.get;
  802. var setter = property && property.set;
  803. if ((!getter || setter) && arguments.length === 2) {
  804. val = obj[key];
  805. }
  806. var childOb = !shallow && observe(val);
  807. Object.defineProperty(obj, key, {
  808. enumerable: true,
  809. configurable: true,
  810. get: function reactiveGetter () {
  811. var value = getter ? getter.call(obj) : val;
  812. if (Dep.SharedObject.target) { // fixed by xxxxxx
  813. dep.depend();
  814. if (childOb) {
  815. childOb.dep.depend();
  816. if (Array.isArray(value)) {
  817. dependArray(value);
  818. }
  819. }
  820. }
  821. return value
  822. },
  823. set: function reactiveSetter (newVal) {
  824. var value = getter ? getter.call(obj) : val;
  825. /* eslint-disable no-self-compare */
  826. if (newVal === value || (newVal !== newVal && value !== value)) {
  827. return
  828. }
  829. // #7981: for accessor properties without setter
  830. if (getter && !setter) { return }
  831. if (setter) {
  832. setter.call(obj, newVal);
  833. } else {
  834. val = newVal;
  835. }
  836. childOb = !shallow && observe(newVal);
  837. dep.notify();
  838. }
  839. });
  840. }
  841. /**
  842. * Set a property on an object. Adds the new property and
  843. * triggers change notification if the property doesn't
  844. * already exist.
  845. */
  846. function set (target, key, val) {
  847. if (Array.isArray(target) && isValidArrayIndex(key)) {
  848. target.length = Math.max(target.length, key);
  849. target.splice(key, 1, val);
  850. return val
  851. }
  852. if (key in target && !(key in Object.prototype)) {
  853. target[key] = val;
  854. return val
  855. }
  856. var ob = (target).__ob__;
  857. if (target._isVue || (ob && ob.vmCount)) {
  858. return val
  859. }
  860. if (!ob) {
  861. target[key] = val;
  862. return val
  863. }
  864. defineReactive$$1(ob.value, key, val);
  865. ob.dep.notify();
  866. return val
  867. }
  868. /**
  869. * Delete a property and trigger change if necessary.
  870. */
  871. function del (target, key) {
  872. if (Array.isArray(target) && isValidArrayIndex(key)) {
  873. target.splice(key, 1);
  874. return
  875. }
  876. var ob = (target).__ob__;
  877. if (target._isVue || (ob && ob.vmCount)) {
  878. return
  879. }
  880. if (!hasOwn(target, key)) {
  881. return
  882. }
  883. delete target[key];
  884. if (!ob) {
  885. return
  886. }
  887. ob.dep.notify();
  888. }
  889. /**
  890. * Collect dependencies on array elements when the array is touched, since
  891. * we cannot intercept array element access like property getters.
  892. */
  893. function dependArray (value) {
  894. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  895. e = value[i];
  896. e && e.__ob__ && e.__ob__.dep.depend();
  897. if (Array.isArray(e)) {
  898. dependArray(e);
  899. }
  900. }
  901. }
  902. /* */
  903. /**
  904. * Option overwriting strategies are functions that handle
  905. * how to merge a parent option value and a child option
  906. * value into the final value.
  907. */
  908. var strats = config.optionMergeStrategies;
  909. /**
  910. * Helper that recursively merges two data objects together.
  911. */
  912. function mergeData (to, from) {
  913. if (!from) { return to }
  914. var key, toVal, fromVal;
  915. var keys = hasSymbol
  916. ? Reflect.ownKeys(from)
  917. : Object.keys(from);
  918. for (var i = 0; i < keys.length; i++) {
  919. key = keys[i];
  920. // in case the object is already observed...
  921. if (key === '__ob__') { continue }
  922. toVal = to[key];
  923. fromVal = from[key];
  924. if (!hasOwn(to, key)) {
  925. set(to, key, fromVal);
  926. } else if (
  927. toVal !== fromVal &&
  928. isPlainObject(toVal) &&
  929. isPlainObject(fromVal)
  930. ) {
  931. mergeData(toVal, fromVal);
  932. }
  933. }
  934. return to
  935. }
  936. /**
  937. * Data
  938. */
  939. function mergeDataOrFn (
  940. parentVal,
  941. childVal,
  942. vm
  943. ) {
  944. if (!vm) {
  945. // in a Vue.extend merge, both should be functions
  946. if (!childVal) {
  947. return parentVal
  948. }
  949. if (!parentVal) {
  950. return childVal
  951. }
  952. // when parentVal & childVal are both present,
  953. // we need to return a function that returns the
  954. // merged result of both functions... no need to
  955. // check if parentVal is a function here because
  956. // it has to be a function to pass previous merges.
  957. return function mergedDataFn () {
  958. return mergeData(
  959. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  960. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  961. )
  962. }
  963. } else {
  964. return function mergedInstanceDataFn () {
  965. // instance merge
  966. var instanceData = typeof childVal === 'function'
  967. ? childVal.call(vm, vm)
  968. : childVal;
  969. var defaultData = typeof parentVal === 'function'
  970. ? parentVal.call(vm, vm)
  971. : parentVal;
  972. if (instanceData) {
  973. return mergeData(instanceData, defaultData)
  974. } else {
  975. return defaultData
  976. }
  977. }
  978. }
  979. }
  980. strats.data = function (
  981. parentVal,
  982. childVal,
  983. vm
  984. ) {
  985. if (!vm) {
  986. if (childVal && typeof childVal !== 'function') {
  987. return parentVal
  988. }
  989. return mergeDataOrFn(parentVal, childVal)
  990. }
  991. return mergeDataOrFn(parentVal, childVal, vm)
  992. };
  993. /**
  994. * Hooks and props are merged as arrays.
  995. */
  996. function mergeHook (
  997. parentVal,
  998. childVal
  999. ) {
  1000. var res = childVal
  1001. ? parentVal
  1002. ? parentVal.concat(childVal)
  1003. : Array.isArray(childVal)
  1004. ? childVal
  1005. : [childVal]
  1006. : parentVal;
  1007. return res
  1008. ? dedupeHooks(res)
  1009. : res
  1010. }
  1011. function dedupeHooks (hooks) {
  1012. var res = [];
  1013. for (var i = 0; i < hooks.length; i++) {
  1014. if (res.indexOf(hooks[i]) === -1) {
  1015. res.push(hooks[i]);
  1016. }
  1017. }
  1018. return res
  1019. }
  1020. LIFECYCLE_HOOKS.forEach(function (hook) {
  1021. strats[hook] = mergeHook;
  1022. });
  1023. /**
  1024. * Assets
  1025. *
  1026. * When a vm is present (instance creation), we need to do
  1027. * a three-way merge between constructor options, instance
  1028. * options and parent options.
  1029. */
  1030. function mergeAssets (
  1031. parentVal,
  1032. childVal,
  1033. vm,
  1034. key
  1035. ) {
  1036. var res = Object.create(parentVal || null);
  1037. if (childVal) {
  1038. return extend(res, childVal)
  1039. } else {
  1040. return res
  1041. }
  1042. }
  1043. ASSET_TYPES.forEach(function (type) {
  1044. strats[type + 's'] = mergeAssets;
  1045. });
  1046. /**
  1047. * Watchers.
  1048. *
  1049. * Watchers hashes should not overwrite one
  1050. * another, so we merge them as arrays.
  1051. */
  1052. strats.watch = function (
  1053. parentVal,
  1054. childVal,
  1055. vm,
  1056. key
  1057. ) {
  1058. // work around Firefox's Object.prototype.watch...
  1059. if (parentVal === nativeWatch) { parentVal = undefined; }
  1060. if (childVal === nativeWatch) { childVal = undefined; }
  1061. /* istanbul ignore if */
  1062. if (!childVal) { return Object.create(parentVal || null) }
  1063. if (!parentVal) { return childVal }
  1064. var ret = {};
  1065. extend(ret, parentVal);
  1066. for (var key$1 in childVal) {
  1067. var parent = ret[key$1];
  1068. var child = childVal[key$1];
  1069. if (parent && !Array.isArray(parent)) {
  1070. parent = [parent];
  1071. }
  1072. ret[key$1] = parent
  1073. ? parent.concat(child)
  1074. : Array.isArray(child) ? child : [child];
  1075. }
  1076. return ret
  1077. };
  1078. /**
  1079. * Other object hashes.
  1080. */
  1081. strats.props =
  1082. strats.methods =
  1083. strats.inject =
  1084. strats.computed = function (
  1085. parentVal,
  1086. childVal,
  1087. vm,
  1088. key
  1089. ) {
  1090. if (childVal && "production" !== 'production') {
  1091. assertObjectType(key, childVal, vm);
  1092. }
  1093. if (!parentVal) { return childVal }
  1094. var ret = Object.create(null);
  1095. extend(ret, parentVal);
  1096. if (childVal) { extend(ret, childVal); }
  1097. return ret
  1098. };
  1099. strats.provide = mergeDataOrFn;
  1100. /**
  1101. * Default strategy.
  1102. */
  1103. var defaultStrat = function (parentVal, childVal) {
  1104. return childVal === undefined
  1105. ? parentVal
  1106. : childVal
  1107. };
  1108. /**
  1109. * Ensure all props option syntax are normalized into the
  1110. * Object-based format.
  1111. */
  1112. function normalizeProps (options, vm) {
  1113. var props = options.props;
  1114. if (!props) { return }
  1115. var res = {};
  1116. var i, val, name;
  1117. if (Array.isArray(props)) {
  1118. i = props.length;
  1119. while (i--) {
  1120. val = props[i];
  1121. if (typeof val === 'string') {
  1122. name = camelize(val);
  1123. res[name] = { type: null };
  1124. }
  1125. }
  1126. } else if (isPlainObject(props)) {
  1127. for (var key in props) {
  1128. val = props[key];
  1129. name = camelize(key);
  1130. res[name] = isPlainObject(val)
  1131. ? val
  1132. : { type: val };
  1133. }
  1134. }
  1135. options.props = res;
  1136. }
  1137. /**
  1138. * Normalize all injections into Object-based format
  1139. */
  1140. function normalizeInject (options, vm) {
  1141. var inject = options.inject;
  1142. if (!inject) { return }
  1143. var normalized = options.inject = {};
  1144. if (Array.isArray(inject)) {
  1145. for (var i = 0; i < inject.length; i++) {
  1146. normalized[inject[i]] = { from: inject[i] };
  1147. }
  1148. } else if (isPlainObject(inject)) {
  1149. for (var key in inject) {
  1150. var val = inject[key];
  1151. normalized[key] = isPlainObject(val)
  1152. ? extend({ from: key }, val)
  1153. : { from: val };
  1154. }
  1155. }
  1156. }
  1157. /**
  1158. * Normalize raw function directives into object format.
  1159. */
  1160. function normalizeDirectives (options) {
  1161. var dirs = options.directives;
  1162. if (dirs) {
  1163. for (var key in dirs) {
  1164. var def$$1 = dirs[key];
  1165. if (typeof def$$1 === 'function') {
  1166. dirs[key] = { bind: def$$1, update: def$$1 };
  1167. }
  1168. }
  1169. }
  1170. }
  1171. function assertObjectType (name, value, vm) {
  1172. if (!isPlainObject(value)) {
  1173. warn(
  1174. "Invalid value for option \"" + name + "\": expected an Object, " +
  1175. "but got " + (toRawType(value)) + ".",
  1176. vm
  1177. );
  1178. }
  1179. }
  1180. /**
  1181. * Merge two option objects into a new one.
  1182. * Core utility used in both instantiation and inheritance.
  1183. */
  1184. function mergeOptions (
  1185. parent,
  1186. child,
  1187. vm
  1188. ) {
  1189. if (typeof child === 'function') {
  1190. child = child.options;
  1191. }
  1192. normalizeProps(child, vm);
  1193. normalizeInject(child, vm);
  1194. normalizeDirectives(child);
  1195. // Apply extends and mixins on the child options,
  1196. // but only if it is a raw options object that isn't
  1197. // the result of another mergeOptions call.
  1198. // Only merged options has the _base property.
  1199. if (!child._base) {
  1200. if (child.extends) {
  1201. parent = mergeOptions(parent, child.extends, vm);
  1202. }
  1203. if (child.mixins) {
  1204. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1205. parent = mergeOptions(parent, child.mixins[i], vm);
  1206. }
  1207. }
  1208. }
  1209. var options = {};
  1210. var key;
  1211. for (key in parent) {
  1212. mergeField(key);
  1213. }
  1214. for (key in child) {
  1215. if (!hasOwn(parent, key)) {
  1216. mergeField(key);
  1217. }
  1218. }
  1219. function mergeField (key) {
  1220. var strat = strats[key] || defaultStrat;
  1221. options[key] = strat(parent[key], child[key], vm, key);
  1222. }
  1223. return options
  1224. }
  1225. /**
  1226. * Resolve an asset.
  1227. * This function is used because child instances need access
  1228. * to assets defined in its ancestor chain.
  1229. */
  1230. function resolveAsset (
  1231. options,
  1232. type,
  1233. id,
  1234. warnMissing
  1235. ) {
  1236. /* istanbul ignore if */
  1237. if (typeof id !== 'string') {
  1238. return
  1239. }
  1240. var assets = options[type];
  1241. // check local registration variations first
  1242. if (hasOwn(assets, id)) { return assets[id] }
  1243. var camelizedId = camelize(id);
  1244. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1245. var PascalCaseId = capitalize(camelizedId);
  1246. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1247. // fallback to prototype chain
  1248. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1249. return res
  1250. }
  1251. /* */
  1252. function validateProp (
  1253. key,
  1254. propOptions,
  1255. propsData,
  1256. vm
  1257. ) {
  1258. var prop = propOptions[key];
  1259. var absent = !hasOwn(propsData, key);
  1260. var value = propsData[key];
  1261. // boolean casting
  1262. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1263. if (booleanIndex > -1) {
  1264. if (absent && !hasOwn(prop, 'default')) {
  1265. value = false;
  1266. } else if (value === '' || value === hyphenate(key)) {
  1267. // only cast empty string / same name to boolean if
  1268. // boolean has higher priority
  1269. var stringIndex = getTypeIndex(String, prop.type);
  1270. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1271. value = true;
  1272. }
  1273. }
  1274. }
  1275. // check default value
  1276. if (value === undefined) {
  1277. value = getPropDefaultValue(vm, prop, key);
  1278. // since the default value is a fresh copy,
  1279. // make sure to observe it.
  1280. var prevShouldObserve = shouldObserve;
  1281. toggleObserving(true);
  1282. observe(value);
  1283. toggleObserving(prevShouldObserve);
  1284. }
  1285. return value
  1286. }
  1287. /**
  1288. * Get the default value of a prop.
  1289. */
  1290. function getPropDefaultValue (vm, prop, key) {
  1291. // no default, return undefined
  1292. if (!hasOwn(prop, 'default')) {
  1293. return undefined
  1294. }
  1295. var def = prop.default;
  1296. // the raw prop value was also undefined from previous render,
  1297. // return previous default value to avoid unnecessary watcher trigger
  1298. if (vm && vm.$options.propsData &&
  1299. vm.$options.propsData[key] === undefined &&
  1300. vm._props[key] !== undefined
  1301. ) {
  1302. return vm._props[key]
  1303. }
  1304. // call factory function for non-Function types
  1305. // a value is Function if its prototype is function even across different execution context
  1306. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1307. ? def.call(vm)
  1308. : def
  1309. }
  1310. /**
  1311. * Use function string name to check built-in types,
  1312. * because a simple equality check will fail when running
  1313. * across different vms / iframes.
  1314. */
  1315. function getType (fn) {
  1316. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1317. return match ? match[1] : ''
  1318. }
  1319. function isSameType (a, b) {
  1320. return getType(a) === getType(b)
  1321. }
  1322. function getTypeIndex (type, expectedTypes) {
  1323. if (!Array.isArray(expectedTypes)) {
  1324. return isSameType(expectedTypes, type) ? 0 : -1
  1325. }
  1326. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1327. if (isSameType(expectedTypes[i], type)) {
  1328. return i
  1329. }
  1330. }
  1331. return -1
  1332. }
  1333. /* */
  1334. function handleError (err, vm, info) {
  1335. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1336. // See: https://github.com/vuejs/vuex/issues/1505
  1337. pushTarget();
  1338. try {
  1339. if (vm) {
  1340. var cur = vm;
  1341. while ((cur = cur.$parent)) {
  1342. var hooks = cur.$options.errorCaptured;
  1343. if (hooks) {
  1344. for (var i = 0; i < hooks.length; i++) {
  1345. try {
  1346. var capture = hooks[i].call(cur, err, vm, info) === false;
  1347. if (capture) { return }
  1348. } catch (e) {
  1349. globalHandleError(e, cur, 'errorCaptured hook');
  1350. }
  1351. }
  1352. }
  1353. }
  1354. }
  1355. globalHandleError(err, vm, info);
  1356. } finally {
  1357. popTarget();
  1358. }
  1359. }
  1360. function invokeWithErrorHandling (
  1361. handler,
  1362. context,
  1363. args,
  1364. vm,
  1365. info
  1366. ) {
  1367. var res;
  1368. try {
  1369. res = args ? handler.apply(context, args) : handler.call(context);
  1370. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1371. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1372. // issue #9511
  1373. // avoid catch triggering multiple times when nested calls
  1374. res._handled = true;
  1375. }
  1376. } catch (e) {
  1377. handleError(e, vm, info);
  1378. }
  1379. return res
  1380. }
  1381. function globalHandleError (err, vm, info) {
  1382. if (config.errorHandler) {
  1383. try {
  1384. return config.errorHandler.call(null, err, vm, info)
  1385. } catch (e) {
  1386. // if the user intentionally throws the original error in the handler,
  1387. // do not log it twice
  1388. if (e !== err) {
  1389. logError(e, null, 'config.errorHandler');
  1390. }
  1391. }
  1392. }
  1393. logError(err, vm, info);
  1394. }
  1395. function logError (err, vm, info) {
  1396. /* istanbul ignore else */
  1397. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1398. console.error(err);
  1399. } else {
  1400. throw err
  1401. }
  1402. }
  1403. /* */
  1404. var callbacks = [];
  1405. var pending = false;
  1406. function flushCallbacks () {
  1407. pending = false;
  1408. var copies = callbacks.slice(0);
  1409. callbacks.length = 0;
  1410. for (var i = 0; i < copies.length; i++) {
  1411. copies[i]();
  1412. }
  1413. }
  1414. // Here we have async deferring wrappers using microtasks.
  1415. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1416. // However, it has subtle problems when state is changed right before repaint
  1417. // (e.g. #6813, out-in transitions).
  1418. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1419. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1420. // So we now use microtasks everywhere, again.
  1421. // A major drawback of this tradeoff is that there are some scenarios
  1422. // where microtasks have too high a priority and fire in between supposedly
  1423. // sequential events (e.g. #4521, #6690, which have workarounds)
  1424. // or even between bubbling of the same event (#6566).
  1425. // fixed by xxxxxx app-plus 平台 Promise 执行顺序不一致,导致各种乱七八糟的 Bug,统一使用 setTimeout
  1426. var timerFunc = function () {
  1427. setTimeout(flushCallbacks, 0);
  1428. };
  1429. // The nextTick behavior leverages the microtask queue, which can be accessed
  1430. // via either native Promise.then or MutationObserver.
  1431. // MutationObserver has wider support, however it is seriously bugged in
  1432. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1433. // completely stops working after triggering a few times... so, if native
  1434. // Promise is available, we will use it:
  1435. /* istanbul ignore next, $flow-disable-line */
  1436. // if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1437. // const p = Promise.resolve()
  1438. // timerFunc = () => {
  1439. // p.then(flushCallbacks)
  1440. // // In problematic UIWebViews, Promise.then doesn't completely break, but
  1441. // // it can get stuck in a weird state where callbacks are pushed into the
  1442. // // microtask queue but the queue isn't being flushed, until the browser
  1443. // // needs to do some other work, e.g. handle a timer. Therefore we can
  1444. // // "force" the microtask queue to be flushed by adding an empty timer.
  1445. // if (isIOS) setTimeout(noop)
  1446. // }
  1447. // isUsingMicroTask = true
  1448. // } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1449. // isNative(MutationObserver) ||
  1450. // // PhantomJS and iOS 7.x
  1451. // MutationObserver.toString() === '[object MutationObserverConstructor]'
  1452. // )) {
  1453. // // Use MutationObserver where native Promise is not available,
  1454. // // e.g. PhantomJS, iOS7, Android 4.4
  1455. // // (#6466 MutationObserver is unreliable in IE11)
  1456. // let counter = 1
  1457. // const observer = new MutationObserver(flushCallbacks)
  1458. // const textNode = document.createTextNode(String(counter))
  1459. // observer.observe(textNode, {
  1460. // characterData: true
  1461. // })
  1462. // timerFunc = () => {
  1463. // counter = (counter + 1) % 2
  1464. // textNode.data = String(counter)
  1465. // }
  1466. // isUsingMicroTask = true
  1467. // } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1468. // // Fallback to setImmediate.
  1469. // // Technically it leverages the (macro) task queue,
  1470. // // but it is still a better choice than setTimeout.
  1471. // timerFunc = () => {
  1472. // setImmediate(flushCallbacks)
  1473. // }
  1474. // } else {
  1475. // // Fallback to setTimeout.
  1476. // timerFunc = () => {
  1477. // setTimeout(flushCallbacks, 0)
  1478. // }
  1479. // }
  1480. function nextTick (cb, ctx) {
  1481. var _resolve;
  1482. callbacks.push(function () {
  1483. if (cb) {
  1484. try {
  1485. cb.call(ctx);
  1486. } catch (e) {
  1487. handleError(e, ctx, 'nextTick');
  1488. }
  1489. } else if (_resolve) {
  1490. _resolve(ctx);
  1491. }
  1492. });
  1493. if (!pending) {
  1494. pending = true;
  1495. timerFunc();
  1496. }
  1497. // $flow-disable-line
  1498. if (!cb && typeof Promise !== 'undefined') {
  1499. return new Promise(function (resolve) {
  1500. _resolve = resolve;
  1501. })
  1502. }
  1503. }
  1504. /* */
  1505. /* not type checking this file because flow doesn't play well with Proxy */
  1506. /* */
  1507. var seenObjects = new _Set();
  1508. /**
  1509. * Recursively traverse an object to evoke all converted
  1510. * getters, so that every nested property inside the object
  1511. * is collected as a "deep" dependency.
  1512. */
  1513. function traverse (val) {
  1514. _traverse(val, seenObjects);
  1515. seenObjects.clear();
  1516. }
  1517. function _traverse (val, seen) {
  1518. var i, keys;
  1519. var isA = Array.isArray(val);
  1520. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1521. return
  1522. }
  1523. if (val.__ob__) {
  1524. var depId = val.__ob__.dep.id;
  1525. if (seen.has(depId)) {
  1526. return
  1527. }
  1528. seen.add(depId);
  1529. }
  1530. if (isA) {
  1531. i = val.length;
  1532. while (i--) { _traverse(val[i], seen); }
  1533. } else {
  1534. keys = Object.keys(val);
  1535. i = keys.length;
  1536. while (i--) { _traverse(val[keys[i]], seen); }
  1537. }
  1538. }
  1539. /* */
  1540. var normalizeEvent = cached(function (name) {
  1541. var passive = name.charAt(0) === '&';
  1542. name = passive ? name.slice(1) : name;
  1543. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1544. name = once$$1 ? name.slice(1) : name;
  1545. var capture = name.charAt(0) === '!';
  1546. name = capture ? name.slice(1) : name;
  1547. return {
  1548. name: name,
  1549. once: once$$1,
  1550. capture: capture,
  1551. passive: passive
  1552. }
  1553. });
  1554. function createFnInvoker (fns, vm) {
  1555. function invoker () {
  1556. var arguments$1 = arguments;
  1557. var fns = invoker.fns;
  1558. if (Array.isArray(fns)) {
  1559. var cloned = fns.slice();
  1560. for (var i = 0; i < cloned.length; i++) {
  1561. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1562. }
  1563. } else {
  1564. // return handler return value for single handlers
  1565. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1566. }
  1567. }
  1568. invoker.fns = fns;
  1569. return invoker
  1570. }
  1571. function updateListeners (
  1572. on,
  1573. oldOn,
  1574. add,
  1575. remove$$1,
  1576. createOnceHandler,
  1577. vm
  1578. ) {
  1579. var name, def$$1, cur, old, event;
  1580. for (name in on) {
  1581. def$$1 = cur = on[name];
  1582. old = oldOn[name];
  1583. event = normalizeEvent(name);
  1584. if (isUndef(cur)) ; else if (isUndef(old)) {
  1585. if (isUndef(cur.fns)) {
  1586. cur = on[name] = createFnInvoker(cur, vm);
  1587. }
  1588. if (isTrue(event.once)) {
  1589. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  1590. }
  1591. add(event.name, cur, event.capture, event.passive, event.params);
  1592. } else if (cur !== old) {
  1593. old.fns = cur;
  1594. on[name] = old;
  1595. }
  1596. }
  1597. for (name in oldOn) {
  1598. if (isUndef(on[name])) {
  1599. event = normalizeEvent(name);
  1600. remove$$1(event.name, oldOn[name], event.capture);
  1601. }
  1602. }
  1603. }
  1604. /* */
  1605. function mergeVNodeHook (def, hookKey, hook) {
  1606. if (def instanceof VNode) {
  1607. def = def.data.hook || (def.data.hook = {});
  1608. }
  1609. var invoker;
  1610. var oldHook = def[hookKey];
  1611. function wrappedHook () {
  1612. hook.apply(this, arguments);
  1613. // important: remove merged hook to ensure it's called only once
  1614. // and prevent memory leak
  1615. remove(invoker.fns, wrappedHook);
  1616. }
  1617. if (isUndef(oldHook)) {
  1618. // no existing hook
  1619. invoker = createFnInvoker([wrappedHook]);
  1620. } else {
  1621. /* istanbul ignore if */
  1622. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1623. // already a merged invoker
  1624. invoker = oldHook;
  1625. invoker.fns.push(wrappedHook);
  1626. } else {
  1627. // existing plain hook
  1628. invoker = createFnInvoker([oldHook, wrappedHook]);
  1629. }
  1630. }
  1631. invoker.merged = true;
  1632. def[hookKey] = invoker;
  1633. }
  1634. /* */
  1635. // fixed by xxxxxx (mp properties)
  1636. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  1637. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  1638. if (isUndef(propOptions)) {
  1639. return res
  1640. }
  1641. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  1642. var attrs = data.attrs;
  1643. var props = data.props;
  1644. if (isDef(attrs) || isDef(props)) {
  1645. for (var key in propOptions) {
  1646. var altKey = hyphenate(key);
  1647. var result = checkProp(res, props, key, altKey, true) ||
  1648. checkProp(res, attrs, key, altKey, false);
  1649. // externalClass
  1650. if (
  1651. result &&
  1652. res[key] &&
  1653. externalClasses.indexOf(altKey) !== -1 &&
  1654. context[camelize(res[key])]
  1655. ) {
  1656. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  1657. res[key] = context[camelize(res[key])];
  1658. }
  1659. }
  1660. }
  1661. return res
  1662. }
  1663. function extractPropsFromVNodeData (
  1664. data,
  1665. Ctor,
  1666. tag,
  1667. context// fixed by xxxxxx
  1668. ) {
  1669. // we are only extracting raw values here.
  1670. // validation and default values are handled in the child
  1671. // component itself.
  1672. var propOptions = Ctor.options.props;
  1673. if (isUndef(propOptions)) {
  1674. // fixed by xxxxxx
  1675. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  1676. }
  1677. var res = {};
  1678. var attrs = data.attrs;
  1679. var props = data.props;
  1680. if (isDef(attrs) || isDef(props)) {
  1681. for (var key in propOptions) {
  1682. var altKey = hyphenate(key);
  1683. checkProp(res, props, key, altKey, true) ||
  1684. checkProp(res, attrs, key, altKey, false);
  1685. }
  1686. }
  1687. // fixed by xxxxxx
  1688. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  1689. }
  1690. function checkProp (
  1691. res,
  1692. hash,
  1693. key,
  1694. altKey,
  1695. preserve
  1696. ) {
  1697. if (isDef(hash)) {
  1698. if (hasOwn(hash, key)) {
  1699. res[key] = hash[key];
  1700. if (!preserve) {
  1701. delete hash[key];
  1702. }
  1703. return true
  1704. } else if (hasOwn(hash, altKey)) {
  1705. res[key] = hash[altKey];
  1706. if (!preserve) {
  1707. delete hash[altKey];
  1708. }
  1709. return true
  1710. }
  1711. }
  1712. return false
  1713. }
  1714. /* */
  1715. // The template compiler attempts to minimize the need for normalization by
  1716. // statically analyzing the template at compile time.
  1717. //
  1718. // For plain HTML markup, normalization can be completely skipped because the
  1719. // generated render function is guaranteed to return Array<VNode>. There are
  1720. // two cases where extra normalization is needed:
  1721. // 1. When the children contains components - because a functional component
  1722. // may return an Array instead of a single root. In this case, just a simple
  1723. // normalization is needed - if any child is an Array, we flatten the whole
  1724. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1725. // because functional components already normalize their own children.
  1726. function simpleNormalizeChildren (children) {
  1727. for (var i = 0; i < children.length; i++) {
  1728. if (Array.isArray(children[i])) {
  1729. return Array.prototype.concat.apply([], children)
  1730. }
  1731. }
  1732. return children
  1733. }
  1734. // 2. When the children contains constructs that always generated nested Arrays,
  1735. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1736. // with hand-written render functions / JSX. In such cases a full normalization
  1737. // is needed to cater to all possible types of children values.
  1738. function normalizeChildren (children) {
  1739. return isPrimitive(children)
  1740. ? [createTextVNode(children)]
  1741. : Array.isArray(children)
  1742. ? normalizeArrayChildren(children)
  1743. : undefined
  1744. }
  1745. function isTextNode (node) {
  1746. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  1747. }
  1748. function normalizeArrayChildren (children, nestedIndex) {
  1749. var res = [];
  1750. var i, c, lastIndex, last;
  1751. for (i = 0; i < children.length; i++) {
  1752. c = children[i];
  1753. if (isUndef(c) || typeof c === 'boolean') { continue }
  1754. lastIndex = res.length - 1;
  1755. last = res[lastIndex];
  1756. // nested
  1757. if (Array.isArray(c)) {
  1758. if (c.length > 0) {
  1759. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  1760. // merge adjacent text nodes
  1761. if (isTextNode(c[0]) && isTextNode(last)) {
  1762. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  1763. c.shift();
  1764. }
  1765. res.push.apply(res, c);
  1766. }
  1767. } else if (isPrimitive(c)) {
  1768. if (isTextNode(last)) {
  1769. // merge adjacent text nodes
  1770. // this is necessary for SSR hydration because text nodes are
  1771. // essentially merged when rendered to HTML strings
  1772. res[lastIndex] = createTextVNode(last.text + c);
  1773. } else if (c !== '') {
  1774. // convert primitive to vnode
  1775. res.push(createTextVNode(c));
  1776. }
  1777. } else {
  1778. if (isTextNode(c) && isTextNode(last)) {
  1779. // merge adjacent text nodes
  1780. res[lastIndex] = createTextVNode(last.text + c.text);
  1781. } else {
  1782. // default key for nested array children (likely generated by v-for)
  1783. if (isTrue(children._isVList) &&
  1784. isDef(c.tag) &&
  1785. isUndef(c.key) &&
  1786. isDef(nestedIndex)) {
  1787. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  1788. }
  1789. res.push(c);
  1790. }
  1791. }
  1792. }
  1793. return res
  1794. }
  1795. /* */
  1796. function initProvide (vm) {
  1797. var provide = vm.$options.provide;
  1798. if (provide) {
  1799. vm._provided = typeof provide === 'function'
  1800. ? provide.call(vm)
  1801. : provide;
  1802. }
  1803. }
  1804. function initInjections (vm) {
  1805. var result = resolveInject(vm.$options.inject, vm);
  1806. if (result) {
  1807. toggleObserving(false);
  1808. Object.keys(result).forEach(function (key) {
  1809. /* istanbul ignore else */
  1810. {
  1811. defineReactive$$1(vm, key, result[key]);
  1812. }
  1813. });
  1814. toggleObserving(true);
  1815. }
  1816. }
  1817. function resolveInject (inject, vm) {
  1818. if (inject) {
  1819. // inject is :any because flow is not smart enough to figure out cached
  1820. var result = Object.create(null);
  1821. var keys = hasSymbol
  1822. ? Reflect.ownKeys(inject)
  1823. : Object.keys(inject);
  1824. for (var i = 0; i < keys.length; i++) {
  1825. var key = keys[i];
  1826. // #6574 in case the inject object is observed...
  1827. if (key === '__ob__') { continue }
  1828. var provideKey = inject[key].from;
  1829. var source = vm;
  1830. while (source) {
  1831. if (source._provided && hasOwn(source._provided, provideKey)) {
  1832. result[key] = source._provided[provideKey];
  1833. break
  1834. }
  1835. source = source.$parent;
  1836. }
  1837. if (!source) {
  1838. if ('default' in inject[key]) {
  1839. var provideDefault = inject[key].default;
  1840. result[key] = typeof provideDefault === 'function'
  1841. ? provideDefault.call(vm)
  1842. : provideDefault;
  1843. }
  1844. }
  1845. }
  1846. return result
  1847. }
  1848. }
  1849. /* */
  1850. /**
  1851. * Runtime helper for resolving raw children VNodes into a slot object.
  1852. */
  1853. function resolveSlots (
  1854. children,
  1855. context
  1856. ) {
  1857. if (!children || !children.length) {
  1858. return {}
  1859. }
  1860. var slots = {};
  1861. for (var i = 0, l = children.length; i < l; i++) {
  1862. var child = children[i];
  1863. var data = child.data;
  1864. // remove slot attribute if the node is resolved as a Vue slot node
  1865. if (data && data.attrs && data.attrs.slot) {
  1866. delete data.attrs.slot;
  1867. }
  1868. // named slots should only be respected if the vnode was rendered in the
  1869. // same context.
  1870. if ((child.context === context || child.fnContext === context) &&
  1871. data && data.slot != null
  1872. ) {
  1873. var name = data.slot;
  1874. var slot = (slots[name] || (slots[name] = []));
  1875. if (child.tag === 'template') {
  1876. slot.push.apply(slot, child.children || []);
  1877. } else {
  1878. slot.push(child);
  1879. }
  1880. } else {
  1881. (slots.default || (slots.default = [])).push(child);
  1882. }
  1883. }
  1884. // ignore slots that contains only whitespace
  1885. for (var name$1 in slots) {
  1886. if (slots[name$1].every(isWhitespace)) {
  1887. delete slots[name$1];
  1888. }
  1889. }
  1890. return slots
  1891. }
  1892. function isWhitespace (node) {
  1893. return (node.isComment && !node.asyncFactory) || node.text === ' '
  1894. }
  1895. /* */
  1896. function normalizeScopedSlots (
  1897. slots,
  1898. normalSlots,
  1899. prevSlots
  1900. ) {
  1901. var res;
  1902. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  1903. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  1904. var key = slots && slots.$key;
  1905. if (!slots) {
  1906. res = {};
  1907. } else if (slots._normalized) {
  1908. // fast path 1: child component re-render only, parent did not change
  1909. return slots._normalized
  1910. } else if (
  1911. isStable &&
  1912. prevSlots &&
  1913. prevSlots !== emptyObject &&
  1914. key === prevSlots.$key &&
  1915. !hasNormalSlots &&
  1916. !prevSlots.$hasNormal
  1917. ) {
  1918. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  1919. // only need to normalize once
  1920. return prevSlots
  1921. } else {
  1922. res = {};
  1923. for (var key$1 in slots) {
  1924. if (slots[key$1] && key$1[0] !== '$') {
  1925. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  1926. }
  1927. }
  1928. }
  1929. // expose normal slots on scopedSlots
  1930. for (var key$2 in normalSlots) {
  1931. if (!(key$2 in res)) {
  1932. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  1933. }
  1934. }
  1935. // avoriaz seems to mock a non-extensible $scopedSlots object
  1936. // and when that is passed down this would cause an error
  1937. if (slots && Object.isExtensible(slots)) {
  1938. (slots)._normalized = res;
  1939. }
  1940. def(res, '$stable', isStable);
  1941. def(res, '$key', key);
  1942. def(res, '$hasNormal', hasNormalSlots);
  1943. return res
  1944. }
  1945. function normalizeScopedSlot(normalSlots, key, fn) {
  1946. var normalized = function () {
  1947. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  1948. res = res && typeof res === 'object' && !Array.isArray(res)
  1949. ? [res] // single vnode
  1950. : normalizeChildren(res);
  1951. return res && (
  1952. res.length === 0 ||
  1953. (res.length === 1 && res[0].isComment) // #9658
  1954. ) ? undefined
  1955. : res
  1956. };
  1957. // this is a slot using the new v-slot syntax without scope. although it is
  1958. // compiled as a scoped slot, render fn users would expect it to be present
  1959. // on this.$slots because the usage is semantically a normal slot.
  1960. if (fn.proxy) {
  1961. Object.defineProperty(normalSlots, key, {
  1962. get: normalized,
  1963. enumerable: true,
  1964. configurable: true
  1965. });
  1966. }
  1967. return normalized
  1968. }
  1969. function proxyNormalSlot(slots, key) {
  1970. return function () { return slots[key]; }
  1971. }
  1972. /* */
  1973. /**
  1974. * Runtime helper for rendering v-for lists.
  1975. */
  1976. function renderList (
  1977. val,
  1978. render
  1979. ) {
  1980. var ret, i, l, keys, key;
  1981. if (Array.isArray(val) || typeof val === 'string') {
  1982. ret = new Array(val.length);
  1983. for (i = 0, l = val.length; i < l; i++) {
  1984. ret[i] = render(val[i], i, i, i);
  1985. }
  1986. } else if (typeof val === 'number') {
  1987. ret = new Array(val);
  1988. for (i = 0; i < val; i++) {
  1989. ret[i] = render(i + 1, i, i, i);
  1990. }
  1991. } else if (isObject(val)) {
  1992. if (hasSymbol && val[Symbol.iterator]) {
  1993. ret = [];
  1994. var iterator = val[Symbol.iterator]();
  1995. var result = iterator.next();
  1996. i = 0;
  1997. while (!result.done) {
  1998. ret.push(render(result.value, ret.length, i++, i));
  1999. result = iterator.next();
  2000. }
  2001. } else {
  2002. keys = Object.keys(val);
  2003. ret = new Array(keys.length);
  2004. for (i = 0, l = keys.length; i < l; i++) {
  2005. key = keys[i];
  2006. ret[i] = render(val[key], key, i, i);
  2007. }
  2008. }
  2009. }
  2010. if (!isDef(ret)) {
  2011. ret = [];
  2012. }
  2013. (ret)._isVList = true;
  2014. return ret
  2015. }
  2016. /* */
  2017. /**
  2018. * Runtime helper for rendering <slot>
  2019. */
  2020. function renderSlot (
  2021. name,
  2022. fallback,
  2023. props,
  2024. bindObject
  2025. ) {
  2026. var scopedSlotFn = this.$scopedSlots[name];
  2027. var nodes;
  2028. if (scopedSlotFn) { // scoped slot
  2029. props = props || {};
  2030. if (bindObject) {
  2031. props = extend(extend({}, bindObject), props);
  2032. }
  2033. // fixed by xxxxxx app-plus scopedSlot
  2034. nodes = scopedSlotFn(props, this, props._i) || fallback;
  2035. } else {
  2036. nodes = this.$slots[name] || fallback;
  2037. }
  2038. var target = props && props.slot;
  2039. if (target) {
  2040. return this.$createElement('template', { slot: target }, nodes)
  2041. } else {
  2042. return nodes
  2043. }
  2044. }
  2045. /* */
  2046. /**
  2047. * Runtime helper for resolving filters
  2048. */
  2049. function resolveFilter (id) {
  2050. return resolveAsset(this.$options, 'filters', id, true) || identity
  2051. }
  2052. /* */
  2053. function isKeyNotMatch (expect, actual) {
  2054. if (Array.isArray(expect)) {
  2055. return expect.indexOf(actual) === -1
  2056. } else {
  2057. return expect !== actual
  2058. }
  2059. }
  2060. /**
  2061. * Runtime helper for checking keyCodes from config.
  2062. * exposed as Vue.prototype._k
  2063. * passing in eventKeyName as last argument separately for backwards compat
  2064. */
  2065. function checkKeyCodes (
  2066. eventKeyCode,
  2067. key,
  2068. builtInKeyCode,
  2069. eventKeyName,
  2070. builtInKeyName
  2071. ) {
  2072. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2073. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2074. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2075. } else if (mappedKeyCode) {
  2076. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2077. } else if (eventKeyName) {
  2078. return hyphenate(eventKeyName) !== key
  2079. }
  2080. }
  2081. /* */
  2082. /**
  2083. * Runtime helper for merging v-bind="object" into a VNode's data.
  2084. */
  2085. function bindObjectProps (
  2086. data,
  2087. tag,
  2088. value,
  2089. asProp,
  2090. isSync
  2091. ) {
  2092. if (value) {
  2093. if (!isObject(value)) ; else {
  2094. if (Array.isArray(value)) {
  2095. value = toObject(value);
  2096. }
  2097. var hash;
  2098. var loop = function ( key ) {
  2099. if (
  2100. key === 'class' ||
  2101. key === 'style' ||
  2102. isReservedAttribute(key)
  2103. ) {
  2104. hash = data;
  2105. } else {
  2106. var type = data.attrs && data.attrs.type;
  2107. hash = asProp || config.mustUseProp(tag, type, key)
  2108. ? data.domProps || (data.domProps = {})
  2109. : data.attrs || (data.attrs = {});
  2110. }
  2111. var camelizedKey = camelize(key);
  2112. var hyphenatedKey = hyphenate(key);
  2113. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2114. hash[key] = value[key];
  2115. if (isSync) {
  2116. var on = data.on || (data.on = {});
  2117. on[("update:" + key)] = function ($event) {
  2118. value[key] = $event;
  2119. };
  2120. }
  2121. }
  2122. };
  2123. for (var key in value) loop( key );
  2124. }
  2125. }
  2126. return data
  2127. }
  2128. /* */
  2129. /**
  2130. * Runtime helper for rendering static trees.
  2131. */
  2132. function renderStatic (
  2133. index,
  2134. isInFor
  2135. ) {
  2136. var cached = this._staticTrees || (this._staticTrees = []);
  2137. var tree = cached[index];
  2138. // if has already-rendered static tree and not inside v-for,
  2139. // we can reuse the same tree.
  2140. if (tree && !isInFor) {
  2141. return tree
  2142. }
  2143. // otherwise, render a fresh tree.
  2144. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2145. this._renderProxy,
  2146. null,
  2147. this // for render fns generated for functional component templates
  2148. );
  2149. markStatic(tree, ("__static__" + index), false);
  2150. return tree
  2151. }
  2152. /**
  2153. * Runtime helper for v-once.
  2154. * Effectively it means marking the node as static with a unique key.
  2155. */
  2156. function markOnce (
  2157. tree,
  2158. index,
  2159. key
  2160. ) {
  2161. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2162. return tree
  2163. }
  2164. function markStatic (
  2165. tree,
  2166. key,
  2167. isOnce
  2168. ) {
  2169. if (Array.isArray(tree)) {
  2170. for (var i = 0; i < tree.length; i++) {
  2171. if (tree[i] && typeof tree[i] !== 'string') {
  2172. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2173. }
  2174. }
  2175. } else {
  2176. markStaticNode(tree, key, isOnce);
  2177. }
  2178. }
  2179. function markStaticNode (node, key, isOnce) {
  2180. node.isStatic = true;
  2181. node.key = key;
  2182. node.isOnce = isOnce;
  2183. }
  2184. /* */
  2185. function bindObjectListeners (data, value) {
  2186. if (value) {
  2187. if (!isPlainObject(value)) ; else {
  2188. var on = data.on = data.on ? extend({}, data.on) : {};
  2189. for (var key in value) {
  2190. var existing = on[key];
  2191. var ours = value[key];
  2192. on[key] = existing ? [].concat(existing, ours) : ours;
  2193. }
  2194. }
  2195. }
  2196. return data
  2197. }
  2198. /* */
  2199. function resolveScopedSlots (
  2200. fns, // see flow/vnode
  2201. res,
  2202. // the following are added in 2.6
  2203. hasDynamicKeys,
  2204. contentHashKey
  2205. ) {
  2206. res = res || { $stable: !hasDynamicKeys };
  2207. for (var i = 0; i < fns.length; i++) {
  2208. var slot = fns[i];
  2209. if (Array.isArray(slot)) {
  2210. resolveScopedSlots(slot, res, hasDynamicKeys);
  2211. } else if (slot) {
  2212. // marker for reverse proxying v-slot without scope on this.$slots
  2213. if (slot.proxy) {
  2214. slot.fn.proxy = true;
  2215. }
  2216. res[slot.key] = slot.fn;
  2217. }
  2218. }
  2219. if (contentHashKey) {
  2220. (res).$key = contentHashKey;
  2221. }
  2222. return res
  2223. }
  2224. /* */
  2225. function bindDynamicKeys (baseObj, values) {
  2226. for (var i = 0; i < values.length; i += 2) {
  2227. var key = values[i];
  2228. if (typeof key === 'string' && key) {
  2229. baseObj[values[i]] = values[i + 1];
  2230. }
  2231. }
  2232. return baseObj
  2233. }
  2234. // helper to dynamically append modifier runtime markers to event names.
  2235. // ensure only append when value is already string, otherwise it will be cast
  2236. // to string and cause the type check to miss.
  2237. function prependModifier (value, symbol) {
  2238. return typeof value === 'string' ? symbol + value : value
  2239. }
  2240. /* */
  2241. function installRenderHelpers (target) {
  2242. target._o = markOnce;
  2243. target._n = toNumber;
  2244. target._s = toString;
  2245. target._l = renderList;
  2246. target._t = renderSlot;
  2247. target._q = looseEqual;
  2248. target._i = looseIndexOf;
  2249. target._m = renderStatic;
  2250. target._f = resolveFilter;
  2251. target._k = checkKeyCodes;
  2252. target._b = bindObjectProps;
  2253. target._v = createTextVNode;
  2254. target._e = createEmptyVNode;
  2255. target._u = resolveScopedSlots;
  2256. target._g = bindObjectListeners;
  2257. target._d = bindDynamicKeys;
  2258. target._p = prependModifier;
  2259. }
  2260. /* */
  2261. function FunctionalRenderContext (
  2262. data,
  2263. props,
  2264. children,
  2265. parent,
  2266. Ctor
  2267. ) {
  2268. var this$1 = this;
  2269. var options = Ctor.options;
  2270. // ensure the createElement function in functional components
  2271. // gets a unique context - this is necessary for correct named slot check
  2272. var contextVm;
  2273. if (hasOwn(parent, '_uid')) {
  2274. contextVm = Object.create(parent);
  2275. // $flow-disable-line
  2276. contextVm._original = parent;
  2277. } else {
  2278. // the context vm passed in is a functional context as well.
  2279. // in this case we want to make sure we are able to get a hold to the
  2280. // real context instance.
  2281. contextVm = parent;
  2282. // $flow-disable-line
  2283. parent = parent._original;
  2284. }
  2285. var isCompiled = isTrue(options._compiled);
  2286. var needNormalization = !isCompiled;
  2287. this.data = data;
  2288. this.props = props;
  2289. this.children = children;
  2290. this.parent = parent;
  2291. this.listeners = data.on || emptyObject;
  2292. this.injections = resolveInject(options.inject, parent);
  2293. this.slots = function () {
  2294. if (!this$1.$slots) {
  2295. normalizeScopedSlots(
  2296. data.scopedSlots,
  2297. this$1.$slots = resolveSlots(children, parent)
  2298. );
  2299. }
  2300. return this$1.$slots
  2301. };
  2302. Object.defineProperty(this, 'scopedSlots', ({
  2303. enumerable: true,
  2304. get: function get () {
  2305. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2306. }
  2307. }));
  2308. // support for compiled functional template
  2309. if (isCompiled) {
  2310. // exposing $options for renderStatic()
  2311. this.$options = options;
  2312. // pre-resolve slots for renderSlot()
  2313. this.$slots = this.slots();
  2314. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2315. }
  2316. if (options._scopeId) {
  2317. this._c = function (a, b, c, d) {
  2318. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2319. if (vnode && !Array.isArray(vnode)) {
  2320. vnode.fnScopeId = options._scopeId;
  2321. vnode.fnContext = parent;
  2322. }
  2323. return vnode
  2324. };
  2325. } else {
  2326. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2327. }
  2328. }
  2329. installRenderHelpers(FunctionalRenderContext.prototype);
  2330. function createFunctionalComponent (
  2331. Ctor,
  2332. propsData,
  2333. data,
  2334. contextVm,
  2335. children
  2336. ) {
  2337. var options = Ctor.options;
  2338. var props = {};
  2339. var propOptions = options.props;
  2340. if (isDef(propOptions)) {
  2341. for (var key in propOptions) {
  2342. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2343. }
  2344. } else {
  2345. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2346. if (isDef(data.props)) { mergeProps(props, data.props); }
  2347. }
  2348. var renderContext = new FunctionalRenderContext(
  2349. data,
  2350. props,
  2351. children,
  2352. contextVm,
  2353. Ctor
  2354. );
  2355. var vnode = options.render.call(null, renderContext._c, renderContext);
  2356. if (vnode instanceof VNode) {
  2357. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2358. } else if (Array.isArray(vnode)) {
  2359. var vnodes = normalizeChildren(vnode) || [];
  2360. var res = new Array(vnodes.length);
  2361. for (var i = 0; i < vnodes.length; i++) {
  2362. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2363. }
  2364. return res
  2365. }
  2366. }
  2367. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2368. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2369. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2370. // that should not be matched to match.
  2371. var clone = cloneVNode(vnode);
  2372. clone.fnContext = contextVm;
  2373. clone.fnOptions = options;
  2374. if (data.slot) {
  2375. (clone.data || (clone.data = {})).slot = data.slot;
  2376. }
  2377. return clone
  2378. }
  2379. function mergeProps (to, from) {
  2380. for (var key in from) {
  2381. to[camelize(key)] = from[key];
  2382. }
  2383. }
  2384. /* */
  2385. /* */
  2386. /* */
  2387. /* */
  2388. // inline hooks to be invoked on component VNodes during patch
  2389. var componentVNodeHooks = {
  2390. init: function init (vnode, hydrating) {
  2391. if (
  2392. vnode.componentInstance &&
  2393. !vnode.componentInstance._isDestroyed &&
  2394. vnode.data.keepAlive
  2395. ) {
  2396. // kept-alive components, treat as a patch
  2397. var mountedNode = vnode; // work around flow
  2398. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2399. } else {
  2400. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2401. vnode,
  2402. activeInstance
  2403. );
  2404. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2405. }
  2406. },
  2407. prepatch: function prepatch (oldVnode, vnode) {
  2408. var options = vnode.componentOptions;
  2409. var child = vnode.componentInstance = oldVnode.componentInstance;
  2410. updateChildComponent(
  2411. child,
  2412. options.propsData, // updated props
  2413. options.listeners, // updated listeners
  2414. vnode, // new parent vnode
  2415. options.children // new children
  2416. );
  2417. },
  2418. insert: function insert (vnode) {
  2419. var context = vnode.context;
  2420. var componentInstance = vnode.componentInstance;
  2421. if (!componentInstance._isMounted) {
  2422. // fixed by xxxxxx
  2423. componentInstance._isMounted = true;
  2424. if (componentInstance._$vd) {// 延迟 mounted
  2425. callHook(componentInstance, 'onServiceCreated');
  2426. callHook(componentInstance, 'onServiceAttached');
  2427. componentInstance._$vd.addMountedVm(componentInstance);
  2428. } else {
  2429. callHook(componentInstance, 'mounted');
  2430. }
  2431. }
  2432. if (vnode.data.keepAlive) {
  2433. if (context._isMounted) {
  2434. // vue-router#1212
  2435. // During updates, a kept-alive component's child components may
  2436. // change, so directly walking the tree here may call activated hooks
  2437. // on incorrect children. Instead we push them into a queue which will
  2438. // be processed after the whole patch process ended.
  2439. queueActivatedComponent(componentInstance);
  2440. } else {
  2441. activateChildComponent(componentInstance, true /* direct */);
  2442. }
  2443. }
  2444. },
  2445. destroy: function destroy (vnode) {
  2446. var componentInstance = vnode.componentInstance;
  2447. if (!componentInstance._isDestroyed) {
  2448. if (!vnode.data.keepAlive) {
  2449. componentInstance.$destroy();
  2450. } else {
  2451. deactivateChildComponent(componentInstance, true /* direct */);
  2452. }
  2453. }
  2454. }
  2455. };
  2456. var hooksToMerge = Object.keys(componentVNodeHooks);
  2457. function createComponent (
  2458. Ctor,
  2459. data,
  2460. context,
  2461. children,
  2462. tag
  2463. ) {
  2464. if (isUndef(Ctor)) {
  2465. return
  2466. }
  2467. var baseCtor = context.$options._base;
  2468. // plain options object: turn it into a constructor
  2469. if (isObject(Ctor)) {
  2470. Ctor = baseCtor.extend(Ctor);
  2471. }
  2472. // if at this stage it's not a constructor or an async component factory,
  2473. // reject.
  2474. if (typeof Ctor !== 'function') {
  2475. return
  2476. }
  2477. // async component
  2478. var asyncFactory;
  2479. if (isUndef(Ctor.cid)) {
  2480. asyncFactory = Ctor;
  2481. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2482. if (Ctor === undefined) {
  2483. // return a placeholder node for async component, which is rendered
  2484. // as a comment node but preserves all the raw information for the node.
  2485. // the information will be used for async server-rendering and hydration.
  2486. return createAsyncPlaceholder(
  2487. asyncFactory,
  2488. data,
  2489. context,
  2490. children,
  2491. tag
  2492. )
  2493. }
  2494. }
  2495. data = data || {};
  2496. // resolve constructor options in case global mixins are applied after
  2497. // component constructor creation
  2498. resolveConstructorOptions(Ctor);
  2499. // transform component v-model data into props & events
  2500. if (isDef(data.model)) {
  2501. transformModel(Ctor.options, data);
  2502. }
  2503. // extract props
  2504. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  2505. // functional component
  2506. if (isTrue(Ctor.options.functional)) {
  2507. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2508. }
  2509. // extract listeners, since these needs to be treated as
  2510. // child component listeners instead of DOM listeners
  2511. var listeners = data.on;
  2512. // replace with listeners with .native modifier
  2513. // so it gets processed during parent component patch.
  2514. data.on = data.nativeOn;
  2515. if (isTrue(Ctor.options.abstract)) {
  2516. // abstract components do not keep anything
  2517. // other than props & listeners & slot
  2518. // work around flow
  2519. var slot = data.slot;
  2520. data = {};
  2521. if (slot) {
  2522. data.slot = slot;
  2523. }
  2524. }
  2525. // install component management hooks onto the placeholder node
  2526. installComponentHooks(data);
  2527. // return a placeholder vnode
  2528. var name = Ctor.options.name || tag;
  2529. var vnode = new VNode(
  2530. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2531. data, undefined, undefined, undefined, context,
  2532. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2533. asyncFactory
  2534. );
  2535. return vnode
  2536. }
  2537. function createComponentInstanceForVnode (
  2538. vnode, // we know it's MountedComponentVNode but flow doesn't
  2539. parent // activeInstance in lifecycle state
  2540. ) {
  2541. var options = {
  2542. _isComponent: true,
  2543. _parentVnode: vnode,
  2544. parent: parent
  2545. };
  2546. // check inline-template render functions
  2547. var inlineTemplate = vnode.data.inlineTemplate;
  2548. if (isDef(inlineTemplate)) {
  2549. options.render = inlineTemplate.render;
  2550. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2551. }
  2552. return new vnode.componentOptions.Ctor(options)
  2553. }
  2554. function installComponentHooks (data) {
  2555. var hooks = data.hook || (data.hook = {});
  2556. for (var i = 0; i < hooksToMerge.length; i++) {
  2557. var key = hooksToMerge[i];
  2558. var existing = hooks[key];
  2559. var toMerge = componentVNodeHooks[key];
  2560. if (existing !== toMerge && !(existing && existing._merged)) {
  2561. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2562. }
  2563. }
  2564. }
  2565. function mergeHook$1 (f1, f2) {
  2566. var merged = function (a, b) {
  2567. // flow complains about extra args which is why we use any
  2568. f1(a, b);
  2569. f2(a, b);
  2570. };
  2571. merged._merged = true;
  2572. return merged
  2573. }
  2574. // transform component v-model info (value and callback) into
  2575. // prop and event handler respectively.
  2576. function transformModel (options, data) {
  2577. var prop = (options.model && options.model.prop) || 'value';
  2578. var event = (options.model && options.model.event) || 'input'
  2579. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  2580. var on = data.on || (data.on = {});
  2581. var existing = on[event];
  2582. var callback = data.model.callback;
  2583. if (isDef(existing)) {
  2584. if (
  2585. Array.isArray(existing)
  2586. ? existing.indexOf(callback) === -1
  2587. : existing !== callback
  2588. ) {
  2589. on[event] = [callback].concat(existing);
  2590. }
  2591. } else {
  2592. on[event] = callback;
  2593. }
  2594. }
  2595. /* */
  2596. var SIMPLE_NORMALIZE = 1;
  2597. var ALWAYS_NORMALIZE = 2;
  2598. // wrapper function for providing a more flexible interface
  2599. // without getting yelled at by flow
  2600. function createElement (
  2601. context,
  2602. tag,
  2603. data,
  2604. children,
  2605. normalizationType,
  2606. alwaysNormalize
  2607. ) {
  2608. if (Array.isArray(data) || isPrimitive(data)) {
  2609. normalizationType = children;
  2610. children = data;
  2611. data = undefined;
  2612. }
  2613. if (isTrue(alwaysNormalize)) {
  2614. normalizationType = ALWAYS_NORMALIZE;
  2615. }
  2616. return _createElement(context, tag, data, children, normalizationType)
  2617. }
  2618. function _createElement (
  2619. context,
  2620. tag,
  2621. data,
  2622. children,
  2623. normalizationType
  2624. ) {
  2625. if (isDef(data) && isDef((data).__ob__)) {
  2626. return createEmptyVNode()
  2627. }
  2628. // object syntax in v-bind
  2629. if (isDef(data) && isDef(data.is)) {
  2630. tag = data.is;
  2631. }
  2632. if (!tag) {
  2633. // in case of component :is set to falsy value
  2634. return createEmptyVNode()
  2635. }
  2636. // support single function children as default scoped slot
  2637. if (Array.isArray(children) &&
  2638. typeof children[0] === 'function'
  2639. ) {
  2640. data = data || {};
  2641. data.scopedSlots = { default: children[0] };
  2642. children.length = 0;
  2643. }
  2644. if (normalizationType === ALWAYS_NORMALIZE) {
  2645. children = normalizeChildren(children);
  2646. } else if (normalizationType === SIMPLE_NORMALIZE) {
  2647. children = simpleNormalizeChildren(children);
  2648. }
  2649. var vnode, ns;
  2650. if (typeof tag === 'string') {
  2651. var Ctor;
  2652. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  2653. if (config.isReservedTag(tag)) {
  2654. vnode = new VNode(
  2655. config.parsePlatformTagName(tag), data, children,
  2656. undefined, undefined, context
  2657. );
  2658. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  2659. // component
  2660. vnode = createComponent(Ctor, data, context, children, tag);
  2661. } else {
  2662. // unknown or unlisted namespaced elements
  2663. // check at runtime because it may get assigned a namespace when its
  2664. // parent normalizes children
  2665. vnode = new VNode(
  2666. tag, data, children,
  2667. undefined, undefined, context
  2668. );
  2669. }
  2670. } else {
  2671. // direct component options / constructor
  2672. vnode = createComponent(tag, data, context, children);
  2673. }
  2674. if (Array.isArray(vnode)) {
  2675. return vnode
  2676. } else if (isDef(vnode)) {
  2677. if (isDef(ns)) { applyNS(vnode, ns); }
  2678. if (isDef(data)) { registerDeepBindings(data); }
  2679. return vnode
  2680. } else {
  2681. return createEmptyVNode()
  2682. }
  2683. }
  2684. function applyNS (vnode, ns, force) {
  2685. vnode.ns = ns;
  2686. if (vnode.tag === 'foreignObject') {
  2687. // use default namespace inside foreignObject
  2688. ns = undefined;
  2689. force = true;
  2690. }
  2691. if (isDef(vnode.children)) {
  2692. for (var i = 0, l = vnode.children.length; i < l; i++) {
  2693. var child = vnode.children[i];
  2694. if (isDef(child.tag) && (
  2695. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  2696. applyNS(child, ns, force);
  2697. }
  2698. }
  2699. }
  2700. }
  2701. // ref #5318
  2702. // necessary to ensure parent re-render when deep bindings like :style and
  2703. // :class are used on slot nodes
  2704. function registerDeepBindings (data) {
  2705. if (isObject(data.style)) {
  2706. traverse(data.style);
  2707. }
  2708. if (isObject(data.class)) {
  2709. traverse(data.class);
  2710. }
  2711. }
  2712. /* */
  2713. function initRender (vm) {
  2714. vm._vnode = null; // the root of the child tree
  2715. vm._staticTrees = null; // v-once cached trees
  2716. var options = vm.$options;
  2717. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  2718. var renderContext = parentVnode && parentVnode.context;
  2719. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  2720. vm.$scopedSlots = emptyObject;
  2721. // bind the createElement fn to this instance
  2722. // so that we get proper render context inside it.
  2723. // args order: tag, data, children, normalizationType, alwaysNormalize
  2724. // internal version is used by render functions compiled from templates
  2725. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  2726. // normalization is always applied for the public version, used in
  2727. // user-written render functions.
  2728. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  2729. // $attrs & $listeners are exposed for easier HOC creation.
  2730. // they need to be reactive so that HOCs using them are always updated
  2731. var parentData = parentVnode && parentVnode.data;
  2732. /* istanbul ignore else */
  2733. {
  2734. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  2735. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  2736. }
  2737. }
  2738. var currentRenderingInstance = null;
  2739. function renderMixin (Vue) {
  2740. // install runtime convenience helpers
  2741. installRenderHelpers(Vue.prototype);
  2742. Vue.prototype.$nextTick = function (fn) {
  2743. return nextTick(fn, this)
  2744. };
  2745. Vue.prototype._render = function () {
  2746. var vm = this;
  2747. var ref = vm.$options;
  2748. var render = ref.render;
  2749. var _parentVnode = ref._parentVnode;
  2750. if (_parentVnode) {
  2751. vm.$scopedSlots = normalizeScopedSlots(
  2752. _parentVnode.data.scopedSlots,
  2753. vm.$slots,
  2754. vm.$scopedSlots
  2755. );
  2756. }
  2757. // set parent vnode. this allows render functions to have access
  2758. // to the data on the placeholder node.
  2759. vm.$vnode = _parentVnode;
  2760. // render self
  2761. var vnode;
  2762. try {
  2763. // There's no need to maintain a stack because all render fns are called
  2764. // separately from one another. Nested component's render fns are called
  2765. // when parent component is patched.
  2766. currentRenderingInstance = vm;
  2767. vnode = render.call(vm._renderProxy, vm.$createElement);
  2768. } catch (e) {
  2769. handleError(e, vm, "render");
  2770. // return error render result,
  2771. // or previous vnode to prevent render error causing blank component
  2772. /* istanbul ignore else */
  2773. {
  2774. vnode = vm._vnode;
  2775. }
  2776. } finally {
  2777. currentRenderingInstance = null;
  2778. }
  2779. // if the returned array contains only a single node, allow it
  2780. if (Array.isArray(vnode) && vnode.length === 1) {
  2781. vnode = vnode[0];
  2782. }
  2783. // return empty vnode in case the render function errored out
  2784. if (!(vnode instanceof VNode)) {
  2785. vnode = createEmptyVNode();
  2786. }
  2787. // set parent
  2788. vnode.parent = _parentVnode;
  2789. return vnode
  2790. };
  2791. }
  2792. /* */
  2793. function ensureCtor (comp, base) {
  2794. if (
  2795. comp.__esModule ||
  2796. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2797. ) {
  2798. comp = comp.default;
  2799. }
  2800. return isObject(comp)
  2801. ? base.extend(comp)
  2802. : comp
  2803. }
  2804. function createAsyncPlaceholder (
  2805. factory,
  2806. data,
  2807. context,
  2808. children,
  2809. tag
  2810. ) {
  2811. var node = createEmptyVNode();
  2812. node.asyncFactory = factory;
  2813. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2814. return node
  2815. }
  2816. function resolveAsyncComponent (
  2817. factory,
  2818. baseCtor
  2819. ) {
  2820. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2821. return factory.errorComp
  2822. }
  2823. if (isDef(factory.resolved)) {
  2824. return factory.resolved
  2825. }
  2826. var owner = currentRenderingInstance;
  2827. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  2828. // already pending
  2829. factory.owners.push(owner);
  2830. }
  2831. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2832. return factory.loadingComp
  2833. }
  2834. if (owner && !isDef(factory.owners)) {
  2835. var owners = factory.owners = [owner];
  2836. var sync = true;
  2837. var timerLoading = null;
  2838. var timerTimeout = null
  2839. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  2840. var forceRender = function (renderCompleted) {
  2841. for (var i = 0, l = owners.length; i < l; i++) {
  2842. (owners[i]).$forceUpdate();
  2843. }
  2844. if (renderCompleted) {
  2845. owners.length = 0;
  2846. if (timerLoading !== null) {
  2847. clearTimeout(timerLoading);
  2848. timerLoading = null;
  2849. }
  2850. if (timerTimeout !== null) {
  2851. clearTimeout(timerTimeout);
  2852. timerTimeout = null;
  2853. }
  2854. }
  2855. };
  2856. var resolve = once(function (res) {
  2857. // cache resolved
  2858. factory.resolved = ensureCtor(res, baseCtor);
  2859. // invoke callbacks only if this is not a synchronous resolve
  2860. // (async resolves are shimmed as synchronous during SSR)
  2861. if (!sync) {
  2862. forceRender(true);
  2863. } else {
  2864. owners.length = 0;
  2865. }
  2866. });
  2867. var reject = once(function (reason) {
  2868. if (isDef(factory.errorComp)) {
  2869. factory.error = true;
  2870. forceRender(true);
  2871. }
  2872. });
  2873. var res = factory(resolve, reject);
  2874. if (isObject(res)) {
  2875. if (isPromise(res)) {
  2876. // () => Promise
  2877. if (isUndef(factory.resolved)) {
  2878. res.then(resolve, reject);
  2879. }
  2880. } else if (isPromise(res.component)) {
  2881. res.component.then(resolve, reject);
  2882. if (isDef(res.error)) {
  2883. factory.errorComp = ensureCtor(res.error, baseCtor);
  2884. }
  2885. if (isDef(res.loading)) {
  2886. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2887. if (res.delay === 0) {
  2888. factory.loading = true;
  2889. } else {
  2890. timerLoading = setTimeout(function () {
  2891. timerLoading = null;
  2892. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2893. factory.loading = true;
  2894. forceRender(false);
  2895. }
  2896. }, res.delay || 200);
  2897. }
  2898. }
  2899. if (isDef(res.timeout)) {
  2900. timerTimeout = setTimeout(function () {
  2901. timerTimeout = null;
  2902. if (isUndef(factory.resolved)) {
  2903. reject(
  2904. null
  2905. );
  2906. }
  2907. }, res.timeout);
  2908. }
  2909. }
  2910. }
  2911. sync = false;
  2912. // return in case resolved synchronously
  2913. return factory.loading
  2914. ? factory.loadingComp
  2915. : factory.resolved
  2916. }
  2917. }
  2918. /* */
  2919. function isAsyncPlaceholder (node) {
  2920. return node.isComment && node.asyncFactory
  2921. }
  2922. /* */
  2923. function getFirstComponentChild (children) {
  2924. if (Array.isArray(children)) {
  2925. for (var i = 0; i < children.length; i++) {
  2926. var c = children[i];
  2927. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2928. return c
  2929. }
  2930. }
  2931. }
  2932. }
  2933. /* */
  2934. /* */
  2935. function initEvents (vm) {
  2936. vm._events = Object.create(null);
  2937. vm._hasHookEvent = false;
  2938. // init parent attached events
  2939. var listeners = vm.$options._parentListeners;
  2940. if (listeners) {
  2941. updateComponentListeners(vm, listeners);
  2942. }
  2943. }
  2944. var target;
  2945. function add (event, fn) {
  2946. target.$on(event, fn);
  2947. }
  2948. function remove$1 (event, fn) {
  2949. target.$off(event, fn);
  2950. }
  2951. function createOnceHandler (event, fn) {
  2952. var _target = target;
  2953. return function onceHandler () {
  2954. var res = fn.apply(null, arguments);
  2955. if (res !== null) {
  2956. _target.$off(event, onceHandler);
  2957. }
  2958. }
  2959. }
  2960. function updateComponentListeners (
  2961. vm,
  2962. listeners,
  2963. oldListeners
  2964. ) {
  2965. target = vm;
  2966. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  2967. target = undefined;
  2968. }
  2969. function eventsMixin (Vue) {
  2970. var hookRE = /^hook:/;
  2971. Vue.prototype.$on = function (event, fn) {
  2972. var vm = this;
  2973. if (Array.isArray(event)) {
  2974. for (var i = 0, l = event.length; i < l; i++) {
  2975. vm.$on(event[i], fn);
  2976. }
  2977. } else {
  2978. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2979. // optimize hook:event cost by using a boolean flag marked at registration
  2980. // instead of a hash lookup
  2981. if (hookRE.test(event)) {
  2982. vm._hasHookEvent = true;
  2983. }
  2984. }
  2985. return vm
  2986. };
  2987. Vue.prototype.$once = function (event, fn) {
  2988. var vm = this;
  2989. function on () {
  2990. vm.$off(event, on);
  2991. fn.apply(vm, arguments);
  2992. }
  2993. on.fn = fn;
  2994. vm.$on(event, on);
  2995. return vm
  2996. };
  2997. Vue.prototype.$off = function (event, fn) {
  2998. var vm = this;
  2999. // all
  3000. if (!arguments.length) {
  3001. vm._events = Object.create(null);
  3002. return vm
  3003. }
  3004. // array of events
  3005. if (Array.isArray(event)) {
  3006. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3007. vm.$off(event[i$1], fn);
  3008. }
  3009. return vm
  3010. }
  3011. // specific event
  3012. var cbs = vm._events[event];
  3013. if (!cbs) {
  3014. return vm
  3015. }
  3016. if (!fn) {
  3017. vm._events[event] = null;
  3018. return vm
  3019. }
  3020. // specific handler
  3021. var cb;
  3022. var i = cbs.length;
  3023. while (i--) {
  3024. cb = cbs[i];
  3025. if (cb === fn || cb.fn === fn) {
  3026. cbs.splice(i, 1);
  3027. break
  3028. }
  3029. }
  3030. return vm
  3031. };
  3032. Vue.prototype.$emit = function (event) {
  3033. var vm = this;
  3034. var cbs = vm._events[event];
  3035. if (cbs) {
  3036. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3037. var args = toArray(arguments, 1);
  3038. var info = "event handler for \"" + event + "\"";
  3039. for (var i = 0, l = cbs.length; i < l; i++) {
  3040. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3041. }
  3042. }
  3043. return vm
  3044. };
  3045. }
  3046. /* */
  3047. var activeInstance = null;
  3048. function setActiveInstance(vm) {
  3049. var prevActiveInstance = activeInstance;
  3050. activeInstance = vm;
  3051. return function () {
  3052. activeInstance = prevActiveInstance;
  3053. }
  3054. }
  3055. function initLifecycle (vm) {
  3056. var options = vm.$options;
  3057. // locate first non-abstract parent
  3058. var parent = options.parent;
  3059. if (parent && !options.abstract) {
  3060. while (parent.$options.abstract && parent.$parent) {
  3061. parent = parent.$parent;
  3062. }
  3063. parent.$children.push(vm);
  3064. }
  3065. vm.$parent = parent;
  3066. vm.$root = parent ? parent.$root : vm;
  3067. vm.$children = [];
  3068. vm.$refs = {};
  3069. vm._watcher = null;
  3070. vm._inactive = null;
  3071. vm._directInactive = false;
  3072. vm._isMounted = false;
  3073. vm._isDestroyed = false;
  3074. vm._isBeingDestroyed = false;
  3075. }
  3076. function lifecycleMixin (Vue) {
  3077. Vue.prototype._update = function (vnode, hydrating) {
  3078. var vm = this;
  3079. var prevEl = vm.$el;
  3080. var prevVnode = vm._vnode;
  3081. var restoreActiveInstance = setActiveInstance(vm);
  3082. vm._vnode = vnode;
  3083. // Vue.prototype.__patch__ is injected in entry points
  3084. // based on the rendering backend used.
  3085. if (!prevVnode) {
  3086. // initial render
  3087. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3088. } else {
  3089. // updates
  3090. vm.$el = vm.__patch__(prevVnode, vnode);
  3091. }
  3092. restoreActiveInstance();
  3093. // update __vue__ reference
  3094. if (prevEl) {
  3095. prevEl.__vue__ = null;
  3096. }
  3097. if (vm.$el) {
  3098. vm.$el.__vue__ = vm;
  3099. }
  3100. // if parent is an HOC, update its $el as well
  3101. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3102. vm.$parent.$el = vm.$el;
  3103. }
  3104. // updated hook is called by the scheduler to ensure that children are
  3105. // updated in a parent's updated hook.
  3106. };
  3107. Vue.prototype.$forceUpdate = function () {
  3108. var vm = this;
  3109. if (vm._watcher) {
  3110. vm._watcher.update();
  3111. }
  3112. };
  3113. Vue.prototype.$destroy = function () {
  3114. var vm = this;
  3115. if (vm._isBeingDestroyed) {
  3116. return
  3117. }
  3118. callHook(vm, 'beforeDestroy');
  3119. vm._isBeingDestroyed = true;
  3120. // remove self from parent
  3121. var parent = vm.$parent;
  3122. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3123. remove(parent.$children, vm);
  3124. }
  3125. // teardown watchers
  3126. if (vm._watcher) {
  3127. vm._watcher.teardown();
  3128. }
  3129. var i = vm._watchers.length;
  3130. while (i--) {
  3131. vm._watchers[i].teardown();
  3132. }
  3133. // remove reference from data ob
  3134. // frozen object may not have observer.
  3135. if (vm._data.__ob__) {
  3136. vm._data.__ob__.vmCount--;
  3137. }
  3138. // call the last hook...
  3139. vm._isDestroyed = true;
  3140. // invoke destroy hooks on current rendered tree
  3141. vm.__patch__(vm._vnode, null);
  3142. // fire destroyed hook
  3143. callHook(vm, 'destroyed');
  3144. // turn off all instance listeners.
  3145. vm.$off();
  3146. // remove __vue__ reference
  3147. if (vm.$el) {
  3148. vm.$el.__vue__ = null;
  3149. }
  3150. // release circular reference (#6759)
  3151. if (vm.$vnode) {
  3152. vm.$vnode.parent = null;
  3153. }
  3154. };
  3155. }
  3156. function mountComponent (
  3157. vm,
  3158. el,
  3159. hydrating
  3160. ) {
  3161. vm.$el = el;
  3162. if (!vm.$options.render) {
  3163. vm.$options.render = createEmptyVNode;
  3164. }
  3165. callHook(vm, 'beforeMount');
  3166. var updateComponent;
  3167. /* istanbul ignore if */
  3168. {
  3169. updateComponent = function () {
  3170. vm._update(vm._render(), hydrating);
  3171. };
  3172. }
  3173. // we set this to vm._watcher inside the watcher's constructor
  3174. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3175. // component's mounted hook), which relies on vm._watcher being already defined
  3176. new Watcher(vm, updateComponent, noop, {
  3177. before: function before () {
  3178. if (vm._isMounted && !vm._isDestroyed) {
  3179. callHook(vm, 'beforeUpdate');
  3180. }
  3181. }
  3182. }, true /* isRenderWatcher */);
  3183. hydrating = false;
  3184. // manually mounted instance, call mounted on self
  3185. // mounted is called for render-created child components in its inserted hook
  3186. if (vm.$vnode == null) {
  3187. // fixed by xxxxxx
  3188. vm._isMounted = true;
  3189. if (vm._$vd) {// 延迟 mounted 事件
  3190. callHook(vm, 'onServiceCreated');
  3191. callHook(vm, 'onServiceAttached');
  3192. vm._$vd.addMountedVm(vm);
  3193. } else {
  3194. callHook(vm, 'mounted');
  3195. }
  3196. }
  3197. return vm
  3198. }
  3199. function updateChildComponent (
  3200. vm,
  3201. propsData,
  3202. listeners,
  3203. parentVnode,
  3204. renderChildren
  3205. ) {
  3206. // determine whether component has slot children
  3207. // we need to do this before overwriting $options._renderChildren.
  3208. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3209. // dynamic slot names). Static scoped slots compiled from template has the
  3210. // "$stable" marker.
  3211. var newScopedSlots = parentVnode.data.scopedSlots;
  3212. var oldScopedSlots = vm.$scopedSlots;
  3213. var hasDynamicScopedSlot = !!(
  3214. (newScopedSlots && !newScopedSlots.$stable) ||
  3215. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3216. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3217. );
  3218. // Any static slot children from the parent may have changed during parent's
  3219. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3220. // update is necessary to ensure correctness.
  3221. var needsForceUpdate = !!(
  3222. renderChildren || // has new static slots
  3223. vm.$options._renderChildren || // has old static slots
  3224. hasDynamicScopedSlot
  3225. );
  3226. vm.$options._parentVnode = parentVnode;
  3227. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3228. if (vm._vnode) { // update child tree's parent
  3229. vm._vnode.parent = parentVnode;
  3230. }
  3231. vm.$options._renderChildren = renderChildren;
  3232. // update $attrs and $listeners hash
  3233. // these are also reactive so they may trigger child update if the child
  3234. // used them during render
  3235. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3236. vm.$listeners = listeners || emptyObject;
  3237. // update props
  3238. if (propsData && vm.$options.props) {
  3239. toggleObserving(false);
  3240. var props = vm._props;
  3241. var propKeys = vm.$options._propKeys || [];
  3242. for (var i = 0; i < propKeys.length; i++) {
  3243. var key = propKeys[i];
  3244. var propOptions = vm.$options.props; // wtf flow?
  3245. props[key] = validateProp(key, propOptions, propsData, vm);
  3246. }
  3247. toggleObserving(true);
  3248. // keep a copy of raw propsData
  3249. vm.$options.propsData = propsData;
  3250. }
  3251. // fixed by xxxxxx update properties(mp runtime)
  3252. vm._$updateProperties && vm._$updateProperties(vm);
  3253. // update listeners
  3254. listeners = listeners || emptyObject;
  3255. var oldListeners = vm.$options._parentListeners;
  3256. vm.$options._parentListeners = listeners;
  3257. updateComponentListeners(vm, listeners, oldListeners);
  3258. // resolve slots + force update if has children
  3259. if (needsForceUpdate) {
  3260. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3261. vm.$forceUpdate();
  3262. }
  3263. }
  3264. function isInInactiveTree (vm) {
  3265. while (vm && (vm = vm.$parent)) {
  3266. if (vm._inactive) { return true }
  3267. }
  3268. return false
  3269. }
  3270. function activateChildComponent (vm, direct) {
  3271. if (direct) {
  3272. vm._directInactive = false;
  3273. if (isInInactiveTree(vm)) {
  3274. return
  3275. }
  3276. } else if (vm._directInactive) {
  3277. return
  3278. }
  3279. if (vm._inactive || vm._inactive === null) {
  3280. vm._inactive = false;
  3281. for (var i = 0; i < vm.$children.length; i++) {
  3282. activateChildComponent(vm.$children[i]);
  3283. }
  3284. callHook(vm, 'activated');
  3285. }
  3286. }
  3287. function deactivateChildComponent (vm, direct) {
  3288. if (direct) {
  3289. vm._directInactive = true;
  3290. if (isInInactiveTree(vm)) {
  3291. return
  3292. }
  3293. }
  3294. if (!vm._inactive) {
  3295. vm._inactive = true;
  3296. for (var i = 0; i < vm.$children.length; i++) {
  3297. deactivateChildComponent(vm.$children[i]);
  3298. }
  3299. callHook(vm, 'deactivated');
  3300. }
  3301. }
  3302. function callHook (vm, hook) {
  3303. // #7573 disable dep collection when invoking lifecycle hooks
  3304. pushTarget();
  3305. var handlers = vm.$options[hook];
  3306. var info = hook + " hook";
  3307. if (handlers) {
  3308. for (var i = 0, j = handlers.length; i < j; i++) {
  3309. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3310. }
  3311. }
  3312. if (vm._hasHookEvent) {
  3313. vm.$emit('hook:' + hook);
  3314. }
  3315. popTarget();
  3316. }
  3317. /* */
  3318. var queue = []; // fixed by xxxxxx
  3319. var activatedChildren = [];
  3320. var has = {};
  3321. var waiting = false;
  3322. var flushing = false;
  3323. var index = 0;
  3324. /**
  3325. * Reset the scheduler's state.
  3326. */
  3327. function resetSchedulerState () {
  3328. index = queue.length = activatedChildren.length = 0;
  3329. has = {};
  3330. waiting = flushing = false;
  3331. }
  3332. // Async edge case #6566 requires saving the timestamp when event listeners are
  3333. // attached. However, calling performance.now() has a perf overhead especially
  3334. // if the page has thousands of event listeners. Instead, we take a timestamp
  3335. // every time the scheduler flushes and use that for all event listeners
  3336. // attached during that flush.
  3337. var currentFlushTimestamp = 0;
  3338. // Async edge case fix requires storing an event listener's attach timestamp.
  3339. var getNow = Date.now;
  3340. // Determine what event timestamp the browser is using. Annoyingly, the
  3341. // timestamp can either be hi-res (relative to page load) or low-res
  3342. // (relative to UNIX epoch), so in order to compare time we have to use the
  3343. // same timestamp type when saving the flush timestamp.
  3344. // All IE versions use low-res event timestamps, and have problematic clock
  3345. // implementations (#9632)
  3346. if (inBrowser && !isIE) {
  3347. var performance = window.performance;
  3348. if (
  3349. performance &&
  3350. typeof performance.now === 'function' &&
  3351. getNow() > document.createEvent('Event').timeStamp
  3352. ) {
  3353. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3354. // smaller than it, it means the event is using a hi-res timestamp,
  3355. // and we need to use the hi-res version for event listener timestamps as
  3356. // well.
  3357. getNow = function () { return performance.now(); };
  3358. }
  3359. }
  3360. /**
  3361. * Flush both queues and run the watchers.
  3362. */
  3363. function flushSchedulerQueue () {
  3364. currentFlushTimestamp = getNow();
  3365. flushing = true;
  3366. var watcher, id;
  3367. // Sort queue before flush.
  3368. // This ensures that:
  3369. // 1. Components are updated from parent to child. (because parent is always
  3370. // created before the child)
  3371. // 2. A component's user watchers are run before its render watcher (because
  3372. // user watchers are created before the render watcher)
  3373. // 3. If a component is destroyed during a parent component's watcher run,
  3374. // its watchers can be skipped.
  3375. queue.sort(function (a, b) { return a.id - b.id; });
  3376. // do not cache length because more watchers might be pushed
  3377. // as we run existing watchers
  3378. for (index = 0; index < queue.length; index++) {
  3379. watcher = queue[index];
  3380. if (watcher.before) {
  3381. watcher.before();
  3382. }
  3383. id = watcher.id;
  3384. has[id] = null;
  3385. watcher.run();
  3386. }
  3387. // keep copies of post queues before resetting state
  3388. var activatedQueue = activatedChildren.slice();
  3389. var updatedQueue = queue.slice();
  3390. resetSchedulerState();
  3391. // call component updated and activated hooks
  3392. callActivatedHooks(activatedQueue);
  3393. callUpdatedHooks(updatedQueue);
  3394. // devtool hook
  3395. /* istanbul ignore if */
  3396. if (devtools && config.devtools) {
  3397. devtools.emit('flush');
  3398. }
  3399. }
  3400. function callUpdatedHooks (queue) {
  3401. var i = queue.length;
  3402. while (i--) {
  3403. var watcher = queue[i];
  3404. var vm = watcher.vm;
  3405. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3406. // fixed by xxxxx
  3407. if (vm._$vd) { // 延迟 updated 事件
  3408. vm._$vd.addUpdatedVm(vm);
  3409. }else{
  3410. callHook(vm, 'updated');
  3411. }
  3412. }
  3413. }
  3414. }
  3415. /**
  3416. * Queue a kept-alive component that was activated during patch.
  3417. * The queue will be processed after the entire tree has been patched.
  3418. */
  3419. function queueActivatedComponent (vm) {
  3420. // setting _inactive to false here so that a render function can
  3421. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3422. vm._inactive = false;
  3423. activatedChildren.push(vm);
  3424. }
  3425. function callActivatedHooks (queue) {
  3426. for (var i = 0; i < queue.length; i++) {
  3427. queue[i]._inactive = true;
  3428. activateChildComponent(queue[i], true /* true */);
  3429. }
  3430. }
  3431. /**
  3432. * Push a watcher into the watcher queue.
  3433. * Jobs with duplicate IDs will be skipped unless it's
  3434. * pushed when the queue is being flushed.
  3435. */
  3436. function queueWatcher (watcher) {
  3437. var id = watcher.id;
  3438. if (has[id] == null) {
  3439. has[id] = true;
  3440. if (!flushing) {
  3441. queue.push(watcher);
  3442. } else {
  3443. // if already flushing, splice the watcher based on its id
  3444. // if already past its id, it will be run next immediately.
  3445. var i = queue.length - 1;
  3446. while (i > index && queue[i].id > watcher.id) {
  3447. i--;
  3448. }
  3449. queue.splice(i + 1, 0, watcher);
  3450. }
  3451. // queue the flush
  3452. if (!waiting) {
  3453. waiting = true;
  3454. nextTick(flushSchedulerQueue);
  3455. }
  3456. }
  3457. }
  3458. /* */
  3459. var uid$2 = 0;
  3460. /**
  3461. * A watcher parses an expression, collects dependencies,
  3462. * and fires callback when the expression value changes.
  3463. * This is used for both the $watch() api and directives.
  3464. */
  3465. var Watcher = function Watcher (
  3466. vm,
  3467. expOrFn,
  3468. cb,
  3469. options,
  3470. isRenderWatcher
  3471. ) {
  3472. this.vm = vm;
  3473. if (isRenderWatcher) {
  3474. vm._watcher = this;
  3475. }
  3476. vm._watchers.push(this);
  3477. // options
  3478. if (options) {
  3479. this.deep = !!options.deep;
  3480. this.user = !!options.user;
  3481. this.lazy = !!options.lazy;
  3482. this.sync = !!options.sync;
  3483. this.before = options.before;
  3484. } else {
  3485. this.deep = this.user = this.lazy = this.sync = false;
  3486. }
  3487. this.cb = cb;
  3488. this.id = ++uid$2; // uid for batching
  3489. this.active = true;
  3490. this.dirty = this.lazy; // for lazy watchers
  3491. this.deps = [];
  3492. this.newDeps = [];
  3493. this.depIds = new _Set();
  3494. this.newDepIds = new _Set();
  3495. this.expression = '';
  3496. // parse expression for getter
  3497. if (typeof expOrFn === 'function') {
  3498. this.getter = expOrFn;
  3499. } else {
  3500. this.getter = parsePath(expOrFn);
  3501. if (!this.getter) {
  3502. this.getter = noop;
  3503. }
  3504. }
  3505. this.value = this.lazy
  3506. ? undefined
  3507. : this.get();
  3508. };
  3509. /**
  3510. * Evaluate the getter, and re-collect dependencies.
  3511. */
  3512. Watcher.prototype.get = function get () {
  3513. pushTarget(this);
  3514. var value;
  3515. var vm = this.vm;
  3516. try {
  3517. value = this.getter.call(vm, vm);
  3518. } catch (e) {
  3519. if (this.user) {
  3520. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  3521. } else {
  3522. throw e
  3523. }
  3524. } finally {
  3525. // "touch" every property so they are all tracked as
  3526. // dependencies for deep watching
  3527. if (this.deep) {
  3528. traverse(value);
  3529. }
  3530. popTarget();
  3531. this.cleanupDeps();
  3532. }
  3533. return value
  3534. };
  3535. /**
  3536. * Add a dependency to this directive.
  3537. */
  3538. Watcher.prototype.addDep = function addDep (dep) {
  3539. var id = dep.id;
  3540. if (!this.newDepIds.has(id)) {
  3541. this.newDepIds.add(id);
  3542. this.newDeps.push(dep);
  3543. if (!this.depIds.has(id)) {
  3544. dep.addSub(this);
  3545. }
  3546. }
  3547. };
  3548. /**
  3549. * Clean up for dependency collection.
  3550. */
  3551. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  3552. var i = this.deps.length;
  3553. while (i--) {
  3554. var dep = this.deps[i];
  3555. if (!this.newDepIds.has(dep.id)) {
  3556. dep.removeSub(this);
  3557. }
  3558. }
  3559. var tmp = this.depIds;
  3560. this.depIds = this.newDepIds;
  3561. this.newDepIds = tmp;
  3562. this.newDepIds.clear();
  3563. tmp = this.deps;
  3564. this.deps = this.newDeps;
  3565. this.newDeps = tmp;
  3566. this.newDeps.length = 0;
  3567. };
  3568. /**
  3569. * Subscriber interface.
  3570. * Will be called when a dependency changes.
  3571. */
  3572. Watcher.prototype.update = function update () {
  3573. /* istanbul ignore else */
  3574. if (this.lazy) {
  3575. this.dirty = true;
  3576. } else if (this.sync) {
  3577. this.run();
  3578. } else {
  3579. queueWatcher(this);
  3580. }
  3581. };
  3582. /**
  3583. * Scheduler job interface.
  3584. * Will be called by the scheduler.
  3585. */
  3586. Watcher.prototype.run = function run () {
  3587. if (this.active) {
  3588. var value = this.get();
  3589. if (
  3590. value !== this.value ||
  3591. // Deep watchers and watchers on Object/Arrays should fire even
  3592. // when the value is the same, because the value may
  3593. // have mutated.
  3594. isObject(value) ||
  3595. this.deep
  3596. ) {
  3597. // set new value
  3598. var oldValue = this.value;
  3599. this.value = value;
  3600. if (this.user) {
  3601. try {
  3602. this.cb.call(this.vm, value, oldValue);
  3603. } catch (e) {
  3604. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  3605. }
  3606. } else {
  3607. this.cb.call(this.vm, value, oldValue);
  3608. }
  3609. }
  3610. }
  3611. };
  3612. /**
  3613. * Evaluate the value of the watcher.
  3614. * This only gets called for lazy watchers.
  3615. */
  3616. Watcher.prototype.evaluate = function evaluate () {
  3617. this.value = this.get();
  3618. this.dirty = false;
  3619. };
  3620. /**
  3621. * Depend on all deps collected by this watcher.
  3622. */
  3623. Watcher.prototype.depend = function depend () {
  3624. var i = this.deps.length;
  3625. while (i--) {
  3626. this.deps[i].depend();
  3627. }
  3628. };
  3629. /**
  3630. * Remove self from all dependencies' subscriber list.
  3631. */
  3632. Watcher.prototype.teardown = function teardown () {
  3633. if (this.active) {
  3634. // remove self from vm's watcher list
  3635. // this is a somewhat expensive operation so we skip it
  3636. // if the vm is being destroyed.
  3637. if (!this.vm._isBeingDestroyed) {
  3638. remove(this.vm._watchers, this);
  3639. }
  3640. var i = this.deps.length;
  3641. while (i--) {
  3642. this.deps[i].removeSub(this);
  3643. }
  3644. this.active = false;
  3645. }
  3646. };
  3647. /* */
  3648. var sharedPropertyDefinition = {
  3649. enumerable: true,
  3650. configurable: true,
  3651. get: noop,
  3652. set: noop
  3653. };
  3654. function proxy (target, sourceKey, key) {
  3655. sharedPropertyDefinition.get = function proxyGetter () {
  3656. return this[sourceKey][key]
  3657. };
  3658. sharedPropertyDefinition.set = function proxySetter (val) {
  3659. this[sourceKey][key] = val;
  3660. };
  3661. Object.defineProperty(target, key, sharedPropertyDefinition);
  3662. }
  3663. function initState (vm) {
  3664. vm._watchers = [];
  3665. var opts = vm.$options;
  3666. if (opts.props) { initProps(vm, opts.props); }
  3667. if (opts.methods) { initMethods(vm, opts.methods); }
  3668. if (opts.data) {
  3669. initData(vm);
  3670. } else {
  3671. observe(vm._data = {}, true /* asRootData */);
  3672. }
  3673. if (opts.computed) { initComputed(vm, opts.computed); }
  3674. if (opts.watch && opts.watch !== nativeWatch) {
  3675. initWatch(vm, opts.watch);
  3676. }
  3677. }
  3678. function initProps (vm, propsOptions) {
  3679. var propsData = vm.$options.propsData || {};
  3680. var props = vm._props = {};
  3681. // cache prop keys so that future props updates can iterate using Array
  3682. // instead of dynamic object key enumeration.
  3683. var keys = vm.$options._propKeys = [];
  3684. var isRoot = !vm.$parent;
  3685. // root instance props should be converted
  3686. if (!isRoot) {
  3687. toggleObserving(false);
  3688. }
  3689. var loop = function ( key ) {
  3690. keys.push(key);
  3691. var value = validateProp(key, propsOptions, propsData, vm);
  3692. /* istanbul ignore else */
  3693. {
  3694. defineReactive$$1(props, key, value);
  3695. }
  3696. // static props are already proxied on the component's prototype
  3697. // during Vue.extend(). We only need to proxy props defined at
  3698. // instantiation here.
  3699. if (!(key in vm)) {
  3700. proxy(vm, "_props", key);
  3701. }
  3702. };
  3703. for (var key in propsOptions) loop( key );
  3704. toggleObserving(true);
  3705. }
  3706. function initData (vm) {
  3707. var data = vm.$options.data;
  3708. data = vm._data = typeof data === 'function'
  3709. ? getData(data, vm)
  3710. : data || {};
  3711. if (!isPlainObject(data)) {
  3712. data = {};
  3713. }
  3714. // proxy data on instance
  3715. var keys = Object.keys(data);
  3716. var props = vm.$options.props;
  3717. var methods = vm.$options.methods;
  3718. var i = keys.length;
  3719. while (i--) {
  3720. var key = keys[i];
  3721. if (props && hasOwn(props, key)) ; else if (!isReserved(key)) {
  3722. proxy(vm, "_data", key);
  3723. }
  3724. }
  3725. // observe data
  3726. observe(data, true /* asRootData */);
  3727. }
  3728. function getData (data, vm) {
  3729. // #7573 disable dep collection when invoking data getters
  3730. pushTarget();
  3731. try {
  3732. return data.call(vm, vm)
  3733. } catch (e) {
  3734. handleError(e, vm, "data()");
  3735. return {}
  3736. } finally {
  3737. popTarget();
  3738. }
  3739. }
  3740. var computedWatcherOptions = { lazy: true };
  3741. function initComputed (vm, computed) {
  3742. // $flow-disable-line
  3743. var watchers = vm._computedWatchers = Object.create(null);
  3744. // computed properties are just getters during SSR
  3745. var isSSR = isServerRendering();
  3746. for (var key in computed) {
  3747. var userDef = computed[key];
  3748. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3749. if (!isSSR) {
  3750. // create internal watcher for the computed property.
  3751. watchers[key] = new Watcher(
  3752. vm,
  3753. getter || noop,
  3754. noop,
  3755. computedWatcherOptions
  3756. );
  3757. }
  3758. // component-defined computed properties are already defined on the
  3759. // component prototype. We only need to define computed properties defined
  3760. // at instantiation here.
  3761. if (!(key in vm)) {
  3762. defineComputed(vm, key, userDef);
  3763. }
  3764. }
  3765. }
  3766. function defineComputed (
  3767. target,
  3768. key,
  3769. userDef
  3770. ) {
  3771. var shouldCache = !isServerRendering();
  3772. if (typeof userDef === 'function') {
  3773. sharedPropertyDefinition.get = shouldCache
  3774. ? createComputedGetter(key)
  3775. : createGetterInvoker(userDef);
  3776. sharedPropertyDefinition.set = noop;
  3777. } else {
  3778. sharedPropertyDefinition.get = userDef.get
  3779. ? shouldCache && userDef.cache !== false
  3780. ? createComputedGetter(key)
  3781. : createGetterInvoker(userDef.get)
  3782. : noop;
  3783. sharedPropertyDefinition.set = userDef.set || noop;
  3784. }
  3785. Object.defineProperty(target, key, sharedPropertyDefinition);
  3786. }
  3787. function createComputedGetter (key) {
  3788. return function computedGetter () {
  3789. var watcher = this._computedWatchers && this._computedWatchers[key];
  3790. if (watcher) {
  3791. if (watcher.dirty) {
  3792. watcher.evaluate();
  3793. }
  3794. if (Dep.SharedObject.target) { // fixed by xxxxxx
  3795. watcher.depend();
  3796. }
  3797. return watcher.value
  3798. }
  3799. }
  3800. }
  3801. function createGetterInvoker(fn) {
  3802. return function computedGetter () {
  3803. return fn.call(this, this)
  3804. }
  3805. }
  3806. function initMethods (vm, methods) {
  3807. var props = vm.$options.props;
  3808. for (var key in methods) {
  3809. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  3810. }
  3811. }
  3812. function initWatch (vm, watch) {
  3813. for (var key in watch) {
  3814. var handler = watch[key];
  3815. if (Array.isArray(handler)) {
  3816. for (var i = 0; i < handler.length; i++) {
  3817. createWatcher(vm, key, handler[i]);
  3818. }
  3819. } else {
  3820. createWatcher(vm, key, handler);
  3821. }
  3822. }
  3823. }
  3824. function createWatcher (
  3825. vm,
  3826. expOrFn,
  3827. handler,
  3828. options
  3829. ) {
  3830. if (isPlainObject(handler)) {
  3831. options = handler;
  3832. handler = handler.handler;
  3833. }
  3834. if (typeof handler === 'string') {
  3835. handler = vm[handler];
  3836. }
  3837. return vm.$watch(expOrFn, handler, options)
  3838. }
  3839. function stateMixin (Vue) {
  3840. // flow somehow has problems with directly declared definition object
  3841. // when using Object.defineProperty, so we have to procedurally build up
  3842. // the object here.
  3843. var dataDef = {};
  3844. dataDef.get = function () { return this._data };
  3845. var propsDef = {};
  3846. propsDef.get = function () { return this._props };
  3847. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3848. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3849. Vue.prototype.$set = set;
  3850. Vue.prototype.$delete = del;
  3851. Vue.prototype.$watch = function (
  3852. expOrFn,
  3853. cb,
  3854. options
  3855. ) {
  3856. var vm = this;
  3857. if (isPlainObject(cb)) {
  3858. return createWatcher(vm, expOrFn, cb, options)
  3859. }
  3860. options = options || {};
  3861. options.user = true;
  3862. var watcher = new Watcher(vm, expOrFn, cb, options);
  3863. if (options.immediate) {
  3864. try {
  3865. cb.call(vm, watcher.value);
  3866. } catch (error) {
  3867. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  3868. }
  3869. }
  3870. return function unwatchFn () {
  3871. watcher.teardown();
  3872. }
  3873. };
  3874. }
  3875. /* */
  3876. var uid$3 = 0;
  3877. function initMixin (Vue) {
  3878. Vue.prototype._init = function (options) {
  3879. var vm = this;
  3880. // a uid
  3881. vm._uid = uid$3++;
  3882. // a flag to avoid this being observed
  3883. vm._isVue = true;
  3884. // merge options
  3885. if (options && options._isComponent) {
  3886. // optimize internal component instantiation
  3887. // since dynamic options merging is pretty slow, and none of the
  3888. // internal component options needs special treatment.
  3889. initInternalComponent(vm, options);
  3890. } else {
  3891. vm.$options = mergeOptions(
  3892. resolveConstructorOptions(vm.constructor),
  3893. options || {},
  3894. vm
  3895. );
  3896. }
  3897. /* istanbul ignore else */
  3898. {
  3899. vm._renderProxy = vm;
  3900. }
  3901. // expose real self
  3902. vm._self = vm;
  3903. initLifecycle(vm);
  3904. initEvents(vm);
  3905. initRender(vm);
  3906. callHook(vm, 'beforeCreate');
  3907. initInjections(vm); // resolve injections before data/props
  3908. initState(vm);
  3909. initProvide(vm); // resolve provide after data/props
  3910. callHook(vm, 'created');
  3911. if (vm.$options.el) {
  3912. vm.$mount(vm.$options.el);
  3913. }
  3914. };
  3915. }
  3916. function initInternalComponent (vm, options) {
  3917. var opts = vm.$options = Object.create(vm.constructor.options);
  3918. // doing this because it's faster than dynamic enumeration.
  3919. var parentVnode = options._parentVnode;
  3920. opts.parent = options.parent;
  3921. opts._parentVnode = parentVnode;
  3922. var vnodeComponentOptions = parentVnode.componentOptions;
  3923. opts.propsData = vnodeComponentOptions.propsData;
  3924. opts._parentListeners = vnodeComponentOptions.listeners;
  3925. opts._renderChildren = vnodeComponentOptions.children;
  3926. opts._componentTag = vnodeComponentOptions.tag;
  3927. if (options.render) {
  3928. opts.render = options.render;
  3929. opts.staticRenderFns = options.staticRenderFns;
  3930. }
  3931. }
  3932. function resolveConstructorOptions (Ctor) {
  3933. var options = Ctor.options;
  3934. if (Ctor.super) {
  3935. var superOptions = resolveConstructorOptions(Ctor.super);
  3936. var cachedSuperOptions = Ctor.superOptions;
  3937. if (superOptions !== cachedSuperOptions) {
  3938. // super option changed,
  3939. // need to resolve new options.
  3940. Ctor.superOptions = superOptions;
  3941. // check if there are any late-modified/attached options (#4976)
  3942. var modifiedOptions = resolveModifiedOptions(Ctor);
  3943. // update base extend options
  3944. if (modifiedOptions) {
  3945. extend(Ctor.extendOptions, modifiedOptions);
  3946. }
  3947. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  3948. if (options.name) {
  3949. options.components[options.name] = Ctor;
  3950. }
  3951. }
  3952. }
  3953. return options
  3954. }
  3955. function resolveModifiedOptions (Ctor) {
  3956. var modified;
  3957. var latest = Ctor.options;
  3958. var sealed = Ctor.sealedOptions;
  3959. for (var key in latest) {
  3960. if (latest[key] !== sealed[key]) {
  3961. if (!modified) { modified = {}; }
  3962. modified[key] = latest[key];
  3963. }
  3964. }
  3965. return modified
  3966. }
  3967. function Vue (options) {
  3968. this._init(options);
  3969. }
  3970. initMixin(Vue);
  3971. stateMixin(Vue);
  3972. eventsMixin(Vue);
  3973. lifecycleMixin(Vue);
  3974. renderMixin(Vue);
  3975. /* */
  3976. function initUse (Vue) {
  3977. Vue.use = function (plugin) {
  3978. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  3979. if (installedPlugins.indexOf(plugin) > -1) {
  3980. return this
  3981. }
  3982. // additional parameters
  3983. var args = toArray(arguments, 1);
  3984. args.unshift(this);
  3985. if (typeof plugin.install === 'function') {
  3986. plugin.install.apply(plugin, args);
  3987. } else if (typeof plugin === 'function') {
  3988. plugin.apply(null, args);
  3989. }
  3990. installedPlugins.push(plugin);
  3991. return this
  3992. };
  3993. }
  3994. /* */
  3995. function initMixin$1 (Vue) {
  3996. Vue.mixin = function (mixin) {
  3997. this.options = mergeOptions(this.options, mixin);
  3998. return this
  3999. };
  4000. }
  4001. /* */
  4002. function initExtend (Vue) {
  4003. /**
  4004. * Each instance constructor, including Vue, has a unique
  4005. * cid. This enables us to create wrapped "child
  4006. * constructors" for prototypal inheritance and cache them.
  4007. */
  4008. Vue.cid = 0;
  4009. var cid = 1;
  4010. /**
  4011. * Class inheritance
  4012. */
  4013. Vue.extend = function (extendOptions) {
  4014. extendOptions = extendOptions || {};
  4015. var Super = this;
  4016. var SuperId = Super.cid;
  4017. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4018. if (cachedCtors[SuperId]) {
  4019. return cachedCtors[SuperId]
  4020. }
  4021. var name = extendOptions.name || Super.options.name;
  4022. var Sub = function VueComponent (options) {
  4023. this._init(options);
  4024. };
  4025. Sub.prototype = Object.create(Super.prototype);
  4026. Sub.prototype.constructor = Sub;
  4027. Sub.cid = cid++;
  4028. Sub.options = mergeOptions(
  4029. Super.options,
  4030. extendOptions
  4031. );
  4032. Sub['super'] = Super;
  4033. // For props and computed properties, we define the proxy getters on
  4034. // the Vue instances at extension time, on the extended prototype. This
  4035. // avoids Object.defineProperty calls for each instance created.
  4036. if (Sub.options.props) {
  4037. initProps$1(Sub);
  4038. }
  4039. if (Sub.options.computed) {
  4040. initComputed$1(Sub);
  4041. }
  4042. // allow further extension/mixin/plugin usage
  4043. Sub.extend = Super.extend;
  4044. Sub.mixin = Super.mixin;
  4045. Sub.use = Super.use;
  4046. // create asset registers, so extended classes
  4047. // can have their private assets too.
  4048. ASSET_TYPES.forEach(function (type) {
  4049. Sub[type] = Super[type];
  4050. });
  4051. // enable recursive self-lookup
  4052. if (name) {
  4053. Sub.options.components[name] = Sub;
  4054. }
  4055. // keep a reference to the super options at extension time.
  4056. // later at instantiation we can check if Super's options have
  4057. // been updated.
  4058. Sub.superOptions = Super.options;
  4059. Sub.extendOptions = extendOptions;
  4060. Sub.sealedOptions = extend({}, Sub.options);
  4061. // cache constructor
  4062. cachedCtors[SuperId] = Sub;
  4063. return Sub
  4064. };
  4065. }
  4066. function initProps$1 (Comp) {
  4067. var props = Comp.options.props;
  4068. for (var key in props) {
  4069. proxy(Comp.prototype, "_props", key);
  4070. }
  4071. }
  4072. function initComputed$1 (Comp) {
  4073. var computed = Comp.options.computed;
  4074. for (var key in computed) {
  4075. defineComputed(Comp.prototype, key, computed[key]);
  4076. }
  4077. }
  4078. /* */
  4079. function initAssetRegisters (Vue) {
  4080. /**
  4081. * Create asset registration methods.
  4082. */
  4083. ASSET_TYPES.forEach(function (type) {
  4084. Vue[type] = function (
  4085. id,
  4086. definition
  4087. ) {
  4088. if (!definition) {
  4089. return this.options[type + 's'][id]
  4090. } else {
  4091. if (type === 'component' && isPlainObject(definition)) {
  4092. definition.name = definition.name || id;
  4093. definition = this.options._base.extend(definition);
  4094. }
  4095. if (type === 'directive' && typeof definition === 'function') {
  4096. definition = { bind: definition, update: definition };
  4097. }
  4098. this.options[type + 's'][id] = definition;
  4099. return definition
  4100. }
  4101. };
  4102. });
  4103. }
  4104. /* */
  4105. function getComponentName (opts) {
  4106. return opts && (opts.Ctor.options.name || opts.tag)
  4107. }
  4108. function matches (pattern, name) {
  4109. if (Array.isArray(pattern)) {
  4110. return pattern.indexOf(name) > -1
  4111. } else if (typeof pattern === 'string') {
  4112. return pattern.split(',').indexOf(name) > -1
  4113. } else if (isRegExp(pattern)) {
  4114. return pattern.test(name)
  4115. }
  4116. /* istanbul ignore next */
  4117. return false
  4118. }
  4119. function pruneCache (keepAliveInstance, filter) {
  4120. var cache = keepAliveInstance.cache;
  4121. var keys = keepAliveInstance.keys;
  4122. var _vnode = keepAliveInstance._vnode;
  4123. for (var key in cache) {
  4124. var cachedNode = cache[key];
  4125. if (cachedNode) {
  4126. var name = getComponentName(cachedNode.componentOptions);
  4127. if (name && !filter(name)) {
  4128. pruneCacheEntry(cache, key, keys, _vnode);
  4129. }
  4130. }
  4131. }
  4132. }
  4133. function pruneCacheEntry (
  4134. cache,
  4135. key,
  4136. keys,
  4137. current
  4138. ) {
  4139. var cached$$1 = cache[key];
  4140. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4141. cached$$1.componentInstance.$destroy();
  4142. }
  4143. cache[key] = null;
  4144. remove(keys, key);
  4145. }
  4146. var patternTypes = [String, RegExp, Array];
  4147. var KeepAlive = {
  4148. name: 'keep-alive',
  4149. abstract: true,
  4150. props: {
  4151. include: patternTypes,
  4152. exclude: patternTypes,
  4153. max: [String, Number]
  4154. },
  4155. created: function created () {
  4156. this.cache = Object.create(null);
  4157. this.keys = [];
  4158. },
  4159. destroyed: function destroyed () {
  4160. for (var key in this.cache) {
  4161. pruneCacheEntry(this.cache, key, this.keys);
  4162. }
  4163. },
  4164. mounted: function mounted () {
  4165. var this$1 = this;
  4166. this.$watch('include', function (val) {
  4167. pruneCache(this$1, function (name) { return matches(val, name); });
  4168. });
  4169. this.$watch('exclude', function (val) {
  4170. pruneCache(this$1, function (name) { return !matches(val, name); });
  4171. });
  4172. },
  4173. render: function render () {
  4174. var slot = this.$slots.default;
  4175. var vnode = getFirstComponentChild(slot);
  4176. var componentOptions = vnode && vnode.componentOptions;
  4177. if (componentOptions) {
  4178. // check pattern
  4179. var name = getComponentName(componentOptions);
  4180. var ref = this;
  4181. var include = ref.include;
  4182. var exclude = ref.exclude;
  4183. if (
  4184. // not included
  4185. (include && (!name || !matches(include, name))) ||
  4186. // excluded
  4187. (exclude && name && matches(exclude, name))
  4188. ) {
  4189. return vnode
  4190. }
  4191. var ref$1 = this;
  4192. var cache = ref$1.cache;
  4193. var keys = ref$1.keys;
  4194. var key = vnode.key == null
  4195. // same constructor may get registered as different local components
  4196. // so cid alone is not enough (#3269)
  4197. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4198. : vnode.key;
  4199. if (cache[key]) {
  4200. vnode.componentInstance = cache[key].componentInstance;
  4201. // make current key freshest
  4202. remove(keys, key);
  4203. keys.push(key);
  4204. } else {
  4205. cache[key] = vnode;
  4206. keys.push(key);
  4207. // prune oldest entry
  4208. if (this.max && keys.length > parseInt(this.max)) {
  4209. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4210. }
  4211. }
  4212. vnode.data.keepAlive = true;
  4213. }
  4214. return vnode || (slot && slot[0])
  4215. }
  4216. };
  4217. var builtInComponents = {
  4218. KeepAlive: KeepAlive
  4219. };
  4220. /* */
  4221. function initGlobalAPI (Vue) {
  4222. // config
  4223. var configDef = {};
  4224. configDef.get = function () { return config; };
  4225. Object.defineProperty(Vue, 'config', configDef);
  4226. // exposed util methods.
  4227. // NOTE: these are not considered part of the public API - avoid relying on
  4228. // them unless you are aware of the risk.
  4229. Vue.util = {
  4230. warn: warn,
  4231. extend: extend,
  4232. mergeOptions: mergeOptions,
  4233. defineReactive: defineReactive$$1
  4234. };
  4235. Vue.set = set;
  4236. Vue.delete = del;
  4237. Vue.nextTick = nextTick;
  4238. // 2.6 explicit observable API
  4239. Vue.observable = function (obj) {
  4240. observe(obj);
  4241. return obj
  4242. };
  4243. Vue.options = Object.create(null);
  4244. ASSET_TYPES.forEach(function (type) {
  4245. Vue.options[type + 's'] = Object.create(null);
  4246. });
  4247. // this is used to identify the "base" constructor to extend all plain-object
  4248. // components with in Weex's multi-instance scenarios.
  4249. Vue.options._base = Vue;
  4250. extend(Vue.options.components, builtInComponents);
  4251. initUse(Vue);
  4252. initMixin$1(Vue);
  4253. initExtend(Vue);
  4254. initAssetRegisters(Vue);
  4255. }
  4256. initGlobalAPI(Vue);
  4257. Object.defineProperty(Vue.prototype, '$isServer', {
  4258. get: isServerRendering
  4259. });
  4260. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4261. get: function get () {
  4262. /* istanbul ignore next */
  4263. return this.$vnode && this.$vnode.ssrContext
  4264. }
  4265. });
  4266. // expose FunctionalRenderContext for ssr runtime helper installation
  4267. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4268. value: FunctionalRenderContext
  4269. });
  4270. Vue.version = '2.6.11';
  4271. var nextNodeRef = 1;
  4272. function uniqueId() {
  4273. return (nextNodeRef++).toString()
  4274. }
  4275. var Node = function Node() {
  4276. this.nodeId = uniqueId();
  4277. this.ref = this.nodeId;
  4278. this.children = [];
  4279. this.pureChildren = [];
  4280. this.parentNode = null;
  4281. this.nextSibling = null;
  4282. this.previousSibling = null;
  4283. };
  4284. Node.prototype.destroy = function destroy () {
  4285. this._$vd && this._$vd.removeElement(this);
  4286. this.children.forEach(function (child) {
  4287. child.destroy();
  4288. });
  4289. };
  4290. var Comment = /*@__PURE__*/(function (Node$$1) {
  4291. function Comment(value) {
  4292. Node$$1.call(this);
  4293. this.nodeType = 8;
  4294. this.nodeId = uniqueId();
  4295. this.ref = this.nodeId;
  4296. this.type = 'comment';
  4297. this.value = value;
  4298. this.children = [];
  4299. this.pureChildren = [];
  4300. }
  4301. if ( Node$$1 ) Comment.__proto__ = Node$$1;
  4302. Comment.prototype = Object.create( Node$$1 && Node$$1.prototype );
  4303. Comment.prototype.constructor = Comment;
  4304. Comment.prototype.toString = function toString () {
  4305. return '<!-- ' + this.value + ' -->'
  4306. };
  4307. return Comment;
  4308. }(Node));
  4309. function appendBody(doc, node, before) {
  4310. var documentElement = doc.documentElement;
  4311. if (documentElement.pureChildren.length > 0 || node.parentNode) {
  4312. return
  4313. }
  4314. var children = documentElement.children;
  4315. var beforeIndex = children.indexOf(before);
  4316. if (beforeIndex < 0) {
  4317. children.push(node);
  4318. } else {
  4319. children.splice(beforeIndex, 0, node);
  4320. }
  4321. if (node.nodeType === 1) {
  4322. if (node.role === 'body') {
  4323. node.docId = doc.id;
  4324. node.ownerDocument = doc;
  4325. node.parentNode = documentElement;
  4326. linkParent(node, documentElement);
  4327. } else {
  4328. node.children.forEach(function (child) {
  4329. child.parentNode = node;
  4330. });
  4331. setBody(doc, node);
  4332. node.docId = doc.id;
  4333. node.ownerDocument = doc;
  4334. linkParent(node, documentElement);
  4335. }
  4336. documentElement.pureChildren.push(node);
  4337. } else {
  4338. node.parentNode = documentElement;
  4339. }
  4340. }
  4341. function setBody(doc, el) {
  4342. el.role = 'body';
  4343. el.depth = 1;
  4344. el.ref = '_root';
  4345. doc.body = el;
  4346. }
  4347. function linkParent(node, parent) {
  4348. node.parentNode = parent;
  4349. if (parent.docId) {
  4350. node.docId = parent.docId;
  4351. node.ownerDocument = parent.ownerDocument;
  4352. node.depth = parent.depth + 1;
  4353. }
  4354. node.children.forEach(function (child) {
  4355. linkParent(child, node);
  4356. });
  4357. }
  4358. function nextElement(node) {
  4359. while (node) {
  4360. if (node.nodeType === 1) {
  4361. return node
  4362. }
  4363. node = node.nextSibling;
  4364. }
  4365. }
  4366. function previousElement(node) {
  4367. while (node) {
  4368. if (node.nodeType === 1) {
  4369. return node
  4370. }
  4371. node = node.previousSibling;
  4372. }
  4373. }
  4374. function insertIndex(target, list, newIndex, changeSibling) {
  4375. if (newIndex < 0) {
  4376. newIndex = 0;
  4377. }
  4378. var before = list[newIndex - 1];
  4379. var after = list[newIndex];
  4380. list.splice(newIndex, 0, target);
  4381. if (changeSibling) {
  4382. before && (before.nextSibling = target);
  4383. target.previousSibling = before;
  4384. target.nextSibling = after;
  4385. after && (after.previousSibling = target);
  4386. }
  4387. return newIndex
  4388. }
  4389. function moveIndex(target, list, newIndex, changeSibling) {
  4390. var index = list.indexOf(target);
  4391. if (index < 0) {
  4392. return -1
  4393. }
  4394. if (changeSibling) {
  4395. var before = list[index - 1];
  4396. var after = list[index + 1];
  4397. before && (before.nextSibling = after);
  4398. after && (after.previousSibling = before);
  4399. }
  4400. list.splice(index, 1);
  4401. var newIndexAfter = newIndex;
  4402. if (index <= newIndex) {
  4403. newIndexAfter = newIndex - 1;
  4404. }
  4405. var beforeNew = list[newIndexAfter - 1];
  4406. var afterNew = list[newIndexAfter];
  4407. list.splice(newIndexAfter, 0, target);
  4408. if (changeSibling) {
  4409. beforeNew && (beforeNew.nextSibling = target);
  4410. target.previousSibling = beforeNew;
  4411. target.nextSibling = afterNew;
  4412. afterNew && (afterNew.previousSibling = target);
  4413. }
  4414. if (index === newIndexAfter) {
  4415. return -1
  4416. }
  4417. return newIndex
  4418. }
  4419. function removeIndex(target, list, changeSibling) {
  4420. var index = list.indexOf(target);
  4421. if (index < 0) {
  4422. return
  4423. }
  4424. if (changeSibling) {
  4425. var before = list[index - 1];
  4426. var after = list[index + 1];
  4427. before && (before.nextSibling = after);
  4428. after && (after.previousSibling = before);
  4429. }
  4430. list.splice(index, 1);
  4431. }
  4432. var DEFAULT_TAG_NAME = 'view';
  4433. var Element = /*@__PURE__*/(function (Node$$1) {
  4434. function Element(type) {
  4435. if ( type === void 0 ) type = DEFAULT_TAG_NAME;
  4436. Node$$1.call(this);
  4437. this.nodeType = 1;
  4438. this.nodeId = uniqueId();
  4439. this.ref = this.nodeId;
  4440. this.type = type;
  4441. this.attr = {};
  4442. this.events = {};
  4443. this.children = [];
  4444. this.pureChildren = [];
  4445. }
  4446. if ( Node$$1 ) Element.__proto__ = Node$$1;
  4447. Element.prototype = Object.create( Node$$1 && Node$$1.prototype );
  4448. Element.prototype.constructor = Element;
  4449. Element.prototype.setAttribute = function setAttribute (key, value) {
  4450. if (key === 'cid') {
  4451. this.cid = value;
  4452. } else if (key === 'nid') {
  4453. this.nid = value;
  4454. }
  4455. };
  4456. Element.prototype.dispatchEvent = function dispatchEvent (name, target) {
  4457. var handlers = this.events[name];
  4458. if (!handlers) {
  4459. return
  4460. }
  4461. handlers.forEach(function (handler) {
  4462. handler(target);
  4463. });
  4464. };
  4465. Element.prototype.addEventListener = function addEventListener (name, handler) {
  4466. if (this.cid === '' || this.nid === '') {
  4467. return console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " addEventListener(" + name + ") not found"))
  4468. }
  4469. (this.events[name] || (this.events[name] = [])).push(handler);
  4470. this._$vd.addElement(this);
  4471. };
  4472. Element.prototype.removeEventListener = function removeEventListener (name, handler) {
  4473. var this$1 = this;
  4474. if (this.cid === '' || this.nid === '') {
  4475. return console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " removeEventListener(" + name + ") not found"))
  4476. }
  4477. var isRemoved = false;
  4478. if (this.events[name]) {
  4479. var handlerIndex = this.events[name].indexOf(handler);
  4480. if (handlerIndex !== -1) {
  4481. this.events[name].splice(handlerIndex, 1);
  4482. isRemoved = true;
  4483. }
  4484. }
  4485. if (!isRemoved) {
  4486. console.error(("cid=" + (this.cid) + ",nid=" + (this.nid) + " removeEventListener(" + name + ") handler not found"));
  4487. }
  4488. Object.keys(this.events).every(function (eventType) { return this$1.events[eventType].length === 0; }) &&
  4489. this._$vd.removeElement(this);
  4490. };
  4491. Element.prototype.appendChild = function appendChild (node) {
  4492. if (node.parentNode && node.parentNode !== this) {
  4493. return
  4494. }
  4495. if (!node.parentNode) {
  4496. // if ("production" !== 'production') {
  4497. // console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
  4498. // `Append <${node.type}> to <${this.type}> (${this.ref}).`)
  4499. // }
  4500. linkParent(node, this);
  4501. insertIndex(node, this.children, this.children.length, true);
  4502. if (node.nodeType === 1) {
  4503. insertIndex(node, this.pureChildren, this.pureChildren.length);
  4504. }
  4505. } else {
  4506. // if ("production" !== 'production') {
  4507. // console.log(`[appendChild](${this.docId},${node.type},${node.ref}) ` +
  4508. // `Move <${node.type}> to ${this.children.length} of <${this.type}> (${this.ref}).`)
  4509. // }
  4510. moveIndex(node, this.children, this.children.length, true);
  4511. if (node.nodeType === 1) {
  4512. moveIndex(node, this.pureChildren, this.pureChildren.length);
  4513. }
  4514. }
  4515. };
  4516. Element.prototype.insertBefore = function insertBefore (node, before) {
  4517. if (node.parentNode && node.parentNode !== this) {
  4518. return
  4519. }
  4520. if (node === before || (node.nextSibling && node.nextSibling === before)) {
  4521. return
  4522. }
  4523. if (!node.parentNode) {
  4524. // if ("production" !== 'production') {
  4525. // console.log(`[insertBefore](${this.docId},${node.type},${node.ref}) ` +
  4526. // `Insert <${node.type}> to <${this.type}> (${this.ref}), before (${before.ref}).`)
  4527. // }
  4528. linkParent(node, this);
  4529. insertIndex(node, this.children, this.children.indexOf(before), true);
  4530. if (node.nodeType === 1) {
  4531. var pureBefore = nextElement(before);
  4532. insertIndex(
  4533. node,
  4534. this.pureChildren,
  4535. pureBefore ?
  4536. this.pureChildren.indexOf(pureBefore) :
  4537. this.pureChildren.length
  4538. );
  4539. }
  4540. } else {
  4541. moveIndex(node, this.children, this.children.indexOf(before), true);
  4542. if (node.nodeType === 1) {
  4543. var pureBefore$1 = nextElement(before);
  4544. moveIndex(
  4545. node,
  4546. this.pureChildren,
  4547. pureBefore$1 ?
  4548. this.pureChildren.indexOf(pureBefore$1) :
  4549. this.pureChildren.length
  4550. );
  4551. }
  4552. }
  4553. };
  4554. Element.prototype.insertAfter = function insertAfter (node, after) {
  4555. if (node.parentNode && node.parentNode !== this) {
  4556. return
  4557. }
  4558. if (node === after || (node.previousSibling && node.previousSibling === after)) {
  4559. return
  4560. }
  4561. if (!node.parentNode) {
  4562. // if ("production" !== 'production') {
  4563. // console.log(`[insertAfter](${this.docId},${node.type},${node.ref}) ` +
  4564. // `Insert <${node.type}> to <${this.type}> (${this.ref}), after (${after.ref}).`)
  4565. // }
  4566. linkParent(node, this);
  4567. insertIndex(node, this.children, this.children.indexOf(after) + 1, true);
  4568. if (node.nodeType === 1) {
  4569. insertIndex(
  4570. node,
  4571. this.pureChildren,
  4572. this.pureChildren.indexOf(previousElement(after)) + 1
  4573. );
  4574. }
  4575. } else {
  4576. moveIndex(node, this.children, this.children.indexOf(after) + 1, true);
  4577. if (node.nodeType === 1) {
  4578. moveIndex(
  4579. node,
  4580. this.pureChildren,
  4581. this.pureChildren.indexOf(previousElement(after)) + 1
  4582. );
  4583. }
  4584. }
  4585. };
  4586. Element.prototype.removeChild = function removeChild (node, preserved) {
  4587. if (node.parentNode) {
  4588. removeIndex(node, this.children, true);
  4589. if (node.nodeType === 1) {
  4590. // if ("production" !== 'production') {
  4591. // console.log(`[removeChild](${this.docId},${node.type},${node.ref}) ` +
  4592. // `Remove <${node.type}> from <${this.type}> (${this.ref}).`)
  4593. // }
  4594. removeIndex(node, this.pureChildren);
  4595. }
  4596. }
  4597. if (!preserved) {
  4598. node.destroy();
  4599. }
  4600. };
  4601. Element.prototype.clear = function clear () {
  4602. this.children.forEach(function (node) {
  4603. node.destroy();
  4604. });
  4605. this.children.length = 0;
  4606. this.pureChildren.length = 0;
  4607. };
  4608. Element.prototype.toString = function toString () {
  4609. return '<' + this.type +
  4610. ' attr=' + JSON.stringify(this.attr) +
  4611. ' style=' + JSON.stringify(this.toStyle()) + '>' +
  4612. this.pureChildren.map(function (child) { return child.toString(); }).join('') +
  4613. '</' + this.type + '>'
  4614. };
  4615. return Element;
  4616. }(Node));
  4617. var Document = function Document(id, url) {
  4618. this.id = id ? id.toString() : '';
  4619. this.URL = url;
  4620. this.createDocumentElement();
  4621. };
  4622. Document.prototype.createDocumentElement = function createDocumentElement () {
  4623. var this$1 = this;
  4624. if (!this.documentElement) {
  4625. var el = new Element('document');
  4626. el.docId = this.id;
  4627. el.ownerDocument = this;
  4628. el.role = 'documentElement';
  4629. el.depth = 0;
  4630. el.ref = '_documentElement';
  4631. this.documentElement = el;
  4632. Object.defineProperty(el, 'appendChild', {
  4633. configurable: true,
  4634. enumerable: true,
  4635. writable: true,
  4636. value: function (node) {
  4637. appendBody(this$1, node);
  4638. }
  4639. });
  4640. Object.defineProperty(el, 'insertBefore', {
  4641. configurable: true,
  4642. enumerable: true,
  4643. writable: true,
  4644. value: function (node, before) {
  4645. appendBody(this$1, node, before);
  4646. }
  4647. });
  4648. // if ("production" !== 'production') {
  4649. // console.log(`Create document element (id: "${el.docId}", ref: "${el.ref}")`)
  4650. // }
  4651. }
  4652. return this.documentElement
  4653. };
  4654. Document.prototype.createBody = function createBody (type) {
  4655. if (!this.body) {
  4656. var el = new Element(type);
  4657. setBody(this, el);
  4658. // if ("production" !== 'production') {
  4659. // console.log(`[createBody](${this.id},${el.type},${el.ref}) ` +
  4660. // `(${JSON.stringify(el.toJSON(true))}).`)
  4661. // }
  4662. }
  4663. return this.body
  4664. };
  4665. Document.prototype.createElement = function createElement (tagName) {
  4666. var el = new Element(tagName);
  4667. // if ("production" !== 'production') {
  4668. // console.log(`[createElement](${this.id},${el.type},${el.ref}) ` +
  4669. // `(${JSON.stringify(el.toJSON(true))}).`)
  4670. // }
  4671. return el
  4672. };
  4673. Document.prototype.createComment = function createComment (text) {
  4674. return new Comment(text)
  4675. };
  4676. Document.prototype.destroy = function destroy () {
  4677. // if ("production" !== 'production') {
  4678. // console.log(`[destroy](${this.id},document,${this.ref}) ` +
  4679. // `Destroy document (id: "${this.id}", URL: "${this.URL}")`)
  4680. // }
  4681. };
  4682. /* */
  4683. // these are reserved for web because they are directly compiled away
  4684. // during template compilation
  4685. var isReservedAttr = makeMap('style,class');
  4686. // attributes that should be using props for binding
  4687. var acceptValue = makeMap('input,textarea,option,select,progress');
  4688. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4689. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4690. var isBooleanAttr = makeMap(
  4691. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4692. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4693. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4694. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4695. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4696. 'truespeed,typemustmatch,visible'
  4697. );
  4698. /* */
  4699. var isReservedTag = makeMap(
  4700. 'html,body,base,head,link,meta,style,title,' +
  4701. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4702. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4703. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4704. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4705. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4706. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4707. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4708. 'output,progress,select,textarea,' +
  4709. 'details,dialog,menu,menuitem,summary,' +
  4710. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4711. );
  4712. function mustUseProp$1 () {
  4713. return false
  4714. }
  4715. function getTagNamespace () { }
  4716. function isUnknownElement () {
  4717. return false
  4718. }
  4719. /* */
  4720. function createElement$1(tagName) {
  4721. return new Element(tagName)
  4722. }
  4723. function createElementNS(namespace, tagName) {
  4724. return new Element(namespace + ':' + tagName)
  4725. }
  4726. function createTextNode() {
  4727. return new Element('text')
  4728. }
  4729. function createComment(text) {
  4730. return new Comment(text)
  4731. }
  4732. function insertBefore(node, target, before) {
  4733. node.insertBefore(target, before);
  4734. }
  4735. function removeChild(node, child) {
  4736. node.removeChild(child);
  4737. }
  4738. function appendChild(node, child) {
  4739. node.appendChild(child);
  4740. }
  4741. function parentNode(node) {
  4742. return node.parentNode
  4743. }
  4744. function nextSibling(node) {
  4745. return node.nextSibling
  4746. }
  4747. function tagName(node) {
  4748. return node.type
  4749. }
  4750. function setTextContent() {}
  4751. function setStyleScope() {}
  4752. var nodeOps = /*#__PURE__*/Object.freeze({
  4753. createElement: createElement$1,
  4754. createElementNS: createElementNS,
  4755. createTextNode: createTextNode,
  4756. createComment: createComment,
  4757. insertBefore: insertBefore,
  4758. removeChild: removeChild,
  4759. appendChild: appendChild,
  4760. parentNode: parentNode,
  4761. nextSibling: nextSibling,
  4762. tagName: tagName,
  4763. setTextContent: setTextContent,
  4764. setStyleScope: setStyleScope
  4765. });
  4766. /* */
  4767. var ref = {
  4768. create: function create (_, vnode) {
  4769. registerRef(vnode);
  4770. },
  4771. update: function update (oldVnode, vnode) {
  4772. if (oldVnode.data.ref !== vnode.data.ref) {
  4773. registerRef(oldVnode, true);
  4774. registerRef(vnode);
  4775. }
  4776. },
  4777. destroy: function destroy (vnode) {
  4778. registerRef(vnode, true);
  4779. }
  4780. };
  4781. function registerRef (vnode, isRemoval) {
  4782. var key = vnode.data.ref;
  4783. if (!isDef(key)) { return }
  4784. var vm = vnode.context;
  4785. var ref = vnode.componentInstance || vnode.elm;
  4786. var refs = vm.$refs;
  4787. if (isRemoval) {
  4788. if (Array.isArray(refs[key])) {
  4789. remove(refs[key], ref);
  4790. } else if (refs[key] === ref) {
  4791. refs[key] = undefined;
  4792. }
  4793. } else {
  4794. if (vnode.data.refInFor) {
  4795. if (!Array.isArray(refs[key])) {
  4796. refs[key] = [ref];
  4797. } else if (refs[key].indexOf(ref) < 0) {
  4798. // $flow-disable-line
  4799. refs[key].push(ref);
  4800. }
  4801. } else {
  4802. refs[key] = ref;
  4803. }
  4804. }
  4805. }
  4806. /* */
  4807. var isHTMLTag = makeMap(
  4808. 'html,body,base,head,link,meta,style,title,' +
  4809. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4810. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4811. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4812. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4813. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4814. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4815. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4816. 'output,progress,select,textarea,' +
  4817. 'details,dialog,menu,menuitem,summary,' +
  4818. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4819. );
  4820. // this map is intentionally selective, only covering SVG elements that may
  4821. // contain child elements.
  4822. var isSVG = makeMap(
  4823. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4824. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4825. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4826. true
  4827. );
  4828. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4829. /**
  4830. * Virtual DOM patching algorithm based on Snabbdom by
  4831. * Simon Friis Vindum (@paldepind)
  4832. * Licensed under the MIT License
  4833. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4834. *
  4835. * modified by Evan You (@yyx990803)
  4836. *
  4837. * Not type-checking this because this file is perf-critical and the cost
  4838. * of making flow understand it is not worth it.
  4839. */
  4840. var emptyNode = new VNode('', {}, []);
  4841. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4842. function sameVnode (a, b) {
  4843. return (
  4844. a.key === b.key && (
  4845. (
  4846. a.tag === b.tag &&
  4847. a.isComment === b.isComment &&
  4848. isDef(a.data) === isDef(b.data) &&
  4849. sameInputType(a, b)
  4850. ) || (
  4851. isTrue(a.isAsyncPlaceholder) &&
  4852. a.asyncFactory === b.asyncFactory &&
  4853. isUndef(b.asyncFactory.error)
  4854. )
  4855. )
  4856. )
  4857. }
  4858. function sameInputType (a, b) {
  4859. if (a.tag !== 'input') { return true }
  4860. var i;
  4861. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4862. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4863. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  4864. }
  4865. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4866. var i, key;
  4867. var map = {};
  4868. for (i = beginIdx; i <= endIdx; ++i) {
  4869. key = children[i].key;
  4870. if (isDef(key)) { map[key] = i; }
  4871. }
  4872. return map
  4873. }
  4874. function createPatchFunction (backend) {
  4875. var i, j;
  4876. var cbs = {};
  4877. var modules = backend.modules;
  4878. var nodeOps = backend.nodeOps;
  4879. for (i = 0; i < hooks.length; ++i) {
  4880. cbs[hooks[i]] = [];
  4881. for (j = 0; j < modules.length; ++j) {
  4882. if (isDef(modules[j][hooks[i]])) {
  4883. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4884. }
  4885. }
  4886. }
  4887. function emptyNodeAt (elm) {
  4888. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4889. }
  4890. function createRmCb (childElm, listeners) {
  4891. function remove$$1 () {
  4892. if (--remove$$1.listeners === 0) {
  4893. removeNode(childElm);
  4894. }
  4895. }
  4896. remove$$1.listeners = listeners;
  4897. return remove$$1
  4898. }
  4899. function removeNode (el) {
  4900. var parent = nodeOps.parentNode(el);
  4901. // element may have already been removed due to v-html / v-text
  4902. if (isDef(parent)) {
  4903. nodeOps.removeChild(parent, el);
  4904. }
  4905. }
  4906. function createElm (
  4907. vnode,
  4908. insertedVnodeQueue,
  4909. parentElm,
  4910. refElm,
  4911. nested,
  4912. ownerArray,
  4913. index
  4914. ) {
  4915. if (isDef(vnode.elm) && isDef(ownerArray)) {
  4916. // This vnode was used in a previous render!
  4917. // now it's used as a new node, overwriting its elm would cause
  4918. // potential patch errors down the road when it's used as an insertion
  4919. // reference node. Instead, we clone the node on-demand before creating
  4920. // associated DOM element for it.
  4921. vnode = ownerArray[index] = cloneVNode(vnode);
  4922. }
  4923. vnode.isRootInsert = !nested; // for transition enter check
  4924. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4925. return
  4926. }
  4927. var data = vnode.data;
  4928. var children = vnode.children;
  4929. var tag = vnode.tag;
  4930. if (isDef(tag)) {
  4931. vnode.elm = vnode.ns
  4932. ? nodeOps.createElementNS(vnode.ns, tag)
  4933. : nodeOps.createElement(tag, vnode);
  4934. setScope(vnode);
  4935. /* istanbul ignore if */
  4936. {
  4937. createChildren(vnode, children, insertedVnodeQueue);
  4938. if (isDef(data)) {
  4939. invokeCreateHooks(vnode, insertedVnodeQueue);
  4940. }
  4941. insert(parentElm, vnode.elm, refElm);
  4942. }
  4943. } else if (isTrue(vnode.isComment)) {
  4944. vnode.elm = nodeOps.createComment(vnode.text);
  4945. insert(parentElm, vnode.elm, refElm);
  4946. } else {
  4947. vnode.elm = nodeOps.createTextNode(vnode.text);
  4948. insert(parentElm, vnode.elm, refElm);
  4949. }
  4950. }
  4951. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4952. var i = vnode.data;
  4953. if (isDef(i)) {
  4954. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  4955. if (isDef(i = i.hook) && isDef(i = i.init)) {
  4956. i(vnode, false /* hydrating */);
  4957. }
  4958. // after calling the init hook, if the vnode is a child component
  4959. // it should've created a child instance and mounted it. the child
  4960. // component also has set the placeholder vnode's elm.
  4961. // in that case we can just return the element and be done.
  4962. if (isDef(vnode.componentInstance)) {
  4963. initComponent(vnode, insertedVnodeQueue);
  4964. insert(parentElm, vnode.elm, refElm);
  4965. if (isTrue(isReactivated)) {
  4966. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  4967. }
  4968. return true
  4969. }
  4970. }
  4971. }
  4972. function initComponent (vnode, insertedVnodeQueue) {
  4973. if (isDef(vnode.data.pendingInsert)) {
  4974. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  4975. vnode.data.pendingInsert = null;
  4976. }
  4977. vnode.elm = vnode.componentInstance.$el;
  4978. if (isPatchable(vnode)) {
  4979. invokeCreateHooks(vnode, insertedVnodeQueue);
  4980. setScope(vnode);
  4981. } else {
  4982. // empty component root.
  4983. // skip all element-related modules except for ref (#3455)
  4984. registerRef(vnode);
  4985. // make sure to invoke the insert hook
  4986. insertedVnodeQueue.push(vnode);
  4987. }
  4988. }
  4989. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4990. var i;
  4991. // hack for #4339: a reactivated component with inner transition
  4992. // does not trigger because the inner node's created hooks are not called
  4993. // again. It's not ideal to involve module-specific logic in here but
  4994. // there doesn't seem to be a better way to do it.
  4995. var innerNode = vnode;
  4996. while (innerNode.componentInstance) {
  4997. innerNode = innerNode.componentInstance._vnode;
  4998. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  4999. for (i = 0; i < cbs.activate.length; ++i) {
  5000. cbs.activate[i](emptyNode, innerNode);
  5001. }
  5002. insertedVnodeQueue.push(innerNode);
  5003. break
  5004. }
  5005. }
  5006. // unlike a newly created component,
  5007. // a reactivated keep-alive component doesn't insert itself
  5008. insert(parentElm, vnode.elm, refElm);
  5009. }
  5010. function insert (parent, elm, ref$$1) {
  5011. if (isDef(parent)) {
  5012. if (isDef(ref$$1)) {
  5013. if (nodeOps.parentNode(ref$$1) === parent) {
  5014. nodeOps.insertBefore(parent, elm, ref$$1);
  5015. }
  5016. } else {
  5017. nodeOps.appendChild(parent, elm);
  5018. }
  5019. }
  5020. }
  5021. function createChildren (vnode, children, insertedVnodeQueue) {
  5022. if (Array.isArray(children)) {
  5023. for (var i = 0; i < children.length; ++i) {
  5024. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5025. }
  5026. } else if (isPrimitive(vnode.text)) {
  5027. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5028. }
  5029. }
  5030. function isPatchable (vnode) {
  5031. while (vnode.componentInstance) {
  5032. vnode = vnode.componentInstance._vnode;
  5033. }
  5034. return isDef(vnode.tag)
  5035. }
  5036. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5037. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5038. cbs.create[i$1](emptyNode, vnode);
  5039. }
  5040. i = vnode.data.hook; // Reuse variable
  5041. if (isDef(i)) {
  5042. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5043. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5044. }
  5045. }
  5046. // set scope id attribute for scoped CSS.
  5047. // this is implemented as a special case to avoid the overhead
  5048. // of going through the normal attribute patching process.
  5049. function setScope (vnode) {
  5050. var i;
  5051. if (isDef(i = vnode.fnScopeId)) {
  5052. nodeOps.setStyleScope(vnode.elm, i);
  5053. } else {
  5054. var ancestor = vnode;
  5055. while (ancestor) {
  5056. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5057. nodeOps.setStyleScope(vnode.elm, i);
  5058. }
  5059. ancestor = ancestor.parent;
  5060. }
  5061. }
  5062. // for slot content they should also get the scopeId from the host instance.
  5063. if (isDef(i = activeInstance) &&
  5064. i !== vnode.context &&
  5065. i !== vnode.fnContext &&
  5066. isDef(i = i.$options._scopeId)
  5067. ) {
  5068. nodeOps.setStyleScope(vnode.elm, i);
  5069. }
  5070. }
  5071. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5072. for (; startIdx <= endIdx; ++startIdx) {
  5073. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5074. }
  5075. }
  5076. function invokeDestroyHook (vnode) {
  5077. var i, j;
  5078. var data = vnode.data;
  5079. if (isDef(data)) {
  5080. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5081. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5082. }
  5083. if (isDef(i = vnode.children)) {
  5084. for (j = 0; j < vnode.children.length; ++j) {
  5085. invokeDestroyHook(vnode.children[j]);
  5086. }
  5087. }
  5088. }
  5089. function removeVnodes (vnodes, startIdx, endIdx) {
  5090. for (; startIdx <= endIdx; ++startIdx) {
  5091. var ch = vnodes[startIdx];
  5092. if (isDef(ch)) {
  5093. if (isDef(ch.tag)) {
  5094. removeAndInvokeRemoveHook(ch);
  5095. invokeDestroyHook(ch);
  5096. } else { // Text node
  5097. removeNode(ch.elm);
  5098. }
  5099. }
  5100. }
  5101. }
  5102. function removeAndInvokeRemoveHook (vnode, rm) {
  5103. if (isDef(rm) || isDef(vnode.data)) {
  5104. var i, children;
  5105. var listeners = cbs.remove.length + 1;
  5106. if (isDef(rm)) {
  5107. // we have a recursively passed down rm callback
  5108. // increase the listeners count
  5109. rm.listeners += listeners;
  5110. } else {
  5111. // directly removing
  5112. rm = createRmCb(vnode.elm, listeners);
  5113. }
  5114. // recursively invoke hooks on child component root node
  5115. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5116. removeAndInvokeRemoveHook(i, rm);
  5117. } else if (isDef(children = vnode.children)) {
  5118. // fixed by xxxxxx
  5119. // app-plus service 层 elm 暂未实现父子关系维护,移除父 elm 时,导致子 elm 还存留(影响了事件查找)
  5120. // 暂时使用 vnode 的 children 递归 rm 掉子 elm
  5121. for (i = 0; i < children.length; i++) {
  5122. if (children[i].tag) {
  5123. removeAndInvokeRemoveHook(children[i]);
  5124. }
  5125. }
  5126. }
  5127. for (i = 0; i < cbs.remove.length; ++i) {
  5128. cbs.remove[i](vnode, rm);
  5129. }
  5130. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5131. i(vnode, rm);
  5132. } else {
  5133. rm();
  5134. }
  5135. } else {
  5136. removeNode(vnode.elm);
  5137. }
  5138. }
  5139. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5140. var oldStartIdx = 0;
  5141. var newStartIdx = 0;
  5142. var oldEndIdx = oldCh.length - 1;
  5143. var oldStartVnode = oldCh[0];
  5144. var oldEndVnode = oldCh[oldEndIdx];
  5145. var newEndIdx = newCh.length - 1;
  5146. var newStartVnode = newCh[0];
  5147. var newEndVnode = newCh[newEndIdx];
  5148. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5149. // removeOnly is a special flag used only by <transition-group>
  5150. // to ensure removed elements stay in correct relative positions
  5151. // during leaving transitions
  5152. var canMove = !removeOnly;
  5153. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5154. if (isUndef(oldStartVnode)) {
  5155. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5156. } else if (isUndef(oldEndVnode)) {
  5157. oldEndVnode = oldCh[--oldEndIdx];
  5158. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5159. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5160. oldStartVnode = oldCh[++oldStartIdx];
  5161. newStartVnode = newCh[++newStartIdx];
  5162. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5163. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5164. oldEndVnode = oldCh[--oldEndIdx];
  5165. newEndVnode = newCh[--newEndIdx];
  5166. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5167. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5168. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5169. oldStartVnode = oldCh[++oldStartIdx];
  5170. newEndVnode = newCh[--newEndIdx];
  5171. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5172. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5173. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5174. oldEndVnode = oldCh[--oldEndIdx];
  5175. newStartVnode = newCh[++newStartIdx];
  5176. } else {
  5177. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5178. idxInOld = isDef(newStartVnode.key)
  5179. ? oldKeyToIdx[newStartVnode.key]
  5180. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5181. if (isUndef(idxInOld)) { // New element
  5182. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5183. } else {
  5184. vnodeToMove = oldCh[idxInOld];
  5185. if (sameVnode(vnodeToMove, newStartVnode)) {
  5186. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5187. oldCh[idxInOld] = undefined;
  5188. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5189. } else {
  5190. // same key but different element. treat as new element
  5191. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5192. }
  5193. }
  5194. newStartVnode = newCh[++newStartIdx];
  5195. }
  5196. }
  5197. if (oldStartIdx > oldEndIdx) {
  5198. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5199. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5200. } else if (newStartIdx > newEndIdx) {
  5201. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5202. }
  5203. }
  5204. function findIdxInOld (node, oldCh, start, end) {
  5205. for (var i = start; i < end; i++) {
  5206. var c = oldCh[i];
  5207. if (isDef(c) && sameVnode(node, c)) { return i }
  5208. }
  5209. }
  5210. function patchVnode (
  5211. oldVnode,
  5212. vnode,
  5213. insertedVnodeQueue,
  5214. ownerArray,
  5215. index,
  5216. removeOnly
  5217. ) {
  5218. if (oldVnode === vnode) {
  5219. return
  5220. }
  5221. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5222. // clone reused vnode
  5223. vnode = ownerArray[index] = cloneVNode(vnode);
  5224. }
  5225. var elm = vnode.elm = oldVnode.elm;
  5226. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5227. if (isDef(vnode.asyncFactory.resolved)) {
  5228. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5229. } else {
  5230. vnode.isAsyncPlaceholder = true;
  5231. }
  5232. return
  5233. }
  5234. // reuse element for static trees.
  5235. // note we only do this if the vnode is cloned -
  5236. // if the new node is not cloned it means the render functions have been
  5237. // reset by the hot-reload-api and we need to do a proper re-render.
  5238. if (isTrue(vnode.isStatic) &&
  5239. isTrue(oldVnode.isStatic) &&
  5240. vnode.key === oldVnode.key &&
  5241. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5242. ) {
  5243. vnode.componentInstance = oldVnode.componentInstance;
  5244. return
  5245. }
  5246. var i;
  5247. var data = vnode.data;
  5248. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5249. i(oldVnode, vnode);
  5250. }
  5251. var oldCh = oldVnode.children;
  5252. var ch = vnode.children;
  5253. if (isDef(data) && isPatchable(vnode)) {
  5254. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5255. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5256. }
  5257. if (isUndef(vnode.text)) {
  5258. if (isDef(oldCh) && isDef(ch)) {
  5259. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5260. } else if (isDef(ch)) {
  5261. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5262. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5263. } else if (isDef(oldCh)) {
  5264. removeVnodes(oldCh, 0, oldCh.length - 1);
  5265. } else if (isDef(oldVnode.text)) {
  5266. nodeOps.setTextContent(elm, '');
  5267. }
  5268. } else if (oldVnode.text !== vnode.text) {
  5269. nodeOps.setTextContent(elm, vnode.text);
  5270. }
  5271. if (isDef(data)) {
  5272. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5273. }
  5274. }
  5275. function invokeInsertHook (vnode, queue, initial) {
  5276. // delay insert hooks for component root nodes, invoke them after the
  5277. // element is really inserted
  5278. if (isTrue(initial) && isDef(vnode.parent)) {
  5279. vnode.parent.data.pendingInsert = queue;
  5280. } else {
  5281. for (var i = 0; i < queue.length; ++i) {
  5282. queue[i].data.hook.insert(queue[i]);
  5283. }
  5284. }
  5285. }
  5286. // list of modules that can skip create hook during hydration because they
  5287. // are already rendered on the client or has no need for initialization
  5288. // Note: style is excluded because it relies on initial clone for future
  5289. // deep updates (#7063).
  5290. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5291. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5292. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5293. var i;
  5294. var tag = vnode.tag;
  5295. var data = vnode.data;
  5296. var children = vnode.children;
  5297. inVPre = inVPre || (data && data.pre);
  5298. vnode.elm = elm;
  5299. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5300. vnode.isAsyncPlaceholder = true;
  5301. return true
  5302. }
  5303. if (isDef(data)) {
  5304. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5305. if (isDef(i = vnode.componentInstance)) {
  5306. // child component. it should have hydrated its own tree.
  5307. initComponent(vnode, insertedVnodeQueue);
  5308. return true
  5309. }
  5310. }
  5311. if (isDef(tag)) {
  5312. if (isDef(children)) {
  5313. // empty element, allow client to pick up and populate children
  5314. if (!elm.hasChildNodes()) {
  5315. createChildren(vnode, children, insertedVnodeQueue);
  5316. } else {
  5317. // v-html and domProps: innerHTML
  5318. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5319. if (i !== elm.innerHTML) {
  5320. return false
  5321. }
  5322. } else {
  5323. // iterate and compare children lists
  5324. var childrenMatch = true;
  5325. var childNode = elm.firstChild;
  5326. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5327. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5328. childrenMatch = false;
  5329. break
  5330. }
  5331. childNode = childNode.nextSibling;
  5332. }
  5333. // if childNode is not null, it means the actual childNodes list is
  5334. // longer than the virtual children list.
  5335. if (!childrenMatch || childNode) {
  5336. return false
  5337. }
  5338. }
  5339. }
  5340. }
  5341. if (isDef(data)) {
  5342. var fullInvoke = false;
  5343. for (var key in data) {
  5344. if (!isRenderedModule(key)) {
  5345. fullInvoke = true;
  5346. invokeCreateHooks(vnode, insertedVnodeQueue);
  5347. break
  5348. }
  5349. }
  5350. if (!fullInvoke && data['class']) {
  5351. // ensure collecting deps for deep class bindings for future updates
  5352. traverse(data['class']);
  5353. }
  5354. }
  5355. } else if (elm.data !== vnode.text) {
  5356. elm.data = vnode.text;
  5357. }
  5358. return true
  5359. }
  5360. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5361. if (isUndef(vnode)) {
  5362. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5363. return
  5364. }
  5365. var isInitialPatch = false;
  5366. var insertedVnodeQueue = [];
  5367. if (isUndef(oldVnode)) {
  5368. // empty mount (likely as component), create new root element
  5369. isInitialPatch = true;
  5370. createElm(vnode, insertedVnodeQueue);
  5371. } else {
  5372. var isRealElement = isDef(oldVnode.nodeType);
  5373. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5374. // patch existing root node
  5375. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5376. } else {
  5377. if (isRealElement) {
  5378. // mounting to a real element
  5379. // check if this is server-rendered content and if we can perform
  5380. // a successful hydration.
  5381. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5382. oldVnode.removeAttribute(SSR_ATTR);
  5383. hydrating = true;
  5384. }
  5385. if (isTrue(hydrating)) {
  5386. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5387. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5388. return oldVnode
  5389. }
  5390. }
  5391. // either not server-rendered, or hydration failed.
  5392. // create an empty node and replace it
  5393. oldVnode = emptyNodeAt(oldVnode);
  5394. }
  5395. // replacing existing element
  5396. var oldElm = oldVnode.elm;
  5397. var parentElm = nodeOps.parentNode(oldElm);
  5398. // create new node
  5399. createElm(
  5400. vnode,
  5401. insertedVnodeQueue,
  5402. // extremely rare edge case: do not insert if old element is in a
  5403. // leaving transition. Only happens when combining transition +
  5404. // keep-alive + HOCs. (#4590)
  5405. oldElm._leaveCb ? null : parentElm,
  5406. nodeOps.nextSibling(oldElm)
  5407. );
  5408. // update parent placeholder node element, recursively
  5409. if (isDef(vnode.parent)) {
  5410. var ancestor = vnode.parent;
  5411. var patchable = isPatchable(vnode);
  5412. while (ancestor) {
  5413. for (var i = 0; i < cbs.destroy.length; ++i) {
  5414. cbs.destroy[i](ancestor);
  5415. }
  5416. ancestor.elm = vnode.elm;
  5417. if (patchable) {
  5418. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5419. cbs.create[i$1](emptyNode, ancestor);
  5420. }
  5421. // #6513
  5422. // invoke insert hooks that may have been merged by create hooks.
  5423. // e.g. for directives that uses the "inserted" hook.
  5424. var insert = ancestor.data.hook.insert;
  5425. if (insert.merged) {
  5426. // start at index 1 to avoid re-invoking component mounted hook
  5427. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5428. insert.fns[i$2]();
  5429. }
  5430. }
  5431. } else {
  5432. registerRef(ancestor);
  5433. }
  5434. ancestor = ancestor.parent;
  5435. }
  5436. }
  5437. // destroy old node
  5438. if (isDef(parentElm)) {
  5439. removeVnodes([oldVnode], 0, 0);
  5440. } else if (isDef(oldVnode.tag)) {
  5441. invokeDestroyHook(oldVnode);
  5442. }
  5443. }
  5444. }
  5445. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5446. return vnode.elm
  5447. }
  5448. }
  5449. /* */
  5450. var directives = {
  5451. create: updateDirectives,
  5452. update: updateDirectives,
  5453. destroy: function unbindDirectives (vnode) {
  5454. updateDirectives(vnode, emptyNode);
  5455. }
  5456. };
  5457. function updateDirectives (oldVnode, vnode) {
  5458. if (oldVnode.data.directives || vnode.data.directives) {
  5459. _update(oldVnode, vnode);
  5460. }
  5461. }
  5462. function _update (oldVnode, vnode) {
  5463. var isCreate = oldVnode === emptyNode;
  5464. var isDestroy = vnode === emptyNode;
  5465. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5466. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5467. var dirsWithInsert = [];
  5468. var dirsWithPostpatch = [];
  5469. var key, oldDir, dir;
  5470. for (key in newDirs) {
  5471. oldDir = oldDirs[key];
  5472. dir = newDirs[key];
  5473. if (!oldDir) {
  5474. // new directive, bind
  5475. callHook$1(dir, 'bind', vnode, oldVnode);
  5476. if (dir.def && dir.def.inserted) {
  5477. dirsWithInsert.push(dir);
  5478. }
  5479. } else {
  5480. // existing directive, update
  5481. dir.oldValue = oldDir.value;
  5482. dir.oldArg = oldDir.arg;
  5483. callHook$1(dir, 'update', vnode, oldVnode);
  5484. if (dir.def && dir.def.componentUpdated) {
  5485. dirsWithPostpatch.push(dir);
  5486. }
  5487. }
  5488. }
  5489. if (dirsWithInsert.length) {
  5490. var callInsert = function () {
  5491. for (var i = 0; i < dirsWithInsert.length; i++) {
  5492. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5493. }
  5494. };
  5495. if (isCreate) {
  5496. mergeVNodeHook(vnode, 'insert', callInsert);
  5497. } else {
  5498. callInsert();
  5499. }
  5500. }
  5501. if (dirsWithPostpatch.length) {
  5502. mergeVNodeHook(vnode, 'postpatch', function () {
  5503. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5504. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5505. }
  5506. });
  5507. }
  5508. if (!isCreate) {
  5509. for (key in oldDirs) {
  5510. if (!newDirs[key]) {
  5511. // no longer present, unbind
  5512. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5513. }
  5514. }
  5515. }
  5516. }
  5517. var emptyModifiers = Object.create(null);
  5518. function normalizeDirectives$1 (
  5519. dirs,
  5520. vm
  5521. ) {
  5522. var res = Object.create(null);
  5523. if (!dirs) {
  5524. // $flow-disable-line
  5525. return res
  5526. }
  5527. var i, dir;
  5528. for (i = 0; i < dirs.length; i++) {
  5529. dir = dirs[i];
  5530. if (!dir.modifiers) {
  5531. // $flow-disable-line
  5532. dir.modifiers = emptyModifiers;
  5533. }
  5534. res[getRawDirName(dir)] = dir;
  5535. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5536. }
  5537. // $flow-disable-line
  5538. return res
  5539. }
  5540. function getRawDirName (dir) {
  5541. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5542. }
  5543. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5544. var fn = dir.def && dir.def[hook];
  5545. if (fn) {
  5546. try {
  5547. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5548. } catch (e) {
  5549. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5550. }
  5551. }
  5552. }
  5553. var baseModules = [
  5554. ref,
  5555. directives
  5556. ];
  5557. /* */
  5558. function updateWxsProps(oldVnode, vnode) {
  5559. if (
  5560. isUndef(oldVnode.data.wxsProps) &&
  5561. isUndef(vnode.data.wxsProps)
  5562. ) {
  5563. return
  5564. }
  5565. var oldWxsWatches = oldVnode.$wxsWatches;
  5566. var wxsPropsKey = Object.keys(vnode.data.wxsProps);
  5567. if (!oldWxsWatches && !wxsPropsKey.length) {
  5568. return
  5569. }
  5570. if (!oldWxsWatches) {
  5571. oldWxsWatches = {};
  5572. }
  5573. var wxsProps = vnode.data.wxsProps;
  5574. vnode.$wxsWatches = {};
  5575. Object.keys(wxsProps).forEach(function (prop) {
  5576. var watchProp = wxsProps[prop];
  5577. vnode.$wxsWatches[prop] = oldWxsWatches[prop] || vnode.context.$watch(watchProp, function() {
  5578. this.$forceUpdate();
  5579. }, {
  5580. deep: true
  5581. });
  5582. });
  5583. Object.keys(oldWxsWatches).forEach(function (oldName) {
  5584. if (!vnode.$wxsWatches[oldName]) {
  5585. oldWxsWatches[oldName]();
  5586. delete oldWxsWatches[oldName];
  5587. }
  5588. });
  5589. }
  5590. var wxs = {
  5591. create: updateWxsProps,
  5592. update: updateWxsProps
  5593. };
  5594. function parseDataset(attrs) {
  5595. var dataset = Object.create(null);
  5596. Object.keys(attrs).forEach(function (name) {
  5597. if (name.indexOf('data-') === 0) {
  5598. var camelizeName = camelize(name.replace('data-', ''));
  5599. try {
  5600. dataset[camelizeName] = JSON.parse(attrs[name]);
  5601. } catch (e) {
  5602. dataset[camelizeName] = attrs[name];
  5603. }
  5604. }
  5605. });
  5606. return dataset
  5607. }
  5608. function updateAttrs(oldVnode, vnode) {
  5609. var attrs = vnode.data.attrs;
  5610. if (isUndef(attrs)) {
  5611. return
  5612. }
  5613. var id = attrs['_i'];
  5614. if (isUndef(id)) {
  5615. return
  5616. }
  5617. var elm = vnode.elm;
  5618. elm.dataset = Object.assign(elm.dataset || {}, parseDataset(attrs));
  5619. }
  5620. var attrs = {
  5621. create: updateAttrs,
  5622. update: updateAttrs
  5623. };
  5624. /* */
  5625. /* */
  5626. /* */
  5627. /* */
  5628. // in some cases, the event used has to be determined at runtime
  5629. // so we used some reserved tokens during compile.
  5630. var RANGE_TOKEN = '__r';
  5631. var CHECKBOX_RADIO_TOKEN = '__c';
  5632. /* */
  5633. // normalize v-model event tokens that can only be determined at runtime.
  5634. // it's important to place the event as the first in the array because
  5635. // the whole point is ensuring the v-model callback gets called before
  5636. // user-attached handlers.
  5637. function normalizeEvents (on) {
  5638. /* istanbul ignore if */
  5639. if (isDef(on[RANGE_TOKEN])) {
  5640. var event = 'input';
  5641. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  5642. delete on[RANGE_TOKEN];
  5643. }
  5644. // This was originally intended to fix #4521 but no longer necessary
  5645. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  5646. /* istanbul ignore if */
  5647. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  5648. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  5649. delete on[CHECKBOX_RADIO_TOKEN];
  5650. }
  5651. }
  5652. var target$1;
  5653. function createOnceHandler$1 (event, handler, capture) {
  5654. var _target = target$1; // save current target element in closure
  5655. return function onceHandler () {
  5656. var res = handler.apply(null, arguments);
  5657. if (res !== null) {
  5658. remove$2(event, onceHandler, capture, _target);
  5659. }
  5660. }
  5661. }
  5662. function add$1 (name,handler) {
  5663. target$1.addEventListener(name, handler);
  5664. }
  5665. function remove$2 (
  5666. name,
  5667. handler,
  5668. capture,
  5669. _target
  5670. ) {
  5671. if (!handler) {
  5672. return
  5673. }
  5674. (_target || target$1).removeEventListener(
  5675. name,
  5676. handler._wrapper || handler
  5677. );
  5678. }
  5679. function updateDOMListeners (oldVnode, vnode) {
  5680. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  5681. return
  5682. }
  5683. var on = vnode.data.on || {};
  5684. var oldOn = oldVnode.data.on || {};
  5685. target$1 = vnode.elm;
  5686. // fixed by xxxxxx 存储 vd
  5687. target$1._$vd = vnode.context._$vd;
  5688. var context = vnode.context;
  5689. // 存储事件标记
  5690. var nid = (vnode.data.attrs || {})['_i'];
  5691. var parent = vnode.parent;
  5692. while (parent && parent.componentInstance) { // 使用组件外壳节点id
  5693. var parentId = parent.data.attrs && parent.data.attrs['_i'];
  5694. isDef(parentId) && (nid = 'r-' + parentId);
  5695. parent = parent.parent;
  5696. }
  5697. target$1.setAttribute('nid', String(nid));
  5698. target$1.setAttribute('cid', context._$id);
  5699. normalizeEvents(on);
  5700. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  5701. target$1 = undefined;
  5702. }
  5703. var events = {
  5704. create: updateDOMListeners,
  5705. update: updateDOMListeners
  5706. };
  5707. var platformModules = [
  5708. wxs,
  5709. attrs,
  5710. events
  5711. ];
  5712. /* */
  5713. // the directive module should be applied last, after all
  5714. // built-in modules have been applied.
  5715. var modules = platformModules.concat(baseModules);
  5716. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  5717. var model$1 = {};
  5718. var show = {};
  5719. var platformDirectives = {
  5720. model: model$1,
  5721. show: show
  5722. };
  5723. var platformComponents = {
  5724. };
  5725. /* */
  5726. function stringifyClass (value) {
  5727. if (Array.isArray(value)) {
  5728. return stringifyArray(value)
  5729. }
  5730. if (isObject(value)) {
  5731. return stringifyObject(value)
  5732. }
  5733. if (typeof value === 'string') {
  5734. return value
  5735. }
  5736. /* istanbul ignore next */
  5737. return ''
  5738. }
  5739. function stringifyArray (value) {
  5740. var res = '';
  5741. var stringified;
  5742. for (var i = 0, l = value.length; i < l; i++) {
  5743. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5744. if (res) { res += ' '; }
  5745. res += stringified;
  5746. }
  5747. }
  5748. return res
  5749. }
  5750. function stringifyObject (value) {
  5751. var res = '';
  5752. for (var key in value) {
  5753. if (value[key]) {
  5754. if (res) { res += ' '; }
  5755. res += key;
  5756. }
  5757. }
  5758. return res
  5759. }
  5760. /* */
  5761. var parseStyleText = cached(function (cssText) {
  5762. var res = {};
  5763. var listDelimiter = /;(?![^(]*\))/g;
  5764. var propertyDelimiter = /:(.+)/;
  5765. cssText.split(listDelimiter).forEach(function (item) {
  5766. if (item) {
  5767. var tmp = item.split(propertyDelimiter);
  5768. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  5769. }
  5770. });
  5771. return res
  5772. });
  5773. // normalize possible array / string values into Object
  5774. function normalizeStyleBinding (bindingStyle) {
  5775. if (Array.isArray(bindingStyle)) {
  5776. return toObject(bindingStyle)
  5777. }
  5778. if (typeof bindingStyle === 'string') {
  5779. return parseStyleText(bindingStyle)
  5780. }
  5781. return bindingStyle
  5782. }
  5783. function callHook$2(hook, args) {
  5784. var vm = this;
  5785. // #7573 disable dep collection when invoking lifecycle hooks
  5786. pushTarget();
  5787. var handlers = vm.$options[hook];
  5788. var info = hook + " hook";
  5789. var ret;
  5790. if (handlers) {
  5791. for (var i = 0, j = handlers.length; i < j; i++) {
  5792. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  5793. }
  5794. }
  5795. if (vm._hasHookEvent) {
  5796. vm.$emit('hook:' + hook, args);
  5797. }
  5798. popTarget();
  5799. return ret
  5800. }
  5801. var plugin = {
  5802. install: function install(Vue) {
  5803. Vue.prototype._$queue = queue;
  5804. Vue.prototype.__call_hook = callHook$2;
  5805. // 运行时需要格式化 class,style
  5806. Vue.prototype._$stringifyClass = stringifyClass;
  5807. Vue.prototype._$normalizeStyleBinding = normalizeStyleBinding;
  5808. }
  5809. };
  5810. /* */
  5811. // install platform specific utils
  5812. Vue.config.mustUseProp = mustUseProp$1;
  5813. Vue.config.isReservedTag = isReservedTag;
  5814. Vue.config.isReservedAttr = isReservedAttr;
  5815. Vue.config.getTagNamespace = getTagNamespace;
  5816. Vue.config.isUnknownElement = isUnknownElement;
  5817. // install platform runtime directives & components
  5818. extend(Vue.options.directives, platformDirectives);
  5819. extend(Vue.options.components, platformComponents);
  5820. // install platform patch function
  5821. Vue.prototype.__patch__ = patch;
  5822. // public mount method
  5823. Vue.prototype.$mount = function (
  5824. el,
  5825. hydrating
  5826. ) {
  5827. if (this.$options.mpType === 'page') {
  5828. var doc = new Document(this.$options.pageId, this.$options.pagePath);
  5829. el = doc.createComment('root');
  5830. el.hasAttribute = el.removeAttribute = function(){}; // hack for patch
  5831. doc.documentElement.appendChild(el);
  5832. }
  5833. return mountComponent(this, el, hydrating)
  5834. };
  5835. Vue.use(plugin);
  5836. // this entry is built and wrapped with a factory function
  5837. exports.Vue = Vue;
  5838. }