vendor.js 841 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017
  1. (global["webpackJsonp"] = global["webpackJsonp"] || []).push([["common/vendor"],{
  2. /***/ 1:
  3. /*!************************************************************!*\
  4. !*** ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js ***!
  5. \************************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", { value: true });exports.createApp = createApp;exports.createComponent = createComponent;exports.createPage = createPage;exports.default = void 0;var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 2));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr, i) {if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"] != null) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);return Constructor;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) {arr2[i] = arr[i];}return arr2;}
  10. var _toString = Object.prototype.toString;
  11. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12. function isFn(fn) {
  13. return typeof fn === 'function';
  14. }
  15. function isStr(str) {
  16. return typeof str === 'string';
  17. }
  18. function isPlainObject(obj) {
  19. return _toString.call(obj) === '[object Object]';
  20. }
  21. function hasOwn(obj, key) {
  22. return hasOwnProperty.call(obj, key);
  23. }
  24. function noop() {}
  25. /**
  26. * Create a cached version of a pure function.
  27. */
  28. function cached(fn) {
  29. var cache = Object.create(null);
  30. return function cachedFn(str) {
  31. var hit = cache[str];
  32. return hit || (cache[str] = fn(str));
  33. };
  34. }
  35. /**
  36. * Camelize a hyphen-delimited string.
  37. */
  38. var camelizeRE = /-(\w)/g;
  39. var camelize = cached(function (str) {
  40. return str.replace(camelizeRE, function (_, c) {return c ? c.toUpperCase() : '';});
  41. });
  42. var HOOKS = [
  43. 'invoke',
  44. 'success',
  45. 'fail',
  46. 'complete',
  47. 'returnValue'];
  48. var globalInterceptors = {};
  49. var scopedInterceptors = {};
  50. function mergeHook(parentVal, childVal) {
  51. var res = childVal ?
  52. parentVal ?
  53. parentVal.concat(childVal) :
  54. Array.isArray(childVal) ?
  55. childVal : [childVal] :
  56. parentVal;
  57. return res ?
  58. dedupeHooks(res) :
  59. res;
  60. }
  61. function dedupeHooks(hooks) {
  62. var res = [];
  63. for (var i = 0; i < hooks.length; i++) {
  64. if (res.indexOf(hooks[i]) === -1) {
  65. res.push(hooks[i]);
  66. }
  67. }
  68. return res;
  69. }
  70. function removeHook(hooks, hook) {
  71. var index = hooks.indexOf(hook);
  72. if (index !== -1) {
  73. hooks.splice(index, 1);
  74. }
  75. }
  76. function mergeInterceptorHook(interceptor, option) {
  77. Object.keys(option).forEach(function (hook) {
  78. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  79. interceptor[hook] = mergeHook(interceptor[hook], option[hook]);
  80. }
  81. });
  82. }
  83. function removeInterceptorHook(interceptor, option) {
  84. if (!interceptor || !option) {
  85. return;
  86. }
  87. Object.keys(option).forEach(function (hook) {
  88. if (HOOKS.indexOf(hook) !== -1 && isFn(option[hook])) {
  89. removeHook(interceptor[hook], option[hook]);
  90. }
  91. });
  92. }
  93. function addInterceptor(method, option) {
  94. if (typeof method === 'string' && isPlainObject(option)) {
  95. mergeInterceptorHook(scopedInterceptors[method] || (scopedInterceptors[method] = {}), option);
  96. } else if (isPlainObject(method)) {
  97. mergeInterceptorHook(globalInterceptors, method);
  98. }
  99. }
  100. function removeInterceptor(method, option) {
  101. if (typeof method === 'string') {
  102. if (isPlainObject(option)) {
  103. removeInterceptorHook(scopedInterceptors[method], option);
  104. } else {
  105. delete scopedInterceptors[method];
  106. }
  107. } else if (isPlainObject(method)) {
  108. removeInterceptorHook(globalInterceptors, method);
  109. }
  110. }
  111. function wrapperHook(hook) {
  112. return function (data) {
  113. return hook(data) || data;
  114. };
  115. }
  116. function isPromise(obj) {
  117. return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
  118. }
  119. function queue(hooks, data) {
  120. var promise = false;
  121. for (var i = 0; i < hooks.length; i++) {
  122. var hook = hooks[i];
  123. if (promise) {
  124. promise = Promise.resolve(wrapperHook(hook));
  125. } else {
  126. var res = hook(data);
  127. if (isPromise(res)) {
  128. promise = Promise.resolve(res);
  129. }
  130. if (res === false) {
  131. return {
  132. then: function then() {} };
  133. }
  134. }
  135. }
  136. return promise || {
  137. then: function then(callback) {
  138. return callback(data);
  139. } };
  140. }
  141. function wrapperOptions(interceptor) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  142. ['success', 'fail', 'complete'].forEach(function (name) {
  143. if (Array.isArray(interceptor[name])) {
  144. var oldCallback = options[name];
  145. options[name] = function callbackInterceptor(res) {
  146. queue(interceptor[name], res).then(function (res) {
  147. /* eslint-disable no-mixed-operators */
  148. return isFn(oldCallback) && oldCallback(res) || res;
  149. });
  150. };
  151. }
  152. });
  153. return options;
  154. }
  155. function wrapperReturnValue(method, returnValue) {
  156. var returnValueHooks = [];
  157. if (Array.isArray(globalInterceptors.returnValue)) {
  158. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(globalInterceptors.returnValue));
  159. }
  160. var interceptor = scopedInterceptors[method];
  161. if (interceptor && Array.isArray(interceptor.returnValue)) {
  162. returnValueHooks.push.apply(returnValueHooks, _toConsumableArray(interceptor.returnValue));
  163. }
  164. returnValueHooks.forEach(function (hook) {
  165. returnValue = hook(returnValue) || returnValue;
  166. });
  167. return returnValue;
  168. }
  169. function getApiInterceptorHooks(method) {
  170. var interceptor = Object.create(null);
  171. Object.keys(globalInterceptors).forEach(function (hook) {
  172. if (hook !== 'returnValue') {
  173. interceptor[hook] = globalInterceptors[hook].slice();
  174. }
  175. });
  176. var scopedInterceptor = scopedInterceptors[method];
  177. if (scopedInterceptor) {
  178. Object.keys(scopedInterceptor).forEach(function (hook) {
  179. if (hook !== 'returnValue') {
  180. interceptor[hook] = (interceptor[hook] || []).concat(scopedInterceptor[hook]);
  181. }
  182. });
  183. }
  184. return interceptor;
  185. }
  186. function invokeApi(method, api, options) {for (var _len = arguments.length, params = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {params[_key - 3] = arguments[_key];}
  187. var interceptor = getApiInterceptorHooks(method);
  188. if (interceptor && Object.keys(interceptor).length) {
  189. if (Array.isArray(interceptor.invoke)) {
  190. var res = queue(interceptor.invoke, options);
  191. return res.then(function (options) {
  192. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  193. });
  194. } else {
  195. return api.apply(void 0, [wrapperOptions(interceptor, options)].concat(params));
  196. }
  197. }
  198. return api.apply(void 0, [options].concat(params));
  199. }
  200. var promiseInterceptor = {
  201. returnValue: function returnValue(res) {
  202. if (!isPromise(res)) {
  203. return res;
  204. }
  205. return res.then(function (res) {
  206. return res[1];
  207. }).catch(function (res) {
  208. return res[0];
  209. });
  210. } };
  211. var SYNC_API_RE =
  212. /^\$|sendNativeEvent|restoreGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
  213. var CONTEXT_API_RE = /^create|Manager$/;
  214. // Context例外情况
  215. var CONTEXT_API_RE_EXC = ['createBLEConnection'];
  216. // 同步例外情况
  217. var ASYNC_API = ['createBLEConnection'];
  218. var CALLBACK_API_RE = /^on|^off/;
  219. function isContextApi(name) {
  220. return CONTEXT_API_RE.test(name) && CONTEXT_API_RE_EXC.indexOf(name) === -1;
  221. }
  222. function isSyncApi(name) {
  223. return SYNC_API_RE.test(name) && ASYNC_API.indexOf(name) === -1;
  224. }
  225. function isCallbackApi(name) {
  226. return CALLBACK_API_RE.test(name) && name !== 'onPush';
  227. }
  228. function handlePromise(promise) {
  229. return promise.then(function (data) {
  230. return [null, data];
  231. }).
  232. catch(function (err) {return [err];});
  233. }
  234. function shouldPromise(name) {
  235. if (
  236. isContextApi(name) ||
  237. isSyncApi(name) ||
  238. isCallbackApi(name))
  239. {
  240. return false;
  241. }
  242. return true;
  243. }
  244. /* eslint-disable no-extend-native */
  245. if (!Promise.prototype.finally) {
  246. Promise.prototype.finally = function (callback) {
  247. var promise = this.constructor;
  248. return this.then(
  249. function (value) {return promise.resolve(callback()).then(function () {return value;});},
  250. function (reason) {return promise.resolve(callback()).then(function () {
  251. throw reason;
  252. });});
  253. };
  254. }
  255. function promisify(name, api) {
  256. if (!shouldPromise(name)) {
  257. return api;
  258. }
  259. return function promiseApi() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {params[_key2 - 1] = arguments[_key2];}
  260. if (isFn(options.success) || isFn(options.fail) || isFn(options.complete)) {
  261. return wrapperReturnValue(name, invokeApi.apply(void 0, [name, api, options].concat(params)));
  262. }
  263. return wrapperReturnValue(name, handlePromise(new Promise(function (resolve, reject) {
  264. invokeApi.apply(void 0, [name, api, Object.assign({}, options, {
  265. success: resolve,
  266. fail: reject })].concat(
  267. params));
  268. })));
  269. };
  270. }
  271. var EPS = 1e-4;
  272. var BASE_DEVICE_WIDTH = 750;
  273. var isIOS = false;
  274. var deviceWidth = 0;
  275. var deviceDPR = 0;
  276. function checkDeviceWidth() {var _wx$getSystemInfoSync =
  277. wx.getSystemInfoSync(),platform = _wx$getSystemInfoSync.platform,pixelRatio = _wx$getSystemInfoSync.pixelRatio,windowWidth = _wx$getSystemInfoSync.windowWidth; // uni=>wx runtime 编译目标是 uni 对象,内部不允许直接使用 uni
  278. deviceWidth = windowWidth;
  279. deviceDPR = pixelRatio;
  280. isIOS = platform === 'ios';
  281. }
  282. function upx2px(number, newDeviceWidth) {
  283. if (deviceWidth === 0) {
  284. checkDeviceWidth();
  285. }
  286. number = Number(number);
  287. if (number === 0) {
  288. return 0;
  289. }
  290. var result = number / BASE_DEVICE_WIDTH * (newDeviceWidth || deviceWidth);
  291. if (result < 0) {
  292. result = -result;
  293. }
  294. result = Math.floor(result + EPS);
  295. if (result === 0) {
  296. if (deviceDPR === 1 || !isIOS) {
  297. result = 1;
  298. } else {
  299. result = 0.5;
  300. }
  301. }
  302. return number < 0 ? -result : result;
  303. }
  304. var interceptors = {
  305. promiseInterceptor: promiseInterceptor };
  306. var baseApi = /*#__PURE__*/Object.freeze({
  307. __proto__: null,
  308. upx2px: upx2px,
  309. addInterceptor: addInterceptor,
  310. removeInterceptor: removeInterceptor,
  311. interceptors: interceptors });var
  312. EventChannel = /*#__PURE__*/function () {
  313. function EventChannel(id, events) {var _this = this;_classCallCheck(this, EventChannel);
  314. this.id = id;
  315. this.listener = {};
  316. this.emitCache = {};
  317. if (events) {
  318. Object.keys(events).forEach(function (name) {
  319. _this.on(name, events[name]);
  320. });
  321. }
  322. }_createClass(EventChannel, [{ key: "emit", value: function emit(
  323. eventName) {for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {args[_key3 - 1] = arguments[_key3];}
  324. var fns = this.listener[eventName];
  325. if (!fns) {
  326. return (this.emitCache[eventName] || (this.emitCache[eventName] = [])).push(args);
  327. }
  328. fns.forEach(function (opt) {
  329. opt.fn.apply(opt.fn, args);
  330. });
  331. this.listener[eventName] = fns.filter(function (opt) {return opt.type !== 'once';});
  332. } }, { key: "on", value: function on(
  333. eventName, fn) {
  334. this._addListener(eventName, 'on', fn);
  335. this._clearCache(eventName);
  336. } }, { key: "once", value: function once(
  337. eventName, fn) {
  338. this._addListener(eventName, 'once', fn);
  339. this._clearCache(eventName);
  340. } }, { key: "off", value: function off(
  341. eventName, fn) {
  342. var fns = this.listener[eventName];
  343. if (!fns) {
  344. return;
  345. }
  346. if (fn) {
  347. for (var i = 0; i < fns.length;) {
  348. if (fns[i].fn === fn) {
  349. fns.splice(i, 1);
  350. i--;
  351. }
  352. i++;
  353. }
  354. } else {
  355. delete this.listener[eventName];
  356. }
  357. } }, { key: "_clearCache", value: function _clearCache(
  358. eventName) {
  359. var cacheArgs = this.emitCache[eventName];
  360. if (cacheArgs) {
  361. for (; cacheArgs.length > 0;) {
  362. this.emit.apply(this, [eventName].concat(cacheArgs.shift()));
  363. }
  364. }
  365. } }, { key: "_addListener", value: function _addListener(
  366. eventName, type, fn) {
  367. (this.listener[eventName] || (this.listener[eventName] = [])).push({
  368. fn: fn,
  369. type: type });
  370. } }]);return EventChannel;}();
  371. var eventChannels = {};
  372. var eventChannelStack = [];
  373. var id = 0;
  374. function initEventChannel(events) {var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  375. id++;
  376. var eventChannel = new EventChannel(id, events);
  377. if (cache) {
  378. eventChannels[id] = eventChannel;
  379. eventChannelStack.push(eventChannel);
  380. }
  381. return eventChannel;
  382. }
  383. function getEventChannel(id) {
  384. if (id) {
  385. var eventChannel = eventChannels[id];
  386. delete eventChannels[id];
  387. return eventChannel;
  388. }
  389. return eventChannelStack.shift();
  390. }
  391. var navigateTo = {
  392. args: function args(fromArgs, toArgs) {
  393. var id = initEventChannel(fromArgs.events).id;
  394. if (fromArgs.url) {
  395. fromArgs.url = fromArgs.url + (fromArgs.url.indexOf('?') === -1 ? '?' : '&') + '__id__=' + id;
  396. }
  397. },
  398. returnValue: function returnValue(fromRes, toRes) {
  399. fromRes.eventChannel = getEventChannel();
  400. } };
  401. function findExistsPageIndex(url) {
  402. var pages = getCurrentPages();
  403. var len = pages.length;
  404. while (len--) {
  405. var page = pages[len];
  406. if (page.$page && page.$page.fullPath === url) {
  407. return len;
  408. }
  409. }
  410. return -1;
  411. }
  412. var redirectTo = {
  413. name: function name(fromArgs) {
  414. if (fromArgs.exists === 'back' && fromArgs.delta) {
  415. return 'navigateBack';
  416. }
  417. return 'redirectTo';
  418. },
  419. args: function args(fromArgs) {
  420. if (fromArgs.exists === 'back' && fromArgs.url) {
  421. var existsPageIndex = findExistsPageIndex(fromArgs.url);
  422. if (existsPageIndex !== -1) {
  423. var delta = getCurrentPages().length - 1 - existsPageIndex;
  424. if (delta > 0) {
  425. fromArgs.delta = delta;
  426. }
  427. }
  428. }
  429. } };
  430. var previewImage = {
  431. args: function args(fromArgs) {
  432. var currentIndex = parseInt(fromArgs.current);
  433. if (isNaN(currentIndex)) {
  434. return;
  435. }
  436. var urls = fromArgs.urls;
  437. if (!Array.isArray(urls)) {
  438. return;
  439. }
  440. var len = urls.length;
  441. if (!len) {
  442. return;
  443. }
  444. if (currentIndex < 0) {
  445. currentIndex = 0;
  446. } else if (currentIndex >= len) {
  447. currentIndex = len - 1;
  448. }
  449. if (currentIndex > 0) {
  450. fromArgs.current = urls[currentIndex];
  451. fromArgs.urls = urls.filter(
  452. function (item, index) {return index < currentIndex ? item !== urls[currentIndex] : true;});
  453. } else {
  454. fromArgs.current = urls[0];
  455. }
  456. return {
  457. indicator: false,
  458. loop: false };
  459. } };
  460. function addSafeAreaInsets(result) {
  461. if (result.safeArea) {
  462. var safeArea = result.safeArea;
  463. result.safeAreaInsets = {
  464. top: safeArea.top,
  465. left: safeArea.left,
  466. right: result.windowWidth - safeArea.right,
  467. bottom: result.windowHeight - safeArea.bottom };
  468. }
  469. }
  470. var protocols = {
  471. redirectTo: redirectTo,
  472. navigateTo: navigateTo,
  473. previewImage: previewImage,
  474. getSystemInfo: {
  475. returnValue: addSafeAreaInsets },
  476. getSystemInfoSync: {
  477. returnValue: addSafeAreaInsets } };
  478. var todos = [
  479. 'vibrate',
  480. 'preloadPage',
  481. 'unPreloadPage',
  482. 'loadSubPackage'];
  483. var canIUses = [];
  484. var CALLBACKS = ['success', 'fail', 'cancel', 'complete'];
  485. function processCallback(methodName, method, returnValue) {
  486. return function (res) {
  487. return method(processReturnValue(methodName, res, returnValue));
  488. };
  489. }
  490. function processArgs(methodName, fromArgs) {var argsOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};var returnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};var keepFromArgs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  491. if (isPlainObject(fromArgs)) {// 一般 api 的参数解析
  492. var toArgs = keepFromArgs === true ? fromArgs : {}; // returnValue 为 false 时,说明是格式化返回值,直接在返回值对象上修改赋值
  493. if (isFn(argsOption)) {
  494. argsOption = argsOption(fromArgs, toArgs) || {};
  495. }
  496. for (var key in fromArgs) {
  497. if (hasOwn(argsOption, key)) {
  498. var keyOption = argsOption[key];
  499. if (isFn(keyOption)) {
  500. keyOption = keyOption(fromArgs[key], fromArgs, toArgs);
  501. }
  502. if (!keyOption) {// 不支持的参数
  503. console.warn("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F ".concat(methodName, "\u6682\u4E0D\u652F\u6301").concat(key));
  504. } else if (isStr(keyOption)) {// 重写参数 key
  505. toArgs[keyOption] = fromArgs[key];
  506. } else if (isPlainObject(keyOption)) {// {name:newName,value:value}可重新指定参数 key:value
  507. toArgs[keyOption.name ? keyOption.name : key] = keyOption.value;
  508. }
  509. } else if (CALLBACKS.indexOf(key) !== -1) {
  510. if (isFn(fromArgs[key])) {
  511. toArgs[key] = processCallback(methodName, fromArgs[key], returnValue);
  512. }
  513. } else {
  514. if (!keepFromArgs) {
  515. toArgs[key] = fromArgs[key];
  516. }
  517. }
  518. }
  519. return toArgs;
  520. } else if (isFn(fromArgs)) {
  521. fromArgs = processCallback(methodName, fromArgs, returnValue);
  522. }
  523. return fromArgs;
  524. }
  525. function processReturnValue(methodName, res, returnValue) {var keepReturnValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  526. if (isFn(protocols.returnValue)) {// 处理通用 returnValue
  527. res = protocols.returnValue(methodName, res);
  528. }
  529. return processArgs(methodName, res, returnValue, {}, keepReturnValue);
  530. }
  531. function wrapper(methodName, method) {
  532. if (hasOwn(protocols, methodName)) {
  533. var protocol = protocols[methodName];
  534. if (!protocol) {// 暂不支持的 api
  535. return function () {
  536. console.error("\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F \u6682\u4E0D\u652F\u6301".concat(methodName));
  537. };
  538. }
  539. return function (arg1, arg2) {// 目前 api 最多两个参数
  540. var options = protocol;
  541. if (isFn(protocol)) {
  542. options = protocol(arg1);
  543. }
  544. arg1 = processArgs(methodName, arg1, options.args, options.returnValue);
  545. var args = [arg1];
  546. if (typeof arg2 !== 'undefined') {
  547. args.push(arg2);
  548. }
  549. if (isFn(options.name)) {
  550. methodName = options.name(arg1);
  551. } else if (isStr(options.name)) {
  552. methodName = options.name;
  553. }
  554. var returnValue = wx[methodName].apply(wx, args);
  555. if (isSyncApi(methodName)) {// 同步 api
  556. return processReturnValue(methodName, returnValue, options.returnValue, isContextApi(methodName));
  557. }
  558. return returnValue;
  559. };
  560. }
  561. return method;
  562. }
  563. var todoApis = Object.create(null);
  564. var TODOS = [
  565. 'onTabBarMidButtonTap',
  566. 'subscribePush',
  567. 'unsubscribePush',
  568. 'onPush',
  569. 'offPush',
  570. 'share'];
  571. function createTodoApi(name) {
  572. return function todoApi(_ref)
  573. {var fail = _ref.fail,complete = _ref.complete;
  574. var res = {
  575. errMsg: "".concat(name, ":fail:\u6682\u4E0D\u652F\u6301 ").concat(name, " \u65B9\u6CD5") };
  576. isFn(fail) && fail(res);
  577. isFn(complete) && complete(res);
  578. };
  579. }
  580. TODOS.forEach(function (name) {
  581. todoApis[name] = createTodoApi(name);
  582. });
  583. var providers = {
  584. oauth: ['weixin'],
  585. share: ['weixin'],
  586. payment: ['wxpay'],
  587. push: ['weixin'] };
  588. function getProvider(_ref2)
  589. {var service = _ref2.service,success = _ref2.success,fail = _ref2.fail,complete = _ref2.complete;
  590. var res = false;
  591. if (providers[service]) {
  592. res = {
  593. errMsg: 'getProvider:ok',
  594. service: service,
  595. provider: providers[service] };
  596. isFn(success) && success(res);
  597. } else {
  598. res = {
  599. errMsg: 'getProvider:fail:服务[' + service + ']不存在' };
  600. isFn(fail) && fail(res);
  601. }
  602. isFn(complete) && complete(res);
  603. }
  604. var extraApi = /*#__PURE__*/Object.freeze({
  605. __proto__: null,
  606. getProvider: getProvider });
  607. var getEmitter = function () {
  608. var Emitter;
  609. return function getUniEmitter() {
  610. if (!Emitter) {
  611. Emitter = new _vue.default();
  612. }
  613. return Emitter;
  614. };
  615. }();
  616. function apply(ctx, method, args) {
  617. return ctx[method].apply(ctx, args);
  618. }
  619. function $on() {
  620. return apply(getEmitter(), '$on', Array.prototype.slice.call(arguments));
  621. }
  622. function $off() {
  623. return apply(getEmitter(), '$off', Array.prototype.slice.call(arguments));
  624. }
  625. function $once() {
  626. return apply(getEmitter(), '$once', Array.prototype.slice.call(arguments));
  627. }
  628. function $emit() {
  629. return apply(getEmitter(), '$emit', Array.prototype.slice.call(arguments));
  630. }
  631. var eventApi = /*#__PURE__*/Object.freeze({
  632. __proto__: null,
  633. $on: $on,
  634. $off: $off,
  635. $once: $once,
  636. $emit: $emit });
  637. var api = /*#__PURE__*/Object.freeze({
  638. __proto__: null });
  639. var MPPage = Page;
  640. var MPComponent = Component;
  641. var customizeRE = /:/g;
  642. var customize = cached(function (str) {
  643. return camelize(str.replace(customizeRE, '-'));
  644. });
  645. function initTriggerEvent(mpInstance) {
  646. {
  647. if (!wx.canIUse('nextTick')) {
  648. return;
  649. }
  650. }
  651. var oldTriggerEvent = mpInstance.triggerEvent;
  652. mpInstance.triggerEvent = function (event) {for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {args[_key4 - 1] = arguments[_key4];}
  653. return oldTriggerEvent.apply(mpInstance, [customize(event)].concat(args));
  654. };
  655. }
  656. function initHook(name, options) {
  657. var oldHook = options[name];
  658. if (!oldHook) {
  659. options[name] = function () {
  660. initTriggerEvent(this);
  661. };
  662. } else {
  663. options[name] = function () {
  664. initTriggerEvent(this);for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}
  665. return oldHook.apply(this, args);
  666. };
  667. }
  668. }
  669. Page = function Page() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  670. initHook('onLoad', options);
  671. return MPPage(options);
  672. };
  673. Component = function Component() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  674. initHook('created', options);
  675. return MPComponent(options);
  676. };
  677. var PAGE_EVENT_HOOKS = [
  678. 'onPullDownRefresh',
  679. 'onReachBottom',
  680. 'onAddToFavorites',
  681. 'onShareTimeline',
  682. 'onShareAppMessage',
  683. 'onPageScroll',
  684. 'onResize',
  685. 'onTabItemTap'];
  686. function initMocks(vm, mocks) {
  687. var mpInstance = vm.$mp[vm.mpType];
  688. mocks.forEach(function (mock) {
  689. if (hasOwn(mpInstance, mock)) {
  690. vm[mock] = mpInstance[mock];
  691. }
  692. });
  693. }
  694. function hasHook(hook, vueOptions) {
  695. if (!vueOptions) {
  696. return true;
  697. }
  698. if (_vue.default.options && Array.isArray(_vue.default.options[hook])) {
  699. return true;
  700. }
  701. vueOptions = vueOptions.default || vueOptions;
  702. if (isFn(vueOptions)) {
  703. if (isFn(vueOptions.extendOptions[hook])) {
  704. return true;
  705. }
  706. if (vueOptions.super &&
  707. vueOptions.super.options &&
  708. Array.isArray(vueOptions.super.options[hook])) {
  709. return true;
  710. }
  711. return false;
  712. }
  713. if (isFn(vueOptions[hook])) {
  714. return true;
  715. }
  716. var mixins = vueOptions.mixins;
  717. if (Array.isArray(mixins)) {
  718. return !!mixins.find(function (mixin) {return hasHook(hook, mixin);});
  719. }
  720. }
  721. function initHooks(mpOptions, hooks, vueOptions) {
  722. hooks.forEach(function (hook) {
  723. if (hasHook(hook, vueOptions)) {
  724. mpOptions[hook] = function (args) {
  725. return this.$vm && this.$vm.__call_hook(hook, args);
  726. };
  727. }
  728. });
  729. }
  730. function initVueComponent(Vue, vueOptions) {
  731. vueOptions = vueOptions.default || vueOptions;
  732. var VueComponent;
  733. if (isFn(vueOptions)) {
  734. VueComponent = vueOptions;
  735. } else {
  736. VueComponent = Vue.extend(vueOptions);
  737. }
  738. vueOptions = VueComponent.options;
  739. return [VueComponent, vueOptions];
  740. }
  741. function initSlots(vm, vueSlots) {
  742. if (Array.isArray(vueSlots) && vueSlots.length) {
  743. var $slots = Object.create(null);
  744. vueSlots.forEach(function (slotName) {
  745. $slots[slotName] = true;
  746. });
  747. vm.$scopedSlots = vm.$slots = $slots;
  748. }
  749. }
  750. function initVueIds(vueIds, mpInstance) {
  751. vueIds = (vueIds || '').split(',');
  752. var len = vueIds.length;
  753. if (len === 1) {
  754. mpInstance._$vueId = vueIds[0];
  755. } else if (len === 2) {
  756. mpInstance._$vueId = vueIds[0];
  757. mpInstance._$vuePid = vueIds[1];
  758. }
  759. }
  760. function initData(vueOptions, context) {
  761. var data = vueOptions.data || {};
  762. var methods = vueOptions.methods || {};
  763. if (typeof data === 'function') {
  764. try {
  765. data = data.call(context); // 支持 Vue.prototype 上挂的数据
  766. } catch (e) {
  767. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  768. console.warn('根据 Vue 的 data 函数初始化小程序 data 失败,请尽量确保 data 函数中不访问 vm 对象,否则可能影响首次数据渲染速度。', data);
  769. }
  770. }
  771. } else {
  772. try {
  773. // 对 data 格式化
  774. data = JSON.parse(JSON.stringify(data));
  775. } catch (e) {}
  776. }
  777. if (!isPlainObject(data)) {
  778. data = {};
  779. }
  780. Object.keys(methods).forEach(function (methodName) {
  781. if (context.__lifecycle_hooks__.indexOf(methodName) === -1 && !hasOwn(data, methodName)) {
  782. data[methodName] = methods[methodName];
  783. }
  784. });
  785. return data;
  786. }
  787. var PROP_TYPES = [String, Number, Boolean, Object, Array, null];
  788. function createObserver(name) {
  789. return function observer(newVal, oldVal) {
  790. if (this.$vm) {
  791. this.$vm[name] = newVal; // 为了触发其他非 render watcher
  792. }
  793. };
  794. }
  795. function initBehaviors(vueOptions, initBehavior) {
  796. var vueBehaviors = vueOptions.behaviors;
  797. var vueExtends = vueOptions.extends;
  798. var vueMixins = vueOptions.mixins;
  799. var vueProps = vueOptions.props;
  800. if (!vueProps) {
  801. vueOptions.props = vueProps = [];
  802. }
  803. var behaviors = [];
  804. if (Array.isArray(vueBehaviors)) {
  805. vueBehaviors.forEach(function (behavior) {
  806. behaviors.push(behavior.replace('uni://', "wx".concat("://")));
  807. if (behavior === 'uni://form-field') {
  808. if (Array.isArray(vueProps)) {
  809. vueProps.push('name');
  810. vueProps.push('value');
  811. } else {
  812. vueProps.name = {
  813. type: String,
  814. default: '' };
  815. vueProps.value = {
  816. type: [String, Number, Boolean, Array, Object, Date],
  817. default: '' };
  818. }
  819. }
  820. });
  821. }
  822. if (isPlainObject(vueExtends) && vueExtends.props) {
  823. behaviors.push(
  824. initBehavior({
  825. properties: initProperties(vueExtends.props, true) }));
  826. }
  827. if (Array.isArray(vueMixins)) {
  828. vueMixins.forEach(function (vueMixin) {
  829. if (isPlainObject(vueMixin) && vueMixin.props) {
  830. behaviors.push(
  831. initBehavior({
  832. properties: initProperties(vueMixin.props, true) }));
  833. }
  834. });
  835. }
  836. return behaviors;
  837. }
  838. function parsePropType(key, type, defaultValue, file) {
  839. // [String]=>String
  840. if (Array.isArray(type) && type.length === 1) {
  841. return type[0];
  842. }
  843. return type;
  844. }
  845. function initProperties(props) {var isBehavior = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;var file = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
  846. var properties = {};
  847. if (!isBehavior) {
  848. properties.vueId = {
  849. type: String,
  850. value: '' };
  851. // 用于字节跳动小程序模拟抽象节点
  852. properties.generic = {
  853. type: Object,
  854. value: null };
  855. properties.vueSlots = { // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
  856. type: null,
  857. value: [],
  858. observer: function observer(newVal, oldVal) {
  859. var $slots = Object.create(null);
  860. newVal.forEach(function (slotName) {
  861. $slots[slotName] = true;
  862. });
  863. this.setData({
  864. $slots: $slots });
  865. } };
  866. }
  867. if (Array.isArray(props)) {// ['title']
  868. props.forEach(function (key) {
  869. properties[key] = {
  870. type: null,
  871. observer: createObserver(key) };
  872. });
  873. } else if (isPlainObject(props)) {// {title:{type:String,default:''},content:String}
  874. Object.keys(props).forEach(function (key) {
  875. var opts = props[key];
  876. if (isPlainObject(opts)) {// title:{type:String,default:''}
  877. var value = opts.default;
  878. if (isFn(value)) {
  879. value = value();
  880. }
  881. opts.type = parsePropType(key, opts.type);
  882. properties[key] = {
  883. type: PROP_TYPES.indexOf(opts.type) !== -1 ? opts.type : null,
  884. value: value,
  885. observer: createObserver(key) };
  886. } else {// content:String
  887. var type = parsePropType(key, opts);
  888. properties[key] = {
  889. type: PROP_TYPES.indexOf(type) !== -1 ? type : null,
  890. observer: createObserver(key) };
  891. }
  892. });
  893. }
  894. return properties;
  895. }
  896. function wrapper$1(event) {
  897. // TODO 又得兼容 mpvue 的 mp 对象
  898. try {
  899. event.mp = JSON.parse(JSON.stringify(event));
  900. } catch (e) {}
  901. event.stopPropagation = noop;
  902. event.preventDefault = noop;
  903. event.target = event.target || {};
  904. if (!hasOwn(event, 'detail')) {
  905. event.detail = {};
  906. }
  907. if (hasOwn(event, 'markerId')) {
  908. event.detail = typeof event.detail === 'object' ? event.detail : {};
  909. event.detail.markerId = event.markerId;
  910. }
  911. if (isPlainObject(event.detail)) {
  912. event.target = Object.assign({}, event.target, event.detail);
  913. }
  914. return event;
  915. }
  916. function getExtraValue(vm, dataPathsArray) {
  917. var context = vm;
  918. dataPathsArray.forEach(function (dataPathArray) {
  919. var dataPath = dataPathArray[0];
  920. var value = dataPathArray[2];
  921. if (dataPath || typeof value !== 'undefined') {// ['','',index,'disable']
  922. var propPath = dataPathArray[1];
  923. var valuePath = dataPathArray[3];
  924. var vFor;
  925. if (Number.isInteger(dataPath)) {
  926. vFor = dataPath;
  927. } else if (!dataPath) {
  928. vFor = context;
  929. } else if (typeof dataPath === 'string' && dataPath) {
  930. if (dataPath.indexOf('#s#') === 0) {
  931. vFor = dataPath.substr(3);
  932. } else {
  933. vFor = vm.__get_value(dataPath, context);
  934. }
  935. }
  936. if (Number.isInteger(vFor)) {
  937. context = value;
  938. } else if (!propPath) {
  939. context = vFor[value];
  940. } else {
  941. if (Array.isArray(vFor)) {
  942. context = vFor.find(function (vForItem) {
  943. return vm.__get_value(propPath, vForItem) === value;
  944. });
  945. } else if (isPlainObject(vFor)) {
  946. context = Object.keys(vFor).find(function (vForKey) {
  947. return vm.__get_value(propPath, vFor[vForKey]) === value;
  948. });
  949. } else {
  950. console.error('v-for 暂不支持循环数据:', vFor);
  951. }
  952. }
  953. if (valuePath) {
  954. context = vm.__get_value(valuePath, context);
  955. }
  956. }
  957. });
  958. return context;
  959. }
  960. function processEventExtra(vm, extra, event) {
  961. var extraObj = {};
  962. if (Array.isArray(extra) && extra.length) {
  963. /**
  964. *[
  965. * ['data.items', 'data.id', item.data.id],
  966. * ['metas', 'id', meta.id]
  967. *],
  968. *[
  969. * ['data.items', 'data.id', item.data.id],
  970. * ['metas', 'id', meta.id]
  971. *],
  972. *'test'
  973. */
  974. extra.forEach(function (dataPath, index) {
  975. if (typeof dataPath === 'string') {
  976. if (!dataPath) {// model,prop.sync
  977. extraObj['$' + index] = vm;
  978. } else {
  979. if (dataPath === '$event') {// $event
  980. extraObj['$' + index] = event;
  981. } else if (dataPath === 'arguments') {
  982. if (event.detail && event.detail.__args__) {
  983. extraObj['$' + index] = event.detail.__args__;
  984. } else {
  985. extraObj['$' + index] = [event];
  986. }
  987. } else if (dataPath.indexOf('$event.') === 0) {// $event.target.value
  988. extraObj['$' + index] = vm.__get_value(dataPath.replace('$event.', ''), event);
  989. } else {
  990. extraObj['$' + index] = vm.__get_value(dataPath);
  991. }
  992. }
  993. } else {
  994. extraObj['$' + index] = getExtraValue(vm, dataPath);
  995. }
  996. });
  997. }
  998. return extraObj;
  999. }
  1000. function getObjByArray(arr) {
  1001. var obj = {};
  1002. for (var i = 1; i < arr.length; i++) {
  1003. var element = arr[i];
  1004. obj[element[0]] = element[1];
  1005. }
  1006. return obj;
  1007. }
  1008. function processEventArgs(vm, event) {var args = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];var extra = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];var isCustom = arguments.length > 4 ? arguments[4] : undefined;var methodName = arguments.length > 5 ? arguments[5] : undefined;
  1009. var isCustomMPEvent = false; // wxcomponent 组件,传递原始 event 对象
  1010. if (isCustom) {// 自定义事件
  1011. isCustomMPEvent = event.currentTarget &&
  1012. event.currentTarget.dataset &&
  1013. event.currentTarget.dataset.comType === 'wx';
  1014. if (!args.length) {// 无参数,直接传入 event 或 detail 数组
  1015. if (isCustomMPEvent) {
  1016. return [event];
  1017. }
  1018. return event.detail.__args__ || event.detail;
  1019. }
  1020. }
  1021. var extraObj = processEventExtra(vm, extra, event);
  1022. var ret = [];
  1023. args.forEach(function (arg) {
  1024. if (arg === '$event') {
  1025. if (methodName === '__set_model' && !isCustom) {// input v-model value
  1026. ret.push(event.target.value);
  1027. } else {
  1028. if (isCustom && !isCustomMPEvent) {
  1029. ret.push(event.detail.__args__[0]);
  1030. } else {// wxcomponent 组件或内置组件
  1031. ret.push(event);
  1032. }
  1033. }
  1034. } else {
  1035. if (Array.isArray(arg) && arg[0] === 'o') {
  1036. ret.push(getObjByArray(arg));
  1037. } else if (typeof arg === 'string' && hasOwn(extraObj, arg)) {
  1038. ret.push(extraObj[arg]);
  1039. } else {
  1040. ret.push(arg);
  1041. }
  1042. }
  1043. });
  1044. return ret;
  1045. }
  1046. var ONCE = '~';
  1047. var CUSTOM = '^';
  1048. function isMatchEventType(eventType, optType) {
  1049. return eventType === optType ||
  1050. optType === 'regionchange' && (
  1051. eventType === 'begin' ||
  1052. eventType === 'end');
  1053. }
  1054. function getContextVm(vm) {
  1055. var $parent = vm.$parent;
  1056. // 父组件是 scoped slots 或者其他自定义组件时继续查找
  1057. while ($parent && $parent.$parent && ($parent.$options.generic || $parent.$parent.$options.generic || $parent.$scope._$vuePid)) {
  1058. $parent = $parent.$parent;
  1059. }
  1060. return $parent && $parent.$parent;
  1061. }
  1062. function handleEvent(event) {var _this2 = this;
  1063. event = wrapper$1(event);
  1064. // [['tap',[['handle',[1,2,a]],['handle1',[1,2,a]]]]]
  1065. var dataset = (event.currentTarget || event.target).dataset;
  1066. if (!dataset) {
  1067. return console.warn('事件信息不存在');
  1068. }
  1069. var eventOpts = dataset.eventOpts || dataset['event-opts']; // 支付宝 web-view 组件 dataset 非驼峰
  1070. if (!eventOpts) {
  1071. return console.warn('事件信息不存在');
  1072. }
  1073. // [['handle',[1,2,a]],['handle1',[1,2,a]]]
  1074. var eventType = event.type;
  1075. var ret = [];
  1076. eventOpts.forEach(function (eventOpt) {
  1077. var type = eventOpt[0];
  1078. var eventsArray = eventOpt[1];
  1079. var isCustom = type.charAt(0) === CUSTOM;
  1080. type = isCustom ? type.slice(1) : type;
  1081. var isOnce = type.charAt(0) === ONCE;
  1082. type = isOnce ? type.slice(1) : type;
  1083. if (eventsArray && isMatchEventType(eventType, type)) {
  1084. eventsArray.forEach(function (eventArray) {
  1085. var methodName = eventArray[0];
  1086. if (methodName) {
  1087. var handlerCtx = _this2.$vm;
  1088. if (handlerCtx.$options.generic) {// mp-weixin,mp-toutiao 抽象节点模拟 scoped slots
  1089. handlerCtx = getContextVm(handlerCtx) || handlerCtx;
  1090. }
  1091. if (methodName === '$emit') {
  1092. handlerCtx.$emit.apply(handlerCtx,
  1093. processEventArgs(
  1094. _this2.$vm,
  1095. event,
  1096. eventArray[1],
  1097. eventArray[2],
  1098. isCustom,
  1099. methodName));
  1100. return;
  1101. }
  1102. var handler = handlerCtx[methodName];
  1103. if (!isFn(handler)) {
  1104. throw new Error(" _vm.".concat(methodName, " is not a function"));
  1105. }
  1106. if (isOnce) {
  1107. if (handler.once) {
  1108. return;
  1109. }
  1110. handler.once = true;
  1111. }
  1112. var params = processEventArgs(
  1113. _this2.$vm,
  1114. event,
  1115. eventArray[1],
  1116. eventArray[2],
  1117. isCustom,
  1118. methodName);
  1119. // 参数尾部增加原始事件对象用于复杂表达式内获取额外数据
  1120. // eslint-disable-next-line no-sparse-arrays
  1121. ret.push(handler.apply(handlerCtx, (Array.isArray(params) ? params : []).concat([,,,,,,,,,, event])));
  1122. }
  1123. });
  1124. }
  1125. });
  1126. if (
  1127. eventType === 'input' &&
  1128. ret.length === 1 &&
  1129. typeof ret[0] !== 'undefined')
  1130. {
  1131. return ret[0];
  1132. }
  1133. }
  1134. var hooks = [
  1135. 'onShow',
  1136. 'onHide',
  1137. 'onError',
  1138. 'onPageNotFound',
  1139. 'onThemeChange',
  1140. 'onUnhandledRejection'];
  1141. function parseBaseApp(vm, _ref3)
  1142. {var mocks = _ref3.mocks,initRefs = _ref3.initRefs;
  1143. if (vm.$options.store) {
  1144. _vue.default.prototype.$store = vm.$options.store;
  1145. }
  1146. _vue.default.prototype.mpHost = "mp-weixin";
  1147. _vue.default.mixin({
  1148. beforeCreate: function beforeCreate() {
  1149. if (!this.$options.mpType) {
  1150. return;
  1151. }
  1152. this.mpType = this.$options.mpType;
  1153. this.$mp = _defineProperty({
  1154. data: {} },
  1155. this.mpType, this.$options.mpInstance);
  1156. this.$scope = this.$options.mpInstance;
  1157. delete this.$options.mpType;
  1158. delete this.$options.mpInstance;
  1159. if (this.mpType !== 'app') {
  1160. initRefs(this);
  1161. initMocks(this, mocks);
  1162. }
  1163. } });
  1164. var appOptions = {
  1165. onLaunch: function onLaunch(args) {
  1166. if (this.$vm) {// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
  1167. return;
  1168. }
  1169. {
  1170. if (!wx.canIUse('nextTick')) {// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
  1171. console.error('当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上');
  1172. }
  1173. }
  1174. this.$vm = vm;
  1175. this.$vm.$mp = {
  1176. app: this };
  1177. this.$vm.$scope = this;
  1178. // vm 上也挂载 globalData
  1179. this.$vm.globalData = this.globalData;
  1180. this.$vm._isMounted = true;
  1181. this.$vm.__call_hook('mounted', args);
  1182. this.$vm.__call_hook('onLaunch', args);
  1183. } };
  1184. // 兼容旧版本 globalData
  1185. appOptions.globalData = vm.$options.globalData || {};
  1186. // 将 methods 中的方法挂在 getApp() 中
  1187. var methods = vm.$options.methods;
  1188. if (methods) {
  1189. Object.keys(methods).forEach(function (name) {
  1190. appOptions[name] = methods[name];
  1191. });
  1192. }
  1193. initHooks(appOptions, hooks);
  1194. return appOptions;
  1195. }
  1196. var mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
  1197. function findVmByVueId(vm, vuePid) {
  1198. var $children = vm.$children;
  1199. // 优先查找直属(反向查找:https://github.com/dcloudio/uni-app/issues/1200)
  1200. for (var i = $children.length - 1; i >= 0; i--) {
  1201. var childVm = $children[i];
  1202. if (childVm.$scope._$vueId === vuePid) {
  1203. return childVm;
  1204. }
  1205. }
  1206. // 反向递归查找
  1207. var parentVm;
  1208. for (var _i = $children.length - 1; _i >= 0; _i--) {
  1209. parentVm = findVmByVueId($children[_i], vuePid);
  1210. if (parentVm) {
  1211. return parentVm;
  1212. }
  1213. }
  1214. }
  1215. function initBehavior(options) {
  1216. return Behavior(options);
  1217. }
  1218. function isPage() {
  1219. return !!this.route;
  1220. }
  1221. function initRelation(detail) {
  1222. this.triggerEvent('__l', detail);
  1223. }
  1224. function initRefs(vm) {
  1225. var mpInstance = vm.$scope;
  1226. Object.defineProperty(vm, '$refs', {
  1227. get: function get() {
  1228. var $refs = {};
  1229. var components = mpInstance.selectAllComponents('.vue-ref');
  1230. components.forEach(function (component) {
  1231. var ref = component.dataset.ref;
  1232. $refs[ref] = component.$vm || component;
  1233. });
  1234. var forComponents = mpInstance.selectAllComponents('.vue-ref-in-for');
  1235. forComponents.forEach(function (component) {
  1236. var ref = component.dataset.ref;
  1237. if (!$refs[ref]) {
  1238. $refs[ref] = [];
  1239. }
  1240. $refs[ref].push(component.$vm || component);
  1241. });
  1242. return $refs;
  1243. } });
  1244. }
  1245. function handleLink(event) {var _ref4 =
  1246. event.detail || event.value,vuePid = _ref4.vuePid,vueOptions = _ref4.vueOptions; // detail 是微信,value 是百度(dipatch)
  1247. var parentVm;
  1248. if (vuePid) {
  1249. parentVm = findVmByVueId(this.$vm, vuePid);
  1250. }
  1251. if (!parentVm) {
  1252. parentVm = this.$vm;
  1253. }
  1254. vueOptions.parent = parentVm;
  1255. }
  1256. function parseApp(vm) {
  1257. return parseBaseApp(vm, {
  1258. mocks: mocks,
  1259. initRefs: initRefs });
  1260. }
  1261. function createApp(vm) {
  1262. _vue.default.prototype.getOpenerEventChannel = function () {
  1263. if (!this.__eventChannel__) {
  1264. this.__eventChannel__ = new EventChannel();
  1265. }
  1266. return this.__eventChannel__;
  1267. };
  1268. var callHook = _vue.default.prototype.__call_hook;
  1269. _vue.default.prototype.__call_hook = function (hook, args) {
  1270. if (hook === 'onLoad' && args && args.__id__) {
  1271. this.__eventChannel__ = getEventChannel(args.__id__);
  1272. delete args.__id__;
  1273. }
  1274. return callHook.call(this, hook, args);
  1275. };
  1276. App(parseApp(vm));
  1277. return vm;
  1278. }
  1279. var encodeReserveRE = /[!'()*]/g;
  1280. var encodeReserveReplacer = function encodeReserveReplacer(c) {return '%' + c.charCodeAt(0).toString(16);};
  1281. var commaRE = /%2C/g;
  1282. // fixed encodeURIComponent which is more conformant to RFC3986:
  1283. // - escapes [!'()*]
  1284. // - preserve commas
  1285. var encode = function encode(str) {return encodeURIComponent(str).
  1286. replace(encodeReserveRE, encodeReserveReplacer).
  1287. replace(commaRE, ',');};
  1288. function stringifyQuery(obj) {var encodeStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : encode;
  1289. var res = obj ? Object.keys(obj).map(function (key) {
  1290. var val = obj[key];
  1291. if (val === undefined) {
  1292. return '';
  1293. }
  1294. if (val === null) {
  1295. return encodeStr(key);
  1296. }
  1297. if (Array.isArray(val)) {
  1298. var result = [];
  1299. val.forEach(function (val2) {
  1300. if (val2 === undefined) {
  1301. return;
  1302. }
  1303. if (val2 === null) {
  1304. result.push(encodeStr(key));
  1305. } else {
  1306. result.push(encodeStr(key) + '=' + encodeStr(val2));
  1307. }
  1308. });
  1309. return result.join('&');
  1310. }
  1311. return encodeStr(key) + '=' + encodeStr(val);
  1312. }).filter(function (x) {return x.length > 0;}).join('&') : null;
  1313. return res ? "?".concat(res) : '';
  1314. }
  1315. function parseBaseComponent(vueComponentOptions)
  1316. {var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},isPage = _ref5.isPage,initRelation = _ref5.initRelation;var _initVueComponent =
  1317. initVueComponent(_vue.default, vueComponentOptions),_initVueComponent2 = _slicedToArray(_initVueComponent, 2),VueComponent = _initVueComponent2[0],vueOptions = _initVueComponent2[1];
  1318. var options = _objectSpread({
  1319. multipleSlots: true,
  1320. addGlobalClass: true },
  1321. vueOptions.options || {});
  1322. {
  1323. // 微信 multipleSlots 部分情况有 bug,导致内容顺序错乱 如 u-list,提供覆盖选项
  1324. if (vueOptions['mp-weixin'] && vueOptions['mp-weixin'].options) {
  1325. Object.assign(options, vueOptions['mp-weixin'].options);
  1326. }
  1327. }
  1328. var componentOptions = {
  1329. options: options,
  1330. data: initData(vueOptions, _vue.default.prototype),
  1331. behaviors: initBehaviors(vueOptions, initBehavior),
  1332. properties: initProperties(vueOptions.props, false, vueOptions.__file),
  1333. lifetimes: {
  1334. attached: function attached() {
  1335. var properties = this.properties;
  1336. var options = {
  1337. mpType: isPage.call(this) ? 'page' : 'component',
  1338. mpInstance: this,
  1339. propsData: properties };
  1340. initVueIds(properties.vueId, this);
  1341. // 处理父子关系
  1342. initRelation.call(this, {
  1343. vuePid: this._$vuePid,
  1344. vueOptions: options });
  1345. // 初始化 vue 实例
  1346. this.$vm = new VueComponent(options);
  1347. // 处理$slots,$scopedSlots(暂不支持动态变化$slots)
  1348. initSlots(this.$vm, properties.vueSlots);
  1349. // 触发首次 setData
  1350. this.$vm.$mount();
  1351. },
  1352. ready: function ready() {
  1353. // 当组件 props 默认值为 true,初始化时传入 false 会导致 created,ready 触发, 但 attached 不触发
  1354. // https://developers.weixin.qq.com/community/develop/doc/00066ae2844cc0f8eb883e2a557800
  1355. if (this.$vm) {
  1356. this.$vm._isMounted = true;
  1357. this.$vm.__call_hook('mounted');
  1358. this.$vm.__call_hook('onReady');
  1359. }
  1360. },
  1361. detached: function detached() {
  1362. this.$vm && this.$vm.$destroy();
  1363. } },
  1364. pageLifetimes: {
  1365. show: function show(args) {
  1366. this.$vm && this.$vm.__call_hook('onPageShow', args);
  1367. },
  1368. hide: function hide() {
  1369. this.$vm && this.$vm.__call_hook('onPageHide');
  1370. },
  1371. resize: function resize(size) {
  1372. this.$vm && this.$vm.__call_hook('onPageResize', size);
  1373. } },
  1374. methods: {
  1375. __l: handleLink,
  1376. __e: handleEvent } };
  1377. // externalClasses
  1378. if (vueOptions.externalClasses) {
  1379. componentOptions.externalClasses = vueOptions.externalClasses;
  1380. }
  1381. if (Array.isArray(vueOptions.wxsCallMethods)) {
  1382. vueOptions.wxsCallMethods.forEach(function (callMethod) {
  1383. componentOptions.methods[callMethod] = function (args) {
  1384. return this.$vm[callMethod](args);
  1385. };
  1386. });
  1387. }
  1388. if (isPage) {
  1389. return componentOptions;
  1390. }
  1391. return [componentOptions, VueComponent];
  1392. }
  1393. function parseComponent(vueComponentOptions) {
  1394. return parseBaseComponent(vueComponentOptions, {
  1395. isPage: isPage,
  1396. initRelation: initRelation });
  1397. }
  1398. var hooks$1 = [
  1399. 'onShow',
  1400. 'onHide',
  1401. 'onUnload'];
  1402. hooks$1.push.apply(hooks$1, PAGE_EVENT_HOOKS);
  1403. function parseBasePage(vuePageOptions, _ref6)
  1404. {var isPage = _ref6.isPage,initRelation = _ref6.initRelation;
  1405. var pageOptions = parseComponent(vuePageOptions);
  1406. initHooks(pageOptions.methods, hooks$1, vuePageOptions);
  1407. pageOptions.methods.onLoad = function (query) {
  1408. this.options = query;
  1409. var copyQuery = Object.assign({}, query);
  1410. delete copyQuery.__id__;
  1411. this.$page = {
  1412. fullPath: '/' + (this.route || this.is) + stringifyQuery(copyQuery) };
  1413. this.$vm.$mp.query = query; // 兼容 mpvue
  1414. this.$vm.__call_hook('onLoad', query);
  1415. };
  1416. return pageOptions;
  1417. }
  1418. function parsePage(vuePageOptions) {
  1419. return parseBasePage(vuePageOptions, {
  1420. isPage: isPage,
  1421. initRelation: initRelation });
  1422. }
  1423. function createPage(vuePageOptions) {
  1424. {
  1425. return Component(parsePage(vuePageOptions));
  1426. }
  1427. }
  1428. function createComponent(vueOptions) {
  1429. {
  1430. return Component(parseComponent(vueOptions));
  1431. }
  1432. }
  1433. todos.forEach(function (todoApi) {
  1434. protocols[todoApi] = false;
  1435. });
  1436. canIUses.forEach(function (canIUseApi) {
  1437. var apiName = protocols[canIUseApi] && protocols[canIUseApi].name ? protocols[canIUseApi].name :
  1438. canIUseApi;
  1439. if (!wx.canIUse(apiName)) {
  1440. protocols[canIUseApi] = false;
  1441. }
  1442. });
  1443. var uni = {};
  1444. if (typeof Proxy !== 'undefined' && "mp-weixin" !== 'app-plus') {
  1445. uni = new Proxy({}, {
  1446. get: function get(target, name) {
  1447. if (hasOwn(target, name)) {
  1448. return target[name];
  1449. }
  1450. if (baseApi[name]) {
  1451. return baseApi[name];
  1452. }
  1453. if (api[name]) {
  1454. return promisify(name, api[name]);
  1455. }
  1456. {
  1457. if (extraApi[name]) {
  1458. return promisify(name, extraApi[name]);
  1459. }
  1460. if (todoApis[name]) {
  1461. return promisify(name, todoApis[name]);
  1462. }
  1463. }
  1464. if (eventApi[name]) {
  1465. return eventApi[name];
  1466. }
  1467. if (!hasOwn(wx, name) && !hasOwn(protocols, name)) {
  1468. return;
  1469. }
  1470. return promisify(name, wrapper(name, wx[name]));
  1471. },
  1472. set: function set(target, name, value) {
  1473. target[name] = value;
  1474. return true;
  1475. } });
  1476. } else {
  1477. Object.keys(baseApi).forEach(function (name) {
  1478. uni[name] = baseApi[name];
  1479. });
  1480. {
  1481. Object.keys(todoApis).forEach(function (name) {
  1482. uni[name] = promisify(name, todoApis[name]);
  1483. });
  1484. Object.keys(extraApi).forEach(function (name) {
  1485. uni[name] = promisify(name, todoApis[name]);
  1486. });
  1487. }
  1488. Object.keys(eventApi).forEach(function (name) {
  1489. uni[name] = eventApi[name];
  1490. });
  1491. Object.keys(api).forEach(function (name) {
  1492. uni[name] = promisify(name, api[name]);
  1493. });
  1494. Object.keys(wx).forEach(function (name) {
  1495. if (hasOwn(wx, name) || hasOwn(protocols, name)) {
  1496. uni[name] = promisify(name, wrapper(name, wx[name]));
  1497. }
  1498. });
  1499. }
  1500. wx.createApp = createApp;
  1501. wx.createPage = createPage;
  1502. wx.createComponent = createComponent;
  1503. var uni$1 = uni;var _default =
  1504. uni$1;exports.default = _default;
  1505. /***/ }),
  1506. /***/ 10:
  1507. /*!**********************************************************************************************************!*\
  1508. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js ***!
  1509. \**********************************************************************************************************/
  1510. /*! exports provided: default */
  1511. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1512. "use strict";
  1513. __webpack_require__.r(__webpack_exports__);
  1514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  1515. /* globals __VUE_SSR_CONTEXT__ */
  1516. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  1517. // This module is a runtime utility for cleaner component module output and will
  1518. // be included in the final webpack user bundle.
  1519. function normalizeComponent (
  1520. scriptExports,
  1521. render,
  1522. staticRenderFns,
  1523. functionalTemplate,
  1524. injectStyles,
  1525. scopeId,
  1526. moduleIdentifier, /* server only */
  1527. shadowMode, /* vue-cli only */
  1528. components, // fixed by xxxxxx auto components
  1529. renderjs // fixed by xxxxxx renderjs
  1530. ) {
  1531. // Vue.extend constructor export interop
  1532. var options = typeof scriptExports === 'function'
  1533. ? scriptExports.options
  1534. : scriptExports
  1535. // fixed by xxxxxx auto components
  1536. if (components) {
  1537. if (!options.components) {
  1538. options.components = {}
  1539. }
  1540. var hasOwn = Object.prototype.hasOwnProperty
  1541. for (var name in components) {
  1542. if (hasOwn.call(components, name) && !hasOwn.call(options.components, name)) {
  1543. options.components[name] = components[name]
  1544. }
  1545. }
  1546. }
  1547. // fixed by xxxxxx renderjs
  1548. if (renderjs) {
  1549. (renderjs.beforeCreate || (renderjs.beforeCreate = [])).unshift(function() {
  1550. this[renderjs.__module] = this
  1551. });
  1552. (options.mixins || (options.mixins = [])).push(renderjs)
  1553. }
  1554. // render functions
  1555. if (render) {
  1556. options.render = render
  1557. options.staticRenderFns = staticRenderFns
  1558. options._compiled = true
  1559. }
  1560. // functional template
  1561. if (functionalTemplate) {
  1562. options.functional = true
  1563. }
  1564. // scopedId
  1565. if (scopeId) {
  1566. options._scopeId = 'data-v-' + scopeId
  1567. }
  1568. var hook
  1569. if (moduleIdentifier) { // server build
  1570. hook = function (context) {
  1571. // 2.3 injection
  1572. context =
  1573. context || // cached call
  1574. (this.$vnode && this.$vnode.ssrContext) || // stateful
  1575. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  1576. // 2.2 with runInNewContext: true
  1577. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  1578. context = __VUE_SSR_CONTEXT__
  1579. }
  1580. // inject component styles
  1581. if (injectStyles) {
  1582. injectStyles.call(this, context)
  1583. }
  1584. // register component module identifier for async chunk inferrence
  1585. if (context && context._registeredComponents) {
  1586. context._registeredComponents.add(moduleIdentifier)
  1587. }
  1588. }
  1589. // used by ssr in case component is cached and beforeCreate
  1590. // never gets called
  1591. options._ssrRegister = hook
  1592. } else if (injectStyles) {
  1593. hook = shadowMode
  1594. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  1595. : injectStyles
  1596. }
  1597. if (hook) {
  1598. if (options.functional) {
  1599. // for template-only hot-reload because in that case the render fn doesn't
  1600. // go through the normalizer
  1601. options._injectStyles = hook
  1602. // register for functioal component in vue file
  1603. var originalRender = options.render
  1604. options.render = function renderWithStyleInjection (h, context) {
  1605. hook.call(context)
  1606. return originalRender(h, context)
  1607. }
  1608. } else {
  1609. // inject component registration as beforeCreate hook
  1610. var existing = options.beforeCreate
  1611. options.beforeCreate = existing
  1612. ? [].concat(existing, hook)
  1613. : [hook]
  1614. }
  1615. }
  1616. return {
  1617. exports: scriptExports,
  1618. options: options
  1619. }
  1620. }
  1621. /***/ }),
  1622. /***/ 2:
  1623. /*!******************************************************************************************!*\
  1624. !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/mp-vue/dist/mp.runtime.esm.js ***!
  1625. \******************************************************************************************/
  1626. /*! exports provided: default */
  1627. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1628. "use strict";
  1629. __webpack_require__.r(__webpack_exports__);
  1630. /* WEBPACK VAR INJECTION */(function(global) {/*!
  1631. * Vue.js v2.6.11
  1632. * (c) 2014-2020 Evan You
  1633. * Released under the MIT License.
  1634. */
  1635. /* */
  1636. var emptyObject = Object.freeze({});
  1637. // These helpers produce better VM code in JS engines due to their
  1638. // explicitness and function inlining.
  1639. function isUndef (v) {
  1640. return v === undefined || v === null
  1641. }
  1642. function isDef (v) {
  1643. return v !== undefined && v !== null
  1644. }
  1645. function isTrue (v) {
  1646. return v === true
  1647. }
  1648. function isFalse (v) {
  1649. return v === false
  1650. }
  1651. /**
  1652. * Check if value is primitive.
  1653. */
  1654. function isPrimitive (value) {
  1655. return (
  1656. typeof value === 'string' ||
  1657. typeof value === 'number' ||
  1658. // $flow-disable-line
  1659. typeof value === 'symbol' ||
  1660. typeof value === 'boolean'
  1661. )
  1662. }
  1663. /**
  1664. * Quick object check - this is primarily used to tell
  1665. * Objects from primitive values when we know the value
  1666. * is a JSON-compliant type.
  1667. */
  1668. function isObject (obj) {
  1669. return obj !== null && typeof obj === 'object'
  1670. }
  1671. /**
  1672. * Get the raw type string of a value, e.g., [object Object].
  1673. */
  1674. var _toString = Object.prototype.toString;
  1675. function toRawType (value) {
  1676. return _toString.call(value).slice(8, -1)
  1677. }
  1678. /**
  1679. * Strict object type check. Only returns true
  1680. * for plain JavaScript objects.
  1681. */
  1682. function isPlainObject (obj) {
  1683. return _toString.call(obj) === '[object Object]'
  1684. }
  1685. function isRegExp (v) {
  1686. return _toString.call(v) === '[object RegExp]'
  1687. }
  1688. /**
  1689. * Check if val is a valid array index.
  1690. */
  1691. function isValidArrayIndex (val) {
  1692. var n = parseFloat(String(val));
  1693. return n >= 0 && Math.floor(n) === n && isFinite(val)
  1694. }
  1695. function isPromise (val) {
  1696. return (
  1697. isDef(val) &&
  1698. typeof val.then === 'function' &&
  1699. typeof val.catch === 'function'
  1700. )
  1701. }
  1702. /**
  1703. * Convert a value to a string that is actually rendered.
  1704. */
  1705. function toString (val) {
  1706. return val == null
  1707. ? ''
  1708. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  1709. ? JSON.stringify(val, null, 2)
  1710. : String(val)
  1711. }
  1712. /**
  1713. * Convert an input value to a number for persistence.
  1714. * If the conversion fails, return original string.
  1715. */
  1716. function toNumber (val) {
  1717. var n = parseFloat(val);
  1718. return isNaN(n) ? val : n
  1719. }
  1720. /**
  1721. * Make a map and return a function for checking if a key
  1722. * is in that map.
  1723. */
  1724. function makeMap (
  1725. str,
  1726. expectsLowerCase
  1727. ) {
  1728. var map = Object.create(null);
  1729. var list = str.split(',');
  1730. for (var i = 0; i < list.length; i++) {
  1731. map[list[i]] = true;
  1732. }
  1733. return expectsLowerCase
  1734. ? function (val) { return map[val.toLowerCase()]; }
  1735. : function (val) { return map[val]; }
  1736. }
  1737. /**
  1738. * Check if a tag is a built-in tag.
  1739. */
  1740. var isBuiltInTag = makeMap('slot,component', true);
  1741. /**
  1742. * Check if an attribute is a reserved attribute.
  1743. */
  1744. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  1745. /**
  1746. * Remove an item from an array.
  1747. */
  1748. function remove (arr, item) {
  1749. if (arr.length) {
  1750. var index = arr.indexOf(item);
  1751. if (index > -1) {
  1752. return arr.splice(index, 1)
  1753. }
  1754. }
  1755. }
  1756. /**
  1757. * Check whether an object has the property.
  1758. */
  1759. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1760. function hasOwn (obj, key) {
  1761. return hasOwnProperty.call(obj, key)
  1762. }
  1763. /**
  1764. * Create a cached version of a pure function.
  1765. */
  1766. function cached (fn) {
  1767. var cache = Object.create(null);
  1768. return (function cachedFn (str) {
  1769. var hit = cache[str];
  1770. return hit || (cache[str] = fn(str))
  1771. })
  1772. }
  1773. /**
  1774. * Camelize a hyphen-delimited string.
  1775. */
  1776. var camelizeRE = /-(\w)/g;
  1777. var camelize = cached(function (str) {
  1778. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  1779. });
  1780. /**
  1781. * Capitalize a string.
  1782. */
  1783. var capitalize = cached(function (str) {
  1784. return str.charAt(0).toUpperCase() + str.slice(1)
  1785. });
  1786. /**
  1787. * Hyphenate a camelCase string.
  1788. */
  1789. var hyphenateRE = /\B([A-Z])/g;
  1790. var hyphenate = cached(function (str) {
  1791. return str.replace(hyphenateRE, '-$1').toLowerCase()
  1792. });
  1793. /**
  1794. * Simple bind polyfill for environments that do not support it,
  1795. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  1796. * since native bind is now performant enough in most browsers.
  1797. * But removing it would mean breaking code that was able to run in
  1798. * PhantomJS 1.x, so this must be kept for backward compatibility.
  1799. */
  1800. /* istanbul ignore next */
  1801. function polyfillBind (fn, ctx) {
  1802. function boundFn (a) {
  1803. var l = arguments.length;
  1804. return l
  1805. ? l > 1
  1806. ? fn.apply(ctx, arguments)
  1807. : fn.call(ctx, a)
  1808. : fn.call(ctx)
  1809. }
  1810. boundFn._length = fn.length;
  1811. return boundFn
  1812. }
  1813. function nativeBind (fn, ctx) {
  1814. return fn.bind(ctx)
  1815. }
  1816. var bind = Function.prototype.bind
  1817. ? nativeBind
  1818. : polyfillBind;
  1819. /**
  1820. * Convert an Array-like object to a real Array.
  1821. */
  1822. function toArray (list, start) {
  1823. start = start || 0;
  1824. var i = list.length - start;
  1825. var ret = new Array(i);
  1826. while (i--) {
  1827. ret[i] = list[i + start];
  1828. }
  1829. return ret
  1830. }
  1831. /**
  1832. * Mix properties into target object.
  1833. */
  1834. function extend (to, _from) {
  1835. for (var key in _from) {
  1836. to[key] = _from[key];
  1837. }
  1838. return to
  1839. }
  1840. /**
  1841. * Merge an Array of Objects into a single Object.
  1842. */
  1843. function toObject (arr) {
  1844. var res = {};
  1845. for (var i = 0; i < arr.length; i++) {
  1846. if (arr[i]) {
  1847. extend(res, arr[i]);
  1848. }
  1849. }
  1850. return res
  1851. }
  1852. /* eslint-disable no-unused-vars */
  1853. /**
  1854. * Perform no operation.
  1855. * Stubbing args to make Flow happy without leaving useless transpiled code
  1856. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  1857. */
  1858. function noop (a, b, c) {}
  1859. /**
  1860. * Always return false.
  1861. */
  1862. var no = function (a, b, c) { return false; };
  1863. /* eslint-enable no-unused-vars */
  1864. /**
  1865. * Return the same value.
  1866. */
  1867. var identity = function (_) { return _; };
  1868. /**
  1869. * Check if two values are loosely equal - that is,
  1870. * if they are plain objects, do they have the same shape?
  1871. */
  1872. function looseEqual (a, b) {
  1873. if (a === b) { return true }
  1874. var isObjectA = isObject(a);
  1875. var isObjectB = isObject(b);
  1876. if (isObjectA && isObjectB) {
  1877. try {
  1878. var isArrayA = Array.isArray(a);
  1879. var isArrayB = Array.isArray(b);
  1880. if (isArrayA && isArrayB) {
  1881. return a.length === b.length && a.every(function (e, i) {
  1882. return looseEqual(e, b[i])
  1883. })
  1884. } else if (a instanceof Date && b instanceof Date) {
  1885. return a.getTime() === b.getTime()
  1886. } else if (!isArrayA && !isArrayB) {
  1887. var keysA = Object.keys(a);
  1888. var keysB = Object.keys(b);
  1889. return keysA.length === keysB.length && keysA.every(function (key) {
  1890. return looseEqual(a[key], b[key])
  1891. })
  1892. } else {
  1893. /* istanbul ignore next */
  1894. return false
  1895. }
  1896. } catch (e) {
  1897. /* istanbul ignore next */
  1898. return false
  1899. }
  1900. } else if (!isObjectA && !isObjectB) {
  1901. return String(a) === String(b)
  1902. } else {
  1903. return false
  1904. }
  1905. }
  1906. /**
  1907. * Return the first index at which a loosely equal value can be
  1908. * found in the array (if value is a plain object, the array must
  1909. * contain an object of the same shape), or -1 if it is not present.
  1910. */
  1911. function looseIndexOf (arr, val) {
  1912. for (var i = 0; i < arr.length; i++) {
  1913. if (looseEqual(arr[i], val)) { return i }
  1914. }
  1915. return -1
  1916. }
  1917. /**
  1918. * Ensure a function is called only once.
  1919. */
  1920. function once (fn) {
  1921. var called = false;
  1922. return function () {
  1923. if (!called) {
  1924. called = true;
  1925. fn.apply(this, arguments);
  1926. }
  1927. }
  1928. }
  1929. var ASSET_TYPES = [
  1930. 'component',
  1931. 'directive',
  1932. 'filter'
  1933. ];
  1934. var LIFECYCLE_HOOKS = [
  1935. 'beforeCreate',
  1936. 'created',
  1937. 'beforeMount',
  1938. 'mounted',
  1939. 'beforeUpdate',
  1940. 'updated',
  1941. 'beforeDestroy',
  1942. 'destroyed',
  1943. 'activated',
  1944. 'deactivated',
  1945. 'errorCaptured',
  1946. 'serverPrefetch'
  1947. ];
  1948. /* */
  1949. var config = ({
  1950. /**
  1951. * Option merge strategies (used in core/util/options)
  1952. */
  1953. // $flow-disable-line
  1954. optionMergeStrategies: Object.create(null),
  1955. /**
  1956. * Whether to suppress warnings.
  1957. */
  1958. silent: false,
  1959. /**
  1960. * Show production mode tip message on boot?
  1961. */
  1962. productionTip: "development" !== 'production',
  1963. /**
  1964. * Whether to enable devtools
  1965. */
  1966. devtools: "development" !== 'production',
  1967. /**
  1968. * Whether to record perf
  1969. */
  1970. performance: false,
  1971. /**
  1972. * Error handler for watcher errors
  1973. */
  1974. errorHandler: null,
  1975. /**
  1976. * Warn handler for watcher warns
  1977. */
  1978. warnHandler: null,
  1979. /**
  1980. * Ignore certain custom elements
  1981. */
  1982. ignoredElements: [],
  1983. /**
  1984. * Custom user key aliases for v-on
  1985. */
  1986. // $flow-disable-line
  1987. keyCodes: Object.create(null),
  1988. /**
  1989. * Check if a tag is reserved so that it cannot be registered as a
  1990. * component. This is platform-dependent and may be overwritten.
  1991. */
  1992. isReservedTag: no,
  1993. /**
  1994. * Check if an attribute is reserved so that it cannot be used as a component
  1995. * prop. This is platform-dependent and may be overwritten.
  1996. */
  1997. isReservedAttr: no,
  1998. /**
  1999. * Check if a tag is an unknown element.
  2000. * Platform-dependent.
  2001. */
  2002. isUnknownElement: no,
  2003. /**
  2004. * Get the namespace of an element
  2005. */
  2006. getTagNamespace: noop,
  2007. /**
  2008. * Parse the real tag name for the specific platform.
  2009. */
  2010. parsePlatformTagName: identity,
  2011. /**
  2012. * Check if an attribute must be bound using property, e.g. value
  2013. * Platform-dependent.
  2014. */
  2015. mustUseProp: no,
  2016. /**
  2017. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  2018. * This will significantly reduce performance if set to false.
  2019. */
  2020. async: true,
  2021. /**
  2022. * Exposed for legacy reasons
  2023. */
  2024. _lifecycleHooks: LIFECYCLE_HOOKS
  2025. });
  2026. /* */
  2027. /**
  2028. * unicode letters used for parsing html tags, component names and property paths.
  2029. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  2030. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  2031. */
  2032. 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/;
  2033. /**
  2034. * Check if a string starts with $ or _
  2035. */
  2036. function isReserved (str) {
  2037. var c = (str + '').charCodeAt(0);
  2038. return c === 0x24 || c === 0x5F
  2039. }
  2040. /**
  2041. * Define a property.
  2042. */
  2043. function def (obj, key, val, enumerable) {
  2044. Object.defineProperty(obj, key, {
  2045. value: val,
  2046. enumerable: !!enumerable,
  2047. writable: true,
  2048. configurable: true
  2049. });
  2050. }
  2051. /**
  2052. * Parse simple path.
  2053. */
  2054. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  2055. function parsePath (path) {
  2056. if (bailRE.test(path)) {
  2057. return
  2058. }
  2059. var segments = path.split('.');
  2060. return function (obj) {
  2061. for (var i = 0; i < segments.length; i++) {
  2062. if (!obj) { return }
  2063. obj = obj[segments[i]];
  2064. }
  2065. return obj
  2066. }
  2067. }
  2068. /* */
  2069. // can we use __proto__?
  2070. var hasProto = '__proto__' in {};
  2071. // Browser environment sniffing
  2072. var inBrowser = typeof window !== 'undefined';
  2073. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  2074. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  2075. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  2076. var isIE = UA && /msie|trident/.test(UA);
  2077. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  2078. var isEdge = UA && UA.indexOf('edge/') > 0;
  2079. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  2080. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  2081. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  2082. var isPhantomJS = UA && /phantomjs/.test(UA);
  2083. var isFF = UA && UA.match(/firefox\/(\d+)/);
  2084. // Firefox has a "watch" function on Object.prototype...
  2085. var nativeWatch = ({}).watch;
  2086. if (inBrowser) {
  2087. try {
  2088. var opts = {};
  2089. Object.defineProperty(opts, 'passive', ({
  2090. get: function get () {
  2091. }
  2092. })); // https://github.com/facebook/flow/issues/285
  2093. window.addEventListener('test-passive', null, opts);
  2094. } catch (e) {}
  2095. }
  2096. // this needs to be lazy-evaled because vue may be required before
  2097. // vue-server-renderer can set VUE_ENV
  2098. var _isServer;
  2099. var isServerRendering = function () {
  2100. if (_isServer === undefined) {
  2101. /* istanbul ignore if */
  2102. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  2103. // detect presence of vue-server-renderer and avoid
  2104. // Webpack shimming the process
  2105. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  2106. } else {
  2107. _isServer = false;
  2108. }
  2109. }
  2110. return _isServer
  2111. };
  2112. // detect devtools
  2113. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  2114. /* istanbul ignore next */
  2115. function isNative (Ctor) {
  2116. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  2117. }
  2118. var hasSymbol =
  2119. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  2120. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  2121. var _Set;
  2122. /* istanbul ignore if */ // $flow-disable-line
  2123. if (typeof Set !== 'undefined' && isNative(Set)) {
  2124. // use native Set when available.
  2125. _Set = Set;
  2126. } else {
  2127. // a non-standard Set polyfill that only works with primitive keys.
  2128. _Set = /*@__PURE__*/(function () {
  2129. function Set () {
  2130. this.set = Object.create(null);
  2131. }
  2132. Set.prototype.has = function has (key) {
  2133. return this.set[key] === true
  2134. };
  2135. Set.prototype.add = function add (key) {
  2136. this.set[key] = true;
  2137. };
  2138. Set.prototype.clear = function clear () {
  2139. this.set = Object.create(null);
  2140. };
  2141. return Set;
  2142. }());
  2143. }
  2144. /* */
  2145. var warn = noop;
  2146. var tip = noop;
  2147. var generateComponentTrace = (noop); // work around flow check
  2148. var formatComponentName = (noop);
  2149. if (true) {
  2150. var hasConsole = typeof console !== 'undefined';
  2151. var classifyRE = /(?:^|[-_])(\w)/g;
  2152. var classify = function (str) { return str
  2153. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  2154. .replace(/[-_]/g, ''); };
  2155. warn = function (msg, vm) {
  2156. var trace = vm ? generateComponentTrace(vm) : '';
  2157. if (config.warnHandler) {
  2158. config.warnHandler.call(null, msg, vm, trace);
  2159. } else if (hasConsole && (!config.silent)) {
  2160. console.error(("[Vue warn]: " + msg + trace));
  2161. }
  2162. };
  2163. tip = function (msg, vm) {
  2164. if (hasConsole && (!config.silent)) {
  2165. console.warn("[Vue tip]: " + msg + (
  2166. vm ? generateComponentTrace(vm) : ''
  2167. ));
  2168. }
  2169. };
  2170. formatComponentName = function (vm, includeFile) {
  2171. if (vm.$root === vm) {
  2172. if (vm.$options && vm.$options.__file) { // fixed by xxxxxx
  2173. return ('') + vm.$options.__file
  2174. }
  2175. return '<Root>'
  2176. }
  2177. var options = typeof vm === 'function' && vm.cid != null
  2178. ? vm.options
  2179. : vm._isVue
  2180. ? vm.$options || vm.constructor.options
  2181. : vm;
  2182. var name = options.name || options._componentTag;
  2183. var file = options.__file;
  2184. if (!name && file) {
  2185. var match = file.match(/([^/\\]+)\.vue$/);
  2186. name = match && match[1];
  2187. }
  2188. return (
  2189. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  2190. (file && includeFile !== false ? (" at " + file) : '')
  2191. )
  2192. };
  2193. var repeat = function (str, n) {
  2194. var res = '';
  2195. while (n) {
  2196. if (n % 2 === 1) { res += str; }
  2197. if (n > 1) { str += str; }
  2198. n >>= 1;
  2199. }
  2200. return res
  2201. };
  2202. generateComponentTrace = function (vm) {
  2203. if (vm._isVue && vm.$parent) {
  2204. var tree = [];
  2205. var currentRecursiveSequence = 0;
  2206. while (vm && vm.$options.name !== 'PageBody') {
  2207. if (tree.length > 0) {
  2208. var last = tree[tree.length - 1];
  2209. if (last.constructor === vm.constructor) {
  2210. currentRecursiveSequence++;
  2211. vm = vm.$parent;
  2212. continue
  2213. } else if (currentRecursiveSequence > 0) {
  2214. tree[tree.length - 1] = [last, currentRecursiveSequence];
  2215. currentRecursiveSequence = 0;
  2216. }
  2217. }
  2218. !vm.$options.isReserved && tree.push(vm);
  2219. vm = vm.$parent;
  2220. }
  2221. return '\n\nfound in\n\n' + tree
  2222. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  2223. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  2224. : formatComponentName(vm))); })
  2225. .join('\n')
  2226. } else {
  2227. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  2228. }
  2229. };
  2230. }
  2231. /* */
  2232. var uid = 0;
  2233. /**
  2234. * A dep is an observable that can have multiple
  2235. * directives subscribing to it.
  2236. */
  2237. var Dep = function Dep () {
  2238. this.id = uid++;
  2239. this.subs = [];
  2240. };
  2241. Dep.prototype.addSub = function addSub (sub) {
  2242. this.subs.push(sub);
  2243. };
  2244. Dep.prototype.removeSub = function removeSub (sub) {
  2245. remove(this.subs, sub);
  2246. };
  2247. Dep.prototype.depend = function depend () {
  2248. if (Dep.SharedObject.target) {
  2249. Dep.SharedObject.target.addDep(this);
  2250. }
  2251. };
  2252. Dep.prototype.notify = function notify () {
  2253. // stabilize the subscriber list first
  2254. var subs = this.subs.slice();
  2255. if ( true && !config.async) {
  2256. // subs aren't sorted in scheduler if not running async
  2257. // we need to sort them now to make sure they fire in correct
  2258. // order
  2259. subs.sort(function (a, b) { return a.id - b.id; });
  2260. }
  2261. for (var i = 0, l = subs.length; i < l; i++) {
  2262. subs[i].update();
  2263. }
  2264. };
  2265. // The current target watcher being evaluated.
  2266. // This is globally unique because only one watcher
  2267. // can be evaluated at a time.
  2268. // fixed by xxxxxx (nvue shared vuex)
  2269. /* eslint-disable no-undef */
  2270. Dep.SharedObject = {};
  2271. Dep.SharedObject.target = null;
  2272. Dep.SharedObject.targetStack = [];
  2273. function pushTarget (target) {
  2274. Dep.SharedObject.targetStack.push(target);
  2275. Dep.SharedObject.target = target;
  2276. }
  2277. function popTarget () {
  2278. Dep.SharedObject.targetStack.pop();
  2279. Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1];
  2280. }
  2281. /* */
  2282. var VNode = function VNode (
  2283. tag,
  2284. data,
  2285. children,
  2286. text,
  2287. elm,
  2288. context,
  2289. componentOptions,
  2290. asyncFactory
  2291. ) {
  2292. this.tag = tag;
  2293. this.data = data;
  2294. this.children = children;
  2295. this.text = text;
  2296. this.elm = elm;
  2297. this.ns = undefined;
  2298. this.context = context;
  2299. this.fnContext = undefined;
  2300. this.fnOptions = undefined;
  2301. this.fnScopeId = undefined;
  2302. this.key = data && data.key;
  2303. this.componentOptions = componentOptions;
  2304. this.componentInstance = undefined;
  2305. this.parent = undefined;
  2306. this.raw = false;
  2307. this.isStatic = false;
  2308. this.isRootInsert = true;
  2309. this.isComment = false;
  2310. this.isCloned = false;
  2311. this.isOnce = false;
  2312. this.asyncFactory = asyncFactory;
  2313. this.asyncMeta = undefined;
  2314. this.isAsyncPlaceholder = false;
  2315. };
  2316. var prototypeAccessors = { child: { configurable: true } };
  2317. // DEPRECATED: alias for componentInstance for backwards compat.
  2318. /* istanbul ignore next */
  2319. prototypeAccessors.child.get = function () {
  2320. return this.componentInstance
  2321. };
  2322. Object.defineProperties( VNode.prototype, prototypeAccessors );
  2323. var createEmptyVNode = function (text) {
  2324. if ( text === void 0 ) text = '';
  2325. var node = new VNode();
  2326. node.text = text;
  2327. node.isComment = true;
  2328. return node
  2329. };
  2330. function createTextVNode (val) {
  2331. return new VNode(undefined, undefined, undefined, String(val))
  2332. }
  2333. // optimized shallow clone
  2334. // used for static nodes and slot nodes because they may be reused across
  2335. // multiple renders, cloning them avoids errors when DOM manipulations rely
  2336. // on their elm reference.
  2337. function cloneVNode (vnode) {
  2338. var cloned = new VNode(
  2339. vnode.tag,
  2340. vnode.data,
  2341. // #7975
  2342. // clone children array to avoid mutating original in case of cloning
  2343. // a child.
  2344. vnode.children && vnode.children.slice(),
  2345. vnode.text,
  2346. vnode.elm,
  2347. vnode.context,
  2348. vnode.componentOptions,
  2349. vnode.asyncFactory
  2350. );
  2351. cloned.ns = vnode.ns;
  2352. cloned.isStatic = vnode.isStatic;
  2353. cloned.key = vnode.key;
  2354. cloned.isComment = vnode.isComment;
  2355. cloned.fnContext = vnode.fnContext;
  2356. cloned.fnOptions = vnode.fnOptions;
  2357. cloned.fnScopeId = vnode.fnScopeId;
  2358. cloned.asyncMeta = vnode.asyncMeta;
  2359. cloned.isCloned = true;
  2360. return cloned
  2361. }
  2362. /*
  2363. * not type checking this file because flow doesn't play well with
  2364. * dynamically accessing methods on Array prototype
  2365. */
  2366. var arrayProto = Array.prototype;
  2367. var arrayMethods = Object.create(arrayProto);
  2368. var methodsToPatch = [
  2369. 'push',
  2370. 'pop',
  2371. 'shift',
  2372. 'unshift',
  2373. 'splice',
  2374. 'sort',
  2375. 'reverse'
  2376. ];
  2377. /**
  2378. * Intercept mutating methods and emit events
  2379. */
  2380. methodsToPatch.forEach(function (method) {
  2381. // cache original method
  2382. var original = arrayProto[method];
  2383. def(arrayMethods, method, function mutator () {
  2384. var args = [], len = arguments.length;
  2385. while ( len-- ) args[ len ] = arguments[ len ];
  2386. var result = original.apply(this, args);
  2387. var ob = this.__ob__;
  2388. var inserted;
  2389. switch (method) {
  2390. case 'push':
  2391. case 'unshift':
  2392. inserted = args;
  2393. break
  2394. case 'splice':
  2395. inserted = args.slice(2);
  2396. break
  2397. }
  2398. if (inserted) { ob.observeArray(inserted); }
  2399. // notify change
  2400. ob.dep.notify();
  2401. return result
  2402. });
  2403. });
  2404. /* */
  2405. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  2406. /**
  2407. * In some cases we may want to disable observation inside a component's
  2408. * update computation.
  2409. */
  2410. var shouldObserve = true;
  2411. function toggleObserving (value) {
  2412. shouldObserve = value;
  2413. }
  2414. /**
  2415. * Observer class that is attached to each observed
  2416. * object. Once attached, the observer converts the target
  2417. * object's property keys into getter/setters that
  2418. * collect dependencies and dispatch updates.
  2419. */
  2420. var Observer = function Observer (value) {
  2421. this.value = value;
  2422. this.dep = new Dep();
  2423. this.vmCount = 0;
  2424. def(value, '__ob__', this);
  2425. if (Array.isArray(value)) {
  2426. if (hasProto) {
  2427. {// fixed by xxxxxx 微信小程序使用 plugins 之后,数组方法被直接挂载到了数组对象上,需要执行 copyAugment 逻辑
  2428. if(value.push !== value.__proto__.push){
  2429. copyAugment(value, arrayMethods, arrayKeys);
  2430. } else {
  2431. protoAugment(value, arrayMethods);
  2432. }
  2433. }
  2434. } else {
  2435. copyAugment(value, arrayMethods, arrayKeys);
  2436. }
  2437. this.observeArray(value);
  2438. } else {
  2439. this.walk(value);
  2440. }
  2441. };
  2442. /**
  2443. * Walk through all properties and convert them into
  2444. * getter/setters. This method should only be called when
  2445. * value type is Object.
  2446. */
  2447. Observer.prototype.walk = function walk (obj) {
  2448. var keys = Object.keys(obj);
  2449. for (var i = 0; i < keys.length; i++) {
  2450. defineReactive$$1(obj, keys[i]);
  2451. }
  2452. };
  2453. /**
  2454. * Observe a list of Array items.
  2455. */
  2456. Observer.prototype.observeArray = function observeArray (items) {
  2457. for (var i = 0, l = items.length; i < l; i++) {
  2458. observe(items[i]);
  2459. }
  2460. };
  2461. // helpers
  2462. /**
  2463. * Augment a target Object or Array by intercepting
  2464. * the prototype chain using __proto__
  2465. */
  2466. function protoAugment (target, src) {
  2467. /* eslint-disable no-proto */
  2468. target.__proto__ = src;
  2469. /* eslint-enable no-proto */
  2470. }
  2471. /**
  2472. * Augment a target Object or Array by defining
  2473. * hidden properties.
  2474. */
  2475. /* istanbul ignore next */
  2476. function copyAugment (target, src, keys) {
  2477. for (var i = 0, l = keys.length; i < l; i++) {
  2478. var key = keys[i];
  2479. def(target, key, src[key]);
  2480. }
  2481. }
  2482. /**
  2483. * Attempt to create an observer instance for a value,
  2484. * returns the new observer if successfully observed,
  2485. * or the existing observer if the value already has one.
  2486. */
  2487. function observe (value, asRootData) {
  2488. if (!isObject(value) || value instanceof VNode) {
  2489. return
  2490. }
  2491. var ob;
  2492. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  2493. ob = value.__ob__;
  2494. } else if (
  2495. shouldObserve &&
  2496. !isServerRendering() &&
  2497. (Array.isArray(value) || isPlainObject(value)) &&
  2498. Object.isExtensible(value) &&
  2499. !value._isVue
  2500. ) {
  2501. ob = new Observer(value);
  2502. }
  2503. if (asRootData && ob) {
  2504. ob.vmCount++;
  2505. }
  2506. return ob
  2507. }
  2508. /**
  2509. * Define a reactive property on an Object.
  2510. */
  2511. function defineReactive$$1 (
  2512. obj,
  2513. key,
  2514. val,
  2515. customSetter,
  2516. shallow
  2517. ) {
  2518. var dep = new Dep();
  2519. var property = Object.getOwnPropertyDescriptor(obj, key);
  2520. if (property && property.configurable === false) {
  2521. return
  2522. }
  2523. // cater for pre-defined getter/setters
  2524. var getter = property && property.get;
  2525. var setter = property && property.set;
  2526. if ((!getter || setter) && arguments.length === 2) {
  2527. val = obj[key];
  2528. }
  2529. var childOb = !shallow && observe(val);
  2530. Object.defineProperty(obj, key, {
  2531. enumerable: true,
  2532. configurable: true,
  2533. get: function reactiveGetter () {
  2534. var value = getter ? getter.call(obj) : val;
  2535. if (Dep.SharedObject.target) { // fixed by xxxxxx
  2536. dep.depend();
  2537. if (childOb) {
  2538. childOb.dep.depend();
  2539. if (Array.isArray(value)) {
  2540. dependArray(value);
  2541. }
  2542. }
  2543. }
  2544. return value
  2545. },
  2546. set: function reactiveSetter (newVal) {
  2547. var value = getter ? getter.call(obj) : val;
  2548. /* eslint-disable no-self-compare */
  2549. if (newVal === value || (newVal !== newVal && value !== value)) {
  2550. return
  2551. }
  2552. /* eslint-enable no-self-compare */
  2553. if ( true && customSetter) {
  2554. customSetter();
  2555. }
  2556. // #7981: for accessor properties without setter
  2557. if (getter && !setter) { return }
  2558. if (setter) {
  2559. setter.call(obj, newVal);
  2560. } else {
  2561. val = newVal;
  2562. }
  2563. childOb = !shallow && observe(newVal);
  2564. dep.notify();
  2565. }
  2566. });
  2567. }
  2568. /**
  2569. * Set a property on an object. Adds the new property and
  2570. * triggers change notification if the property doesn't
  2571. * already exist.
  2572. */
  2573. function set (target, key, val) {
  2574. if ( true &&
  2575. (isUndef(target) || isPrimitive(target))
  2576. ) {
  2577. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  2578. }
  2579. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2580. target.length = Math.max(target.length, key);
  2581. target.splice(key, 1, val);
  2582. return val
  2583. }
  2584. if (key in target && !(key in Object.prototype)) {
  2585. target[key] = val;
  2586. return val
  2587. }
  2588. var ob = (target).__ob__;
  2589. if (target._isVue || (ob && ob.vmCount)) {
  2590. true && warn(
  2591. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  2592. 'at runtime - declare it upfront in the data option.'
  2593. );
  2594. return val
  2595. }
  2596. if (!ob) {
  2597. target[key] = val;
  2598. return val
  2599. }
  2600. defineReactive$$1(ob.value, key, val);
  2601. ob.dep.notify();
  2602. return val
  2603. }
  2604. /**
  2605. * Delete a property and trigger change if necessary.
  2606. */
  2607. function del (target, key) {
  2608. if ( true &&
  2609. (isUndef(target) || isPrimitive(target))
  2610. ) {
  2611. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  2612. }
  2613. if (Array.isArray(target) && isValidArrayIndex(key)) {
  2614. target.splice(key, 1);
  2615. return
  2616. }
  2617. var ob = (target).__ob__;
  2618. if (target._isVue || (ob && ob.vmCount)) {
  2619. true && warn(
  2620. 'Avoid deleting properties on a Vue instance or its root $data ' +
  2621. '- just set it to null.'
  2622. );
  2623. return
  2624. }
  2625. if (!hasOwn(target, key)) {
  2626. return
  2627. }
  2628. delete target[key];
  2629. if (!ob) {
  2630. return
  2631. }
  2632. ob.dep.notify();
  2633. }
  2634. /**
  2635. * Collect dependencies on array elements when the array is touched, since
  2636. * we cannot intercept array element access like property getters.
  2637. */
  2638. function dependArray (value) {
  2639. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  2640. e = value[i];
  2641. e && e.__ob__ && e.__ob__.dep.depend();
  2642. if (Array.isArray(e)) {
  2643. dependArray(e);
  2644. }
  2645. }
  2646. }
  2647. /* */
  2648. /**
  2649. * Option overwriting strategies are functions that handle
  2650. * how to merge a parent option value and a child option
  2651. * value into the final value.
  2652. */
  2653. var strats = config.optionMergeStrategies;
  2654. /**
  2655. * Options with restrictions
  2656. */
  2657. if (true) {
  2658. strats.el = strats.propsData = function (parent, child, vm, key) {
  2659. if (!vm) {
  2660. warn(
  2661. "option \"" + key + "\" can only be used during instance " +
  2662. 'creation with the `new` keyword.'
  2663. );
  2664. }
  2665. return defaultStrat(parent, child)
  2666. };
  2667. }
  2668. /**
  2669. * Helper that recursively merges two data objects together.
  2670. */
  2671. function mergeData (to, from) {
  2672. if (!from) { return to }
  2673. var key, toVal, fromVal;
  2674. var keys = hasSymbol
  2675. ? Reflect.ownKeys(from)
  2676. : Object.keys(from);
  2677. for (var i = 0; i < keys.length; i++) {
  2678. key = keys[i];
  2679. // in case the object is already observed...
  2680. if (key === '__ob__') { continue }
  2681. toVal = to[key];
  2682. fromVal = from[key];
  2683. if (!hasOwn(to, key)) {
  2684. set(to, key, fromVal);
  2685. } else if (
  2686. toVal !== fromVal &&
  2687. isPlainObject(toVal) &&
  2688. isPlainObject(fromVal)
  2689. ) {
  2690. mergeData(toVal, fromVal);
  2691. }
  2692. }
  2693. return to
  2694. }
  2695. /**
  2696. * Data
  2697. */
  2698. function mergeDataOrFn (
  2699. parentVal,
  2700. childVal,
  2701. vm
  2702. ) {
  2703. if (!vm) {
  2704. // in a Vue.extend merge, both should be functions
  2705. if (!childVal) {
  2706. return parentVal
  2707. }
  2708. if (!parentVal) {
  2709. return childVal
  2710. }
  2711. // when parentVal & childVal are both present,
  2712. // we need to return a function that returns the
  2713. // merged result of both functions... no need to
  2714. // check if parentVal is a function here because
  2715. // it has to be a function to pass previous merges.
  2716. return function mergedDataFn () {
  2717. return mergeData(
  2718. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  2719. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  2720. )
  2721. }
  2722. } else {
  2723. return function mergedInstanceDataFn () {
  2724. // instance merge
  2725. var instanceData = typeof childVal === 'function'
  2726. ? childVal.call(vm, vm)
  2727. : childVal;
  2728. var defaultData = typeof parentVal === 'function'
  2729. ? parentVal.call(vm, vm)
  2730. : parentVal;
  2731. if (instanceData) {
  2732. return mergeData(instanceData, defaultData)
  2733. } else {
  2734. return defaultData
  2735. }
  2736. }
  2737. }
  2738. }
  2739. strats.data = function (
  2740. parentVal,
  2741. childVal,
  2742. vm
  2743. ) {
  2744. if (!vm) {
  2745. if (childVal && typeof childVal !== 'function') {
  2746. true && warn(
  2747. 'The "data" option should be a function ' +
  2748. 'that returns a per-instance value in component ' +
  2749. 'definitions.',
  2750. vm
  2751. );
  2752. return parentVal
  2753. }
  2754. return mergeDataOrFn(parentVal, childVal)
  2755. }
  2756. return mergeDataOrFn(parentVal, childVal, vm)
  2757. };
  2758. /**
  2759. * Hooks and props are merged as arrays.
  2760. */
  2761. function mergeHook (
  2762. parentVal,
  2763. childVal
  2764. ) {
  2765. var res = childVal
  2766. ? parentVal
  2767. ? parentVal.concat(childVal)
  2768. : Array.isArray(childVal)
  2769. ? childVal
  2770. : [childVal]
  2771. : parentVal;
  2772. return res
  2773. ? dedupeHooks(res)
  2774. : res
  2775. }
  2776. function dedupeHooks (hooks) {
  2777. var res = [];
  2778. for (var i = 0; i < hooks.length; i++) {
  2779. if (res.indexOf(hooks[i]) === -1) {
  2780. res.push(hooks[i]);
  2781. }
  2782. }
  2783. return res
  2784. }
  2785. LIFECYCLE_HOOKS.forEach(function (hook) {
  2786. strats[hook] = mergeHook;
  2787. });
  2788. /**
  2789. * Assets
  2790. *
  2791. * When a vm is present (instance creation), we need to do
  2792. * a three-way merge between constructor options, instance
  2793. * options and parent options.
  2794. */
  2795. function mergeAssets (
  2796. parentVal,
  2797. childVal,
  2798. vm,
  2799. key
  2800. ) {
  2801. var res = Object.create(parentVal || null);
  2802. if (childVal) {
  2803. true && assertObjectType(key, childVal, vm);
  2804. return extend(res, childVal)
  2805. } else {
  2806. return res
  2807. }
  2808. }
  2809. ASSET_TYPES.forEach(function (type) {
  2810. strats[type + 's'] = mergeAssets;
  2811. });
  2812. /**
  2813. * Watchers.
  2814. *
  2815. * Watchers hashes should not overwrite one
  2816. * another, so we merge them as arrays.
  2817. */
  2818. strats.watch = function (
  2819. parentVal,
  2820. childVal,
  2821. vm,
  2822. key
  2823. ) {
  2824. // work around Firefox's Object.prototype.watch...
  2825. if (parentVal === nativeWatch) { parentVal = undefined; }
  2826. if (childVal === nativeWatch) { childVal = undefined; }
  2827. /* istanbul ignore if */
  2828. if (!childVal) { return Object.create(parentVal || null) }
  2829. if (true) {
  2830. assertObjectType(key, childVal, vm);
  2831. }
  2832. if (!parentVal) { return childVal }
  2833. var ret = {};
  2834. extend(ret, parentVal);
  2835. for (var key$1 in childVal) {
  2836. var parent = ret[key$1];
  2837. var child = childVal[key$1];
  2838. if (parent && !Array.isArray(parent)) {
  2839. parent = [parent];
  2840. }
  2841. ret[key$1] = parent
  2842. ? parent.concat(child)
  2843. : Array.isArray(child) ? child : [child];
  2844. }
  2845. return ret
  2846. };
  2847. /**
  2848. * Other object hashes.
  2849. */
  2850. strats.props =
  2851. strats.methods =
  2852. strats.inject =
  2853. strats.computed = function (
  2854. parentVal,
  2855. childVal,
  2856. vm,
  2857. key
  2858. ) {
  2859. if (childVal && "development" !== 'production') {
  2860. assertObjectType(key, childVal, vm);
  2861. }
  2862. if (!parentVal) { return childVal }
  2863. var ret = Object.create(null);
  2864. extend(ret, parentVal);
  2865. if (childVal) { extend(ret, childVal); }
  2866. return ret
  2867. };
  2868. strats.provide = mergeDataOrFn;
  2869. /**
  2870. * Default strategy.
  2871. */
  2872. var defaultStrat = function (parentVal, childVal) {
  2873. return childVal === undefined
  2874. ? parentVal
  2875. : childVal
  2876. };
  2877. /**
  2878. * Validate component names
  2879. */
  2880. function checkComponents (options) {
  2881. for (var key in options.components) {
  2882. validateComponentName(key);
  2883. }
  2884. }
  2885. function validateComponentName (name) {
  2886. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  2887. warn(
  2888. 'Invalid component name: "' + name + '". Component names ' +
  2889. 'should conform to valid custom element name in html5 specification.'
  2890. );
  2891. }
  2892. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  2893. warn(
  2894. 'Do not use built-in or reserved HTML elements as component ' +
  2895. 'id: ' + name
  2896. );
  2897. }
  2898. }
  2899. /**
  2900. * Ensure all props option syntax are normalized into the
  2901. * Object-based format.
  2902. */
  2903. function normalizeProps (options, vm) {
  2904. var props = options.props;
  2905. if (!props) { return }
  2906. var res = {};
  2907. var i, val, name;
  2908. if (Array.isArray(props)) {
  2909. i = props.length;
  2910. while (i--) {
  2911. val = props[i];
  2912. if (typeof val === 'string') {
  2913. name = camelize(val);
  2914. res[name] = { type: null };
  2915. } else if (true) {
  2916. warn('props must be strings when using array syntax.');
  2917. }
  2918. }
  2919. } else if (isPlainObject(props)) {
  2920. for (var key in props) {
  2921. val = props[key];
  2922. name = camelize(key);
  2923. res[name] = isPlainObject(val)
  2924. ? val
  2925. : { type: val };
  2926. }
  2927. } else if (true) {
  2928. warn(
  2929. "Invalid value for option \"props\": expected an Array or an Object, " +
  2930. "but got " + (toRawType(props)) + ".",
  2931. vm
  2932. );
  2933. }
  2934. options.props = res;
  2935. }
  2936. /**
  2937. * Normalize all injections into Object-based format
  2938. */
  2939. function normalizeInject (options, vm) {
  2940. var inject = options.inject;
  2941. if (!inject) { return }
  2942. var normalized = options.inject = {};
  2943. if (Array.isArray(inject)) {
  2944. for (var i = 0; i < inject.length; i++) {
  2945. normalized[inject[i]] = { from: inject[i] };
  2946. }
  2947. } else if (isPlainObject(inject)) {
  2948. for (var key in inject) {
  2949. var val = inject[key];
  2950. normalized[key] = isPlainObject(val)
  2951. ? extend({ from: key }, val)
  2952. : { from: val };
  2953. }
  2954. } else if (true) {
  2955. warn(
  2956. "Invalid value for option \"inject\": expected an Array or an Object, " +
  2957. "but got " + (toRawType(inject)) + ".",
  2958. vm
  2959. );
  2960. }
  2961. }
  2962. /**
  2963. * Normalize raw function directives into object format.
  2964. */
  2965. function normalizeDirectives (options) {
  2966. var dirs = options.directives;
  2967. if (dirs) {
  2968. for (var key in dirs) {
  2969. var def$$1 = dirs[key];
  2970. if (typeof def$$1 === 'function') {
  2971. dirs[key] = { bind: def$$1, update: def$$1 };
  2972. }
  2973. }
  2974. }
  2975. }
  2976. function assertObjectType (name, value, vm) {
  2977. if (!isPlainObject(value)) {
  2978. warn(
  2979. "Invalid value for option \"" + name + "\": expected an Object, " +
  2980. "but got " + (toRawType(value)) + ".",
  2981. vm
  2982. );
  2983. }
  2984. }
  2985. /**
  2986. * Merge two option objects into a new one.
  2987. * Core utility used in both instantiation and inheritance.
  2988. */
  2989. function mergeOptions (
  2990. parent,
  2991. child,
  2992. vm
  2993. ) {
  2994. if (true) {
  2995. checkComponents(child);
  2996. }
  2997. if (typeof child === 'function') {
  2998. child = child.options;
  2999. }
  3000. normalizeProps(child, vm);
  3001. normalizeInject(child, vm);
  3002. normalizeDirectives(child);
  3003. // Apply extends and mixins on the child options,
  3004. // but only if it is a raw options object that isn't
  3005. // the result of another mergeOptions call.
  3006. // Only merged options has the _base property.
  3007. if (!child._base) {
  3008. if (child.extends) {
  3009. parent = mergeOptions(parent, child.extends, vm);
  3010. }
  3011. if (child.mixins) {
  3012. for (var i = 0, l = child.mixins.length; i < l; i++) {
  3013. parent = mergeOptions(parent, child.mixins[i], vm);
  3014. }
  3015. }
  3016. }
  3017. var options = {};
  3018. var key;
  3019. for (key in parent) {
  3020. mergeField(key);
  3021. }
  3022. for (key in child) {
  3023. if (!hasOwn(parent, key)) {
  3024. mergeField(key);
  3025. }
  3026. }
  3027. function mergeField (key) {
  3028. var strat = strats[key] || defaultStrat;
  3029. options[key] = strat(parent[key], child[key], vm, key);
  3030. }
  3031. return options
  3032. }
  3033. /**
  3034. * Resolve an asset.
  3035. * This function is used because child instances need access
  3036. * to assets defined in its ancestor chain.
  3037. */
  3038. function resolveAsset (
  3039. options,
  3040. type,
  3041. id,
  3042. warnMissing
  3043. ) {
  3044. /* istanbul ignore if */
  3045. if (typeof id !== 'string') {
  3046. return
  3047. }
  3048. var assets = options[type];
  3049. // check local registration variations first
  3050. if (hasOwn(assets, id)) { return assets[id] }
  3051. var camelizedId = camelize(id);
  3052. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  3053. var PascalCaseId = capitalize(camelizedId);
  3054. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  3055. // fallback to prototype chain
  3056. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  3057. if ( true && warnMissing && !res) {
  3058. warn(
  3059. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  3060. options
  3061. );
  3062. }
  3063. return res
  3064. }
  3065. /* */
  3066. function validateProp (
  3067. key,
  3068. propOptions,
  3069. propsData,
  3070. vm
  3071. ) {
  3072. var prop = propOptions[key];
  3073. var absent = !hasOwn(propsData, key);
  3074. var value = propsData[key];
  3075. // boolean casting
  3076. var booleanIndex = getTypeIndex(Boolean, prop.type);
  3077. if (booleanIndex > -1) {
  3078. if (absent && !hasOwn(prop, 'default')) {
  3079. value = false;
  3080. } else if (value === '' || value === hyphenate(key)) {
  3081. // only cast empty string / same name to boolean if
  3082. // boolean has higher priority
  3083. var stringIndex = getTypeIndex(String, prop.type);
  3084. if (stringIndex < 0 || booleanIndex < stringIndex) {
  3085. value = true;
  3086. }
  3087. }
  3088. }
  3089. // check default value
  3090. if (value === undefined) {
  3091. value = getPropDefaultValue(vm, prop, key);
  3092. // since the default value is a fresh copy,
  3093. // make sure to observe it.
  3094. var prevShouldObserve = shouldObserve;
  3095. toggleObserving(true);
  3096. observe(value);
  3097. toggleObserving(prevShouldObserve);
  3098. }
  3099. if (
  3100. true
  3101. ) {
  3102. assertProp(prop, key, value, vm, absent);
  3103. }
  3104. return value
  3105. }
  3106. /**
  3107. * Get the default value of a prop.
  3108. */
  3109. function getPropDefaultValue (vm, prop, key) {
  3110. // no default, return undefined
  3111. if (!hasOwn(prop, 'default')) {
  3112. return undefined
  3113. }
  3114. var def = prop.default;
  3115. // warn against non-factory defaults for Object & Array
  3116. if ( true && isObject(def)) {
  3117. warn(
  3118. 'Invalid default value for prop "' + key + '": ' +
  3119. 'Props with type Object/Array must use a factory function ' +
  3120. 'to return the default value.',
  3121. vm
  3122. );
  3123. }
  3124. // the raw prop value was also undefined from previous render,
  3125. // return previous default value to avoid unnecessary watcher trigger
  3126. if (vm && vm.$options.propsData &&
  3127. vm.$options.propsData[key] === undefined &&
  3128. vm._props[key] !== undefined
  3129. ) {
  3130. return vm._props[key]
  3131. }
  3132. // call factory function for non-Function types
  3133. // a value is Function if its prototype is function even across different execution context
  3134. return typeof def === 'function' && getType(prop.type) !== 'Function'
  3135. ? def.call(vm)
  3136. : def
  3137. }
  3138. /**
  3139. * Assert whether a prop is valid.
  3140. */
  3141. function assertProp (
  3142. prop,
  3143. name,
  3144. value,
  3145. vm,
  3146. absent
  3147. ) {
  3148. if (prop.required && absent) {
  3149. warn(
  3150. 'Missing required prop: "' + name + '"',
  3151. vm
  3152. );
  3153. return
  3154. }
  3155. if (value == null && !prop.required) {
  3156. return
  3157. }
  3158. var type = prop.type;
  3159. var valid = !type || type === true;
  3160. var expectedTypes = [];
  3161. if (type) {
  3162. if (!Array.isArray(type)) {
  3163. type = [type];
  3164. }
  3165. for (var i = 0; i < type.length && !valid; i++) {
  3166. var assertedType = assertType(value, type[i]);
  3167. expectedTypes.push(assertedType.expectedType || '');
  3168. valid = assertedType.valid;
  3169. }
  3170. }
  3171. if (!valid) {
  3172. warn(
  3173. getInvalidTypeMessage(name, value, expectedTypes),
  3174. vm
  3175. );
  3176. return
  3177. }
  3178. var validator = prop.validator;
  3179. if (validator) {
  3180. if (!validator(value)) {
  3181. warn(
  3182. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  3183. vm
  3184. );
  3185. }
  3186. }
  3187. }
  3188. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  3189. function assertType (value, type) {
  3190. var valid;
  3191. var expectedType = getType(type);
  3192. if (simpleCheckRE.test(expectedType)) {
  3193. var t = typeof value;
  3194. valid = t === expectedType.toLowerCase();
  3195. // for primitive wrapper objects
  3196. if (!valid && t === 'object') {
  3197. valid = value instanceof type;
  3198. }
  3199. } else if (expectedType === 'Object') {
  3200. valid = isPlainObject(value);
  3201. } else if (expectedType === 'Array') {
  3202. valid = Array.isArray(value);
  3203. } else {
  3204. valid = value instanceof type;
  3205. }
  3206. return {
  3207. valid: valid,
  3208. expectedType: expectedType
  3209. }
  3210. }
  3211. /**
  3212. * Use function string name to check built-in types,
  3213. * because a simple equality check will fail when running
  3214. * across different vms / iframes.
  3215. */
  3216. function getType (fn) {
  3217. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  3218. return match ? match[1] : ''
  3219. }
  3220. function isSameType (a, b) {
  3221. return getType(a) === getType(b)
  3222. }
  3223. function getTypeIndex (type, expectedTypes) {
  3224. if (!Array.isArray(expectedTypes)) {
  3225. return isSameType(expectedTypes, type) ? 0 : -1
  3226. }
  3227. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  3228. if (isSameType(expectedTypes[i], type)) {
  3229. return i
  3230. }
  3231. }
  3232. return -1
  3233. }
  3234. function getInvalidTypeMessage (name, value, expectedTypes) {
  3235. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  3236. " Expected " + (expectedTypes.map(capitalize).join(', '));
  3237. var expectedType = expectedTypes[0];
  3238. var receivedType = toRawType(value);
  3239. var expectedValue = styleValue(value, expectedType);
  3240. var receivedValue = styleValue(value, receivedType);
  3241. // check if we need to specify expected value
  3242. if (expectedTypes.length === 1 &&
  3243. isExplicable(expectedType) &&
  3244. !isBoolean(expectedType, receivedType)) {
  3245. message += " with value " + expectedValue;
  3246. }
  3247. message += ", got " + receivedType + " ";
  3248. // check if we need to specify received value
  3249. if (isExplicable(receivedType)) {
  3250. message += "with value " + receivedValue + ".";
  3251. }
  3252. return message
  3253. }
  3254. function styleValue (value, type) {
  3255. if (type === 'String') {
  3256. return ("\"" + value + "\"")
  3257. } else if (type === 'Number') {
  3258. return ("" + (Number(value)))
  3259. } else {
  3260. return ("" + value)
  3261. }
  3262. }
  3263. function isExplicable (value) {
  3264. var explicitTypes = ['string', 'number', 'boolean'];
  3265. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  3266. }
  3267. function isBoolean () {
  3268. var args = [], len = arguments.length;
  3269. while ( len-- ) args[ len ] = arguments[ len ];
  3270. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  3271. }
  3272. /* */
  3273. function handleError (err, vm, info) {
  3274. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  3275. // See: https://github.com/vuejs/vuex/issues/1505
  3276. pushTarget();
  3277. try {
  3278. if (vm) {
  3279. var cur = vm;
  3280. while ((cur = cur.$parent)) {
  3281. var hooks = cur.$options.errorCaptured;
  3282. if (hooks) {
  3283. for (var i = 0; i < hooks.length; i++) {
  3284. try {
  3285. var capture = hooks[i].call(cur, err, vm, info) === false;
  3286. if (capture) { return }
  3287. } catch (e) {
  3288. globalHandleError(e, cur, 'errorCaptured hook');
  3289. }
  3290. }
  3291. }
  3292. }
  3293. }
  3294. globalHandleError(err, vm, info);
  3295. } finally {
  3296. popTarget();
  3297. }
  3298. }
  3299. function invokeWithErrorHandling (
  3300. handler,
  3301. context,
  3302. args,
  3303. vm,
  3304. info
  3305. ) {
  3306. var res;
  3307. try {
  3308. res = args ? handler.apply(context, args) : handler.call(context);
  3309. if (res && !res._isVue && isPromise(res) && !res._handled) {
  3310. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  3311. // issue #9511
  3312. // avoid catch triggering multiple times when nested calls
  3313. res._handled = true;
  3314. }
  3315. } catch (e) {
  3316. handleError(e, vm, info);
  3317. }
  3318. return res
  3319. }
  3320. function globalHandleError (err, vm, info) {
  3321. if (config.errorHandler) {
  3322. try {
  3323. return config.errorHandler.call(null, err, vm, info)
  3324. } catch (e) {
  3325. // if the user intentionally throws the original error in the handler,
  3326. // do not log it twice
  3327. if (e !== err) {
  3328. logError(e, null, 'config.errorHandler');
  3329. }
  3330. }
  3331. }
  3332. logError(err, vm, info);
  3333. }
  3334. function logError (err, vm, info) {
  3335. if (true) {
  3336. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  3337. }
  3338. /* istanbul ignore else */
  3339. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  3340. console.error(err);
  3341. } else {
  3342. throw err
  3343. }
  3344. }
  3345. /* */
  3346. var callbacks = [];
  3347. var pending = false;
  3348. function flushCallbacks () {
  3349. pending = false;
  3350. var copies = callbacks.slice(0);
  3351. callbacks.length = 0;
  3352. for (var i = 0; i < copies.length; i++) {
  3353. copies[i]();
  3354. }
  3355. }
  3356. // Here we have async deferring wrappers using microtasks.
  3357. // In 2.5 we used (macro) tasks (in combination with microtasks).
  3358. // However, it has subtle problems when state is changed right before repaint
  3359. // (e.g. #6813, out-in transitions).
  3360. // Also, using (macro) tasks in event handler would cause some weird behaviors
  3361. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  3362. // So we now use microtasks everywhere, again.
  3363. // A major drawback of this tradeoff is that there are some scenarios
  3364. // where microtasks have too high a priority and fire in between supposedly
  3365. // sequential events (e.g. #4521, #6690, which have workarounds)
  3366. // or even between bubbling of the same event (#6566).
  3367. var timerFunc;
  3368. // The nextTick behavior leverages the microtask queue, which can be accessed
  3369. // via either native Promise.then or MutationObserver.
  3370. // MutationObserver has wider support, however it is seriously bugged in
  3371. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  3372. // completely stops working after triggering a few times... so, if native
  3373. // Promise is available, we will use it:
  3374. /* istanbul ignore next, $flow-disable-line */
  3375. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  3376. var p = Promise.resolve();
  3377. timerFunc = function () {
  3378. p.then(flushCallbacks);
  3379. // In problematic UIWebViews, Promise.then doesn't completely break, but
  3380. // it can get stuck in a weird state where callbacks are pushed into the
  3381. // microtask queue but the queue isn't being flushed, until the browser
  3382. // needs to do some other work, e.g. handle a timer. Therefore we can
  3383. // "force" the microtask queue to be flushed by adding an empty timer.
  3384. if (isIOS) { setTimeout(noop); }
  3385. };
  3386. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  3387. isNative(MutationObserver) ||
  3388. // PhantomJS and iOS 7.x
  3389. MutationObserver.toString() === '[object MutationObserverConstructor]'
  3390. )) {
  3391. // Use MutationObserver where native Promise is not available,
  3392. // e.g. PhantomJS, iOS7, Android 4.4
  3393. // (#6466 MutationObserver is unreliable in IE11)
  3394. var counter = 1;
  3395. var observer = new MutationObserver(flushCallbacks);
  3396. var textNode = document.createTextNode(String(counter));
  3397. observer.observe(textNode, {
  3398. characterData: true
  3399. });
  3400. timerFunc = function () {
  3401. counter = (counter + 1) % 2;
  3402. textNode.data = String(counter);
  3403. };
  3404. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  3405. // Fallback to setImmediate.
  3406. // Technically it leverages the (macro) task queue,
  3407. // but it is still a better choice than setTimeout.
  3408. timerFunc = function () {
  3409. setImmediate(flushCallbacks);
  3410. };
  3411. } else {
  3412. // Fallback to setTimeout.
  3413. timerFunc = function () {
  3414. setTimeout(flushCallbacks, 0);
  3415. };
  3416. }
  3417. function nextTick (cb, ctx) {
  3418. var _resolve;
  3419. callbacks.push(function () {
  3420. if (cb) {
  3421. try {
  3422. cb.call(ctx);
  3423. } catch (e) {
  3424. handleError(e, ctx, 'nextTick');
  3425. }
  3426. } else if (_resolve) {
  3427. _resolve(ctx);
  3428. }
  3429. });
  3430. if (!pending) {
  3431. pending = true;
  3432. timerFunc();
  3433. }
  3434. // $flow-disable-line
  3435. if (!cb && typeof Promise !== 'undefined') {
  3436. return new Promise(function (resolve) {
  3437. _resolve = resolve;
  3438. })
  3439. }
  3440. }
  3441. /* */
  3442. /* not type checking this file because flow doesn't play well with Proxy */
  3443. var initProxy;
  3444. if (true) {
  3445. var allowedGlobals = makeMap(
  3446. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  3447. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  3448. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  3449. 'require' // for Webpack/Browserify
  3450. );
  3451. var warnNonPresent = function (target, key) {
  3452. warn(
  3453. "Property or method \"" + key + "\" is not defined on the instance but " +
  3454. 'referenced during render. Make sure that this property is reactive, ' +
  3455. 'either in the data option, or for class-based components, by ' +
  3456. 'initializing the property. ' +
  3457. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  3458. target
  3459. );
  3460. };
  3461. var warnReservedPrefix = function (target, key) {
  3462. warn(
  3463. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  3464. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  3465. 'prevent conflicts with Vue internals. ' +
  3466. 'See: https://vuejs.org/v2/api/#data',
  3467. target
  3468. );
  3469. };
  3470. var hasProxy =
  3471. typeof Proxy !== 'undefined' && isNative(Proxy);
  3472. if (hasProxy) {
  3473. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  3474. config.keyCodes = new Proxy(config.keyCodes, {
  3475. set: function set (target, key, value) {
  3476. if (isBuiltInModifier(key)) {
  3477. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  3478. return false
  3479. } else {
  3480. target[key] = value;
  3481. return true
  3482. }
  3483. }
  3484. });
  3485. }
  3486. var hasHandler = {
  3487. has: function has (target, key) {
  3488. var has = key in target;
  3489. var isAllowed = allowedGlobals(key) ||
  3490. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  3491. if (!has && !isAllowed) {
  3492. if (key in target.$data) { warnReservedPrefix(target, key); }
  3493. else { warnNonPresent(target, key); }
  3494. }
  3495. return has || !isAllowed
  3496. }
  3497. };
  3498. var getHandler = {
  3499. get: function get (target, key) {
  3500. if (typeof key === 'string' && !(key in target)) {
  3501. if (key in target.$data) { warnReservedPrefix(target, key); }
  3502. else { warnNonPresent(target, key); }
  3503. }
  3504. return target[key]
  3505. }
  3506. };
  3507. initProxy = function initProxy (vm) {
  3508. if (hasProxy) {
  3509. // determine which proxy handler to use
  3510. var options = vm.$options;
  3511. var handlers = options.render && options.render._withStripped
  3512. ? getHandler
  3513. : hasHandler;
  3514. vm._renderProxy = new Proxy(vm, handlers);
  3515. } else {
  3516. vm._renderProxy = vm;
  3517. }
  3518. };
  3519. }
  3520. /* */
  3521. var seenObjects = new _Set();
  3522. /**
  3523. * Recursively traverse an object to evoke all converted
  3524. * getters, so that every nested property inside the object
  3525. * is collected as a "deep" dependency.
  3526. */
  3527. function traverse (val) {
  3528. _traverse(val, seenObjects);
  3529. seenObjects.clear();
  3530. }
  3531. function _traverse (val, seen) {
  3532. var i, keys;
  3533. var isA = Array.isArray(val);
  3534. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  3535. return
  3536. }
  3537. if (val.__ob__) {
  3538. var depId = val.__ob__.dep.id;
  3539. if (seen.has(depId)) {
  3540. return
  3541. }
  3542. seen.add(depId);
  3543. }
  3544. if (isA) {
  3545. i = val.length;
  3546. while (i--) { _traverse(val[i], seen); }
  3547. } else {
  3548. keys = Object.keys(val);
  3549. i = keys.length;
  3550. while (i--) { _traverse(val[keys[i]], seen); }
  3551. }
  3552. }
  3553. var mark;
  3554. var measure;
  3555. if (true) {
  3556. var perf = inBrowser && window.performance;
  3557. /* istanbul ignore if */
  3558. if (
  3559. perf &&
  3560. perf.mark &&
  3561. perf.measure &&
  3562. perf.clearMarks &&
  3563. perf.clearMeasures
  3564. ) {
  3565. mark = function (tag) { return perf.mark(tag); };
  3566. measure = function (name, startTag, endTag) {
  3567. perf.measure(name, startTag, endTag);
  3568. perf.clearMarks(startTag);
  3569. perf.clearMarks(endTag);
  3570. // perf.clearMeasures(name)
  3571. };
  3572. }
  3573. }
  3574. /* */
  3575. var normalizeEvent = cached(function (name) {
  3576. var passive = name.charAt(0) === '&';
  3577. name = passive ? name.slice(1) : name;
  3578. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  3579. name = once$$1 ? name.slice(1) : name;
  3580. var capture = name.charAt(0) === '!';
  3581. name = capture ? name.slice(1) : name;
  3582. return {
  3583. name: name,
  3584. once: once$$1,
  3585. capture: capture,
  3586. passive: passive
  3587. }
  3588. });
  3589. function createFnInvoker (fns, vm) {
  3590. function invoker () {
  3591. var arguments$1 = arguments;
  3592. var fns = invoker.fns;
  3593. if (Array.isArray(fns)) {
  3594. var cloned = fns.slice();
  3595. for (var i = 0; i < cloned.length; i++) {
  3596. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  3597. }
  3598. } else {
  3599. // return handler return value for single handlers
  3600. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  3601. }
  3602. }
  3603. invoker.fns = fns;
  3604. return invoker
  3605. }
  3606. function updateListeners (
  3607. on,
  3608. oldOn,
  3609. add,
  3610. remove$$1,
  3611. createOnceHandler,
  3612. vm
  3613. ) {
  3614. var name, def$$1, cur, old, event;
  3615. for (name in on) {
  3616. def$$1 = cur = on[name];
  3617. old = oldOn[name];
  3618. event = normalizeEvent(name);
  3619. if (isUndef(cur)) {
  3620. true && warn(
  3621. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  3622. vm
  3623. );
  3624. } else if (isUndef(old)) {
  3625. if (isUndef(cur.fns)) {
  3626. cur = on[name] = createFnInvoker(cur, vm);
  3627. }
  3628. if (isTrue(event.once)) {
  3629. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  3630. }
  3631. add(event.name, cur, event.capture, event.passive, event.params);
  3632. } else if (cur !== old) {
  3633. old.fns = cur;
  3634. on[name] = old;
  3635. }
  3636. }
  3637. for (name in oldOn) {
  3638. if (isUndef(on[name])) {
  3639. event = normalizeEvent(name);
  3640. remove$$1(event.name, oldOn[name], event.capture);
  3641. }
  3642. }
  3643. }
  3644. /* */
  3645. /* */
  3646. // fixed by xxxxxx (mp properties)
  3647. function extractPropertiesFromVNodeData(data, Ctor, res, context) {
  3648. var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
  3649. if (isUndef(propOptions)) {
  3650. return res
  3651. }
  3652. var externalClasses = Ctor.options.mpOptions.externalClasses || [];
  3653. var attrs = data.attrs;
  3654. var props = data.props;
  3655. if (isDef(attrs) || isDef(props)) {
  3656. for (var key in propOptions) {
  3657. var altKey = hyphenate(key);
  3658. var result = checkProp(res, props, key, altKey, true) ||
  3659. checkProp(res, attrs, key, altKey, false);
  3660. // externalClass
  3661. if (
  3662. result &&
  3663. res[key] &&
  3664. externalClasses.indexOf(altKey) !== -1 &&
  3665. context[camelize(res[key])]
  3666. ) {
  3667. // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
  3668. res[key] = context[camelize(res[key])];
  3669. }
  3670. }
  3671. }
  3672. return res
  3673. }
  3674. function extractPropsFromVNodeData (
  3675. data,
  3676. Ctor,
  3677. tag,
  3678. context// fixed by xxxxxx
  3679. ) {
  3680. // we are only extracting raw values here.
  3681. // validation and default values are handled in the child
  3682. // component itself.
  3683. var propOptions = Ctor.options.props;
  3684. if (isUndef(propOptions)) {
  3685. // fixed by xxxxxx
  3686. return extractPropertiesFromVNodeData(data, Ctor, {}, context)
  3687. }
  3688. var res = {};
  3689. var attrs = data.attrs;
  3690. var props = data.props;
  3691. if (isDef(attrs) || isDef(props)) {
  3692. for (var key in propOptions) {
  3693. var altKey = hyphenate(key);
  3694. if (true) {
  3695. var keyInLowerCase = key.toLowerCase();
  3696. if (
  3697. key !== keyInLowerCase &&
  3698. attrs && hasOwn(attrs, keyInLowerCase)
  3699. ) {
  3700. tip(
  3701. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  3702. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  3703. " \"" + key + "\". " +
  3704. "Note that HTML attributes are case-insensitive and camelCased " +
  3705. "props need to use their kebab-case equivalents when using in-DOM " +
  3706. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  3707. );
  3708. }
  3709. }
  3710. checkProp(res, props, key, altKey, true) ||
  3711. checkProp(res, attrs, key, altKey, false);
  3712. }
  3713. }
  3714. // fixed by xxxxxx
  3715. return extractPropertiesFromVNodeData(data, Ctor, res, context)
  3716. }
  3717. function checkProp (
  3718. res,
  3719. hash,
  3720. key,
  3721. altKey,
  3722. preserve
  3723. ) {
  3724. if (isDef(hash)) {
  3725. if (hasOwn(hash, key)) {
  3726. res[key] = hash[key];
  3727. if (!preserve) {
  3728. delete hash[key];
  3729. }
  3730. return true
  3731. } else if (hasOwn(hash, altKey)) {
  3732. res[key] = hash[altKey];
  3733. if (!preserve) {
  3734. delete hash[altKey];
  3735. }
  3736. return true
  3737. }
  3738. }
  3739. return false
  3740. }
  3741. /* */
  3742. // The template compiler attempts to minimize the need for normalization by
  3743. // statically analyzing the template at compile time.
  3744. //
  3745. // For plain HTML markup, normalization can be completely skipped because the
  3746. // generated render function is guaranteed to return Array<VNode>. There are
  3747. // two cases where extra normalization is needed:
  3748. // 1. When the children contains components - because a functional component
  3749. // may return an Array instead of a single root. In this case, just a simple
  3750. // normalization is needed - if any child is an Array, we flatten the whole
  3751. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  3752. // because functional components already normalize their own children.
  3753. function simpleNormalizeChildren (children) {
  3754. for (var i = 0; i < children.length; i++) {
  3755. if (Array.isArray(children[i])) {
  3756. return Array.prototype.concat.apply([], children)
  3757. }
  3758. }
  3759. return children
  3760. }
  3761. // 2. When the children contains constructs that always generated nested Arrays,
  3762. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  3763. // with hand-written render functions / JSX. In such cases a full normalization
  3764. // is needed to cater to all possible types of children values.
  3765. function normalizeChildren (children) {
  3766. return isPrimitive(children)
  3767. ? [createTextVNode(children)]
  3768. : Array.isArray(children)
  3769. ? normalizeArrayChildren(children)
  3770. : undefined
  3771. }
  3772. function isTextNode (node) {
  3773. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  3774. }
  3775. function normalizeArrayChildren (children, nestedIndex) {
  3776. var res = [];
  3777. var i, c, lastIndex, last;
  3778. for (i = 0; i < children.length; i++) {
  3779. c = children[i];
  3780. if (isUndef(c) || typeof c === 'boolean') { continue }
  3781. lastIndex = res.length - 1;
  3782. last = res[lastIndex];
  3783. // nested
  3784. if (Array.isArray(c)) {
  3785. if (c.length > 0) {
  3786. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  3787. // merge adjacent text nodes
  3788. if (isTextNode(c[0]) && isTextNode(last)) {
  3789. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  3790. c.shift();
  3791. }
  3792. res.push.apply(res, c);
  3793. }
  3794. } else if (isPrimitive(c)) {
  3795. if (isTextNode(last)) {
  3796. // merge adjacent text nodes
  3797. // this is necessary for SSR hydration because text nodes are
  3798. // essentially merged when rendered to HTML strings
  3799. res[lastIndex] = createTextVNode(last.text + c);
  3800. } else if (c !== '') {
  3801. // convert primitive to vnode
  3802. res.push(createTextVNode(c));
  3803. }
  3804. } else {
  3805. if (isTextNode(c) && isTextNode(last)) {
  3806. // merge adjacent text nodes
  3807. res[lastIndex] = createTextVNode(last.text + c.text);
  3808. } else {
  3809. // default key for nested array children (likely generated by v-for)
  3810. if (isTrue(children._isVList) &&
  3811. isDef(c.tag) &&
  3812. isUndef(c.key) &&
  3813. isDef(nestedIndex)) {
  3814. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  3815. }
  3816. res.push(c);
  3817. }
  3818. }
  3819. }
  3820. return res
  3821. }
  3822. /* */
  3823. function initProvide (vm) {
  3824. var provide = vm.$options.provide;
  3825. if (provide) {
  3826. vm._provided = typeof provide === 'function'
  3827. ? provide.call(vm)
  3828. : provide;
  3829. }
  3830. }
  3831. function initInjections (vm) {
  3832. var result = resolveInject(vm.$options.inject, vm);
  3833. if (result) {
  3834. toggleObserving(false);
  3835. Object.keys(result).forEach(function (key) {
  3836. /* istanbul ignore else */
  3837. if (true) {
  3838. defineReactive$$1(vm, key, result[key], function () {
  3839. warn(
  3840. "Avoid mutating an injected value directly since the changes will be " +
  3841. "overwritten whenever the provided component re-renders. " +
  3842. "injection being mutated: \"" + key + "\"",
  3843. vm
  3844. );
  3845. });
  3846. } else {}
  3847. });
  3848. toggleObserving(true);
  3849. }
  3850. }
  3851. function resolveInject (inject, vm) {
  3852. if (inject) {
  3853. // inject is :any because flow is not smart enough to figure out cached
  3854. var result = Object.create(null);
  3855. var keys = hasSymbol
  3856. ? Reflect.ownKeys(inject)
  3857. : Object.keys(inject);
  3858. for (var i = 0; i < keys.length; i++) {
  3859. var key = keys[i];
  3860. // #6574 in case the inject object is observed...
  3861. if (key === '__ob__') { continue }
  3862. var provideKey = inject[key].from;
  3863. var source = vm;
  3864. while (source) {
  3865. if (source._provided && hasOwn(source._provided, provideKey)) {
  3866. result[key] = source._provided[provideKey];
  3867. break
  3868. }
  3869. source = source.$parent;
  3870. }
  3871. if (!source) {
  3872. if ('default' in inject[key]) {
  3873. var provideDefault = inject[key].default;
  3874. result[key] = typeof provideDefault === 'function'
  3875. ? provideDefault.call(vm)
  3876. : provideDefault;
  3877. } else if (true) {
  3878. warn(("Injection \"" + key + "\" not found"), vm);
  3879. }
  3880. }
  3881. }
  3882. return result
  3883. }
  3884. }
  3885. /* */
  3886. /**
  3887. * Runtime helper for resolving raw children VNodes into a slot object.
  3888. */
  3889. function resolveSlots (
  3890. children,
  3891. context
  3892. ) {
  3893. if (!children || !children.length) {
  3894. return {}
  3895. }
  3896. var slots = {};
  3897. for (var i = 0, l = children.length; i < l; i++) {
  3898. var child = children[i];
  3899. var data = child.data;
  3900. // remove slot attribute if the node is resolved as a Vue slot node
  3901. if (data && data.attrs && data.attrs.slot) {
  3902. delete data.attrs.slot;
  3903. }
  3904. // named slots should only be respected if the vnode was rendered in the
  3905. // same context.
  3906. if ((child.context === context || child.fnContext === context) &&
  3907. data && data.slot != null
  3908. ) {
  3909. var name = data.slot;
  3910. var slot = (slots[name] || (slots[name] = []));
  3911. if (child.tag === 'template') {
  3912. slot.push.apply(slot, child.children || []);
  3913. } else {
  3914. slot.push(child);
  3915. }
  3916. } else {
  3917. // fixed by xxxxxx 临时 hack 掉 uni-app 中的异步 name slot page
  3918. if(child.asyncMeta && child.asyncMeta.data && child.asyncMeta.data.slot === 'page'){
  3919. (slots['page'] || (slots['page'] = [])).push(child);
  3920. }else{
  3921. (slots.default || (slots.default = [])).push(child);
  3922. }
  3923. }
  3924. }
  3925. // ignore slots that contains only whitespace
  3926. for (var name$1 in slots) {
  3927. if (slots[name$1].every(isWhitespace)) {
  3928. delete slots[name$1];
  3929. }
  3930. }
  3931. return slots
  3932. }
  3933. function isWhitespace (node) {
  3934. return (node.isComment && !node.asyncFactory) || node.text === ' '
  3935. }
  3936. /* */
  3937. function normalizeScopedSlots (
  3938. slots,
  3939. normalSlots,
  3940. prevSlots
  3941. ) {
  3942. var res;
  3943. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  3944. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  3945. var key = slots && slots.$key;
  3946. if (!slots) {
  3947. res = {};
  3948. } else if (slots._normalized) {
  3949. // fast path 1: child component re-render only, parent did not change
  3950. return slots._normalized
  3951. } else if (
  3952. isStable &&
  3953. prevSlots &&
  3954. prevSlots !== emptyObject &&
  3955. key === prevSlots.$key &&
  3956. !hasNormalSlots &&
  3957. !prevSlots.$hasNormal
  3958. ) {
  3959. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  3960. // only need to normalize once
  3961. return prevSlots
  3962. } else {
  3963. res = {};
  3964. for (var key$1 in slots) {
  3965. if (slots[key$1] && key$1[0] !== '$') {
  3966. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  3967. }
  3968. }
  3969. }
  3970. // expose normal slots on scopedSlots
  3971. for (var key$2 in normalSlots) {
  3972. if (!(key$2 in res)) {
  3973. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  3974. }
  3975. }
  3976. // avoriaz seems to mock a non-extensible $scopedSlots object
  3977. // and when that is passed down this would cause an error
  3978. if (slots && Object.isExtensible(slots)) {
  3979. (slots)._normalized = res;
  3980. }
  3981. def(res, '$stable', isStable);
  3982. def(res, '$key', key);
  3983. def(res, '$hasNormal', hasNormalSlots);
  3984. return res
  3985. }
  3986. function normalizeScopedSlot(normalSlots, key, fn) {
  3987. var normalized = function () {
  3988. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  3989. res = res && typeof res === 'object' && !Array.isArray(res)
  3990. ? [res] // single vnode
  3991. : normalizeChildren(res);
  3992. return res && (
  3993. res.length === 0 ||
  3994. (res.length === 1 && res[0].isComment) // #9658
  3995. ) ? undefined
  3996. : res
  3997. };
  3998. // this is a slot using the new v-slot syntax without scope. although it is
  3999. // compiled as a scoped slot, render fn users would expect it to be present
  4000. // on this.$slots because the usage is semantically a normal slot.
  4001. if (fn.proxy) {
  4002. Object.defineProperty(normalSlots, key, {
  4003. get: normalized,
  4004. enumerable: true,
  4005. configurable: true
  4006. });
  4007. }
  4008. return normalized
  4009. }
  4010. function proxyNormalSlot(slots, key) {
  4011. return function () { return slots[key]; }
  4012. }
  4013. /* */
  4014. /**
  4015. * Runtime helper for rendering v-for lists.
  4016. */
  4017. function renderList (
  4018. val,
  4019. render
  4020. ) {
  4021. var ret, i, l, keys, key;
  4022. if (Array.isArray(val) || typeof val === 'string') {
  4023. ret = new Array(val.length);
  4024. for (i = 0, l = val.length; i < l; i++) {
  4025. ret[i] = render(val[i], i, i, i); // fixed by xxxxxx
  4026. }
  4027. } else if (typeof val === 'number') {
  4028. ret = new Array(val);
  4029. for (i = 0; i < val; i++) {
  4030. ret[i] = render(i + 1, i, i, i); // fixed by xxxxxx
  4031. }
  4032. } else if (isObject(val)) {
  4033. if (hasSymbol && val[Symbol.iterator]) {
  4034. ret = [];
  4035. var iterator = val[Symbol.iterator]();
  4036. var result = iterator.next();
  4037. while (!result.done) {
  4038. ret.push(render(result.value, ret.length, i++, i)); // fixed by xxxxxx
  4039. result = iterator.next();
  4040. }
  4041. } else {
  4042. keys = Object.keys(val);
  4043. ret = new Array(keys.length);
  4044. for (i = 0, l = keys.length; i < l; i++) {
  4045. key = keys[i];
  4046. ret[i] = render(val[key], key, i, i); // fixed by xxxxxx
  4047. }
  4048. }
  4049. }
  4050. if (!isDef(ret)) {
  4051. ret = [];
  4052. }
  4053. (ret)._isVList = true;
  4054. return ret
  4055. }
  4056. /* */
  4057. /**
  4058. * Runtime helper for rendering <slot>
  4059. */
  4060. function renderSlot (
  4061. name,
  4062. fallback,
  4063. props,
  4064. bindObject
  4065. ) {
  4066. var scopedSlotFn = this.$scopedSlots[name];
  4067. var nodes;
  4068. if (scopedSlotFn) { // scoped slot
  4069. props = props || {};
  4070. if (bindObject) {
  4071. if ( true && !isObject(bindObject)) {
  4072. warn(
  4073. 'slot v-bind without argument expects an Object',
  4074. this
  4075. );
  4076. }
  4077. props = extend(extend({}, bindObject), props);
  4078. }
  4079. // fixed by xxxxxx app-plus scopedSlot
  4080. nodes = scopedSlotFn(props, this, props._i) || fallback;
  4081. } else {
  4082. nodes = this.$slots[name] || fallback;
  4083. }
  4084. var target = props && props.slot;
  4085. if (target) {
  4086. return this.$createElement('template', { slot: target }, nodes)
  4087. } else {
  4088. return nodes
  4089. }
  4090. }
  4091. /* */
  4092. /**
  4093. * Runtime helper for resolving filters
  4094. */
  4095. function resolveFilter (id) {
  4096. return resolveAsset(this.$options, 'filters', id, true) || identity
  4097. }
  4098. /* */
  4099. function isKeyNotMatch (expect, actual) {
  4100. if (Array.isArray(expect)) {
  4101. return expect.indexOf(actual) === -1
  4102. } else {
  4103. return expect !== actual
  4104. }
  4105. }
  4106. /**
  4107. * Runtime helper for checking keyCodes from config.
  4108. * exposed as Vue.prototype._k
  4109. * passing in eventKeyName as last argument separately for backwards compat
  4110. */
  4111. function checkKeyCodes (
  4112. eventKeyCode,
  4113. key,
  4114. builtInKeyCode,
  4115. eventKeyName,
  4116. builtInKeyName
  4117. ) {
  4118. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  4119. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  4120. return isKeyNotMatch(builtInKeyName, eventKeyName)
  4121. } else if (mappedKeyCode) {
  4122. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  4123. } else if (eventKeyName) {
  4124. return hyphenate(eventKeyName) !== key
  4125. }
  4126. }
  4127. /* */
  4128. /**
  4129. * Runtime helper for merging v-bind="object" into a VNode's data.
  4130. */
  4131. function bindObjectProps (
  4132. data,
  4133. tag,
  4134. value,
  4135. asProp,
  4136. isSync
  4137. ) {
  4138. if (value) {
  4139. if (!isObject(value)) {
  4140. true && warn(
  4141. 'v-bind without argument expects an Object or Array value',
  4142. this
  4143. );
  4144. } else {
  4145. if (Array.isArray(value)) {
  4146. value = toObject(value);
  4147. }
  4148. var hash;
  4149. var loop = function ( key ) {
  4150. if (
  4151. key === 'class' ||
  4152. key === 'style' ||
  4153. isReservedAttribute(key)
  4154. ) {
  4155. hash = data;
  4156. } else {
  4157. var type = data.attrs && data.attrs.type;
  4158. hash = asProp || config.mustUseProp(tag, type, key)
  4159. ? data.domProps || (data.domProps = {})
  4160. : data.attrs || (data.attrs = {});
  4161. }
  4162. var camelizedKey = camelize(key);
  4163. var hyphenatedKey = hyphenate(key);
  4164. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  4165. hash[key] = value[key];
  4166. if (isSync) {
  4167. var on = data.on || (data.on = {});
  4168. on[("update:" + key)] = function ($event) {
  4169. value[key] = $event;
  4170. };
  4171. }
  4172. }
  4173. };
  4174. for (var key in value) loop( key );
  4175. }
  4176. }
  4177. return data
  4178. }
  4179. /* */
  4180. /**
  4181. * Runtime helper for rendering static trees.
  4182. */
  4183. function renderStatic (
  4184. index,
  4185. isInFor
  4186. ) {
  4187. var cached = this._staticTrees || (this._staticTrees = []);
  4188. var tree = cached[index];
  4189. // if has already-rendered static tree and not inside v-for,
  4190. // we can reuse the same tree.
  4191. if (tree && !isInFor) {
  4192. return tree
  4193. }
  4194. // otherwise, render a fresh tree.
  4195. tree = cached[index] = this.$options.staticRenderFns[index].call(
  4196. this._renderProxy,
  4197. null,
  4198. this // for render fns generated for functional component templates
  4199. );
  4200. markStatic(tree, ("__static__" + index), false);
  4201. return tree
  4202. }
  4203. /**
  4204. * Runtime helper for v-once.
  4205. * Effectively it means marking the node as static with a unique key.
  4206. */
  4207. function markOnce (
  4208. tree,
  4209. index,
  4210. key
  4211. ) {
  4212. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  4213. return tree
  4214. }
  4215. function markStatic (
  4216. tree,
  4217. key,
  4218. isOnce
  4219. ) {
  4220. if (Array.isArray(tree)) {
  4221. for (var i = 0; i < tree.length; i++) {
  4222. if (tree[i] && typeof tree[i] !== 'string') {
  4223. markStaticNode(tree[i], (key + "_" + i), isOnce);
  4224. }
  4225. }
  4226. } else {
  4227. markStaticNode(tree, key, isOnce);
  4228. }
  4229. }
  4230. function markStaticNode (node, key, isOnce) {
  4231. node.isStatic = true;
  4232. node.key = key;
  4233. node.isOnce = isOnce;
  4234. }
  4235. /* */
  4236. function bindObjectListeners (data, value) {
  4237. if (value) {
  4238. if (!isPlainObject(value)) {
  4239. true && warn(
  4240. 'v-on without argument expects an Object value',
  4241. this
  4242. );
  4243. } else {
  4244. var on = data.on = data.on ? extend({}, data.on) : {};
  4245. for (var key in value) {
  4246. var existing = on[key];
  4247. var ours = value[key];
  4248. on[key] = existing ? [].concat(existing, ours) : ours;
  4249. }
  4250. }
  4251. }
  4252. return data
  4253. }
  4254. /* */
  4255. function resolveScopedSlots (
  4256. fns, // see flow/vnode
  4257. res,
  4258. // the following are added in 2.6
  4259. hasDynamicKeys,
  4260. contentHashKey
  4261. ) {
  4262. res = res || { $stable: !hasDynamicKeys };
  4263. for (var i = 0; i < fns.length; i++) {
  4264. var slot = fns[i];
  4265. if (Array.isArray(slot)) {
  4266. resolveScopedSlots(slot, res, hasDynamicKeys);
  4267. } else if (slot) {
  4268. // marker for reverse proxying v-slot without scope on this.$slots
  4269. if (slot.proxy) {
  4270. slot.fn.proxy = true;
  4271. }
  4272. res[slot.key] = slot.fn;
  4273. }
  4274. }
  4275. if (contentHashKey) {
  4276. (res).$key = contentHashKey;
  4277. }
  4278. return res
  4279. }
  4280. /* */
  4281. function bindDynamicKeys (baseObj, values) {
  4282. for (var i = 0; i < values.length; i += 2) {
  4283. var key = values[i];
  4284. if (typeof key === 'string' && key) {
  4285. baseObj[values[i]] = values[i + 1];
  4286. } else if ( true && key !== '' && key !== null) {
  4287. // null is a special value for explicitly removing a binding
  4288. warn(
  4289. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  4290. this
  4291. );
  4292. }
  4293. }
  4294. return baseObj
  4295. }
  4296. // helper to dynamically append modifier runtime markers to event names.
  4297. // ensure only append when value is already string, otherwise it will be cast
  4298. // to string and cause the type check to miss.
  4299. function prependModifier (value, symbol) {
  4300. return typeof value === 'string' ? symbol + value : value
  4301. }
  4302. /* */
  4303. function installRenderHelpers (target) {
  4304. target._o = markOnce;
  4305. target._n = toNumber;
  4306. target._s = toString;
  4307. target._l = renderList;
  4308. target._t = renderSlot;
  4309. target._q = looseEqual;
  4310. target._i = looseIndexOf;
  4311. target._m = renderStatic;
  4312. target._f = resolveFilter;
  4313. target._k = checkKeyCodes;
  4314. target._b = bindObjectProps;
  4315. target._v = createTextVNode;
  4316. target._e = createEmptyVNode;
  4317. target._u = resolveScopedSlots;
  4318. target._g = bindObjectListeners;
  4319. target._d = bindDynamicKeys;
  4320. target._p = prependModifier;
  4321. }
  4322. /* */
  4323. function FunctionalRenderContext (
  4324. data,
  4325. props,
  4326. children,
  4327. parent,
  4328. Ctor
  4329. ) {
  4330. var this$1 = this;
  4331. var options = Ctor.options;
  4332. // ensure the createElement function in functional components
  4333. // gets a unique context - this is necessary for correct named slot check
  4334. var contextVm;
  4335. if (hasOwn(parent, '_uid')) {
  4336. contextVm = Object.create(parent);
  4337. // $flow-disable-line
  4338. contextVm._original = parent;
  4339. } else {
  4340. // the context vm passed in is a functional context as well.
  4341. // in this case we want to make sure we are able to get a hold to the
  4342. // real context instance.
  4343. contextVm = parent;
  4344. // $flow-disable-line
  4345. parent = parent._original;
  4346. }
  4347. var isCompiled = isTrue(options._compiled);
  4348. var needNormalization = !isCompiled;
  4349. this.data = data;
  4350. this.props = props;
  4351. this.children = children;
  4352. this.parent = parent;
  4353. this.listeners = data.on || emptyObject;
  4354. this.injections = resolveInject(options.inject, parent);
  4355. this.slots = function () {
  4356. if (!this$1.$slots) {
  4357. normalizeScopedSlots(
  4358. data.scopedSlots,
  4359. this$1.$slots = resolveSlots(children, parent)
  4360. );
  4361. }
  4362. return this$1.$slots
  4363. };
  4364. Object.defineProperty(this, 'scopedSlots', ({
  4365. enumerable: true,
  4366. get: function get () {
  4367. return normalizeScopedSlots(data.scopedSlots, this.slots())
  4368. }
  4369. }));
  4370. // support for compiled functional template
  4371. if (isCompiled) {
  4372. // exposing $options for renderStatic()
  4373. this.$options = options;
  4374. // pre-resolve slots for renderSlot()
  4375. this.$slots = this.slots();
  4376. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  4377. }
  4378. if (options._scopeId) {
  4379. this._c = function (a, b, c, d) {
  4380. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  4381. if (vnode && !Array.isArray(vnode)) {
  4382. vnode.fnScopeId = options._scopeId;
  4383. vnode.fnContext = parent;
  4384. }
  4385. return vnode
  4386. };
  4387. } else {
  4388. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  4389. }
  4390. }
  4391. installRenderHelpers(FunctionalRenderContext.prototype);
  4392. function createFunctionalComponent (
  4393. Ctor,
  4394. propsData,
  4395. data,
  4396. contextVm,
  4397. children
  4398. ) {
  4399. var options = Ctor.options;
  4400. var props = {};
  4401. var propOptions = options.props;
  4402. if (isDef(propOptions)) {
  4403. for (var key in propOptions) {
  4404. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  4405. }
  4406. } else {
  4407. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  4408. if (isDef(data.props)) { mergeProps(props, data.props); }
  4409. }
  4410. var renderContext = new FunctionalRenderContext(
  4411. data,
  4412. props,
  4413. children,
  4414. contextVm,
  4415. Ctor
  4416. );
  4417. var vnode = options.render.call(null, renderContext._c, renderContext);
  4418. if (vnode instanceof VNode) {
  4419. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  4420. } else if (Array.isArray(vnode)) {
  4421. var vnodes = normalizeChildren(vnode) || [];
  4422. var res = new Array(vnodes.length);
  4423. for (var i = 0; i < vnodes.length; i++) {
  4424. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  4425. }
  4426. return res
  4427. }
  4428. }
  4429. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  4430. // #7817 clone node before setting fnContext, otherwise if the node is reused
  4431. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  4432. // that should not be matched to match.
  4433. var clone = cloneVNode(vnode);
  4434. clone.fnContext = contextVm;
  4435. clone.fnOptions = options;
  4436. if (true) {
  4437. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  4438. }
  4439. if (data.slot) {
  4440. (clone.data || (clone.data = {})).slot = data.slot;
  4441. }
  4442. return clone
  4443. }
  4444. function mergeProps (to, from) {
  4445. for (var key in from) {
  4446. to[camelize(key)] = from[key];
  4447. }
  4448. }
  4449. /* */
  4450. /* */
  4451. /* */
  4452. /* */
  4453. // inline hooks to be invoked on component VNodes during patch
  4454. var componentVNodeHooks = {
  4455. init: function init (vnode, hydrating) {
  4456. if (
  4457. vnode.componentInstance &&
  4458. !vnode.componentInstance._isDestroyed &&
  4459. vnode.data.keepAlive
  4460. ) {
  4461. // kept-alive components, treat as a patch
  4462. var mountedNode = vnode; // work around flow
  4463. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  4464. } else {
  4465. var child = vnode.componentInstance = createComponentInstanceForVnode(
  4466. vnode,
  4467. activeInstance
  4468. );
  4469. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  4470. }
  4471. },
  4472. prepatch: function prepatch (oldVnode, vnode) {
  4473. var options = vnode.componentOptions;
  4474. var child = vnode.componentInstance = oldVnode.componentInstance;
  4475. updateChildComponent(
  4476. child,
  4477. options.propsData, // updated props
  4478. options.listeners, // updated listeners
  4479. vnode, // new parent vnode
  4480. options.children // new children
  4481. );
  4482. },
  4483. insert: function insert (vnode) {
  4484. var context = vnode.context;
  4485. var componentInstance = vnode.componentInstance;
  4486. if (!componentInstance._isMounted) {
  4487. callHook(componentInstance, 'onServiceCreated');
  4488. callHook(componentInstance, 'onServiceAttached');
  4489. componentInstance._isMounted = true;
  4490. callHook(componentInstance, 'mounted');
  4491. }
  4492. if (vnode.data.keepAlive) {
  4493. if (context._isMounted) {
  4494. // vue-router#1212
  4495. // During updates, a kept-alive component's child components may
  4496. // change, so directly walking the tree here may call activated hooks
  4497. // on incorrect children. Instead we push them into a queue which will
  4498. // be processed after the whole patch process ended.
  4499. queueActivatedComponent(componentInstance);
  4500. } else {
  4501. activateChildComponent(componentInstance, true /* direct */);
  4502. }
  4503. }
  4504. },
  4505. destroy: function destroy (vnode) {
  4506. var componentInstance = vnode.componentInstance;
  4507. if (!componentInstance._isDestroyed) {
  4508. if (!vnode.data.keepAlive) {
  4509. componentInstance.$destroy();
  4510. } else {
  4511. deactivateChildComponent(componentInstance, true /* direct */);
  4512. }
  4513. }
  4514. }
  4515. };
  4516. var hooksToMerge = Object.keys(componentVNodeHooks);
  4517. function createComponent (
  4518. Ctor,
  4519. data,
  4520. context,
  4521. children,
  4522. tag
  4523. ) {
  4524. if (isUndef(Ctor)) {
  4525. return
  4526. }
  4527. var baseCtor = context.$options._base;
  4528. // plain options object: turn it into a constructor
  4529. if (isObject(Ctor)) {
  4530. Ctor = baseCtor.extend(Ctor);
  4531. }
  4532. // if at this stage it's not a constructor or an async component factory,
  4533. // reject.
  4534. if (typeof Ctor !== 'function') {
  4535. if (true) {
  4536. warn(("Invalid Component definition: " + (String(Ctor))), context);
  4537. }
  4538. return
  4539. }
  4540. // async component
  4541. var asyncFactory;
  4542. if (isUndef(Ctor.cid)) {
  4543. asyncFactory = Ctor;
  4544. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  4545. if (Ctor === undefined) {
  4546. // return a placeholder node for async component, which is rendered
  4547. // as a comment node but preserves all the raw information for the node.
  4548. // the information will be used for async server-rendering and hydration.
  4549. return createAsyncPlaceholder(
  4550. asyncFactory,
  4551. data,
  4552. context,
  4553. children,
  4554. tag
  4555. )
  4556. }
  4557. }
  4558. data = data || {};
  4559. // resolve constructor options in case global mixins are applied after
  4560. // component constructor creation
  4561. resolveConstructorOptions(Ctor);
  4562. // transform component v-model data into props & events
  4563. if (isDef(data.model)) {
  4564. transformModel(Ctor.options, data);
  4565. }
  4566. // extract props
  4567. var propsData = extractPropsFromVNodeData(data, Ctor, tag, context); // fixed by xxxxxx
  4568. // functional component
  4569. if (isTrue(Ctor.options.functional)) {
  4570. return createFunctionalComponent(Ctor, propsData, data, context, children)
  4571. }
  4572. // extract listeners, since these needs to be treated as
  4573. // child component listeners instead of DOM listeners
  4574. var listeners = data.on;
  4575. // replace with listeners with .native modifier
  4576. // so it gets processed during parent component patch.
  4577. data.on = data.nativeOn;
  4578. if (isTrue(Ctor.options.abstract)) {
  4579. // abstract components do not keep anything
  4580. // other than props & listeners & slot
  4581. // work around flow
  4582. var slot = data.slot;
  4583. data = {};
  4584. if (slot) {
  4585. data.slot = slot;
  4586. }
  4587. }
  4588. // install component management hooks onto the placeholder node
  4589. installComponentHooks(data);
  4590. // return a placeholder vnode
  4591. var name = Ctor.options.name || tag;
  4592. var vnode = new VNode(
  4593. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  4594. data, undefined, undefined, undefined, context,
  4595. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  4596. asyncFactory
  4597. );
  4598. return vnode
  4599. }
  4600. function createComponentInstanceForVnode (
  4601. vnode, // we know it's MountedComponentVNode but flow doesn't
  4602. parent // activeInstance in lifecycle state
  4603. ) {
  4604. var options = {
  4605. _isComponent: true,
  4606. _parentVnode: vnode,
  4607. parent: parent
  4608. };
  4609. // check inline-template render functions
  4610. var inlineTemplate = vnode.data.inlineTemplate;
  4611. if (isDef(inlineTemplate)) {
  4612. options.render = inlineTemplate.render;
  4613. options.staticRenderFns = inlineTemplate.staticRenderFns;
  4614. }
  4615. return new vnode.componentOptions.Ctor(options)
  4616. }
  4617. function installComponentHooks (data) {
  4618. var hooks = data.hook || (data.hook = {});
  4619. for (var i = 0; i < hooksToMerge.length; i++) {
  4620. var key = hooksToMerge[i];
  4621. var existing = hooks[key];
  4622. var toMerge = componentVNodeHooks[key];
  4623. if (existing !== toMerge && !(existing && existing._merged)) {
  4624. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  4625. }
  4626. }
  4627. }
  4628. function mergeHook$1 (f1, f2) {
  4629. var merged = function (a, b) {
  4630. // flow complains about extra args which is why we use any
  4631. f1(a, b);
  4632. f2(a, b);
  4633. };
  4634. merged._merged = true;
  4635. return merged
  4636. }
  4637. // transform component v-model info (value and callback) into
  4638. // prop and event handler respectively.
  4639. function transformModel (options, data) {
  4640. var prop = (options.model && options.model.prop) || 'value';
  4641. var event = (options.model && options.model.event) || 'input'
  4642. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  4643. var on = data.on || (data.on = {});
  4644. var existing = on[event];
  4645. var callback = data.model.callback;
  4646. if (isDef(existing)) {
  4647. if (
  4648. Array.isArray(existing)
  4649. ? existing.indexOf(callback) === -1
  4650. : existing !== callback
  4651. ) {
  4652. on[event] = [callback].concat(existing);
  4653. }
  4654. } else {
  4655. on[event] = callback;
  4656. }
  4657. }
  4658. /* */
  4659. var SIMPLE_NORMALIZE = 1;
  4660. var ALWAYS_NORMALIZE = 2;
  4661. // wrapper function for providing a more flexible interface
  4662. // without getting yelled at by flow
  4663. function createElement (
  4664. context,
  4665. tag,
  4666. data,
  4667. children,
  4668. normalizationType,
  4669. alwaysNormalize
  4670. ) {
  4671. if (Array.isArray(data) || isPrimitive(data)) {
  4672. normalizationType = children;
  4673. children = data;
  4674. data = undefined;
  4675. }
  4676. if (isTrue(alwaysNormalize)) {
  4677. normalizationType = ALWAYS_NORMALIZE;
  4678. }
  4679. return _createElement(context, tag, data, children, normalizationType)
  4680. }
  4681. function _createElement (
  4682. context,
  4683. tag,
  4684. data,
  4685. children,
  4686. normalizationType
  4687. ) {
  4688. if (isDef(data) && isDef((data).__ob__)) {
  4689. true && warn(
  4690. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  4691. 'Always create fresh vnode data objects in each render!',
  4692. context
  4693. );
  4694. return createEmptyVNode()
  4695. }
  4696. // object syntax in v-bind
  4697. if (isDef(data) && isDef(data.is)) {
  4698. tag = data.is;
  4699. }
  4700. if (!tag) {
  4701. // in case of component :is set to falsy value
  4702. return createEmptyVNode()
  4703. }
  4704. // warn against non-primitive key
  4705. if ( true &&
  4706. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  4707. ) {
  4708. {
  4709. warn(
  4710. 'Avoid using non-primitive value as key, ' +
  4711. 'use string/number value instead.',
  4712. context
  4713. );
  4714. }
  4715. }
  4716. // support single function children as default scoped slot
  4717. if (Array.isArray(children) &&
  4718. typeof children[0] === 'function'
  4719. ) {
  4720. data = data || {};
  4721. data.scopedSlots = { default: children[0] };
  4722. children.length = 0;
  4723. }
  4724. if (normalizationType === ALWAYS_NORMALIZE) {
  4725. children = normalizeChildren(children);
  4726. } else if (normalizationType === SIMPLE_NORMALIZE) {
  4727. children = simpleNormalizeChildren(children);
  4728. }
  4729. var vnode, ns;
  4730. if (typeof tag === 'string') {
  4731. var Ctor;
  4732. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  4733. if (config.isReservedTag(tag)) {
  4734. // platform built-in elements
  4735. if ( true && isDef(data) && isDef(data.nativeOn)) {
  4736. warn(
  4737. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  4738. context
  4739. );
  4740. }
  4741. vnode = new VNode(
  4742. config.parsePlatformTagName(tag), data, children,
  4743. undefined, undefined, context
  4744. );
  4745. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4746. // component
  4747. vnode = createComponent(Ctor, data, context, children, tag);
  4748. } else {
  4749. // unknown or unlisted namespaced elements
  4750. // check at runtime because it may get assigned a namespace when its
  4751. // parent normalizes children
  4752. vnode = new VNode(
  4753. tag, data, children,
  4754. undefined, undefined, context
  4755. );
  4756. }
  4757. } else {
  4758. // direct component options / constructor
  4759. vnode = createComponent(tag, data, context, children);
  4760. }
  4761. if (Array.isArray(vnode)) {
  4762. return vnode
  4763. } else if (isDef(vnode)) {
  4764. if (isDef(ns)) { applyNS(vnode, ns); }
  4765. if (isDef(data)) { registerDeepBindings(data); }
  4766. return vnode
  4767. } else {
  4768. return createEmptyVNode()
  4769. }
  4770. }
  4771. function applyNS (vnode, ns, force) {
  4772. vnode.ns = ns;
  4773. if (vnode.tag === 'foreignObject') {
  4774. // use default namespace inside foreignObject
  4775. ns = undefined;
  4776. force = true;
  4777. }
  4778. if (isDef(vnode.children)) {
  4779. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4780. var child = vnode.children[i];
  4781. if (isDef(child.tag) && (
  4782. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4783. applyNS(child, ns, force);
  4784. }
  4785. }
  4786. }
  4787. }
  4788. // ref #5318
  4789. // necessary to ensure parent re-render when deep bindings like :style and
  4790. // :class are used on slot nodes
  4791. function registerDeepBindings (data) {
  4792. if (isObject(data.style)) {
  4793. traverse(data.style);
  4794. }
  4795. if (isObject(data.class)) {
  4796. traverse(data.class);
  4797. }
  4798. }
  4799. /* */
  4800. function initRender (vm) {
  4801. vm._vnode = null; // the root of the child tree
  4802. vm._staticTrees = null; // v-once cached trees
  4803. var options = vm.$options;
  4804. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4805. var renderContext = parentVnode && parentVnode.context;
  4806. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4807. vm.$scopedSlots = emptyObject;
  4808. // bind the createElement fn to this instance
  4809. // so that we get proper render context inside it.
  4810. // args order: tag, data, children, normalizationType, alwaysNormalize
  4811. // internal version is used by render functions compiled from templates
  4812. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4813. // normalization is always applied for the public version, used in
  4814. // user-written render functions.
  4815. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4816. // $attrs & $listeners are exposed for easier HOC creation.
  4817. // they need to be reactive so that HOCs using them are always updated
  4818. var parentData = parentVnode && parentVnode.data;
  4819. /* istanbul ignore else */
  4820. if (true) {
  4821. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4822. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4823. }, true);
  4824. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4825. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4826. }, true);
  4827. } else {}
  4828. }
  4829. var currentRenderingInstance = null;
  4830. function renderMixin (Vue) {
  4831. // install runtime convenience helpers
  4832. installRenderHelpers(Vue.prototype);
  4833. Vue.prototype.$nextTick = function (fn) {
  4834. return nextTick(fn, this)
  4835. };
  4836. Vue.prototype._render = function () {
  4837. var vm = this;
  4838. var ref = vm.$options;
  4839. var render = ref.render;
  4840. var _parentVnode = ref._parentVnode;
  4841. if (_parentVnode) {
  4842. vm.$scopedSlots = normalizeScopedSlots(
  4843. _parentVnode.data.scopedSlots,
  4844. vm.$slots,
  4845. vm.$scopedSlots
  4846. );
  4847. }
  4848. // set parent vnode. this allows render functions to have access
  4849. // to the data on the placeholder node.
  4850. vm.$vnode = _parentVnode;
  4851. // render self
  4852. var vnode;
  4853. try {
  4854. // There's no need to maintain a stack because all render fns are called
  4855. // separately from one another. Nested component's render fns are called
  4856. // when parent component is patched.
  4857. currentRenderingInstance = vm;
  4858. vnode = render.call(vm._renderProxy, vm.$createElement);
  4859. } catch (e) {
  4860. handleError(e, vm, "render");
  4861. // return error render result,
  4862. // or previous vnode to prevent render error causing blank component
  4863. /* istanbul ignore else */
  4864. if ( true && vm.$options.renderError) {
  4865. try {
  4866. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4867. } catch (e) {
  4868. handleError(e, vm, "renderError");
  4869. vnode = vm._vnode;
  4870. }
  4871. } else {
  4872. vnode = vm._vnode;
  4873. }
  4874. } finally {
  4875. currentRenderingInstance = null;
  4876. }
  4877. // if the returned array contains only a single node, allow it
  4878. if (Array.isArray(vnode) && vnode.length === 1) {
  4879. vnode = vnode[0];
  4880. }
  4881. // return empty vnode in case the render function errored out
  4882. if (!(vnode instanceof VNode)) {
  4883. if ( true && Array.isArray(vnode)) {
  4884. warn(
  4885. 'Multiple root nodes returned from render function. Render function ' +
  4886. 'should return a single root node.',
  4887. vm
  4888. );
  4889. }
  4890. vnode = createEmptyVNode();
  4891. }
  4892. // set parent
  4893. vnode.parent = _parentVnode;
  4894. return vnode
  4895. };
  4896. }
  4897. /* */
  4898. function ensureCtor (comp, base) {
  4899. if (
  4900. comp.__esModule ||
  4901. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  4902. ) {
  4903. comp = comp.default;
  4904. }
  4905. return isObject(comp)
  4906. ? base.extend(comp)
  4907. : comp
  4908. }
  4909. function createAsyncPlaceholder (
  4910. factory,
  4911. data,
  4912. context,
  4913. children,
  4914. tag
  4915. ) {
  4916. var node = createEmptyVNode();
  4917. node.asyncFactory = factory;
  4918. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  4919. return node
  4920. }
  4921. function resolveAsyncComponent (
  4922. factory,
  4923. baseCtor
  4924. ) {
  4925. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  4926. return factory.errorComp
  4927. }
  4928. if (isDef(factory.resolved)) {
  4929. return factory.resolved
  4930. }
  4931. var owner = currentRenderingInstance;
  4932. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  4933. // already pending
  4934. factory.owners.push(owner);
  4935. }
  4936. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  4937. return factory.loadingComp
  4938. }
  4939. if (owner && !isDef(factory.owners)) {
  4940. var owners = factory.owners = [owner];
  4941. var sync = true;
  4942. var timerLoading = null;
  4943. var timerTimeout = null
  4944. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  4945. var forceRender = function (renderCompleted) {
  4946. for (var i = 0, l = owners.length; i < l; i++) {
  4947. (owners[i]).$forceUpdate();
  4948. }
  4949. if (renderCompleted) {
  4950. owners.length = 0;
  4951. if (timerLoading !== null) {
  4952. clearTimeout(timerLoading);
  4953. timerLoading = null;
  4954. }
  4955. if (timerTimeout !== null) {
  4956. clearTimeout(timerTimeout);
  4957. timerTimeout = null;
  4958. }
  4959. }
  4960. };
  4961. var resolve = once(function (res) {
  4962. // cache resolved
  4963. factory.resolved = ensureCtor(res, baseCtor);
  4964. // invoke callbacks only if this is not a synchronous resolve
  4965. // (async resolves are shimmed as synchronous during SSR)
  4966. if (!sync) {
  4967. forceRender(true);
  4968. } else {
  4969. owners.length = 0;
  4970. }
  4971. });
  4972. var reject = once(function (reason) {
  4973. true && warn(
  4974. "Failed to resolve async component: " + (String(factory)) +
  4975. (reason ? ("\nReason: " + reason) : '')
  4976. );
  4977. if (isDef(factory.errorComp)) {
  4978. factory.error = true;
  4979. forceRender(true);
  4980. }
  4981. });
  4982. var res = factory(resolve, reject);
  4983. if (isObject(res)) {
  4984. if (isPromise(res)) {
  4985. // () => Promise
  4986. if (isUndef(factory.resolved)) {
  4987. res.then(resolve, reject);
  4988. }
  4989. } else if (isPromise(res.component)) {
  4990. res.component.then(resolve, reject);
  4991. if (isDef(res.error)) {
  4992. factory.errorComp = ensureCtor(res.error, baseCtor);
  4993. }
  4994. if (isDef(res.loading)) {
  4995. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  4996. if (res.delay === 0) {
  4997. factory.loading = true;
  4998. } else {
  4999. timerLoading = setTimeout(function () {
  5000. timerLoading = null;
  5001. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  5002. factory.loading = true;
  5003. forceRender(false);
  5004. }
  5005. }, res.delay || 200);
  5006. }
  5007. }
  5008. if (isDef(res.timeout)) {
  5009. timerTimeout = setTimeout(function () {
  5010. timerTimeout = null;
  5011. if (isUndef(factory.resolved)) {
  5012. reject(
  5013. true
  5014. ? ("timeout (" + (res.timeout) + "ms)")
  5015. : undefined
  5016. );
  5017. }
  5018. }, res.timeout);
  5019. }
  5020. }
  5021. }
  5022. sync = false;
  5023. // return in case resolved synchronously
  5024. return factory.loading
  5025. ? factory.loadingComp
  5026. : factory.resolved
  5027. }
  5028. }
  5029. /* */
  5030. function isAsyncPlaceholder (node) {
  5031. return node.isComment && node.asyncFactory
  5032. }
  5033. /* */
  5034. function getFirstComponentChild (children) {
  5035. if (Array.isArray(children)) {
  5036. for (var i = 0; i < children.length; i++) {
  5037. var c = children[i];
  5038. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  5039. return c
  5040. }
  5041. }
  5042. }
  5043. }
  5044. /* */
  5045. /* */
  5046. function initEvents (vm) {
  5047. vm._events = Object.create(null);
  5048. vm._hasHookEvent = false;
  5049. // init parent attached events
  5050. var listeners = vm.$options._parentListeners;
  5051. if (listeners) {
  5052. updateComponentListeners(vm, listeners);
  5053. }
  5054. }
  5055. var target;
  5056. function add (event, fn) {
  5057. target.$on(event, fn);
  5058. }
  5059. function remove$1 (event, fn) {
  5060. target.$off(event, fn);
  5061. }
  5062. function createOnceHandler (event, fn) {
  5063. var _target = target;
  5064. return function onceHandler () {
  5065. var res = fn.apply(null, arguments);
  5066. if (res !== null) {
  5067. _target.$off(event, onceHandler);
  5068. }
  5069. }
  5070. }
  5071. function updateComponentListeners (
  5072. vm,
  5073. listeners,
  5074. oldListeners
  5075. ) {
  5076. target = vm;
  5077. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  5078. target = undefined;
  5079. }
  5080. function eventsMixin (Vue) {
  5081. var hookRE = /^hook:/;
  5082. Vue.prototype.$on = function (event, fn) {
  5083. var vm = this;
  5084. if (Array.isArray(event)) {
  5085. for (var i = 0, l = event.length; i < l; i++) {
  5086. vm.$on(event[i], fn);
  5087. }
  5088. } else {
  5089. (vm._events[event] || (vm._events[event] = [])).push(fn);
  5090. // optimize hook:event cost by using a boolean flag marked at registration
  5091. // instead of a hash lookup
  5092. if (hookRE.test(event)) {
  5093. vm._hasHookEvent = true;
  5094. }
  5095. }
  5096. return vm
  5097. };
  5098. Vue.prototype.$once = function (event, fn) {
  5099. var vm = this;
  5100. function on () {
  5101. vm.$off(event, on);
  5102. fn.apply(vm, arguments);
  5103. }
  5104. on.fn = fn;
  5105. vm.$on(event, on);
  5106. return vm
  5107. };
  5108. Vue.prototype.$off = function (event, fn) {
  5109. var vm = this;
  5110. // all
  5111. if (!arguments.length) {
  5112. vm._events = Object.create(null);
  5113. return vm
  5114. }
  5115. // array of events
  5116. if (Array.isArray(event)) {
  5117. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  5118. vm.$off(event[i$1], fn);
  5119. }
  5120. return vm
  5121. }
  5122. // specific event
  5123. var cbs = vm._events[event];
  5124. if (!cbs) {
  5125. return vm
  5126. }
  5127. if (!fn) {
  5128. vm._events[event] = null;
  5129. return vm
  5130. }
  5131. // specific handler
  5132. var cb;
  5133. var i = cbs.length;
  5134. while (i--) {
  5135. cb = cbs[i];
  5136. if (cb === fn || cb.fn === fn) {
  5137. cbs.splice(i, 1);
  5138. break
  5139. }
  5140. }
  5141. return vm
  5142. };
  5143. Vue.prototype.$emit = function (event) {
  5144. var vm = this;
  5145. if (true) {
  5146. var lowerCaseEvent = event.toLowerCase();
  5147. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  5148. tip(
  5149. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  5150. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  5151. "Note that HTML attributes are case-insensitive and you cannot use " +
  5152. "v-on to listen to camelCase events when using in-DOM templates. " +
  5153. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  5154. );
  5155. }
  5156. }
  5157. var cbs = vm._events[event];
  5158. if (cbs) {
  5159. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  5160. var args = toArray(arguments, 1);
  5161. var info = "event handler for \"" + event + "\"";
  5162. for (var i = 0, l = cbs.length; i < l; i++) {
  5163. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  5164. }
  5165. }
  5166. return vm
  5167. };
  5168. }
  5169. /* */
  5170. var activeInstance = null;
  5171. var isUpdatingChildComponent = false;
  5172. function setActiveInstance(vm) {
  5173. var prevActiveInstance = activeInstance;
  5174. activeInstance = vm;
  5175. return function () {
  5176. activeInstance = prevActiveInstance;
  5177. }
  5178. }
  5179. function initLifecycle (vm) {
  5180. var options = vm.$options;
  5181. // locate first non-abstract parent
  5182. var parent = options.parent;
  5183. if (parent && !options.abstract) {
  5184. while (parent.$options.abstract && parent.$parent) {
  5185. parent = parent.$parent;
  5186. }
  5187. parent.$children.push(vm);
  5188. }
  5189. vm.$parent = parent;
  5190. vm.$root = parent ? parent.$root : vm;
  5191. vm.$children = [];
  5192. vm.$refs = {};
  5193. vm._watcher = null;
  5194. vm._inactive = null;
  5195. vm._directInactive = false;
  5196. vm._isMounted = false;
  5197. vm._isDestroyed = false;
  5198. vm._isBeingDestroyed = false;
  5199. }
  5200. function lifecycleMixin (Vue) {
  5201. Vue.prototype._update = function (vnode, hydrating) {
  5202. var vm = this;
  5203. var prevEl = vm.$el;
  5204. var prevVnode = vm._vnode;
  5205. var restoreActiveInstance = setActiveInstance(vm);
  5206. vm._vnode = vnode;
  5207. // Vue.prototype.__patch__ is injected in entry points
  5208. // based on the rendering backend used.
  5209. if (!prevVnode) {
  5210. // initial render
  5211. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  5212. } else {
  5213. // updates
  5214. vm.$el = vm.__patch__(prevVnode, vnode);
  5215. }
  5216. restoreActiveInstance();
  5217. // update __vue__ reference
  5218. if (prevEl) {
  5219. prevEl.__vue__ = null;
  5220. }
  5221. if (vm.$el) {
  5222. vm.$el.__vue__ = vm;
  5223. }
  5224. // if parent is an HOC, update its $el as well
  5225. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  5226. vm.$parent.$el = vm.$el;
  5227. }
  5228. // updated hook is called by the scheduler to ensure that children are
  5229. // updated in a parent's updated hook.
  5230. };
  5231. Vue.prototype.$forceUpdate = function () {
  5232. var vm = this;
  5233. if (vm._watcher) {
  5234. vm._watcher.update();
  5235. }
  5236. };
  5237. Vue.prototype.$destroy = function () {
  5238. var vm = this;
  5239. if (vm._isBeingDestroyed) {
  5240. return
  5241. }
  5242. callHook(vm, 'beforeDestroy');
  5243. vm._isBeingDestroyed = true;
  5244. // remove self from parent
  5245. var parent = vm.$parent;
  5246. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  5247. remove(parent.$children, vm);
  5248. }
  5249. // teardown watchers
  5250. if (vm._watcher) {
  5251. vm._watcher.teardown();
  5252. }
  5253. var i = vm._watchers.length;
  5254. while (i--) {
  5255. vm._watchers[i].teardown();
  5256. }
  5257. // remove reference from data ob
  5258. // frozen object may not have observer.
  5259. if (vm._data.__ob__) {
  5260. vm._data.__ob__.vmCount--;
  5261. }
  5262. // call the last hook...
  5263. vm._isDestroyed = true;
  5264. // invoke destroy hooks on current rendered tree
  5265. vm.__patch__(vm._vnode, null);
  5266. // fire destroyed hook
  5267. callHook(vm, 'destroyed');
  5268. // turn off all instance listeners.
  5269. vm.$off();
  5270. // remove __vue__ reference
  5271. if (vm.$el) {
  5272. vm.$el.__vue__ = null;
  5273. }
  5274. // release circular reference (#6759)
  5275. if (vm.$vnode) {
  5276. vm.$vnode.parent = null;
  5277. }
  5278. };
  5279. }
  5280. function updateChildComponent (
  5281. vm,
  5282. propsData,
  5283. listeners,
  5284. parentVnode,
  5285. renderChildren
  5286. ) {
  5287. if (true) {
  5288. isUpdatingChildComponent = true;
  5289. }
  5290. // determine whether component has slot children
  5291. // we need to do this before overwriting $options._renderChildren.
  5292. // check if there are dynamic scopedSlots (hand-written or compiled but with
  5293. // dynamic slot names). Static scoped slots compiled from template has the
  5294. // "$stable" marker.
  5295. var newScopedSlots = parentVnode.data.scopedSlots;
  5296. var oldScopedSlots = vm.$scopedSlots;
  5297. var hasDynamicScopedSlot = !!(
  5298. (newScopedSlots && !newScopedSlots.$stable) ||
  5299. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  5300. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  5301. );
  5302. // Any static slot children from the parent may have changed during parent's
  5303. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  5304. // update is necessary to ensure correctness.
  5305. var needsForceUpdate = !!(
  5306. renderChildren || // has new static slots
  5307. vm.$options._renderChildren || // has old static slots
  5308. hasDynamicScopedSlot
  5309. );
  5310. vm.$options._parentVnode = parentVnode;
  5311. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  5312. if (vm._vnode) { // update child tree's parent
  5313. vm._vnode.parent = parentVnode;
  5314. }
  5315. vm.$options._renderChildren = renderChildren;
  5316. // update $attrs and $listeners hash
  5317. // these are also reactive so they may trigger child update if the child
  5318. // used them during render
  5319. vm.$attrs = parentVnode.data.attrs || emptyObject;
  5320. vm.$listeners = listeners || emptyObject;
  5321. // update props
  5322. if (propsData && vm.$options.props) {
  5323. toggleObserving(false);
  5324. var props = vm._props;
  5325. var propKeys = vm.$options._propKeys || [];
  5326. for (var i = 0; i < propKeys.length; i++) {
  5327. var key = propKeys[i];
  5328. var propOptions = vm.$options.props; // wtf flow?
  5329. props[key] = validateProp(key, propOptions, propsData, vm);
  5330. }
  5331. toggleObserving(true);
  5332. // keep a copy of raw propsData
  5333. vm.$options.propsData = propsData;
  5334. }
  5335. // fixed by xxxxxx update properties(mp runtime)
  5336. vm._$updateProperties && vm._$updateProperties(vm);
  5337. // update listeners
  5338. listeners = listeners || emptyObject;
  5339. var oldListeners = vm.$options._parentListeners;
  5340. vm.$options._parentListeners = listeners;
  5341. updateComponentListeners(vm, listeners, oldListeners);
  5342. // resolve slots + force update if has children
  5343. if (needsForceUpdate) {
  5344. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  5345. vm.$forceUpdate();
  5346. }
  5347. if (true) {
  5348. isUpdatingChildComponent = false;
  5349. }
  5350. }
  5351. function isInInactiveTree (vm) {
  5352. while (vm && (vm = vm.$parent)) {
  5353. if (vm._inactive) { return true }
  5354. }
  5355. return false
  5356. }
  5357. function activateChildComponent (vm, direct) {
  5358. if (direct) {
  5359. vm._directInactive = false;
  5360. if (isInInactiveTree(vm)) {
  5361. return
  5362. }
  5363. } else if (vm._directInactive) {
  5364. return
  5365. }
  5366. if (vm._inactive || vm._inactive === null) {
  5367. vm._inactive = false;
  5368. for (var i = 0; i < vm.$children.length; i++) {
  5369. activateChildComponent(vm.$children[i]);
  5370. }
  5371. callHook(vm, 'activated');
  5372. }
  5373. }
  5374. function deactivateChildComponent (vm, direct) {
  5375. if (direct) {
  5376. vm._directInactive = true;
  5377. if (isInInactiveTree(vm)) {
  5378. return
  5379. }
  5380. }
  5381. if (!vm._inactive) {
  5382. vm._inactive = true;
  5383. for (var i = 0; i < vm.$children.length; i++) {
  5384. deactivateChildComponent(vm.$children[i]);
  5385. }
  5386. callHook(vm, 'deactivated');
  5387. }
  5388. }
  5389. function callHook (vm, hook) {
  5390. // #7573 disable dep collection when invoking lifecycle hooks
  5391. pushTarget();
  5392. var handlers = vm.$options[hook];
  5393. var info = hook + " hook";
  5394. if (handlers) {
  5395. for (var i = 0, j = handlers.length; i < j; i++) {
  5396. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  5397. }
  5398. }
  5399. if (vm._hasHookEvent) {
  5400. vm.$emit('hook:' + hook);
  5401. }
  5402. popTarget();
  5403. }
  5404. /* */
  5405. var MAX_UPDATE_COUNT = 100;
  5406. var queue = [];
  5407. var activatedChildren = [];
  5408. var has = {};
  5409. var circular = {};
  5410. var waiting = false;
  5411. var flushing = false;
  5412. var index = 0;
  5413. /**
  5414. * Reset the scheduler's state.
  5415. */
  5416. function resetSchedulerState () {
  5417. index = queue.length = activatedChildren.length = 0;
  5418. has = {};
  5419. if (true) {
  5420. circular = {};
  5421. }
  5422. waiting = flushing = false;
  5423. }
  5424. // Async edge case #6566 requires saving the timestamp when event listeners are
  5425. // attached. However, calling performance.now() has a perf overhead especially
  5426. // if the page has thousands of event listeners. Instead, we take a timestamp
  5427. // every time the scheduler flushes and use that for all event listeners
  5428. // attached during that flush.
  5429. var currentFlushTimestamp = 0;
  5430. // Async edge case fix requires storing an event listener's attach timestamp.
  5431. var getNow = Date.now;
  5432. // Determine what event timestamp the browser is using. Annoyingly, the
  5433. // timestamp can either be hi-res (relative to page load) or low-res
  5434. // (relative to UNIX epoch), so in order to compare time we have to use the
  5435. // same timestamp type when saving the flush timestamp.
  5436. // All IE versions use low-res event timestamps, and have problematic clock
  5437. // implementations (#9632)
  5438. if (inBrowser && !isIE) {
  5439. var performance = window.performance;
  5440. if (
  5441. performance &&
  5442. typeof performance.now === 'function' &&
  5443. getNow() > document.createEvent('Event').timeStamp
  5444. ) {
  5445. // if the event timestamp, although evaluated AFTER the Date.now(), is
  5446. // smaller than it, it means the event is using a hi-res timestamp,
  5447. // and we need to use the hi-res version for event listener timestamps as
  5448. // well.
  5449. getNow = function () { return performance.now(); };
  5450. }
  5451. }
  5452. /**
  5453. * Flush both queues and run the watchers.
  5454. */
  5455. function flushSchedulerQueue () {
  5456. currentFlushTimestamp = getNow();
  5457. flushing = true;
  5458. var watcher, id;
  5459. // Sort queue before flush.
  5460. // This ensures that:
  5461. // 1. Components are updated from parent to child. (because parent is always
  5462. // created before the child)
  5463. // 2. A component's user watchers are run before its render watcher (because
  5464. // user watchers are created before the render watcher)
  5465. // 3. If a component is destroyed during a parent component's watcher run,
  5466. // its watchers can be skipped.
  5467. queue.sort(function (a, b) { return a.id - b.id; });
  5468. // do not cache length because more watchers might be pushed
  5469. // as we run existing watchers
  5470. for (index = 0; index < queue.length; index++) {
  5471. watcher = queue[index];
  5472. if (watcher.before) {
  5473. watcher.before();
  5474. }
  5475. id = watcher.id;
  5476. has[id] = null;
  5477. watcher.run();
  5478. // in dev build, check and stop circular updates.
  5479. if ( true && has[id] != null) {
  5480. circular[id] = (circular[id] || 0) + 1;
  5481. if (circular[id] > MAX_UPDATE_COUNT) {
  5482. warn(
  5483. 'You may have an infinite update loop ' + (
  5484. watcher.user
  5485. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  5486. : "in a component render function."
  5487. ),
  5488. watcher.vm
  5489. );
  5490. break
  5491. }
  5492. }
  5493. }
  5494. // keep copies of post queues before resetting state
  5495. var activatedQueue = activatedChildren.slice();
  5496. var updatedQueue = queue.slice();
  5497. resetSchedulerState();
  5498. // call component updated and activated hooks
  5499. callActivatedHooks(activatedQueue);
  5500. callUpdatedHooks(updatedQueue);
  5501. // devtool hook
  5502. /* istanbul ignore if */
  5503. if (devtools && config.devtools) {
  5504. devtools.emit('flush');
  5505. }
  5506. }
  5507. function callUpdatedHooks (queue) {
  5508. var i = queue.length;
  5509. while (i--) {
  5510. var watcher = queue[i];
  5511. var vm = watcher.vm;
  5512. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  5513. callHook(vm, 'updated');
  5514. }
  5515. }
  5516. }
  5517. /**
  5518. * Queue a kept-alive component that was activated during patch.
  5519. * The queue will be processed after the entire tree has been patched.
  5520. */
  5521. function queueActivatedComponent (vm) {
  5522. // setting _inactive to false here so that a render function can
  5523. // rely on checking whether it's in an inactive tree (e.g. router-view)
  5524. vm._inactive = false;
  5525. activatedChildren.push(vm);
  5526. }
  5527. function callActivatedHooks (queue) {
  5528. for (var i = 0; i < queue.length; i++) {
  5529. queue[i]._inactive = true;
  5530. activateChildComponent(queue[i], true /* true */);
  5531. }
  5532. }
  5533. /**
  5534. * Push a watcher into the watcher queue.
  5535. * Jobs with duplicate IDs will be skipped unless it's
  5536. * pushed when the queue is being flushed.
  5537. */
  5538. function queueWatcher (watcher) {
  5539. var id = watcher.id;
  5540. if (has[id] == null) {
  5541. has[id] = true;
  5542. if (!flushing) {
  5543. queue.push(watcher);
  5544. } else {
  5545. // if already flushing, splice the watcher based on its id
  5546. // if already past its id, it will be run next immediately.
  5547. var i = queue.length - 1;
  5548. while (i > index && queue[i].id > watcher.id) {
  5549. i--;
  5550. }
  5551. queue.splice(i + 1, 0, watcher);
  5552. }
  5553. // queue the flush
  5554. if (!waiting) {
  5555. waiting = true;
  5556. if ( true && !config.async) {
  5557. flushSchedulerQueue();
  5558. return
  5559. }
  5560. nextTick(flushSchedulerQueue);
  5561. }
  5562. }
  5563. }
  5564. /* */
  5565. var uid$2 = 0;
  5566. /**
  5567. * A watcher parses an expression, collects dependencies,
  5568. * and fires callback when the expression value changes.
  5569. * This is used for both the $watch() api and directives.
  5570. */
  5571. var Watcher = function Watcher (
  5572. vm,
  5573. expOrFn,
  5574. cb,
  5575. options,
  5576. isRenderWatcher
  5577. ) {
  5578. this.vm = vm;
  5579. if (isRenderWatcher) {
  5580. vm._watcher = this;
  5581. }
  5582. vm._watchers.push(this);
  5583. // options
  5584. if (options) {
  5585. this.deep = !!options.deep;
  5586. this.user = !!options.user;
  5587. this.lazy = !!options.lazy;
  5588. this.sync = !!options.sync;
  5589. this.before = options.before;
  5590. } else {
  5591. this.deep = this.user = this.lazy = this.sync = false;
  5592. }
  5593. this.cb = cb;
  5594. this.id = ++uid$2; // uid for batching
  5595. this.active = true;
  5596. this.dirty = this.lazy; // for lazy watchers
  5597. this.deps = [];
  5598. this.newDeps = [];
  5599. this.depIds = new _Set();
  5600. this.newDepIds = new _Set();
  5601. this.expression = true
  5602. ? expOrFn.toString()
  5603. : undefined;
  5604. // parse expression for getter
  5605. if (typeof expOrFn === 'function') {
  5606. this.getter = expOrFn;
  5607. } else {
  5608. this.getter = parsePath(expOrFn);
  5609. if (!this.getter) {
  5610. this.getter = noop;
  5611. true && warn(
  5612. "Failed watching path: \"" + expOrFn + "\" " +
  5613. 'Watcher only accepts simple dot-delimited paths. ' +
  5614. 'For full control, use a function instead.',
  5615. vm
  5616. );
  5617. }
  5618. }
  5619. this.value = this.lazy
  5620. ? undefined
  5621. : this.get();
  5622. };
  5623. /**
  5624. * Evaluate the getter, and re-collect dependencies.
  5625. */
  5626. Watcher.prototype.get = function get () {
  5627. pushTarget(this);
  5628. var value;
  5629. var vm = this.vm;
  5630. try {
  5631. value = this.getter.call(vm, vm);
  5632. } catch (e) {
  5633. if (this.user) {
  5634. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  5635. } else {
  5636. throw e
  5637. }
  5638. } finally {
  5639. // "touch" every property so they are all tracked as
  5640. // dependencies for deep watching
  5641. if (this.deep) {
  5642. traverse(value);
  5643. }
  5644. popTarget();
  5645. this.cleanupDeps();
  5646. }
  5647. return value
  5648. };
  5649. /**
  5650. * Add a dependency to this directive.
  5651. */
  5652. Watcher.prototype.addDep = function addDep (dep) {
  5653. var id = dep.id;
  5654. if (!this.newDepIds.has(id)) {
  5655. this.newDepIds.add(id);
  5656. this.newDeps.push(dep);
  5657. if (!this.depIds.has(id)) {
  5658. dep.addSub(this);
  5659. }
  5660. }
  5661. };
  5662. /**
  5663. * Clean up for dependency collection.
  5664. */
  5665. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  5666. var i = this.deps.length;
  5667. while (i--) {
  5668. var dep = this.deps[i];
  5669. if (!this.newDepIds.has(dep.id)) {
  5670. dep.removeSub(this);
  5671. }
  5672. }
  5673. var tmp = this.depIds;
  5674. this.depIds = this.newDepIds;
  5675. this.newDepIds = tmp;
  5676. this.newDepIds.clear();
  5677. tmp = this.deps;
  5678. this.deps = this.newDeps;
  5679. this.newDeps = tmp;
  5680. this.newDeps.length = 0;
  5681. };
  5682. /**
  5683. * Subscriber interface.
  5684. * Will be called when a dependency changes.
  5685. */
  5686. Watcher.prototype.update = function update () {
  5687. /* istanbul ignore else */
  5688. if (this.lazy) {
  5689. this.dirty = true;
  5690. } else if (this.sync) {
  5691. this.run();
  5692. } else {
  5693. queueWatcher(this);
  5694. }
  5695. };
  5696. /**
  5697. * Scheduler job interface.
  5698. * Will be called by the scheduler.
  5699. */
  5700. Watcher.prototype.run = function run () {
  5701. if (this.active) {
  5702. var value = this.get();
  5703. if (
  5704. value !== this.value ||
  5705. // Deep watchers and watchers on Object/Arrays should fire even
  5706. // when the value is the same, because the value may
  5707. // have mutated.
  5708. isObject(value) ||
  5709. this.deep
  5710. ) {
  5711. // set new value
  5712. var oldValue = this.value;
  5713. this.value = value;
  5714. if (this.user) {
  5715. try {
  5716. this.cb.call(this.vm, value, oldValue);
  5717. } catch (e) {
  5718. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  5719. }
  5720. } else {
  5721. this.cb.call(this.vm, value, oldValue);
  5722. }
  5723. }
  5724. }
  5725. };
  5726. /**
  5727. * Evaluate the value of the watcher.
  5728. * This only gets called for lazy watchers.
  5729. */
  5730. Watcher.prototype.evaluate = function evaluate () {
  5731. this.value = this.get();
  5732. this.dirty = false;
  5733. };
  5734. /**
  5735. * Depend on all deps collected by this watcher.
  5736. */
  5737. Watcher.prototype.depend = function depend () {
  5738. var i = this.deps.length;
  5739. while (i--) {
  5740. this.deps[i].depend();
  5741. }
  5742. };
  5743. /**
  5744. * Remove self from all dependencies' subscriber list.
  5745. */
  5746. Watcher.prototype.teardown = function teardown () {
  5747. if (this.active) {
  5748. // remove self from vm's watcher list
  5749. // this is a somewhat expensive operation so we skip it
  5750. // if the vm is being destroyed.
  5751. if (!this.vm._isBeingDestroyed) {
  5752. remove(this.vm._watchers, this);
  5753. }
  5754. var i = this.deps.length;
  5755. while (i--) {
  5756. this.deps[i].removeSub(this);
  5757. }
  5758. this.active = false;
  5759. }
  5760. };
  5761. /* */
  5762. var sharedPropertyDefinition = {
  5763. enumerable: true,
  5764. configurable: true,
  5765. get: noop,
  5766. set: noop
  5767. };
  5768. function proxy (target, sourceKey, key) {
  5769. sharedPropertyDefinition.get = function proxyGetter () {
  5770. return this[sourceKey][key]
  5771. };
  5772. sharedPropertyDefinition.set = function proxySetter (val) {
  5773. this[sourceKey][key] = val;
  5774. };
  5775. Object.defineProperty(target, key, sharedPropertyDefinition);
  5776. }
  5777. function initState (vm) {
  5778. vm._watchers = [];
  5779. var opts = vm.$options;
  5780. if (opts.props) { initProps(vm, opts.props); }
  5781. if (opts.methods) { initMethods(vm, opts.methods); }
  5782. if (opts.data) {
  5783. initData(vm);
  5784. } else {
  5785. observe(vm._data = {}, true /* asRootData */);
  5786. }
  5787. if (opts.computed) { initComputed(vm, opts.computed); }
  5788. if (opts.watch && opts.watch !== nativeWatch) {
  5789. initWatch(vm, opts.watch);
  5790. }
  5791. }
  5792. function initProps (vm, propsOptions) {
  5793. var propsData = vm.$options.propsData || {};
  5794. var props = vm._props = {};
  5795. // cache prop keys so that future props updates can iterate using Array
  5796. // instead of dynamic object key enumeration.
  5797. var keys = vm.$options._propKeys = [];
  5798. var isRoot = !vm.$parent;
  5799. // root instance props should be converted
  5800. if (!isRoot) {
  5801. toggleObserving(false);
  5802. }
  5803. var loop = function ( key ) {
  5804. keys.push(key);
  5805. var value = validateProp(key, propsOptions, propsData, vm);
  5806. /* istanbul ignore else */
  5807. if (true) {
  5808. var hyphenatedKey = hyphenate(key);
  5809. if (isReservedAttribute(hyphenatedKey) ||
  5810. config.isReservedAttr(hyphenatedKey)) {
  5811. warn(
  5812. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  5813. vm
  5814. );
  5815. }
  5816. defineReactive$$1(props, key, value, function () {
  5817. if (!isRoot && !isUpdatingChildComponent) {
  5818. {
  5819. if(vm.mpHost === 'mp-baidu'){//百度 observer 在 setData callback 之后触发,直接忽略该 warn
  5820. return
  5821. }
  5822. //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
  5823. if(
  5824. key === 'value' &&
  5825. Array.isArray(vm.$options.behaviors) &&
  5826. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  5827. ){
  5828. return
  5829. }
  5830. if(vm._getFormData){
  5831. return
  5832. }
  5833. var $parent = vm.$parent;
  5834. while($parent){
  5835. if($parent.__next_tick_pending){
  5836. return
  5837. }
  5838. $parent = $parent.$parent;
  5839. }
  5840. }
  5841. warn(
  5842. "Avoid mutating a prop directly since the value will be " +
  5843. "overwritten whenever the parent component re-renders. " +
  5844. "Instead, use a data or computed property based on the prop's " +
  5845. "value. Prop being mutated: \"" + key + "\"",
  5846. vm
  5847. );
  5848. }
  5849. });
  5850. } else {}
  5851. // static props are already proxied on the component's prototype
  5852. // during Vue.extend(). We only need to proxy props defined at
  5853. // instantiation here.
  5854. if (!(key in vm)) {
  5855. proxy(vm, "_props", key);
  5856. }
  5857. };
  5858. for (var key in propsOptions) loop( key );
  5859. toggleObserving(true);
  5860. }
  5861. function initData (vm) {
  5862. var data = vm.$options.data;
  5863. data = vm._data = typeof data === 'function'
  5864. ? getData(data, vm)
  5865. : data || {};
  5866. if (!isPlainObject(data)) {
  5867. data = {};
  5868. true && warn(
  5869. 'data functions should return an object:\n' +
  5870. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  5871. vm
  5872. );
  5873. }
  5874. // proxy data on instance
  5875. var keys = Object.keys(data);
  5876. var props = vm.$options.props;
  5877. var methods = vm.$options.methods;
  5878. var i = keys.length;
  5879. while (i--) {
  5880. var key = keys[i];
  5881. if (true) {
  5882. if (methods && hasOwn(methods, key)) {
  5883. warn(
  5884. ("Method \"" + key + "\" has already been defined as a data property."),
  5885. vm
  5886. );
  5887. }
  5888. }
  5889. if (props && hasOwn(props, key)) {
  5890. true && warn(
  5891. "The data property \"" + key + "\" is already declared as a prop. " +
  5892. "Use prop default value instead.",
  5893. vm
  5894. );
  5895. } else if (!isReserved(key)) {
  5896. proxy(vm, "_data", key);
  5897. }
  5898. }
  5899. // observe data
  5900. observe(data, true /* asRootData */);
  5901. }
  5902. function getData (data, vm) {
  5903. // #7573 disable dep collection when invoking data getters
  5904. pushTarget();
  5905. try {
  5906. return data.call(vm, vm)
  5907. } catch (e) {
  5908. handleError(e, vm, "data()");
  5909. return {}
  5910. } finally {
  5911. popTarget();
  5912. }
  5913. }
  5914. var computedWatcherOptions = { lazy: true };
  5915. function initComputed (vm, computed) {
  5916. // $flow-disable-line
  5917. var watchers = vm._computedWatchers = Object.create(null);
  5918. // computed properties are just getters during SSR
  5919. var isSSR = isServerRendering();
  5920. for (var key in computed) {
  5921. var userDef = computed[key];
  5922. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  5923. if ( true && getter == null) {
  5924. warn(
  5925. ("Getter is missing for computed property \"" + key + "\"."),
  5926. vm
  5927. );
  5928. }
  5929. if (!isSSR) {
  5930. // create internal watcher for the computed property.
  5931. watchers[key] = new Watcher(
  5932. vm,
  5933. getter || noop,
  5934. noop,
  5935. computedWatcherOptions
  5936. );
  5937. }
  5938. // component-defined computed properties are already defined on the
  5939. // component prototype. We only need to define computed properties defined
  5940. // at instantiation here.
  5941. if (!(key in vm)) {
  5942. defineComputed(vm, key, userDef);
  5943. } else if (true) {
  5944. if (key in vm.$data) {
  5945. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  5946. } else if (vm.$options.props && key in vm.$options.props) {
  5947. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  5948. }
  5949. }
  5950. }
  5951. }
  5952. function defineComputed (
  5953. target,
  5954. key,
  5955. userDef
  5956. ) {
  5957. var shouldCache = !isServerRendering();
  5958. if (typeof userDef === 'function') {
  5959. sharedPropertyDefinition.get = shouldCache
  5960. ? createComputedGetter(key)
  5961. : createGetterInvoker(userDef);
  5962. sharedPropertyDefinition.set = noop;
  5963. } else {
  5964. sharedPropertyDefinition.get = userDef.get
  5965. ? shouldCache && userDef.cache !== false
  5966. ? createComputedGetter(key)
  5967. : createGetterInvoker(userDef.get)
  5968. : noop;
  5969. sharedPropertyDefinition.set = userDef.set || noop;
  5970. }
  5971. if ( true &&
  5972. sharedPropertyDefinition.set === noop) {
  5973. sharedPropertyDefinition.set = function () {
  5974. warn(
  5975. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  5976. this
  5977. );
  5978. };
  5979. }
  5980. Object.defineProperty(target, key, sharedPropertyDefinition);
  5981. }
  5982. function createComputedGetter (key) {
  5983. return function computedGetter () {
  5984. var watcher = this._computedWatchers && this._computedWatchers[key];
  5985. if (watcher) {
  5986. if (watcher.dirty) {
  5987. watcher.evaluate();
  5988. }
  5989. if (Dep.SharedObject.target) {// fixed by xxxxxx
  5990. watcher.depend();
  5991. }
  5992. return watcher.value
  5993. }
  5994. }
  5995. }
  5996. function createGetterInvoker(fn) {
  5997. return function computedGetter () {
  5998. return fn.call(this, this)
  5999. }
  6000. }
  6001. function initMethods (vm, methods) {
  6002. var props = vm.$options.props;
  6003. for (var key in methods) {
  6004. if (true) {
  6005. if (typeof methods[key] !== 'function') {
  6006. warn(
  6007. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  6008. "Did you reference the function correctly?",
  6009. vm
  6010. );
  6011. }
  6012. if (props && hasOwn(props, key)) {
  6013. warn(
  6014. ("Method \"" + key + "\" has already been defined as a prop."),
  6015. vm
  6016. );
  6017. }
  6018. if ((key in vm) && isReserved(key)) {
  6019. warn(
  6020. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  6021. "Avoid defining component methods that start with _ or $."
  6022. );
  6023. }
  6024. }
  6025. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  6026. }
  6027. }
  6028. function initWatch (vm, watch) {
  6029. for (var key in watch) {
  6030. var handler = watch[key];
  6031. if (Array.isArray(handler)) {
  6032. for (var i = 0; i < handler.length; i++) {
  6033. createWatcher(vm, key, handler[i]);
  6034. }
  6035. } else {
  6036. createWatcher(vm, key, handler);
  6037. }
  6038. }
  6039. }
  6040. function createWatcher (
  6041. vm,
  6042. expOrFn,
  6043. handler,
  6044. options
  6045. ) {
  6046. if (isPlainObject(handler)) {
  6047. options = handler;
  6048. handler = handler.handler;
  6049. }
  6050. if (typeof handler === 'string') {
  6051. handler = vm[handler];
  6052. }
  6053. return vm.$watch(expOrFn, handler, options)
  6054. }
  6055. function stateMixin (Vue) {
  6056. // flow somehow has problems with directly declared definition object
  6057. // when using Object.defineProperty, so we have to procedurally build up
  6058. // the object here.
  6059. var dataDef = {};
  6060. dataDef.get = function () { return this._data };
  6061. var propsDef = {};
  6062. propsDef.get = function () { return this._props };
  6063. if (true) {
  6064. dataDef.set = function () {
  6065. warn(
  6066. 'Avoid replacing instance root $data. ' +
  6067. 'Use nested data properties instead.',
  6068. this
  6069. );
  6070. };
  6071. propsDef.set = function () {
  6072. warn("$props is readonly.", this);
  6073. };
  6074. }
  6075. Object.defineProperty(Vue.prototype, '$data', dataDef);
  6076. Object.defineProperty(Vue.prototype, '$props', propsDef);
  6077. Vue.prototype.$set = set;
  6078. Vue.prototype.$delete = del;
  6079. Vue.prototype.$watch = function (
  6080. expOrFn,
  6081. cb,
  6082. options
  6083. ) {
  6084. var vm = this;
  6085. if (isPlainObject(cb)) {
  6086. return createWatcher(vm, expOrFn, cb, options)
  6087. }
  6088. options = options || {};
  6089. options.user = true;
  6090. var watcher = new Watcher(vm, expOrFn, cb, options);
  6091. if (options.immediate) {
  6092. try {
  6093. cb.call(vm, watcher.value);
  6094. } catch (error) {
  6095. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  6096. }
  6097. }
  6098. return function unwatchFn () {
  6099. watcher.teardown();
  6100. }
  6101. };
  6102. }
  6103. /* */
  6104. var uid$3 = 0;
  6105. function initMixin (Vue) {
  6106. Vue.prototype._init = function (options) {
  6107. var vm = this;
  6108. // a uid
  6109. vm._uid = uid$3++;
  6110. var startTag, endTag;
  6111. /* istanbul ignore if */
  6112. if ( true && config.performance && mark) {
  6113. startTag = "vue-perf-start:" + (vm._uid);
  6114. endTag = "vue-perf-end:" + (vm._uid);
  6115. mark(startTag);
  6116. }
  6117. // a flag to avoid this being observed
  6118. vm._isVue = true;
  6119. // merge options
  6120. if (options && options._isComponent) {
  6121. // optimize internal component instantiation
  6122. // since dynamic options merging is pretty slow, and none of the
  6123. // internal component options needs special treatment.
  6124. initInternalComponent(vm, options);
  6125. } else {
  6126. vm.$options = mergeOptions(
  6127. resolveConstructorOptions(vm.constructor),
  6128. options || {},
  6129. vm
  6130. );
  6131. }
  6132. /* istanbul ignore else */
  6133. if (true) {
  6134. initProxy(vm);
  6135. } else {}
  6136. // expose real self
  6137. vm._self = vm;
  6138. initLifecycle(vm);
  6139. initEvents(vm);
  6140. initRender(vm);
  6141. callHook(vm, 'beforeCreate');
  6142. !vm._$fallback && initInjections(vm); // resolve injections before data/props
  6143. initState(vm);
  6144. !vm._$fallback && initProvide(vm); // resolve provide after data/props
  6145. !vm._$fallback && callHook(vm, 'created');
  6146. /* istanbul ignore if */
  6147. if ( true && config.performance && mark) {
  6148. vm._name = formatComponentName(vm, false);
  6149. mark(endTag);
  6150. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  6151. }
  6152. if (vm.$options.el) {
  6153. vm.$mount(vm.$options.el);
  6154. }
  6155. };
  6156. }
  6157. function initInternalComponent (vm, options) {
  6158. var opts = vm.$options = Object.create(vm.constructor.options);
  6159. // doing this because it's faster than dynamic enumeration.
  6160. var parentVnode = options._parentVnode;
  6161. opts.parent = options.parent;
  6162. opts._parentVnode = parentVnode;
  6163. var vnodeComponentOptions = parentVnode.componentOptions;
  6164. opts.propsData = vnodeComponentOptions.propsData;
  6165. opts._parentListeners = vnodeComponentOptions.listeners;
  6166. opts._renderChildren = vnodeComponentOptions.children;
  6167. opts._componentTag = vnodeComponentOptions.tag;
  6168. if (options.render) {
  6169. opts.render = options.render;
  6170. opts.staticRenderFns = options.staticRenderFns;
  6171. }
  6172. }
  6173. function resolveConstructorOptions (Ctor) {
  6174. var options = Ctor.options;
  6175. if (Ctor.super) {
  6176. var superOptions = resolveConstructorOptions(Ctor.super);
  6177. var cachedSuperOptions = Ctor.superOptions;
  6178. if (superOptions !== cachedSuperOptions) {
  6179. // super option changed,
  6180. // need to resolve new options.
  6181. Ctor.superOptions = superOptions;
  6182. // check if there are any late-modified/attached options (#4976)
  6183. var modifiedOptions = resolveModifiedOptions(Ctor);
  6184. // update base extend options
  6185. if (modifiedOptions) {
  6186. extend(Ctor.extendOptions, modifiedOptions);
  6187. }
  6188. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  6189. if (options.name) {
  6190. options.components[options.name] = Ctor;
  6191. }
  6192. }
  6193. }
  6194. return options
  6195. }
  6196. function resolveModifiedOptions (Ctor) {
  6197. var modified;
  6198. var latest = Ctor.options;
  6199. var sealed = Ctor.sealedOptions;
  6200. for (var key in latest) {
  6201. if (latest[key] !== sealed[key]) {
  6202. if (!modified) { modified = {}; }
  6203. modified[key] = latest[key];
  6204. }
  6205. }
  6206. return modified
  6207. }
  6208. function Vue (options) {
  6209. if ( true &&
  6210. !(this instanceof Vue)
  6211. ) {
  6212. warn('Vue is a constructor and should be called with the `new` keyword');
  6213. }
  6214. this._init(options);
  6215. }
  6216. initMixin(Vue);
  6217. stateMixin(Vue);
  6218. eventsMixin(Vue);
  6219. lifecycleMixin(Vue);
  6220. renderMixin(Vue);
  6221. /* */
  6222. function initUse (Vue) {
  6223. Vue.use = function (plugin) {
  6224. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  6225. if (installedPlugins.indexOf(plugin) > -1) {
  6226. return this
  6227. }
  6228. // additional parameters
  6229. var args = toArray(arguments, 1);
  6230. args.unshift(this);
  6231. if (typeof plugin.install === 'function') {
  6232. plugin.install.apply(plugin, args);
  6233. } else if (typeof plugin === 'function') {
  6234. plugin.apply(null, args);
  6235. }
  6236. installedPlugins.push(plugin);
  6237. return this
  6238. };
  6239. }
  6240. /* */
  6241. function initMixin$1 (Vue) {
  6242. Vue.mixin = function (mixin) {
  6243. this.options = mergeOptions(this.options, mixin);
  6244. return this
  6245. };
  6246. }
  6247. /* */
  6248. function initExtend (Vue) {
  6249. /**
  6250. * Each instance constructor, including Vue, has a unique
  6251. * cid. This enables us to create wrapped "child
  6252. * constructors" for prototypal inheritance and cache them.
  6253. */
  6254. Vue.cid = 0;
  6255. var cid = 1;
  6256. /**
  6257. * Class inheritance
  6258. */
  6259. Vue.extend = function (extendOptions) {
  6260. extendOptions = extendOptions || {};
  6261. var Super = this;
  6262. var SuperId = Super.cid;
  6263. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  6264. if (cachedCtors[SuperId]) {
  6265. return cachedCtors[SuperId]
  6266. }
  6267. var name = extendOptions.name || Super.options.name;
  6268. if ( true && name) {
  6269. validateComponentName(name);
  6270. }
  6271. var Sub = function VueComponent (options) {
  6272. this._init(options);
  6273. };
  6274. Sub.prototype = Object.create(Super.prototype);
  6275. Sub.prototype.constructor = Sub;
  6276. Sub.cid = cid++;
  6277. Sub.options = mergeOptions(
  6278. Super.options,
  6279. extendOptions
  6280. );
  6281. Sub['super'] = Super;
  6282. // For props and computed properties, we define the proxy getters on
  6283. // the Vue instances at extension time, on the extended prototype. This
  6284. // avoids Object.defineProperty calls for each instance created.
  6285. if (Sub.options.props) {
  6286. initProps$1(Sub);
  6287. }
  6288. if (Sub.options.computed) {
  6289. initComputed$1(Sub);
  6290. }
  6291. // allow further extension/mixin/plugin usage
  6292. Sub.extend = Super.extend;
  6293. Sub.mixin = Super.mixin;
  6294. Sub.use = Super.use;
  6295. // create asset registers, so extended classes
  6296. // can have their private assets too.
  6297. ASSET_TYPES.forEach(function (type) {
  6298. Sub[type] = Super[type];
  6299. });
  6300. // enable recursive self-lookup
  6301. if (name) {
  6302. Sub.options.components[name] = Sub;
  6303. }
  6304. // keep a reference to the super options at extension time.
  6305. // later at instantiation we can check if Super's options have
  6306. // been updated.
  6307. Sub.superOptions = Super.options;
  6308. Sub.extendOptions = extendOptions;
  6309. Sub.sealedOptions = extend({}, Sub.options);
  6310. // cache constructor
  6311. cachedCtors[SuperId] = Sub;
  6312. return Sub
  6313. };
  6314. }
  6315. function initProps$1 (Comp) {
  6316. var props = Comp.options.props;
  6317. for (var key in props) {
  6318. proxy(Comp.prototype, "_props", key);
  6319. }
  6320. }
  6321. function initComputed$1 (Comp) {
  6322. var computed = Comp.options.computed;
  6323. for (var key in computed) {
  6324. defineComputed(Comp.prototype, key, computed[key]);
  6325. }
  6326. }
  6327. /* */
  6328. function initAssetRegisters (Vue) {
  6329. /**
  6330. * Create asset registration methods.
  6331. */
  6332. ASSET_TYPES.forEach(function (type) {
  6333. Vue[type] = function (
  6334. id,
  6335. definition
  6336. ) {
  6337. if (!definition) {
  6338. return this.options[type + 's'][id]
  6339. } else {
  6340. /* istanbul ignore if */
  6341. if ( true && type === 'component') {
  6342. validateComponentName(id);
  6343. }
  6344. if (type === 'component' && isPlainObject(definition)) {
  6345. definition.name = definition.name || id;
  6346. definition = this.options._base.extend(definition);
  6347. }
  6348. if (type === 'directive' && typeof definition === 'function') {
  6349. definition = { bind: definition, update: definition };
  6350. }
  6351. this.options[type + 's'][id] = definition;
  6352. return definition
  6353. }
  6354. };
  6355. });
  6356. }
  6357. /* */
  6358. function getComponentName (opts) {
  6359. return opts && (opts.Ctor.options.name || opts.tag)
  6360. }
  6361. function matches (pattern, name) {
  6362. if (Array.isArray(pattern)) {
  6363. return pattern.indexOf(name) > -1
  6364. } else if (typeof pattern === 'string') {
  6365. return pattern.split(',').indexOf(name) > -1
  6366. } else if (isRegExp(pattern)) {
  6367. return pattern.test(name)
  6368. }
  6369. /* istanbul ignore next */
  6370. return false
  6371. }
  6372. function pruneCache (keepAliveInstance, filter) {
  6373. var cache = keepAliveInstance.cache;
  6374. var keys = keepAliveInstance.keys;
  6375. var _vnode = keepAliveInstance._vnode;
  6376. for (var key in cache) {
  6377. var cachedNode = cache[key];
  6378. if (cachedNode) {
  6379. var name = getComponentName(cachedNode.componentOptions);
  6380. if (name && !filter(name)) {
  6381. pruneCacheEntry(cache, key, keys, _vnode);
  6382. }
  6383. }
  6384. }
  6385. }
  6386. function pruneCacheEntry (
  6387. cache,
  6388. key,
  6389. keys,
  6390. current
  6391. ) {
  6392. var cached$$1 = cache[key];
  6393. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  6394. cached$$1.componentInstance.$destroy();
  6395. }
  6396. cache[key] = null;
  6397. remove(keys, key);
  6398. }
  6399. var patternTypes = [String, RegExp, Array];
  6400. var KeepAlive = {
  6401. name: 'keep-alive',
  6402. abstract: true,
  6403. props: {
  6404. include: patternTypes,
  6405. exclude: patternTypes,
  6406. max: [String, Number]
  6407. },
  6408. created: function created () {
  6409. this.cache = Object.create(null);
  6410. this.keys = [];
  6411. },
  6412. destroyed: function destroyed () {
  6413. for (var key in this.cache) {
  6414. pruneCacheEntry(this.cache, key, this.keys);
  6415. }
  6416. },
  6417. mounted: function mounted () {
  6418. var this$1 = this;
  6419. this.$watch('include', function (val) {
  6420. pruneCache(this$1, function (name) { return matches(val, name); });
  6421. });
  6422. this.$watch('exclude', function (val) {
  6423. pruneCache(this$1, function (name) { return !matches(val, name); });
  6424. });
  6425. },
  6426. render: function render () {
  6427. var slot = this.$slots.default;
  6428. var vnode = getFirstComponentChild(slot);
  6429. var componentOptions = vnode && vnode.componentOptions;
  6430. if (componentOptions) {
  6431. // check pattern
  6432. var name = getComponentName(componentOptions);
  6433. var ref = this;
  6434. var include = ref.include;
  6435. var exclude = ref.exclude;
  6436. if (
  6437. // not included
  6438. (include && (!name || !matches(include, name))) ||
  6439. // excluded
  6440. (exclude && name && matches(exclude, name))
  6441. ) {
  6442. return vnode
  6443. }
  6444. var ref$1 = this;
  6445. var cache = ref$1.cache;
  6446. var keys = ref$1.keys;
  6447. var key = vnode.key == null
  6448. // same constructor may get registered as different local components
  6449. // so cid alone is not enough (#3269)
  6450. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  6451. : vnode.key;
  6452. if (cache[key]) {
  6453. vnode.componentInstance = cache[key].componentInstance;
  6454. // make current key freshest
  6455. remove(keys, key);
  6456. keys.push(key);
  6457. } else {
  6458. cache[key] = vnode;
  6459. keys.push(key);
  6460. // prune oldest entry
  6461. if (this.max && keys.length > parseInt(this.max)) {
  6462. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  6463. }
  6464. }
  6465. vnode.data.keepAlive = true;
  6466. }
  6467. return vnode || (slot && slot[0])
  6468. }
  6469. };
  6470. var builtInComponents = {
  6471. KeepAlive: KeepAlive
  6472. };
  6473. /* */
  6474. function initGlobalAPI (Vue) {
  6475. // config
  6476. var configDef = {};
  6477. configDef.get = function () { return config; };
  6478. if (true) {
  6479. configDef.set = function () {
  6480. warn(
  6481. 'Do not replace the Vue.config object, set individual fields instead.'
  6482. );
  6483. };
  6484. }
  6485. Object.defineProperty(Vue, 'config', configDef);
  6486. // exposed util methods.
  6487. // NOTE: these are not considered part of the public API - avoid relying on
  6488. // them unless you are aware of the risk.
  6489. Vue.util = {
  6490. warn: warn,
  6491. extend: extend,
  6492. mergeOptions: mergeOptions,
  6493. defineReactive: defineReactive$$1
  6494. };
  6495. Vue.set = set;
  6496. Vue.delete = del;
  6497. Vue.nextTick = nextTick;
  6498. // 2.6 explicit observable API
  6499. Vue.observable = function (obj) {
  6500. observe(obj);
  6501. return obj
  6502. };
  6503. Vue.options = Object.create(null);
  6504. ASSET_TYPES.forEach(function (type) {
  6505. Vue.options[type + 's'] = Object.create(null);
  6506. });
  6507. // this is used to identify the "base" constructor to extend all plain-object
  6508. // components with in Weex's multi-instance scenarios.
  6509. Vue.options._base = Vue;
  6510. extend(Vue.options.components, builtInComponents);
  6511. initUse(Vue);
  6512. initMixin$1(Vue);
  6513. initExtend(Vue);
  6514. initAssetRegisters(Vue);
  6515. }
  6516. initGlobalAPI(Vue);
  6517. Object.defineProperty(Vue.prototype, '$isServer', {
  6518. get: isServerRendering
  6519. });
  6520. Object.defineProperty(Vue.prototype, '$ssrContext', {
  6521. get: function get () {
  6522. /* istanbul ignore next */
  6523. return this.$vnode && this.$vnode.ssrContext
  6524. }
  6525. });
  6526. // expose FunctionalRenderContext for ssr runtime helper installation
  6527. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  6528. value: FunctionalRenderContext
  6529. });
  6530. Vue.version = '2.6.11';
  6531. /**
  6532. * https://raw.githubusercontent.com/Tencent/westore/master/packages/westore/utils/diff.js
  6533. */
  6534. var ARRAYTYPE = '[object Array]';
  6535. var OBJECTTYPE = '[object Object]';
  6536. // const FUNCTIONTYPE = '[object Function]'
  6537. function diff(current, pre) {
  6538. var result = {};
  6539. syncKeys(current, pre);
  6540. _diff(current, pre, '', result);
  6541. return result
  6542. }
  6543. function syncKeys(current, pre) {
  6544. if (current === pre) { return }
  6545. var rootCurrentType = type(current);
  6546. var rootPreType = type(pre);
  6547. if (rootCurrentType == OBJECTTYPE && rootPreType == OBJECTTYPE) {
  6548. if(Object.keys(current).length >= Object.keys(pre).length){
  6549. for (var key in pre) {
  6550. var currentValue = current[key];
  6551. if (currentValue === undefined) {
  6552. current[key] = null;
  6553. } else {
  6554. syncKeys(currentValue, pre[key]);
  6555. }
  6556. }
  6557. }
  6558. } else if (rootCurrentType == ARRAYTYPE && rootPreType == ARRAYTYPE) {
  6559. if (current.length >= pre.length) {
  6560. pre.forEach(function (item, index) {
  6561. syncKeys(current[index], item);
  6562. });
  6563. }
  6564. }
  6565. }
  6566. function _diff(current, pre, path, result) {
  6567. if (current === pre) { return }
  6568. var rootCurrentType = type(current);
  6569. var rootPreType = type(pre);
  6570. if (rootCurrentType == OBJECTTYPE) {
  6571. if (rootPreType != OBJECTTYPE || Object.keys(current).length < Object.keys(pre).length) {
  6572. setResult(result, path, current);
  6573. } else {
  6574. var loop = function ( key ) {
  6575. var currentValue = current[key];
  6576. var preValue = pre[key];
  6577. var currentType = type(currentValue);
  6578. var preType = type(preValue);
  6579. if (currentType != ARRAYTYPE && currentType != OBJECTTYPE) {
  6580. if (currentValue != pre[key]) {
  6581. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6582. }
  6583. } else if (currentType == ARRAYTYPE) {
  6584. if (preType != ARRAYTYPE) {
  6585. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6586. } else {
  6587. if (currentValue.length < preValue.length) {
  6588. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6589. } else {
  6590. currentValue.forEach(function (item, index) {
  6591. _diff(item, preValue[index], (path == '' ? '' : path + ".") + key + '[' + index + ']', result);
  6592. });
  6593. }
  6594. }
  6595. } else if (currentType == OBJECTTYPE) {
  6596. if (preType != OBJECTTYPE || Object.keys(currentValue).length < Object.keys(preValue).length) {
  6597. setResult(result, (path == '' ? '' : path + ".") + key, currentValue);
  6598. } else {
  6599. for (var subKey in currentValue) {
  6600. _diff(currentValue[subKey], preValue[subKey], (path == '' ? '' : path + ".") + key + '.' + subKey, result);
  6601. }
  6602. }
  6603. }
  6604. };
  6605. for (var key in current) loop( key );
  6606. }
  6607. } else if (rootCurrentType == ARRAYTYPE) {
  6608. if (rootPreType != ARRAYTYPE) {
  6609. setResult(result, path, current);
  6610. } else {
  6611. if (current.length < pre.length) {
  6612. setResult(result, path, current);
  6613. } else {
  6614. current.forEach(function (item, index) {
  6615. _diff(item, pre[index], path + '[' + index + ']', result);
  6616. });
  6617. }
  6618. }
  6619. } else {
  6620. setResult(result, path, current);
  6621. }
  6622. }
  6623. function setResult(result, k, v) {
  6624. // if (type(v) != FUNCTIONTYPE) {
  6625. result[k] = v;
  6626. // }
  6627. }
  6628. function type(obj) {
  6629. return Object.prototype.toString.call(obj)
  6630. }
  6631. /* */
  6632. function flushCallbacks$1(vm) {
  6633. if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
  6634. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6635. var mpInstance = vm.$scope;
  6636. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6637. ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
  6638. }
  6639. var copies = vm.__next_tick_callbacks.slice(0);
  6640. vm.__next_tick_callbacks.length = 0;
  6641. for (var i = 0; i < copies.length; i++) {
  6642. copies[i]();
  6643. }
  6644. }
  6645. }
  6646. function hasRenderWatcher(vm) {
  6647. return queue.find(function (watcher) { return vm._watcher === watcher; })
  6648. }
  6649. function nextTick$1(vm, cb) {
  6650. //1.nextTick 之前 已 setData 且 setData 还未回调完成
  6651. //2.nextTick 之前存在 render watcher
  6652. if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
  6653. if(Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  6654. var mpInstance = vm.$scope;
  6655. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
  6656. ']:nextVueTick');
  6657. }
  6658. return nextTick(cb, vm)
  6659. }else{
  6660. if(Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG){
  6661. var mpInstance$1 = vm.$scope;
  6662. console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
  6663. ']:nextMPTick');
  6664. }
  6665. }
  6666. var _resolve;
  6667. if (!vm.__next_tick_callbacks) {
  6668. vm.__next_tick_callbacks = [];
  6669. }
  6670. vm.__next_tick_callbacks.push(function () {
  6671. if (cb) {
  6672. try {
  6673. cb.call(vm);
  6674. } catch (e) {
  6675. handleError(e, vm, 'nextTick');
  6676. }
  6677. } else if (_resolve) {
  6678. _resolve(vm);
  6679. }
  6680. });
  6681. // $flow-disable-line
  6682. if (!cb && typeof Promise !== 'undefined') {
  6683. return new Promise(function (resolve) {
  6684. _resolve = resolve;
  6685. })
  6686. }
  6687. }
  6688. /* */
  6689. function cloneWithData(vm) {
  6690. // 确保当前 vm 所有数据被同步
  6691. var ret = Object.create(null);
  6692. var dataKeys = [].concat(
  6693. Object.keys(vm._data || {}),
  6694. Object.keys(vm._computedWatchers || {}));
  6695. dataKeys.reduce(function(ret, key) {
  6696. ret[key] = vm[key];
  6697. return ret
  6698. }, ret);
  6699. // vue-composition-api
  6700. var rawBindings = vm.__secret_vfa_state__ && vm.__secret_vfa_state__.rawBindings;
  6701. if (rawBindings) {
  6702. Object.keys(rawBindings).forEach(function (key) {
  6703. ret[key] = vm[key];
  6704. });
  6705. }
  6706. //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
  6707. Object.assign(ret, vm.$mp.data || {});
  6708. if (
  6709. Array.isArray(vm.$options.behaviors) &&
  6710. vm.$options.behaviors.indexOf('uni://form-field') !== -1
  6711. ) { //form-field
  6712. ret['name'] = vm.name;
  6713. ret['value'] = vm.value;
  6714. }
  6715. return JSON.parse(JSON.stringify(ret))
  6716. }
  6717. var patch = function(oldVnode, vnode) {
  6718. var this$1 = this;
  6719. if (vnode === null) { //destroy
  6720. return
  6721. }
  6722. if (this.mpType === 'page' || this.mpType === 'component') {
  6723. var mpInstance = this.$scope;
  6724. var data = Object.create(null);
  6725. try {
  6726. data = cloneWithData(this);
  6727. } catch (err) {
  6728. console.error(err);
  6729. }
  6730. data.__webviewId__ = mpInstance.data.__webviewId__;
  6731. var mpData = Object.create(null);
  6732. Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
  6733. mpData[key] = mpInstance.data[key];
  6734. });
  6735. var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
  6736. if (Object.keys(diffData).length) {
  6737. if (Object({"NODE_ENV":"development","VUE_APP_PLATFORM":"mp-weixin","BASE_URL":"/"}).VUE_APP_DEBUG) {
  6738. console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
  6739. ']差量更新',
  6740. JSON.stringify(diffData));
  6741. }
  6742. this.__next_tick_pending = true;
  6743. mpInstance.setData(diffData, function () {
  6744. this$1.__next_tick_pending = false;
  6745. flushCallbacks$1(this$1);
  6746. });
  6747. } else {
  6748. flushCallbacks$1(this);
  6749. }
  6750. }
  6751. };
  6752. /* */
  6753. function createEmptyRender() {
  6754. }
  6755. function mountComponent$1(
  6756. vm,
  6757. el,
  6758. hydrating
  6759. ) {
  6760. if (!vm.mpType) {//main.js 中的 new Vue
  6761. return vm
  6762. }
  6763. if (vm.mpType === 'app') {
  6764. vm.$options.render = createEmptyRender;
  6765. }
  6766. if (!vm.$options.render) {
  6767. vm.$options.render = createEmptyRender;
  6768. if (true) {
  6769. /* istanbul ignore if */
  6770. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  6771. vm.$options.el || el) {
  6772. warn(
  6773. 'You are using the runtime-only build of Vue where the template ' +
  6774. 'compiler is not available. Either pre-compile the templates into ' +
  6775. 'render functions, or use the compiler-included build.',
  6776. vm
  6777. );
  6778. } else {
  6779. warn(
  6780. 'Failed to mount component: template or render function not defined.',
  6781. vm
  6782. );
  6783. }
  6784. }
  6785. }
  6786. !vm._$fallback && callHook(vm, 'beforeMount');
  6787. var updateComponent = function () {
  6788. vm._update(vm._render(), hydrating);
  6789. };
  6790. // we set this to vm._watcher inside the watcher's constructor
  6791. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  6792. // component's mounted hook), which relies on vm._watcher being already defined
  6793. new Watcher(vm, updateComponent, noop, {
  6794. before: function before() {
  6795. if (vm._isMounted && !vm._isDestroyed) {
  6796. callHook(vm, 'beforeUpdate');
  6797. }
  6798. }
  6799. }, true /* isRenderWatcher */);
  6800. hydrating = false;
  6801. return vm
  6802. }
  6803. /* */
  6804. function renderClass (
  6805. staticClass,
  6806. dynamicClass
  6807. ) {
  6808. if (isDef(staticClass) || isDef(dynamicClass)) {
  6809. return concat(staticClass, stringifyClass(dynamicClass))
  6810. }
  6811. /* istanbul ignore next */
  6812. return ''
  6813. }
  6814. function concat (a, b) {
  6815. return a ? b ? (a + ' ' + b) : a : (b || '')
  6816. }
  6817. function stringifyClass (value) {
  6818. if (Array.isArray(value)) {
  6819. return stringifyArray(value)
  6820. }
  6821. if (isObject(value)) {
  6822. return stringifyObject(value)
  6823. }
  6824. if (typeof value === 'string') {
  6825. return value
  6826. }
  6827. /* istanbul ignore next */
  6828. return ''
  6829. }
  6830. function stringifyArray (value) {
  6831. var res = '';
  6832. var stringified;
  6833. for (var i = 0, l = value.length; i < l; i++) {
  6834. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  6835. if (res) { res += ' '; }
  6836. res += stringified;
  6837. }
  6838. }
  6839. return res
  6840. }
  6841. function stringifyObject (value) {
  6842. var res = '';
  6843. for (var key in value) {
  6844. if (value[key]) {
  6845. if (res) { res += ' '; }
  6846. res += key;
  6847. }
  6848. }
  6849. return res
  6850. }
  6851. /* */
  6852. var parseStyleText = cached(function (cssText) {
  6853. var res = {};
  6854. var listDelimiter = /;(?![^(]*\))/g;
  6855. var propertyDelimiter = /:(.+)/;
  6856. cssText.split(listDelimiter).forEach(function (item) {
  6857. if (item) {
  6858. var tmp = item.split(propertyDelimiter);
  6859. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6860. }
  6861. });
  6862. return res
  6863. });
  6864. // normalize possible array / string values into Object
  6865. function normalizeStyleBinding (bindingStyle) {
  6866. if (Array.isArray(bindingStyle)) {
  6867. return toObject(bindingStyle)
  6868. }
  6869. if (typeof bindingStyle === 'string') {
  6870. return parseStyleText(bindingStyle)
  6871. }
  6872. return bindingStyle
  6873. }
  6874. /* */
  6875. var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
  6876. function getTarget(obj, path) {
  6877. var parts = path.split('.');
  6878. var key = parts[0];
  6879. if (key.indexOf('__$n') === 0) { //number index
  6880. key = parseInt(key.replace('__$n', ''));
  6881. }
  6882. if (parts.length === 1) {
  6883. return obj[key]
  6884. }
  6885. return getTarget(obj[key], parts.slice(1).join('.'))
  6886. }
  6887. function internalMixin(Vue) {
  6888. Vue.config.errorHandler = function(err, vm, info) {
  6889. Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  6890. console.error(err);
  6891. /* eslint-disable no-undef */
  6892. var app = getApp();
  6893. if (app && app.onError) {
  6894. app.onError(err);
  6895. }
  6896. };
  6897. var oldEmit = Vue.prototype.$emit;
  6898. Vue.prototype.$emit = function(event) {
  6899. if (this.$scope && event) {
  6900. this.$scope['triggerEvent'](event, {
  6901. __args__: toArray(arguments, 1)
  6902. });
  6903. }
  6904. return oldEmit.apply(this, arguments)
  6905. };
  6906. Vue.prototype.$nextTick = function(fn) {
  6907. return nextTick$1(this, fn)
  6908. };
  6909. MP_METHODS.forEach(function (method) {
  6910. Vue.prototype[method] = function(args) {
  6911. if (this.$scope && this.$scope[method]) {
  6912. return this.$scope[method](args)
  6913. }
  6914. // mp-alipay
  6915. if (typeof my === 'undefined') {
  6916. return
  6917. }
  6918. if (method === 'createSelectorQuery') {
  6919. /* eslint-disable no-undef */
  6920. return my.createSelectorQuery(args)
  6921. } else if (method === 'createIntersectionObserver') {
  6922. /* eslint-disable no-undef */
  6923. return my.createIntersectionObserver(args)
  6924. }
  6925. // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
  6926. };
  6927. });
  6928. Vue.prototype.__init_provide = initProvide;
  6929. Vue.prototype.__init_injections = initInjections;
  6930. Vue.prototype.__call_hook = function(hook, args) {
  6931. var vm = this;
  6932. // #7573 disable dep collection when invoking lifecycle hooks
  6933. pushTarget();
  6934. var handlers = vm.$options[hook];
  6935. var info = hook + " hook";
  6936. var ret;
  6937. if (handlers) {
  6938. for (var i = 0, j = handlers.length; i < j; i++) {
  6939. ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
  6940. }
  6941. }
  6942. if (vm._hasHookEvent) {
  6943. vm.$emit('hook:' + hook, args);
  6944. }
  6945. popTarget();
  6946. return ret
  6947. };
  6948. Vue.prototype.__set_model = function(target, key, value, modifiers) {
  6949. if (Array.isArray(modifiers)) {
  6950. if (modifiers.indexOf('trim') !== -1) {
  6951. value = value.trim();
  6952. }
  6953. if (modifiers.indexOf('number') !== -1) {
  6954. value = this._n(value);
  6955. }
  6956. }
  6957. if (!target) {
  6958. target = this;
  6959. }
  6960. target[key] = value;
  6961. };
  6962. Vue.prototype.__set_sync = function(target, key, value) {
  6963. if (!target) {
  6964. target = this;
  6965. }
  6966. target[key] = value;
  6967. };
  6968. Vue.prototype.__get_orig = function(item) {
  6969. if (isPlainObject(item)) {
  6970. return item['$orig'] || item
  6971. }
  6972. return item
  6973. };
  6974. Vue.prototype.__get_value = function(dataPath, target) {
  6975. return getTarget(target || this, dataPath)
  6976. };
  6977. Vue.prototype.__get_class = function(dynamicClass, staticClass) {
  6978. return renderClass(staticClass, dynamicClass)
  6979. };
  6980. Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
  6981. if (!dynamicStyle && !staticStyle) {
  6982. return ''
  6983. }
  6984. var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
  6985. var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
  6986. return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
  6987. };
  6988. Vue.prototype.__map = function(val, iteratee) {
  6989. //TODO 暂不考虑 string
  6990. var ret, i, l, keys, key;
  6991. if (Array.isArray(val)) {
  6992. ret = new Array(val.length);
  6993. for (i = 0, l = val.length; i < l; i++) {
  6994. ret[i] = iteratee(val[i], i);
  6995. }
  6996. return ret
  6997. } else if (isObject(val)) {
  6998. keys = Object.keys(val);
  6999. ret = Object.create(null);
  7000. for (i = 0, l = keys.length; i < l; i++) {
  7001. key = keys[i];
  7002. ret[key] = iteratee(val[key], key, i);
  7003. }
  7004. return ret
  7005. } else if (typeof val === 'number') {
  7006. ret = new Array(val);
  7007. for (i = 0, l = val; i < l; i++) {
  7008. // 第一个参数暂时仍和小程序一致
  7009. ret[i] = iteratee(i, i);
  7010. }
  7011. return ret
  7012. }
  7013. return []
  7014. };
  7015. }
  7016. /* */
  7017. var LIFECYCLE_HOOKS$1 = [
  7018. //App
  7019. 'onLaunch',
  7020. 'onShow',
  7021. 'onHide',
  7022. 'onUniNViewMessage',
  7023. 'onPageNotFound',
  7024. 'onThemeChange',
  7025. 'onError',
  7026. 'onUnhandledRejection',
  7027. //Page
  7028. 'onLoad',
  7029. // 'onShow',
  7030. 'onReady',
  7031. // 'onHide',
  7032. 'onUnload',
  7033. 'onPullDownRefresh',
  7034. 'onReachBottom',
  7035. 'onTabItemTap',
  7036. 'onAddToFavorites',
  7037. 'onShareTimeline',
  7038. 'onShareAppMessage',
  7039. 'onResize',
  7040. 'onPageScroll',
  7041. 'onNavigationBarButtonTap',
  7042. 'onBackPress',
  7043. 'onNavigationBarSearchInputChanged',
  7044. 'onNavigationBarSearchInputConfirmed',
  7045. 'onNavigationBarSearchInputClicked',
  7046. //Component
  7047. // 'onReady', // 兼容旧版本,应该移除该事件
  7048. 'onPageShow',
  7049. 'onPageHide',
  7050. 'onPageResize'
  7051. ];
  7052. function lifecycleMixin$1(Vue) {
  7053. //fixed vue-class-component
  7054. var oldExtend = Vue.extend;
  7055. Vue.extend = function(extendOptions) {
  7056. extendOptions = extendOptions || {};
  7057. var methods = extendOptions.methods;
  7058. if (methods) {
  7059. Object.keys(methods).forEach(function (methodName) {
  7060. if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
  7061. extendOptions[methodName] = methods[methodName];
  7062. delete methods[methodName];
  7063. }
  7064. });
  7065. }
  7066. return oldExtend.call(this, extendOptions)
  7067. };
  7068. var strategies = Vue.config.optionMergeStrategies;
  7069. var mergeHook = strategies.created;
  7070. LIFECYCLE_HOOKS$1.forEach(function (hook) {
  7071. strategies[hook] = mergeHook;
  7072. });
  7073. Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
  7074. }
  7075. /* */
  7076. // install platform patch function
  7077. Vue.prototype.__patch__ = patch;
  7078. // public mount method
  7079. Vue.prototype.$mount = function(
  7080. el ,
  7081. hydrating
  7082. ) {
  7083. return mountComponent$1(this, el, hydrating)
  7084. };
  7085. lifecycleMixin$1(Vue);
  7086. internalMixin(Vue);
  7087. /* */
  7088. /* harmony default export */ __webpack_exports__["default"] = (Vue);
  7089. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ 3)))
  7090. /***/ }),
  7091. /***/ 3:
  7092. /*!***********************************!*\
  7093. !*** (webpack)/buildin/global.js ***!
  7094. \***********************************/
  7095. /*! no static exports found */
  7096. /***/ (function(module, exports) {
  7097. var g;
  7098. // This works in non-strict mode
  7099. g = (function() {
  7100. return this;
  7101. })();
  7102. try {
  7103. // This works if eval is allowed (see CSP)
  7104. g = g || new Function("return this")();
  7105. } catch (e) {
  7106. // This works if the window reference is available
  7107. if (typeof window === "object") g = window;
  7108. }
  7109. // g can still be undefined, but nothing to do about it...
  7110. // We return undefined, instead of nothing here, so it's
  7111. // easier to handle this case. if(!global) { ...}
  7112. module.exports = g;
  7113. /***/ }),
  7114. /***/ 4:
  7115. /*!***************************************************!*\
  7116. !*** /Users/mead/Code/vue/epidemic-h5/pages.json ***!
  7117. \***************************************************/
  7118. /*! no static exports found */
  7119. /***/ (function(module, exports) {
  7120. /***/ }),
  7121. /***/ 40:
  7122. /*!***************************************************************!*\
  7123. !*** /Users/mead/Code/vue/epidemic-h5/static/html/js/test.js ***!
  7124. \***************************************************************/
  7125. /*! no static exports found */
  7126. /***/ (function(module, exports, __webpack_require__) {
  7127. /* WEBPACK VAR INJECTION */(function(global) {var require;var require;/*
  7128. html2canvas 0.5.0-beta4 <http://html2canvas.hertzen.com>
  7129. Copyright (c) 2017 Niklas von Hertzen
  7130. 2017-06-14 Custom build by Erik Koopmans, featuring latest bugfixes and features
  7131. Released under MIT License
  7132. */
  7133. (function (f) {if (true) {module.exports = f();} else { var g; }})(function () {var define, module, exports;return function e(t, n, r) {function s(o, u) {if (!n[o]) {if (!t[o]) {var a = typeof require == "function" && require;if (!u && a) return require(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;}var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {var n = t[o][1][e];return s(n ? n : e);}, l, l.exports, e, t, n, r);}return n[o].exports;}var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {s(r[o]);}return s;}({ 1: [function (_dereq_, module, exports) {
  7134. (function (global) {
  7135. /*! https://mths.be/punycode v1.4.1 by @mathias */
  7136. ;(function (root) {
  7137. /** Detect free variables */
  7138. var freeExports = typeof exports == 'object' && exports &&
  7139. !exports.nodeType && exports;
  7140. var freeModule = typeof module == 'object' && module &&
  7141. !module.nodeType && module;
  7142. var freeGlobal = typeof global == 'object' && global;
  7143. if (
  7144. freeGlobal.global === freeGlobal ||
  7145. freeGlobal.window === freeGlobal ||
  7146. freeGlobal.self === freeGlobal)
  7147. {
  7148. root = freeGlobal;
  7149. }
  7150. /**
  7151. * The `punycode` object.
  7152. * @name punycode
  7153. * @type Object
  7154. */
  7155. var punycode,
  7156. /** Highest positive signed 32-bit float value */
  7157. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  7158. /** Bootstring parameters */
  7159. base = 36,
  7160. tMin = 1,
  7161. tMax = 26,
  7162. skew = 38,
  7163. damp = 700,
  7164. initialBias = 72,
  7165. initialN = 128, // 0x80
  7166. delimiter = '-', // '\x2D'
  7167. /** Regular expressions */
  7168. regexPunycode = /^xn--/,
  7169. regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  7170. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  7171. /** Error messages */
  7172. errors = {
  7173. 'overflow': 'Overflow: input needs wider integers to process',
  7174. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  7175. 'invalid-input': 'Invalid input' },
  7176. /** Convenience shortcuts */
  7177. baseMinusTMin = base - tMin,
  7178. floor = Math.floor,
  7179. stringFromCharCode = String.fromCharCode,
  7180. /** Temporary variable */
  7181. key;
  7182. /*--------------------------------------------------------------------------*/
  7183. /**
  7184. * A generic error utility function.
  7185. * @private
  7186. * @param {String} type The error type.
  7187. * @returns {Error} Throws a `RangeError` with the applicable error message.
  7188. */
  7189. function error(type) {
  7190. throw new RangeError(errors[type]);
  7191. }
  7192. /**
  7193. * A generic `Array#map` utility function.
  7194. * @private
  7195. * @param {Array} array The array to iterate over.
  7196. * @param {Function} callback The function that gets called for every array
  7197. * item.
  7198. * @returns {Array} A new array of values returned by the callback function.
  7199. */
  7200. function map(array, fn) {
  7201. var length = array.length;
  7202. var result = [];
  7203. while (length--) {
  7204. result[length] = fn(array[length]);
  7205. }
  7206. return result;
  7207. }
  7208. /**
  7209. * A simple `Array#map`-like wrapper to work with domain name strings or email
  7210. * addresses.
  7211. * @private
  7212. * @param {String} domain The domain name or email address.
  7213. * @param {Function} callback The function that gets called for every
  7214. * character.
  7215. * @returns {Array} A new string of characters returned by the callback
  7216. * function.
  7217. */
  7218. function mapDomain(string, fn) {
  7219. var parts = string.split('@');
  7220. var result = '';
  7221. if (parts.length > 1) {
  7222. // In email addresses, only the domain name should be punycoded. Leave
  7223. // the local part (i.e. everything up to `@`) intact.
  7224. result = parts[0] + '@';
  7225. string = parts[1];
  7226. }
  7227. // Avoid `split(regex)` for IE8 compatibility. See #17.
  7228. string = string.replace(regexSeparators, '\x2E');
  7229. var labels = string.split('.');
  7230. var encoded = map(labels, fn).join('.');
  7231. return result + encoded;
  7232. }
  7233. /**
  7234. * Creates an array containing the numeric code points of each Unicode
  7235. * character in the string. While JavaScript uses UCS-2 internally,
  7236. * this function will convert a pair of surrogate halves (each of which
  7237. * UCS-2 exposes as separate characters) into a single code point,
  7238. * matching UTF-16.
  7239. * @see `punycode.ucs2.encode`
  7240. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  7241. * @memberOf punycode.ucs2
  7242. * @name decode
  7243. * @param {String} string The Unicode input string (UCS-2).
  7244. * @returns {Array} The new array of code points.
  7245. */
  7246. function ucs2decode(string) {
  7247. var output = [],
  7248. counter = 0,
  7249. length = string.length,
  7250. value,
  7251. extra;
  7252. while (counter < length) {
  7253. value = string.charCodeAt(counter++);
  7254. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  7255. // high surrogate, and there is a next character
  7256. extra = string.charCodeAt(counter++);
  7257. if ((extra & 0xFC00) == 0xDC00) {// low surrogate
  7258. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  7259. } else {
  7260. // unmatched surrogate; only append this code unit, in case the next
  7261. // code unit is the high surrogate of a surrogate pair
  7262. output.push(value);
  7263. counter--;
  7264. }
  7265. } else {
  7266. output.push(value);
  7267. }
  7268. }
  7269. return output;
  7270. }
  7271. /**
  7272. * Creates a string based on an array of numeric code points.
  7273. * @see `punycode.ucs2.decode`
  7274. * @memberOf punycode.ucs2
  7275. * @name encode
  7276. * @param {Array} codePoints The array of numeric code points.
  7277. * @returns {String} The new Unicode string (UCS-2).
  7278. */
  7279. function ucs2encode(array) {
  7280. return map(array, function (value) {
  7281. var output = '';
  7282. if (value > 0xFFFF) {
  7283. value -= 0x10000;
  7284. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  7285. value = 0xDC00 | value & 0x3FF;
  7286. }
  7287. output += stringFromCharCode(value);
  7288. return output;
  7289. }).join('');
  7290. }
  7291. /**
  7292. * Converts a basic code point into a digit/integer.
  7293. * @see `digitToBasic()`
  7294. * @private
  7295. * @param {Number} codePoint The basic numeric code point value.
  7296. * @returns {Number} The numeric value of a basic code point (for use in
  7297. * representing integers) in the range `0` to `base - 1`, or `base` if
  7298. * the code point does not represent a value.
  7299. */
  7300. function basicToDigit(codePoint) {
  7301. if (codePoint - 48 < 10) {
  7302. return codePoint - 22;
  7303. }
  7304. if (codePoint - 65 < 26) {
  7305. return codePoint - 65;
  7306. }
  7307. if (codePoint - 97 < 26) {
  7308. return codePoint - 97;
  7309. }
  7310. return base;
  7311. }
  7312. /**
  7313. * Converts a digit/integer into a basic code point.
  7314. * @see `basicToDigit()`
  7315. * @private
  7316. * @param {Number} digit The numeric value of a basic code point.
  7317. * @returns {Number} The basic code point whose value (when used for
  7318. * representing integers) is `digit`, which needs to be in the range
  7319. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  7320. * used; else, the lowercase form is used. The behavior is undefined
  7321. * if `flag` is non-zero and `digit` has no uppercase form.
  7322. */
  7323. function digitToBasic(digit, flag) {
  7324. // 0..25 map to ASCII a..z or A..Z
  7325. // 26..35 map to ASCII 0..9
  7326. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  7327. }
  7328. /**
  7329. * Bias adaptation function as per section 3.4 of RFC 3492.
  7330. * https://tools.ietf.org/html/rfc3492#section-3.4
  7331. * @private
  7332. */
  7333. function adapt(delta, numPoints, firstTime) {
  7334. var k = 0;
  7335. delta = firstTime ? floor(delta / damp) : delta >> 1;
  7336. delta += floor(delta / numPoints);
  7337. for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
  7338. delta = floor(delta / baseMinusTMin);
  7339. }
  7340. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  7341. }
  7342. /**
  7343. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  7344. * symbols.
  7345. * @memberOf punycode
  7346. * @param {String} input The Punycode string of ASCII-only symbols.
  7347. * @returns {String} The resulting string of Unicode symbols.
  7348. */
  7349. function decode(input) {
  7350. // Don't use UCS-2
  7351. var output = [],
  7352. inputLength = input.length,
  7353. out,
  7354. i = 0,
  7355. n = initialN,
  7356. bias = initialBias,
  7357. basic,
  7358. j,
  7359. index,
  7360. oldi,
  7361. w,
  7362. k,
  7363. digit,
  7364. t,
  7365. /** Cached calculation results */
  7366. baseMinusT;
  7367. // Handle the basic code points: let `basic` be the number of input code
  7368. // points before the last delimiter, or `0` if there is none, then copy
  7369. // the first basic code points to the output.
  7370. basic = input.lastIndexOf(delimiter);
  7371. if (basic < 0) {
  7372. basic = 0;
  7373. }
  7374. for (j = 0; j < basic; ++j) {
  7375. // if it's not a basic code point
  7376. if (input.charCodeAt(j) >= 0x80) {
  7377. error('not-basic');
  7378. }
  7379. output.push(input.charCodeAt(j));
  7380. }
  7381. // Main decoding loop: start just after the last delimiter if any basic code
  7382. // points were copied; start at the beginning otherwise.
  7383. for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
  7384. // `index` is the index of the next character to be consumed.
  7385. // Decode a generalized variable-length integer into `delta`,
  7386. // which gets added to `i`. The overflow checking is easier
  7387. // if we increase `i` as we go, then subtract off its starting
  7388. // value at the end to obtain `delta`.
  7389. for (oldi = i, w = 1, k = base;; /* no condition */k += base) {
  7390. if (index >= inputLength) {
  7391. error('invalid-input');
  7392. }
  7393. digit = basicToDigit(input.charCodeAt(index++));
  7394. if (digit >= base || digit > floor((maxInt - i) / w)) {
  7395. error('overflow');
  7396. }
  7397. i += digit * w;
  7398. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  7399. if (digit < t) {
  7400. break;
  7401. }
  7402. baseMinusT = base - t;
  7403. if (w > floor(maxInt / baseMinusT)) {
  7404. error('overflow');
  7405. }
  7406. w *= baseMinusT;
  7407. }
  7408. out = output.length + 1;
  7409. bias = adapt(i - oldi, out, oldi == 0);
  7410. // `i` was supposed to wrap around from `out` to `0`,
  7411. // incrementing `n` each time, so we'll fix that now:
  7412. if (floor(i / out) > maxInt - n) {
  7413. error('overflow');
  7414. }
  7415. n += floor(i / out);
  7416. i %= out;
  7417. // Insert `n` at position `i` of the output
  7418. output.splice(i++, 0, n);
  7419. }
  7420. return ucs2encode(output);
  7421. }
  7422. /**
  7423. * Converts a string of Unicode symbols (e.g. a domain name label) to a
  7424. * Punycode string of ASCII-only symbols.
  7425. * @memberOf punycode
  7426. * @param {String} input The string of Unicode symbols.
  7427. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  7428. */
  7429. function encode(input) {
  7430. var n,
  7431. delta,
  7432. handledCPCount,
  7433. basicLength,
  7434. bias,
  7435. j,
  7436. m,
  7437. q,
  7438. k,
  7439. t,
  7440. currentValue,
  7441. output = [],
  7442. /** `inputLength` will hold the number of code points in `input`. */
  7443. inputLength,
  7444. /** Cached calculation results */
  7445. handledCPCountPlusOne,
  7446. baseMinusT,
  7447. qMinusT;
  7448. // Convert the input in UCS-2 to Unicode
  7449. input = ucs2decode(input);
  7450. // Cache the length
  7451. inputLength = input.length;
  7452. // Initialize the state
  7453. n = initialN;
  7454. delta = 0;
  7455. bias = initialBias;
  7456. // Handle the basic code points
  7457. for (j = 0; j < inputLength; ++j) {
  7458. currentValue = input[j];
  7459. if (currentValue < 0x80) {
  7460. output.push(stringFromCharCode(currentValue));
  7461. }
  7462. }
  7463. handledCPCount = basicLength = output.length;
  7464. // `handledCPCount` is the number of code points that have been handled;
  7465. // `basicLength` is the number of basic code points.
  7466. // Finish the basic string - if it is not empty - with a delimiter
  7467. if (basicLength) {
  7468. output.push(delimiter);
  7469. }
  7470. // Main encoding loop:
  7471. while (handledCPCount < inputLength) {
  7472. // All non-basic code points < n have been handled already. Find the next
  7473. // larger one:
  7474. for (m = maxInt, j = 0; j < inputLength; ++j) {
  7475. currentValue = input[j];
  7476. if (currentValue >= n && currentValue < m) {
  7477. m = currentValue;
  7478. }
  7479. }
  7480. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  7481. // but guard against overflow
  7482. handledCPCountPlusOne = handledCPCount + 1;
  7483. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  7484. error('overflow');
  7485. }
  7486. delta += (m - n) * handledCPCountPlusOne;
  7487. n = m;
  7488. for (j = 0; j < inputLength; ++j) {
  7489. currentValue = input[j];
  7490. if (currentValue < n && ++delta > maxInt) {
  7491. error('overflow');
  7492. }
  7493. if (currentValue == n) {
  7494. // Represent delta as a generalized variable-length integer
  7495. for (q = delta, k = base;; /* no condition */k += base) {
  7496. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  7497. if (q < t) {
  7498. break;
  7499. }
  7500. qMinusT = q - t;
  7501. baseMinusT = base - t;
  7502. output.push(
  7503. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
  7504. q = floor(qMinusT / baseMinusT);
  7505. }
  7506. output.push(stringFromCharCode(digitToBasic(q, 0)));
  7507. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  7508. delta = 0;
  7509. ++handledCPCount;
  7510. }
  7511. }
  7512. ++delta;
  7513. ++n;
  7514. }
  7515. return output.join('');
  7516. }
  7517. /**
  7518. * Converts a Punycode string representing a domain name or an email address
  7519. * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  7520. * it doesn't matter if you call it on a string that has already been
  7521. * converted to Unicode.
  7522. * @memberOf punycode
  7523. * @param {String} input The Punycoded domain name or email address to
  7524. * convert to Unicode.
  7525. * @returns {String} The Unicode representation of the given Punycode
  7526. * string.
  7527. */
  7528. function toUnicode(input) {
  7529. return mapDomain(input, function (string) {
  7530. return regexPunycode.test(string) ?
  7531. decode(string.slice(4).toLowerCase()) :
  7532. string;
  7533. });
  7534. }
  7535. /**
  7536. * Converts a Unicode string representing a domain name or an email address to
  7537. * Punycode. Only the non-ASCII parts of the domain name will be converted,
  7538. * i.e. it doesn't matter if you call it with a domain that's already in
  7539. * ASCII.
  7540. * @memberOf punycode
  7541. * @param {String} input The domain name or email address to convert, as a
  7542. * Unicode string.
  7543. * @returns {String} The Punycode representation of the given domain name or
  7544. * email address.
  7545. */
  7546. function toASCII(input) {
  7547. return mapDomain(input, function (string) {
  7548. return regexNonASCII.test(string) ?
  7549. 'xn--' + encode(string) :
  7550. string;
  7551. });
  7552. }
  7553. /*--------------------------------------------------------------------------*/
  7554. /** Define the public API */
  7555. punycode = {
  7556. /**
  7557. * A string representing the current Punycode.js version number.
  7558. * @memberOf punycode
  7559. * @type String
  7560. */
  7561. 'version': '1.4.1',
  7562. /**
  7563. * An object of methods to convert from JavaScript's internal character
  7564. * representation (UCS-2) to Unicode code points, and back.
  7565. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  7566. * @memberOf punycode
  7567. * @type Object
  7568. */
  7569. 'ucs2': {
  7570. 'decode': ucs2decode,
  7571. 'encode': ucs2encode },
  7572. 'decode': decode,
  7573. 'encode': encode,
  7574. 'toASCII': toASCII,
  7575. 'toUnicode': toUnicode };
  7576. /** Expose `punycode` */
  7577. // Some AMD build optimizers, like r.js, check for specific condition patterns
  7578. // like the following:
  7579. if (
  7580. typeof define == 'function' &&
  7581. typeof define.amd == 'object' &&
  7582. define.amd)
  7583. {
  7584. define('punycode', function () {
  7585. return punycode;
  7586. });
  7587. } else if (freeExports && freeModule) {
  7588. if (module.exports == freeExports) {
  7589. // in Node.js, io.js, or RingoJS v0.8.0+
  7590. freeModule.exports = punycode;
  7591. } else {
  7592. // in Narwhal or RingoJS v0.7.0-
  7593. for (key in punycode) {
  7594. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  7595. }
  7596. }
  7597. } else {
  7598. // in Rhino or a web browser
  7599. root.punycode = punycode;
  7600. }
  7601. })(this);
  7602. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  7603. }, {}], 2: [function (_dereq_, module, exports) {
  7604. var log = _dereq_('./log');
  7605. function restoreOwnerScroll(ownerDocument, x, y) {
  7606. if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
  7607. ownerDocument.defaultView.scrollTo(x, y);
  7608. }
  7609. }
  7610. function cloneCanvasContents(canvas, clonedCanvas) {
  7611. try {
  7612. if (clonedCanvas) {
  7613. clonedCanvas.width = canvas.width;
  7614. clonedCanvas.height = canvas.height;
  7615. clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0);
  7616. }
  7617. } catch (e) {
  7618. log("Unable to copy canvas content from", canvas, e);
  7619. }
  7620. }
  7621. function cloneNode(node, javascriptEnabled) {
  7622. var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
  7623. var child = node.firstChild;
  7624. while (child) {
  7625. if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
  7626. clone.appendChild(cloneNode(child, javascriptEnabled));
  7627. }
  7628. child = child.nextSibling;
  7629. }
  7630. if (node.nodeType === 1) {
  7631. clone._scrollTop = node.scrollTop;
  7632. clone._scrollLeft = node.scrollLeft;
  7633. if (node.nodeName === "CANVAS") {
  7634. cloneCanvasContents(node, clone);
  7635. } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") {
  7636. clone.value = node.value;
  7637. }
  7638. }
  7639. return clone;
  7640. }
  7641. function initNode(node) {
  7642. if (node.nodeType === 1) {
  7643. node.scrollTop = node._scrollTop;
  7644. node.scrollLeft = node._scrollLeft;
  7645. var child = node.firstChild;
  7646. while (child) {
  7647. initNode(child);
  7648. child = child.nextSibling;
  7649. }
  7650. }
  7651. }
  7652. module.exports = function (ownerDocument, containerDocument, width, height, options, x, y) {
  7653. var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled);
  7654. var container = containerDocument.createElement("iframe");
  7655. container.className = "html2canvas-container";
  7656. container.style.visibility = "hidden";
  7657. container.style.position = "fixed";
  7658. container.style.left = "-10000px";
  7659. container.style.top = "0px";
  7660. container.style.border = "0";
  7661. container.width = width;
  7662. container.height = height;
  7663. container.scrolling = "no"; // ios won't scroll without it
  7664. containerDocument.body.appendChild(container);
  7665. return new Promise(function (resolve) {
  7666. var documentClone = container.contentWindow.document;
  7667. /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
  7668. if window url is about:blank, we can assign the url to current by writing onto the document
  7669. */
  7670. container.contentWindow.onload = container.onload = function () {
  7671. var interval = setInterval(function () {
  7672. if (documentClone.body.childNodes.length > 0) {
  7673. initNode(documentClone.documentElement);
  7674. clearInterval(interval);
  7675. if (options.type === "view") {
  7676. container.contentWindow.scrollTo(x, y);
  7677. if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (container.contentWindow.scrollY !== y || container.contentWindow.scrollX !== x)) {
  7678. documentClone.documentElement.style.top = -y + "px";
  7679. documentClone.documentElement.style.left = -x + "px";
  7680. documentClone.documentElement.style.position = 'absolute';
  7681. }
  7682. }
  7683. resolve(container);
  7684. }
  7685. }, 50);
  7686. };
  7687. documentClone.open();
  7688. documentClone.write("<!DOCTYPE html><html></html>");
  7689. // Chrome scrolls the parent document for some reason after the write to the cloned window???
  7690. restoreOwnerScroll(ownerDocument, x, y);
  7691. documentClone.replaceChild(documentClone.adoptNode(documentElement), documentClone.documentElement);
  7692. documentClone.close();
  7693. });
  7694. };
  7695. }, { "./log": 13 }], 3: [function (_dereq_, module, exports) {
  7696. // http://dev.w3.org/csswg/css-color/
  7697. function Color(value) {
  7698. this.r = 0;
  7699. this.g = 0;
  7700. this.b = 0;
  7701. this.a = null;
  7702. var result = this.fromArray(value) ||
  7703. this.namedColor(value) ||
  7704. this.rgb(value) ||
  7705. this.rgba(value) ||
  7706. this.hex6(value) ||
  7707. this.hex3(value);
  7708. }
  7709. Color.prototype.darken = function (amount) {
  7710. var a = 1 - amount;
  7711. return new Color([
  7712. Math.round(this.r * a),
  7713. Math.round(this.g * a),
  7714. Math.round(this.b * a),
  7715. this.a]);
  7716. };
  7717. Color.prototype.isTransparent = function () {
  7718. return this.a === 0;
  7719. };
  7720. Color.prototype.isBlack = function () {
  7721. return this.r === 0 && this.g === 0 && this.b === 0;
  7722. };
  7723. Color.prototype.fromArray = function (array) {
  7724. if (Array.isArray(array)) {
  7725. this.r = Math.min(array[0], 255);
  7726. this.g = Math.min(array[1], 255);
  7727. this.b = Math.min(array[2], 255);
  7728. if (array.length > 3) {
  7729. this.a = array[3];
  7730. }
  7731. }
  7732. return Array.isArray(array);
  7733. };
  7734. var _hex3 = /^#([a-f0-9]{3})$/i;
  7735. Color.prototype.hex3 = function (value) {
  7736. var match = null;
  7737. if ((match = value.match(_hex3)) !== null) {
  7738. this.r = parseInt(match[1][0] + match[1][0], 16);
  7739. this.g = parseInt(match[1][1] + match[1][1], 16);
  7740. this.b = parseInt(match[1][2] + match[1][2], 16);
  7741. }
  7742. return match !== null;
  7743. };
  7744. var _hex6 = /^#([a-f0-9]{6})$/i;
  7745. Color.prototype.hex6 = function (value) {
  7746. var match = null;
  7747. if ((match = value.match(_hex6)) !== null) {
  7748. this.r = parseInt(match[1].substring(0, 2), 16);
  7749. this.g = parseInt(match[1].substring(2, 4), 16);
  7750. this.b = parseInt(match[1].substring(4, 6), 16);
  7751. }
  7752. return match !== null;
  7753. };
  7754. var _rgb = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;
  7755. Color.prototype.rgb = function (value) {
  7756. var match = null;
  7757. if ((match = value.match(_rgb)) !== null) {
  7758. this.r = Number(match[1]);
  7759. this.g = Number(match[2]);
  7760. this.b = Number(match[3]);
  7761. }
  7762. return match !== null;
  7763. };
  7764. var _rgba = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;
  7765. Color.prototype.rgba = function (value) {
  7766. var match = null;
  7767. if ((match = value.match(_rgba)) !== null) {
  7768. this.r = Number(match[1]);
  7769. this.g = Number(match[2]);
  7770. this.b = Number(match[3]);
  7771. this.a = Number(match[4]);
  7772. }
  7773. return match !== null;
  7774. };
  7775. Color.prototype.toString = function () {
  7776. return this.a !== null && this.a !== 1 ?
  7777. "rgba(" + [this.r, this.g, this.b, this.a].join(",") + ")" :
  7778. "rgb(" + [this.r, this.g, this.b].join(",") + ")";
  7779. };
  7780. Color.prototype.namedColor = function (value) {
  7781. value = value.toLowerCase();
  7782. var color = colors[value];
  7783. if (color) {
  7784. this.r = color[0];
  7785. this.g = color[1];
  7786. this.b = color[2];
  7787. } else if (value === "transparent") {
  7788. this.r = this.g = this.b = this.a = 0;
  7789. return true;
  7790. }
  7791. return !!color;
  7792. };
  7793. Color.prototype.isColor = true;
  7794. // JSON.stringify([].slice.call($$('.named-color-table tr'), 1).map(function(row) { return [row.childNodes[3].textContent, row.childNodes[5].textContent.trim().split(",").map(Number)] }).reduce(function(data, row) {data[row[0]] = row[1]; return data}, {}))
  7795. var colors = {
  7796. "aliceblue": [240, 248, 255],
  7797. "antiquewhite": [250, 235, 215],
  7798. "aqua": [0, 255, 255],
  7799. "aquamarine": [127, 255, 212],
  7800. "azure": [240, 255, 255],
  7801. "beige": [245, 245, 220],
  7802. "bisque": [255, 228, 196],
  7803. "black": [0, 0, 0],
  7804. "blanchedalmond": [255, 235, 205],
  7805. "blue": [0, 0, 255],
  7806. "blueviolet": [138, 43, 226],
  7807. "brown": [165, 42, 42],
  7808. "burlywood": [222, 184, 135],
  7809. "cadetblue": [95, 158, 160],
  7810. "chartreuse": [127, 255, 0],
  7811. "chocolate": [210, 105, 30],
  7812. "coral": [255, 127, 80],
  7813. "cornflowerblue": [100, 149, 237],
  7814. "cornsilk": [255, 248, 220],
  7815. "crimson": [220, 20, 60],
  7816. "cyan": [0, 255, 255],
  7817. "darkblue": [0, 0, 139],
  7818. "darkcyan": [0, 139, 139],
  7819. "darkgoldenrod": [184, 134, 11],
  7820. "darkgray": [169, 169, 169],
  7821. "darkgreen": [0, 100, 0],
  7822. "darkgrey": [169, 169, 169],
  7823. "darkkhaki": [189, 183, 107],
  7824. "darkmagenta": [139, 0, 139],
  7825. "darkolivegreen": [85, 107, 47],
  7826. "darkorange": [255, 140, 0],
  7827. "darkorchid": [153, 50, 204],
  7828. "darkred": [139, 0, 0],
  7829. "darksalmon": [233, 150, 122],
  7830. "darkseagreen": [143, 188, 143],
  7831. "darkslateblue": [72, 61, 139],
  7832. "darkslategray": [47, 79, 79],
  7833. "darkslategrey": [47, 79, 79],
  7834. "darkturquoise": [0, 206, 209],
  7835. "darkviolet": [148, 0, 211],
  7836. "deeppink": [255, 20, 147],
  7837. "deepskyblue": [0, 191, 255],
  7838. "dimgray": [105, 105, 105],
  7839. "dimgrey": [105, 105, 105],
  7840. "dodgerblue": [30, 144, 255],
  7841. "firebrick": [178, 34, 34],
  7842. "floralwhite": [255, 250, 240],
  7843. "forestgreen": [34, 139, 34],
  7844. "fuchsia": [255, 0, 255],
  7845. "gainsboro": [220, 220, 220],
  7846. "ghostwhite": [248, 248, 255],
  7847. "gold": [255, 215, 0],
  7848. "goldenrod": [218, 165, 32],
  7849. "gray": [128, 128, 128],
  7850. "green": [0, 128, 0],
  7851. "greenyellow": [173, 255, 47],
  7852. "grey": [128, 128, 128],
  7853. "honeydew": [240, 255, 240],
  7854. "hotpink": [255, 105, 180],
  7855. "indianred": [205, 92, 92],
  7856. "indigo": [75, 0, 130],
  7857. "ivory": [255, 255, 240],
  7858. "khaki": [240, 230, 140],
  7859. "lavender": [230, 230, 250],
  7860. "lavenderblush": [255, 240, 245],
  7861. "lawngreen": [124, 252, 0],
  7862. "lemonchiffon": [255, 250, 205],
  7863. "lightblue": [173, 216, 230],
  7864. "lightcoral": [240, 128, 128],
  7865. "lightcyan": [224, 255, 255],
  7866. "lightgoldenrodyellow": [250, 250, 210],
  7867. "lightgray": [211, 211, 211],
  7868. "lightgreen": [144, 238, 144],
  7869. "lightgrey": [211, 211, 211],
  7870. "lightpink": [255, 182, 193],
  7871. "lightsalmon": [255, 160, 122],
  7872. "lightseagreen": [32, 178, 170],
  7873. "lightskyblue": [135, 206, 250],
  7874. "lightslategray": [119, 136, 153],
  7875. "lightslategrey": [119, 136, 153],
  7876. "lightsteelblue": [176, 196, 222],
  7877. "lightyellow": [255, 255, 224],
  7878. "lime": [0, 255, 0],
  7879. "limegreen": [50, 205, 50],
  7880. "linen": [250, 240, 230],
  7881. "magenta": [255, 0, 255],
  7882. "maroon": [128, 0, 0],
  7883. "mediumaquamarine": [102, 205, 170],
  7884. "mediumblue": [0, 0, 205],
  7885. "mediumorchid": [186, 85, 211],
  7886. "mediumpurple": [147, 112, 219],
  7887. "mediumseagreen": [60, 179, 113],
  7888. "mediumslateblue": [123, 104, 238],
  7889. "mediumspringgreen": [0, 250, 154],
  7890. "mediumturquoise": [72, 209, 204],
  7891. "mediumvioletred": [199, 21, 133],
  7892. "midnightblue": [25, 25, 112],
  7893. "mintcream": [245, 255, 250],
  7894. "mistyrose": [255, 228, 225],
  7895. "moccasin": [255, 228, 181],
  7896. "navajowhite": [255, 222, 173],
  7897. "navy": [0, 0, 128],
  7898. "oldlace": [253, 245, 230],
  7899. "olive": [128, 128, 0],
  7900. "olivedrab": [107, 142, 35],
  7901. "orange": [255, 165, 0],
  7902. "orangered": [255, 69, 0],
  7903. "orchid": [218, 112, 214],
  7904. "palegoldenrod": [238, 232, 170],
  7905. "palegreen": [152, 251, 152],
  7906. "paleturquoise": [175, 238, 238],
  7907. "palevioletred": [219, 112, 147],
  7908. "papayawhip": [255, 239, 213],
  7909. "peachpuff": [255, 218, 185],
  7910. "peru": [205, 133, 63],
  7911. "pink": [255, 192, 203],
  7912. "plum": [221, 160, 221],
  7913. "powderblue": [176, 224, 230],
  7914. "purple": [128, 0, 128],
  7915. "rebeccapurple": [102, 51, 153],
  7916. "red": [255, 0, 0],
  7917. "rosybrown": [188, 143, 143],
  7918. "royalblue": [65, 105, 225],
  7919. "saddlebrown": [139, 69, 19],
  7920. "salmon": [250, 128, 114],
  7921. "sandybrown": [244, 164, 96],
  7922. "seagreen": [46, 139, 87],
  7923. "seashell": [255, 245, 238],
  7924. "sienna": [160, 82, 45],
  7925. "silver": [192, 192, 192],
  7926. "skyblue": [135, 206, 235],
  7927. "slateblue": [106, 90, 205],
  7928. "slategray": [112, 128, 144],
  7929. "slategrey": [112, 128, 144],
  7930. "snow": [255, 250, 250],
  7931. "springgreen": [0, 255, 127],
  7932. "steelblue": [70, 130, 180],
  7933. "tan": [210, 180, 140],
  7934. "teal": [0, 128, 128],
  7935. "thistle": [216, 191, 216],
  7936. "tomato": [255, 99, 71],
  7937. "turquoise": [64, 224, 208],
  7938. "violet": [238, 130, 238],
  7939. "wheat": [245, 222, 179],
  7940. "white": [255, 255, 255],
  7941. "whitesmoke": [245, 245, 245],
  7942. "yellow": [255, 255, 0],
  7943. "yellowgreen": [154, 205, 50] };
  7944. module.exports = Color;
  7945. }, {}], 4: [function (_dereq_, module, exports) {
  7946. var Support = _dereq_('./support');
  7947. var CanvasRenderer = _dereq_('./renderers/canvas');
  7948. var ImageLoader = _dereq_('./imageloader');
  7949. var NodeParser = _dereq_('./nodeparser');
  7950. var NodeContainer = _dereq_('./nodecontainer');
  7951. var log = _dereq_('./log');
  7952. var utils = _dereq_('./utils');
  7953. var createWindowClone = _dereq_('./clone');
  7954. var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;
  7955. var getBounds = utils.getBounds;
  7956. var html2canvasNodeAttribute = "data-html2canvas-node";
  7957. var html2canvasCloneIndex = 0;
  7958. function html2canvas(nodeList, options) {
  7959. var index = html2canvasCloneIndex++;
  7960. options = options || {};
  7961. if (options.logging) {
  7962. log.options.logging = true;
  7963. log.options.start = Date.now();
  7964. }
  7965. options.async = typeof options.async === "undefined" ? true : options.async;
  7966. options.allowTaint = typeof options.allowTaint === "undefined" ? false : options.allowTaint;
  7967. options.removeContainer = typeof options.removeContainer === "undefined" ? true : options.removeContainer;
  7968. options.javascriptEnabled = typeof options.javascriptEnabled === "undefined" ? false : options.javascriptEnabled;
  7969. options.imageTimeout = typeof options.imageTimeout === "undefined" ? 10000 : options.imageTimeout;
  7970. options.renderer = typeof options.renderer === "function" ? options.renderer : CanvasRenderer;
  7971. options.strict = !!options.strict;
  7972. if (typeof nodeList === "string") {
  7973. if (typeof options.proxy !== "string") {
  7974. return Promise.reject("Proxy must be used when rendering url");
  7975. }
  7976. var width = options.width != null ? options.width : window.innerWidth;
  7977. var height = options.height != null ? options.height : window.innerHeight;
  7978. return loadUrlDocument(absoluteUrl(nodeList), options.proxy, document, width, height, options).then(function (container) {
  7979. return renderWindow(container.contentWindow.document.documentElement, container, options, width, height);
  7980. });
  7981. }
  7982. var node = (nodeList === undefined ? [document.documentElement] : nodeList.length ? nodeList : [nodeList])[0];
  7983. node.setAttribute(html2canvasNodeAttribute + index, index);
  7984. return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight, index).then(function (canvas) {
  7985. if (typeof options.onrendered === "function") {
  7986. log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");
  7987. options.onrendered(canvas);
  7988. }
  7989. return canvas;
  7990. });
  7991. }
  7992. html2canvas.CanvasRenderer = CanvasRenderer;
  7993. html2canvas.NodeContainer = NodeContainer;
  7994. html2canvas.log = log;
  7995. html2canvas.utils = utils;
  7996. var html2canvasExport = typeof document === "undefined" || typeof Object.create !== "function" || typeof document.createElement("canvas").getContext !== "function" ? function () {
  7997. return Promise.reject("No canvas support");
  7998. } : html2canvas;
  7999. module.exports = html2canvasExport;
  8000. if (typeof define === 'function' && define.amd) {
  8001. define('html2canvas', [], function () {
  8002. return html2canvasExport;
  8003. });
  8004. }
  8005. function renderDocument(document, options, windowWidth, windowHeight, html2canvasIndex) {
  8006. return createWindowClone(document, document, windowWidth, windowHeight, options, document.defaultView.pageXOffset, document.defaultView.pageYOffset).then(function (container) {
  8007. log("Document cloned");
  8008. var attributeName = html2canvasNodeAttribute + html2canvasIndex;
  8009. var selector = "[" + attributeName + "='" + html2canvasIndex + "']";
  8010. document.querySelector(selector).removeAttribute(attributeName);
  8011. var clonedWindow = container.contentWindow;
  8012. var node = clonedWindow.document.querySelector(selector);
  8013. var oncloneHandler = typeof options.onclone === "function" ? Promise.resolve(options.onclone(clonedWindow.document)) : Promise.resolve(true);
  8014. return oncloneHandler.then(function () {
  8015. return renderWindow(node, container, options, windowWidth, windowHeight);
  8016. });
  8017. });
  8018. }
  8019. function renderWindow(node, container, options, windowWidth, windowHeight) {
  8020. var clonedWindow = container.contentWindow;
  8021. var support = new Support(clonedWindow.document);
  8022. var imageLoader = new ImageLoader(options, support);
  8023. var bounds = getBounds(node);
  8024. var width = options.type === "view" ? windowWidth : bounds.right + 1;
  8025. var height = options.type === "view" ? windowHeight : bounds.bottom + 1;
  8026. var renderer = new options.renderer(width, height, imageLoader, options, document);
  8027. var parser = new NodeParser(node, renderer, support, imageLoader, options);
  8028. return parser.ready.then(function () {
  8029. log("Finished rendering");
  8030. var canvas;
  8031. if (options.type === "view") {
  8032. canvas = crop(renderer.canvas, { width: renderer.canvas.width, height: renderer.canvas.height, top: 0, left: 0, x: 0, y: 0 });
  8033. } else if (node === clonedWindow.document.body || node === clonedWindow.document.documentElement || options.canvas != null) {
  8034. canvas = renderer.canvas;
  8035. } else if (options.scale) {
  8036. var origBounds = { width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: 0, y: 0 };
  8037. var cropBounds = {};
  8038. for (var key in origBounds) {
  8039. if (origBounds.hasOwnProperty(key)) {cropBounds[key] = origBounds[key] * options.scale;}
  8040. }
  8041. canvas = crop(renderer.canvas, cropBounds);
  8042. canvas.style.width = origBounds.width + 'px';
  8043. canvas.style.height = origBounds.height + 'px';
  8044. } else {
  8045. canvas = crop(renderer.canvas, { width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: 0, y: 0 });
  8046. }
  8047. cleanupContainer(container, options);
  8048. return canvas;
  8049. });
  8050. }
  8051. function cleanupContainer(container, options) {
  8052. if (options.removeContainer) {
  8053. container.parentNode.removeChild(container);
  8054. log("Cleaned up container");
  8055. }
  8056. }
  8057. function crop(canvas, bounds) {
  8058. var croppedCanvas = document.createElement("canvas");
  8059. var x1 = Math.min(canvas.width - 1, Math.max(0, bounds.left));
  8060. var x2 = Math.min(canvas.width, Math.max(1, bounds.left + bounds.width));
  8061. var y1 = Math.min(canvas.height - 1, Math.max(0, bounds.top));
  8062. var y2 = Math.min(canvas.height, Math.max(1, bounds.top + bounds.height));
  8063. croppedCanvas.width = bounds.width;
  8064. croppedCanvas.height = bounds.height;
  8065. var width = x2 - x1;
  8066. var height = y2 - y1;
  8067. log("Cropping canvas at:", "left:", bounds.left, "top:", bounds.top, "width:", width, "height:", height);
  8068. log("Resulting crop with width", bounds.width, "and height", bounds.height, "with x", x1, "and y", y1);
  8069. croppedCanvas.getContext("2d").drawImage(canvas, x1, y1, width, height, bounds.x, bounds.y, width, height);
  8070. return croppedCanvas;
  8071. }
  8072. function documentWidth(doc) {
  8073. return Math.max(
  8074. Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth),
  8075. Math.max(doc.body.offsetWidth, doc.documentElement.offsetWidth),
  8076. Math.max(doc.body.clientWidth, doc.documentElement.clientWidth));
  8077. }
  8078. function documentHeight(doc) {
  8079. return Math.max(
  8080. Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight),
  8081. Math.max(doc.body.offsetHeight, doc.documentElement.offsetHeight),
  8082. Math.max(doc.body.clientHeight, doc.documentElement.clientHeight));
  8083. }
  8084. function absoluteUrl(url) {
  8085. var link = document.createElement("a");
  8086. link.href = url;
  8087. link.href = link.href;
  8088. return link;
  8089. }
  8090. }, { "./clone": 2, "./imageloader": 11, "./log": 13, "./nodecontainer": 14, "./nodeparser": 15, "./proxy": 16, "./renderers/canvas": 20, "./support": 22, "./utils": 26 }], 5: [function (_dereq_, module, exports) {
  8091. var log = _dereq_('./log');
  8092. var smallImage = _dereq_('./utils').smallImage;
  8093. function DummyImageContainer(src) {
  8094. this.src = src;
  8095. log("DummyImageContainer for", src);
  8096. if (!this.promise || !this.image) {
  8097. log("Initiating DummyImageContainer");
  8098. DummyImageContainer.prototype.image = new Image();
  8099. var image = this.image;
  8100. DummyImageContainer.prototype.promise = new Promise(function (resolve, reject) {
  8101. image.onload = resolve;
  8102. image.onerror = reject;
  8103. image.src = smallImage();
  8104. if (image.complete === true) {
  8105. resolve(image);
  8106. }
  8107. });
  8108. }
  8109. }
  8110. module.exports = DummyImageContainer;
  8111. }, { "./log": 13, "./utils": 26 }], 6: [function (_dereq_, module, exports) {
  8112. var smallImage = _dereq_('./utils').smallImage;
  8113. function Font(family, size) {
  8114. var container = document.createElement('div'),
  8115. img = document.createElement('img'),
  8116. span = document.createElement('span'),
  8117. sampleText = 'Hidden Text',
  8118. baseline,
  8119. middle;
  8120. container.style.visibility = "hidden";
  8121. container.style.fontFamily = family;
  8122. container.style.fontSize = size;
  8123. container.style.margin = 0;
  8124. container.style.padding = 0;
  8125. document.body.appendChild(container);
  8126. img.src = smallImage();
  8127. img.width = 1;
  8128. img.height = 1;
  8129. img.style.margin = 0;
  8130. img.style.padding = 0;
  8131. img.style.verticalAlign = "baseline";
  8132. span.style.fontFamily = family;
  8133. span.style.fontSize = size;
  8134. span.style.margin = 0;
  8135. span.style.padding = 0;
  8136. span.appendChild(document.createTextNode(sampleText));
  8137. container.appendChild(span);
  8138. container.appendChild(img);
  8139. baseline = img.offsetTop - span.offsetTop + 1;
  8140. container.removeChild(span);
  8141. container.appendChild(document.createTextNode(sampleText));
  8142. container.style.lineHeight = "normal";
  8143. img.style.verticalAlign = "super";
  8144. middle = img.offsetTop - container.offsetTop + 1;
  8145. document.body.removeChild(container);
  8146. this.baseline = baseline;
  8147. this.lineWidth = 1;
  8148. this.middle = middle;
  8149. }
  8150. module.exports = Font;
  8151. }, { "./utils": 26 }], 7: [function (_dereq_, module, exports) {
  8152. var Font = _dereq_('./font');
  8153. function FontMetrics() {
  8154. this.data = {};
  8155. }
  8156. FontMetrics.prototype.getMetrics = function (family, size) {
  8157. if (this.data[family + "-" + size] === undefined) {
  8158. this.data[family + "-" + size] = new Font(family, size);
  8159. }
  8160. return this.data[family + "-" + size];
  8161. };
  8162. module.exports = FontMetrics;
  8163. }, { "./font": 6 }], 8: [function (_dereq_, module, exports) {
  8164. var utils = _dereq_('./utils');
  8165. var getBounds = utils.getBounds;
  8166. var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;
  8167. function FrameContainer(container, sameOrigin, options) {
  8168. this.image = null;
  8169. this.src = container;
  8170. var self = this;
  8171. var bounds = getBounds(container);
  8172. this.promise = (!sameOrigin ? this.proxyLoad(options.proxy, bounds, options) : new Promise(function (resolve) {
  8173. if (container.contentWindow.document.URL === "about:blank" || container.contentWindow.document.documentElement == null) {
  8174. container.contentWindow.onload = container.onload = function () {
  8175. resolve(container);
  8176. };
  8177. } else {
  8178. resolve(container);
  8179. }
  8180. })).then(function (container) {
  8181. var html2canvas = _dereq_('./core');
  8182. return html2canvas(container.contentWindow.document.documentElement, { type: 'view', width: container.width, height: container.height, proxy: options.proxy, javascriptEnabled: options.javascriptEnabled, removeContainer: options.removeContainer, allowTaint: options.allowTaint, imageTimeout: options.imageTimeout / 2 });
  8183. }).then(function (canvas) {
  8184. return self.image = canvas;
  8185. });
  8186. }
  8187. FrameContainer.prototype.proxyLoad = function (proxy, bounds, options) {
  8188. var container = this.src;
  8189. return loadUrlDocument(container.src, proxy, container.ownerDocument, bounds.width, bounds.height, options);
  8190. };
  8191. module.exports = FrameContainer;
  8192. }, { "./core": 4, "./proxy": 16, "./utils": 26 }], 9: [function (_dereq_, module, exports) {
  8193. function GradientContainer(imageData) {
  8194. this.src = imageData.value;
  8195. this.colorStops = [];
  8196. this.type = null;
  8197. this.x0 = 0.5;
  8198. this.y0 = 0.5;
  8199. this.x1 = 0.5;
  8200. this.y1 = 0.5;
  8201. this.promise = Promise.resolve(true);
  8202. }
  8203. GradientContainer.TYPES = {
  8204. LINEAR: 1,
  8205. RADIAL: 2 };
  8206. // TODO: support hsl[a], negative %/length values
  8207. // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )
  8208. GradientContainer.REGEXP_COLORSTOP = /^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i;
  8209. module.exports = GradientContainer;
  8210. }, {}], 10: [function (_dereq_, module, exports) {
  8211. function ImageContainer(src, cors) {
  8212. this.src = src;
  8213. this.image = new Image();
  8214. var self = this;
  8215. this.tainted = null;
  8216. this.promise = new Promise(function (resolve, reject) {
  8217. self.image.onload = resolve;
  8218. self.image.onerror = reject;
  8219. if (cors) {
  8220. self.image.crossOrigin = "anonymous";
  8221. }
  8222. self.image.src = src;
  8223. if (self.image.complete === true) {
  8224. resolve(self.image);
  8225. }
  8226. });
  8227. }
  8228. module.exports = ImageContainer;
  8229. }, {}], 11: [function (_dereq_, module, exports) {
  8230. var log = _dereq_('./log');
  8231. var ImageContainer = _dereq_('./imagecontainer');
  8232. var DummyImageContainer = _dereq_('./dummyimagecontainer');
  8233. var ProxyImageContainer = _dereq_('./proxyimagecontainer');
  8234. var FrameContainer = _dereq_('./framecontainer');
  8235. var SVGContainer = _dereq_('./svgcontainer');
  8236. var SVGNodeContainer = _dereq_('./svgnodecontainer');
  8237. var LinearGradientContainer = _dereq_('./lineargradientcontainer');
  8238. var WebkitGradientContainer = _dereq_('./webkitgradientcontainer');
  8239. var bind = _dereq_('./utils').bind;
  8240. function ImageLoader(options, support) {
  8241. this.link = null;
  8242. this.options = options;
  8243. this.support = support;
  8244. this.origin = this.getOrigin(window.location.href);
  8245. }
  8246. ImageLoader.prototype.findImages = function (nodes) {
  8247. var images = [];
  8248. nodes.reduce(function (imageNodes, container) {
  8249. switch (container.node.nodeName) {
  8250. case "IMG":
  8251. return imageNodes.concat([{
  8252. args: [container.node.src],
  8253. method: "url" }]);
  8254. case "svg":
  8255. case "IFRAME":
  8256. return imageNodes.concat([{
  8257. args: [container.node],
  8258. method: container.node.nodeName }]);}
  8259. return imageNodes;
  8260. }, []).forEach(this.addImage(images, this.loadImage), this);
  8261. return images;
  8262. };
  8263. ImageLoader.prototype.findBackgroundImage = function (images, container) {
  8264. container.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(images, this.loadImage), this);
  8265. return images;
  8266. };
  8267. ImageLoader.prototype.addImage = function (images, callback) {
  8268. return function (newImage) {
  8269. newImage.args.forEach(function (image) {
  8270. if (!this.imageExists(images, image)) {
  8271. images.splice(0, 0, callback.call(this, newImage));
  8272. log('Added image #' + images.length, typeof image === "string" ? image.substring(0, 100) : image);
  8273. }
  8274. }, this);
  8275. };
  8276. };
  8277. ImageLoader.prototype.hasImageBackground = function (imageData) {
  8278. return imageData.method !== "none";
  8279. };
  8280. ImageLoader.prototype.loadImage = function (imageData) {
  8281. if (imageData.method === "url") {
  8282. var src = imageData.args[0];
  8283. if (this.isSVG(src) && !this.support.svg && !this.options.allowTaint) {
  8284. return new SVGContainer(src);
  8285. } else if (src.match(/data:image\/.*;base64,/i)) {
  8286. return new ImageContainer(src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''), false);
  8287. } else if (this.isSameOrigin(src) || this.options.allowTaint === true || this.isSVG(src)) {
  8288. return new ImageContainer(src, false);
  8289. } else if (this.support.cors && !this.options.allowTaint && this.options.useCORS) {
  8290. return new ImageContainer(src, true);
  8291. } else if (this.options.proxy) {
  8292. return new ProxyImageContainer(src, this.options.proxy);
  8293. } else {
  8294. return new DummyImageContainer(src);
  8295. }
  8296. } else if (imageData.method === "linear-gradient") {
  8297. return new LinearGradientContainer(imageData);
  8298. } else if (imageData.method === "gradient") {
  8299. return new WebkitGradientContainer(imageData);
  8300. } else if (imageData.method === "svg") {
  8301. return new SVGNodeContainer(imageData.args[0], this.support.svg);
  8302. } else if (imageData.method === "IFRAME") {
  8303. return new FrameContainer(imageData.args[0], this.isSameOrigin(imageData.args[0].src), this.options);
  8304. } else {
  8305. return new DummyImageContainer(imageData);
  8306. }
  8307. };
  8308. ImageLoader.prototype.isSVG = function (src) {
  8309. return src.substring(src.length - 3).toLowerCase() === "svg" || SVGContainer.prototype.isInline(src);
  8310. };
  8311. ImageLoader.prototype.imageExists = function (images, src) {
  8312. return images.some(function (image) {
  8313. return image.src === src;
  8314. });
  8315. };
  8316. ImageLoader.prototype.isSameOrigin = function (url) {
  8317. return this.getOrigin(url) === this.origin;
  8318. };
  8319. ImageLoader.prototype.getOrigin = function (url) {
  8320. var link = this.link || (this.link = document.createElement("a"));
  8321. link.href = url;
  8322. link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
  8323. return link.protocol + link.hostname + link.port;
  8324. };
  8325. ImageLoader.prototype.getPromise = function (container) {
  8326. return this.timeout(container, this.options.imageTimeout)['catch'](function () {
  8327. var dummy = new DummyImageContainer(container.src);
  8328. return dummy.promise.then(function (image) {
  8329. container.image = image;
  8330. });
  8331. });
  8332. };
  8333. ImageLoader.prototype.get = function (src) {
  8334. var found = null;
  8335. return this.images.some(function (img) {
  8336. return (found = img).src === src;
  8337. }) ? found : null;
  8338. };
  8339. ImageLoader.prototype.fetch = function (nodes) {
  8340. this.images = nodes.reduce(bind(this.findBackgroundImage, this), this.findImages(nodes));
  8341. this.images.forEach(function (image, index) {
  8342. image.promise.then(function () {
  8343. log("Succesfully loaded image #" + (index + 1), image);
  8344. }, function (e) {
  8345. log("Failed loading image #" + (index + 1), image, e);
  8346. });
  8347. });
  8348. this.ready = Promise.all(this.images.map(this.getPromise, this));
  8349. log("Finished searching images");
  8350. return this;
  8351. };
  8352. ImageLoader.prototype.timeout = function (container, timeout) {
  8353. var timer;
  8354. var promise = Promise.race([container.promise, new Promise(function (res, reject) {
  8355. timer = setTimeout(function () {
  8356. log("Timed out loading image", container);
  8357. reject(container);
  8358. }, timeout);
  8359. })]).then(function (container) {
  8360. clearTimeout(timer);
  8361. return container;
  8362. });
  8363. promise['catch'](function () {
  8364. clearTimeout(timer);
  8365. });
  8366. return promise;
  8367. };
  8368. module.exports = ImageLoader;
  8369. }, { "./dummyimagecontainer": 5, "./framecontainer": 8, "./imagecontainer": 10, "./lineargradientcontainer": 12, "./log": 13, "./proxyimagecontainer": 17, "./svgcontainer": 23, "./svgnodecontainer": 24, "./utils": 26, "./webkitgradientcontainer": 27 }], 12: [function (_dereq_, module, exports) {
  8370. var GradientContainer = _dereq_('./gradientcontainer');
  8371. var Color = _dereq_('./color');
  8372. function LinearGradientContainer(imageData) {
  8373. GradientContainer.apply(this, arguments);
  8374. this.type = GradientContainer.TYPES.LINEAR;
  8375. var hasDirection = LinearGradientContainer.REGEXP_DIRECTION.test(imageData.args[0]) ||
  8376. !GradientContainer.REGEXP_COLORSTOP.test(imageData.args[0]);
  8377. if (hasDirection) {
  8378. imageData.args[0].split(/\s+/).reverse().forEach(function (position, index) {
  8379. switch (position) {
  8380. case "left":
  8381. this.x0 = 0;
  8382. this.x1 = 1;
  8383. break;
  8384. case "top":
  8385. this.y0 = 0;
  8386. this.y1 = 1;
  8387. break;
  8388. case "right":
  8389. this.x0 = 1;
  8390. this.x1 = 0;
  8391. break;
  8392. case "bottom":
  8393. this.y0 = 1;
  8394. this.y1 = 0;
  8395. break;
  8396. case "to":
  8397. var y0 = this.y0;
  8398. var x0 = this.x0;
  8399. this.y0 = this.y1;
  8400. this.x0 = this.x1;
  8401. this.x1 = x0;
  8402. this.y1 = y0;
  8403. break;
  8404. case "center":
  8405. break; // centered by default
  8406. // Firefox internally converts position keywords to percentages:
  8407. // http://www.w3.org/TR/2010/WD-CSS2-20101207/colors.html#propdef-background-position
  8408. default: // percentage or absolute length
  8409. // TODO: support absolute start point positions (e.g., use bounds to convert px to a ratio)
  8410. var ratio = parseFloat(position, 10) * 1e-2;
  8411. if (isNaN(ratio)) {// invalid or unhandled value
  8412. break;
  8413. }
  8414. if (index === 0) {
  8415. this.y0 = ratio;
  8416. this.y1 = 1 - this.y0;
  8417. } else {
  8418. this.x0 = ratio;
  8419. this.x1 = 1 - this.x0;
  8420. }
  8421. break;}
  8422. }, this);
  8423. } else {
  8424. this.y0 = 0;
  8425. this.y1 = 1;
  8426. }
  8427. this.colorStops = imageData.args.slice(hasDirection ? 1 : 0).map(function (colorStop) {
  8428. var colorStopMatch = colorStop.match(GradientContainer.REGEXP_COLORSTOP);
  8429. var value = +colorStopMatch[2];
  8430. var unit = value === 0 ? "%" : colorStopMatch[3]; // treat "0" as "0%"
  8431. return {
  8432. color: new Color(colorStopMatch[1]),
  8433. // TODO: support absolute stop positions (e.g., compute gradient line length & convert px to ratio)
  8434. stop: unit === "%" ? value / 100 : null };
  8435. });
  8436. if (this.colorStops[0].stop === null) {
  8437. this.colorStops[0].stop = 0;
  8438. }
  8439. if (this.colorStops[this.colorStops.length - 1].stop === null) {
  8440. this.colorStops[this.colorStops.length - 1].stop = 1;
  8441. }
  8442. // calculates and fills-in explicit stop positions when omitted from rule
  8443. this.colorStops.forEach(function (colorStop, index) {
  8444. if (colorStop.stop === null) {
  8445. this.colorStops.slice(index).some(function (find, count) {
  8446. if (find.stop !== null) {
  8447. colorStop.stop = (find.stop - this.colorStops[index - 1].stop) / (count + 1) + this.colorStops[index - 1].stop;
  8448. return true;
  8449. } else {
  8450. return false;
  8451. }
  8452. }, this);
  8453. }
  8454. }, this);
  8455. }
  8456. LinearGradientContainer.prototype = Object.create(GradientContainer.prototype);
  8457. // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )
  8458. LinearGradientContainer.REGEXP_DIRECTION = /^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i;
  8459. module.exports = LinearGradientContainer;
  8460. }, { "./color": 3, "./gradientcontainer": 9 }], 13: [function (_dereq_, module, exports) {
  8461. var logger = function logger() {
  8462. if (logger.options.logging && window.console && window.console.log) {
  8463. Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [Date.now() - logger.options.start + "ms", "html2canvas:"].concat([].slice.call(arguments, 0)));
  8464. }
  8465. };
  8466. logger.options = { logging: false };
  8467. module.exports = logger;
  8468. }, {}], 14: [function (_dereq_, module, exports) {
  8469. var Color = _dereq_('./color');
  8470. var utils = _dereq_('./utils');
  8471. var getBounds = utils.getBounds;
  8472. var parseBackgrounds = utils.parseBackgrounds;
  8473. var offsetBounds = utils.offsetBounds;
  8474. function NodeContainer(node, parent) {
  8475. this.node = node;
  8476. this.parent = parent;
  8477. this.stack = null;
  8478. this.bounds = null;
  8479. this.borders = null;
  8480. this.clip = [];
  8481. this.backgroundClip = [];
  8482. this.offsetBounds = null;
  8483. this.visible = null;
  8484. this.computedStyles = null;
  8485. this.colors = {};
  8486. this.styles = {};
  8487. this.backgroundImages = null;
  8488. this.transformData = null;
  8489. this.transformMatrix = null;
  8490. this.isPseudoElement = false;
  8491. this.opacity = null;
  8492. }
  8493. NodeContainer.prototype.cloneTo = function (stack) {
  8494. stack.visible = this.visible;
  8495. stack.borders = this.borders;
  8496. stack.bounds = this.bounds;
  8497. stack.clip = this.clip;
  8498. stack.backgroundClip = this.backgroundClip;
  8499. stack.computedStyles = this.computedStyles;
  8500. stack.styles = this.styles;
  8501. stack.backgroundImages = this.backgroundImages;
  8502. stack.opacity = this.opacity;
  8503. };
  8504. NodeContainer.prototype.getOpacity = function () {
  8505. return this.opacity === null ? this.opacity = this.cssFloat('opacity') : this.opacity;
  8506. };
  8507. NodeContainer.prototype.assignStack = function (stack) {
  8508. this.stack = stack;
  8509. stack.children.push(this);
  8510. };
  8511. NodeContainer.prototype.isElementVisible = function () {
  8512. return this.node.nodeType === Node.TEXT_NODE ? this.parent.visible :
  8513. this.css('display') !== "none" &&
  8514. this.css('visibility') !== "hidden" &&
  8515. !this.node.hasAttribute("data-html2canvas-ignore") && (
  8516. this.node.nodeName !== "INPUT" || this.node.getAttribute("type") !== "hidden");
  8517. };
  8518. NodeContainer.prototype.css = function (attribute) {
  8519. if (!this.computedStyles) {
  8520. this.computedStyles = this.isPseudoElement ? this.parent.computedStyle(this.before ? ":before" : ":after") : this.computedStyle(null);
  8521. }
  8522. return this.styles[attribute] || (this.styles[attribute] = this.computedStyles[attribute]);
  8523. };
  8524. NodeContainer.prototype.prefixedCss = function (attribute) {
  8525. var prefixes = ["webkit", "moz", "ms", "o"];
  8526. var value = this.css(attribute);
  8527. if (value === undefined) {
  8528. prefixes.some(function (prefix) {
  8529. value = this.css(prefix + attribute.substr(0, 1).toUpperCase() + attribute.substr(1));
  8530. return value !== undefined;
  8531. }, this);
  8532. }
  8533. return value === undefined ? null : value;
  8534. };
  8535. NodeContainer.prototype.computedStyle = function (type) {
  8536. return this.node.ownerDocument.defaultView.getComputedStyle(this.node, type);
  8537. };
  8538. NodeContainer.prototype.cssInt = function (attribute) {
  8539. var value = parseInt(this.css(attribute), 10);
  8540. return isNaN(value) ? 0 : value; // borders in old IE are throwing 'medium' for demo.html
  8541. };
  8542. NodeContainer.prototype.color = function (attribute) {
  8543. return this.colors[attribute] || (this.colors[attribute] = new Color(this.css(attribute)));
  8544. };
  8545. NodeContainer.prototype.cssFloat = function (attribute) {
  8546. var value = parseFloat(this.css(attribute));
  8547. return isNaN(value) ? 0 : value;
  8548. };
  8549. NodeContainer.prototype.fontWeight = function () {
  8550. var weight = this.css("fontWeight");
  8551. switch (parseInt(weight, 10)) {
  8552. case 401:
  8553. weight = "bold";
  8554. break;
  8555. case 400:
  8556. weight = "normal";
  8557. break;}
  8558. return weight;
  8559. };
  8560. NodeContainer.prototype.parseClip = function () {
  8561. var matches = this.css('clip').match(this.CLIP);
  8562. if (matches) {
  8563. return {
  8564. top: parseInt(matches[1], 10),
  8565. right: parseInt(matches[2], 10),
  8566. bottom: parseInt(matches[3], 10),
  8567. left: parseInt(matches[4], 10) };
  8568. }
  8569. return null;
  8570. };
  8571. NodeContainer.prototype.parseBackgroundImages = function () {
  8572. return this.backgroundImages || (this.backgroundImages = parseBackgrounds(this.css("backgroundImage")));
  8573. };
  8574. NodeContainer.prototype.cssList = function (property, index) {
  8575. var value = (this.css(property) || '').split(',');
  8576. value = value[index || 0] || value[0] || 'auto';
  8577. value = value.trim().split(' ');
  8578. if (value.length === 1) {
  8579. value = [value[0], isPercentage(value[0]) ? 'auto' : value[0]];
  8580. }
  8581. return value;
  8582. };
  8583. NodeContainer.prototype.parseBackgroundSize = function (bounds, image, index) {
  8584. var size = this.cssList("backgroundSize", index);
  8585. var width, height;
  8586. if (isPercentage(size[0])) {
  8587. width = bounds.width * parseFloat(size[0]) / 100;
  8588. } else if (/contain|cover/.test(size[0])) {
  8589. var targetRatio = bounds.width / bounds.height,currentRatio = image.width / image.height;
  8590. return targetRatio < currentRatio ^ size[0] === 'contain' ? { width: bounds.height * currentRatio, height: bounds.height } : { width: bounds.width, height: bounds.width / currentRatio };
  8591. } else {
  8592. width = parseInt(size[0], 10);
  8593. }
  8594. if (size[0] === 'auto' && size[1] === 'auto') {
  8595. height = image.height;
  8596. } else if (size[1] === 'auto') {
  8597. height = width / image.width * image.height;
  8598. } else if (isPercentage(size[1])) {
  8599. height = bounds.height * parseFloat(size[1]) / 100;
  8600. } else {
  8601. height = parseInt(size[1], 10);
  8602. }
  8603. if (size[0] === 'auto') {
  8604. width = height / image.height * image.width;
  8605. }
  8606. return { width: width, height: height };
  8607. };
  8608. NodeContainer.prototype.parseBackgroundPosition = function (bounds, image, index, backgroundSize) {
  8609. var position = this.cssList('backgroundPosition', index);
  8610. var left, top;
  8611. if (isPercentage(position[0])) {
  8612. left = (bounds.width - (backgroundSize || image).width) * (parseFloat(position[0]) / 100);
  8613. } else {
  8614. left = parseInt(position[0], 10);
  8615. }
  8616. if (position[1] === 'auto') {
  8617. top = left / image.width * image.height;
  8618. } else if (isPercentage(position[1])) {
  8619. top = (bounds.height - (backgroundSize || image).height) * parseFloat(position[1]) / 100;
  8620. } else {
  8621. top = parseInt(position[1], 10);
  8622. }
  8623. if (position[0] === 'auto') {
  8624. left = top / image.height * image.width;
  8625. }
  8626. return { left: left, top: top };
  8627. };
  8628. NodeContainer.prototype.parseBackgroundRepeat = function (index) {
  8629. return this.cssList("backgroundRepeat", index)[0];
  8630. };
  8631. NodeContainer.prototype.parseTextShadows = function () {
  8632. var textShadow = this.css("textShadow");
  8633. var results = [];
  8634. if (textShadow && textShadow !== 'none') {
  8635. var shadows = textShadow.match(this.TEXT_SHADOW_PROPERTY);
  8636. for (var i = 0; shadows && i < shadows.length; i++) {
  8637. var s = shadows[i].match(this.TEXT_SHADOW_VALUES);
  8638. results.push({
  8639. color: new Color(s[0]),
  8640. offsetX: s[1] ? parseFloat(s[1].replace('px', '')) : 0,
  8641. offsetY: s[2] ? parseFloat(s[2].replace('px', '')) : 0,
  8642. blur: s[3] ? s[3].replace('px', '') : 0 });
  8643. }
  8644. }
  8645. return results;
  8646. };
  8647. NodeContainer.prototype.parseTransform = function () {
  8648. if (!this.transformData) {
  8649. if (this.hasTransform()) {
  8650. var offset = this.parseBounds();
  8651. var origin = this.prefixedCss("transformOrigin").split(" ").map(removePx).map(asFloat);
  8652. origin[0] += offset.left;
  8653. origin[1] += offset.top;
  8654. this.transformData = {
  8655. origin: origin,
  8656. matrix: this.parseTransformMatrix() };
  8657. } else {
  8658. this.transformData = {
  8659. origin: [0, 0],
  8660. matrix: [1, 0, 0, 1, 0, 0] };
  8661. }
  8662. }
  8663. return this.transformData;
  8664. };
  8665. NodeContainer.prototype.parseTransformMatrix = function () {
  8666. if (!this.transformMatrix) {
  8667. var transform = this.prefixedCss("transform");
  8668. var matrix = transform ? parseMatrix(transform.match(this.MATRIX_PROPERTY)) : null;
  8669. this.transformMatrix = matrix ? matrix : [1, 0, 0, 1, 0, 0];
  8670. }
  8671. return this.transformMatrix;
  8672. };
  8673. NodeContainer.prototype.inverseTransform = function () {
  8674. var transformData = this.parseTransform();
  8675. return { origin: transformData.origin, matrix: matrixInverse(transformData.matrix) };
  8676. };
  8677. NodeContainer.prototype.parseBounds = function () {
  8678. return this.bounds || (this.bounds = this.hasTransform() ? offsetBounds(this.node) : getBounds(this.node));
  8679. };
  8680. NodeContainer.prototype.hasTransform = function () {
  8681. return this.parseTransformMatrix().join(",") !== "1,0,0,1,0,0" || this.parent && this.parent.hasTransform();
  8682. };
  8683. NodeContainer.prototype.getValue = function () {
  8684. var value = this.node.value || "";
  8685. if (this.node.tagName === "SELECT") {
  8686. value = selectionValue(this.node);
  8687. } else if (this.node.type === "password") {
  8688. value = Array(value.length + 1).join("\u2022"); // jshint ignore:line
  8689. }
  8690. return value.length === 0 ? this.node.placeholder || "" : value;
  8691. };
  8692. NodeContainer.prototype.MATRIX_PROPERTY = /(matrix|matrix3d)\((.+)\)/;
  8693. NodeContainer.prototype.TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
  8694. NodeContainer.prototype.TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
  8695. NodeContainer.prototype.CLIP = /^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/;
  8696. function selectionValue(node) {
  8697. var option = node.options[node.selectedIndex || 0];
  8698. return option ? option.text || "" : "";
  8699. }
  8700. function parseMatrix(match) {
  8701. if (match && match[1] === "matrix") {
  8702. return match[2].split(",").map(function (s) {
  8703. return parseFloat(s.trim());
  8704. });
  8705. } else if (match && match[1] === "matrix3d") {
  8706. var matrix3d = match[2].split(",").map(function (s) {
  8707. return parseFloat(s.trim());
  8708. });
  8709. return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]];
  8710. }
  8711. }
  8712. function matrixInverse(m) {
  8713. // This is programmed specifically for transform matrices, which have a fixed structure.
  8714. var a = m[0],b = m[2],c = m[4],d = m[1],e = m[3],f = m[5];
  8715. var det = a * e - b * d;
  8716. var M = [e, -d, -b, a, b * f - c * e, c * d - a * f].map(function (val) {return val / det;});
  8717. return M;
  8718. }
  8719. function isPercentage(value) {
  8720. return value.toString().indexOf("%") !== -1;
  8721. }
  8722. function removePx(str) {
  8723. return str.replace("px", "");
  8724. }
  8725. function asFloat(str) {
  8726. return parseFloat(str);
  8727. }
  8728. module.exports = NodeContainer;
  8729. }, { "./color": 3, "./utils": 26 }], 15: [function (_dereq_, module, exports) {
  8730. var log = _dereq_('./log');
  8731. var punycode = _dereq_('punycode');
  8732. var NodeContainer = _dereq_('./nodecontainer');
  8733. var TextContainer = _dereq_('./textcontainer');
  8734. var PseudoElementContainer = _dereq_('./pseudoelementcontainer');
  8735. var FontMetrics = _dereq_('./fontmetrics');
  8736. var Color = _dereq_('./color');
  8737. var StackingContext = _dereq_('./stackingcontext');
  8738. var utils = _dereq_('./utils');
  8739. var bind = utils.bind;
  8740. var getBounds = utils.getBounds;
  8741. var parseBackgrounds = utils.parseBackgrounds;
  8742. var offsetBounds = utils.offsetBounds;
  8743. function NodeParser(element, renderer, support, imageLoader, options) {
  8744. log("Starting NodeParser");
  8745. this.renderer = renderer;
  8746. this.options = options;
  8747. this.range = null;
  8748. this.support = support;
  8749. this.renderQueue = [];
  8750. this.stack = new StackingContext(true, 1, element.ownerDocument, null);
  8751. var parent = new NodeContainer(element, null);
  8752. if (options.background) {
  8753. renderer.rectangle(0, 0, renderer.width, renderer.height, new Color(options.background));
  8754. }
  8755. if (element === element.ownerDocument.documentElement) {
  8756. // http://www.w3.org/TR/css3-background/#special-backgrounds
  8757. var canvasBackground = new NodeContainer(parent.color('backgroundColor').isTransparent() ? element.ownerDocument.body : element.ownerDocument.documentElement, null);
  8758. renderer.rectangle(0, 0, renderer.width, renderer.height, canvasBackground.color('backgroundColor'));
  8759. }
  8760. parent.visibile = parent.isElementVisible();
  8761. this.createPseudoHideStyles(element.ownerDocument);
  8762. this.disableAnimations(element.ownerDocument);
  8763. this.nodes = flatten([parent].concat(this.getChildren(parent)).filter(function (container) {
  8764. return container.visible = container.isElementVisible();
  8765. }).map(this.getPseudoElements, this));
  8766. this.fontMetrics = new FontMetrics();
  8767. log("Fetched nodes, total:", this.nodes.length);
  8768. log("Calculate overflow clips");
  8769. this.calculateOverflowClips();
  8770. log("Start fetching images");
  8771. this.images = imageLoader.fetch(this.nodes.filter(isElement));
  8772. this.ready = this.images.ready.then(bind(function () {
  8773. log("Images loaded, starting parsing");
  8774. log("Creating stacking contexts");
  8775. this.createStackingContexts();
  8776. log("Sorting stacking contexts");
  8777. this.sortStackingContexts(this.stack);
  8778. this.parse(this.stack);
  8779. log("Render queue created with " + this.renderQueue.length + " items");
  8780. return new Promise(bind(function (resolve) {
  8781. if (!options.async) {
  8782. this.renderQueue.forEach(this.paint, this);
  8783. resolve();
  8784. } else if (typeof options.async === "function") {
  8785. options.async.call(this, this.renderQueue, resolve);
  8786. } else if (this.renderQueue.length > 0) {
  8787. this.renderIndex = 0;
  8788. this.asyncRenderer(this.renderQueue, resolve);
  8789. } else {
  8790. resolve();
  8791. }
  8792. }, this));
  8793. }, this));
  8794. }
  8795. NodeParser.prototype.calculateOverflowClips = function () {
  8796. this.nodes.forEach(function (container) {
  8797. if (isElement(container)) {
  8798. if (isPseudoElement(container)) {
  8799. container.appendToDOM();
  8800. }
  8801. container.borders = this.parseBorders(container);
  8802. var clip = container.css('overflow') === "hidden" ? [container.borders.clip] : [];
  8803. var cssClip = container.parseClip();
  8804. if (cssClip && ["absolute", "fixed"].indexOf(container.css('position')) !== -1) {
  8805. clip.push([["rect",
  8806. container.bounds.left + cssClip.left,
  8807. container.bounds.top + cssClip.top,
  8808. cssClip.right - cssClip.left,
  8809. cssClip.bottom - cssClip.top]]);
  8810. }
  8811. container.clip = hasParentClip(container) ? container.parent.clip.concat(clip) : clip;
  8812. container.backgroundClip = container.css('overflow') !== "hidden" ? container.clip.concat([container.borders.clip]) : container.clip;
  8813. if (isPseudoElement(container)) {
  8814. container.cleanDOM();
  8815. }
  8816. } else if (isTextNode(container)) {
  8817. container.clip = hasParentClip(container) ? container.parent.clip : [];
  8818. }
  8819. if (!isPseudoElement(container)) {
  8820. container.bounds = null;
  8821. }
  8822. }, this);
  8823. };
  8824. function hasParentClip(container) {
  8825. return container.parent && container.parent.clip.length;
  8826. }
  8827. NodeParser.prototype.asyncRenderer = function (queue, resolve, asyncTimer) {
  8828. asyncTimer = asyncTimer || Date.now();
  8829. this.paint(queue[this.renderIndex++]);
  8830. if (queue.length === this.renderIndex) {
  8831. resolve();
  8832. } else if (asyncTimer + 20 > Date.now()) {
  8833. this.asyncRenderer(queue, resolve, asyncTimer);
  8834. } else {
  8835. setTimeout(bind(function () {
  8836. this.asyncRenderer(queue, resolve);
  8837. }, this), 0);
  8838. }
  8839. };
  8840. NodeParser.prototype.createPseudoHideStyles = function (document) {
  8841. this.createStyles(document, '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
  8842. '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }');
  8843. };
  8844. NodeParser.prototype.disableAnimations = function (document) {
  8845. this.createStyles(document, '* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; ' +
  8846. '-webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}');
  8847. };
  8848. NodeParser.prototype.createStyles = function (document, styles) {
  8849. var hidePseudoElements = document.createElement('style');
  8850. hidePseudoElements.innerHTML = styles;
  8851. document.body.appendChild(hidePseudoElements);
  8852. };
  8853. NodeParser.prototype.getPseudoElements = function (container) {
  8854. var nodes = [[container]];
  8855. if (container.node.nodeType === Node.ELEMENT_NODE) {
  8856. var before = this.getPseudoElement(container, ":before");
  8857. var after = this.getPseudoElement(container, ":after");
  8858. if (before) {
  8859. nodes.push(before);
  8860. }
  8861. if (after) {
  8862. nodes.push(after);
  8863. }
  8864. }
  8865. return flatten(nodes);
  8866. };
  8867. function toCamelCase(str) {
  8868. return str.replace(/(\-[a-z])/g, function (match) {
  8869. return match.toUpperCase().replace('-', '');
  8870. });
  8871. }
  8872. NodeParser.prototype.getPseudoElement = function (container, type) {
  8873. var style = container.computedStyle(type);
  8874. if (!style || !style.content || style.content === "none" || style.content === "-moz-alt-content" || style.display === "none") {
  8875. return null;
  8876. }
  8877. var content = stripQuotes(style.content);
  8878. var isImage = content.substr(0, 3) === 'url';
  8879. var pseudoNode = document.createElement(isImage ? 'img' : 'html2canvaspseudoelement');
  8880. var pseudoContainer = new PseudoElementContainer(pseudoNode, container, type);
  8881. for (var i = style.length - 1; i >= 0; i--) {
  8882. var property = toCamelCase(style.item(i));
  8883. pseudoNode.style[property] = style[property];
  8884. }
  8885. pseudoNode.className = PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  8886. if (isImage) {
  8887. pseudoNode.src = parseBackgrounds(content)[0].args[0];
  8888. return [pseudoContainer];
  8889. } else {
  8890. var text = document.createTextNode(content);
  8891. pseudoNode.appendChild(text);
  8892. return [pseudoContainer, new TextContainer(text, pseudoContainer)];
  8893. }
  8894. };
  8895. NodeParser.prototype.getChildren = function (parentContainer) {
  8896. return flatten([].filter.call(parentContainer.node.childNodes, renderableNode).map(function (node) {
  8897. var container = [node.nodeType === Node.TEXT_NODE ? new TextContainer(node, parentContainer) : new NodeContainer(node, parentContainer)].filter(nonIgnoredElement);
  8898. return node.nodeType === Node.ELEMENT_NODE && container.length && node.tagName !== "TEXTAREA" ? container[0].isElementVisible() ? container.concat(this.getChildren(container[0])) : [] : container;
  8899. }, this));
  8900. };
  8901. NodeParser.prototype.newStackingContext = function (container, hasOwnStacking) {
  8902. var stack = new StackingContext(hasOwnStacking, container.getOpacity(), container.node, container.parent);
  8903. container.cloneTo(stack);
  8904. var parentStack = hasOwnStacking ? stack.getParentStack(this) : stack.parent.stack;
  8905. parentStack.contexts.push(stack);
  8906. container.stack = stack;
  8907. };
  8908. NodeParser.prototype.createStackingContexts = function () {
  8909. this.nodes.forEach(function (container) {
  8910. if (isElement(container) && (this.isRootElement(container) || hasOpacity(container) || isPositionedForStacking(container) || this.isBodyWithTransparentRoot(container) || container.hasTransform())) {
  8911. this.newStackingContext(container, true);
  8912. } else if (isElement(container) && (isPositioned(container) && zIndex0(container) || isInlineBlock(container) || isFloating(container))) {
  8913. this.newStackingContext(container, false);
  8914. } else {
  8915. container.assignStack(container.parent.stack);
  8916. }
  8917. }, this);
  8918. };
  8919. NodeParser.prototype.isBodyWithTransparentRoot = function (container) {
  8920. return container.node.nodeName === "BODY" && container.parent.color('backgroundColor').isTransparent();
  8921. };
  8922. NodeParser.prototype.isRootElement = function (container) {
  8923. return container.parent === null;
  8924. };
  8925. NodeParser.prototype.sortStackingContexts = function (stack) {
  8926. stack.contexts.sort(zIndexSort(stack.contexts.slice(0)));
  8927. stack.contexts.forEach(this.sortStackingContexts, this);
  8928. };
  8929. NodeParser.prototype.parseTextBounds = function (container) {
  8930. return function (text, index, textList) {
  8931. if (container.parent.css("textDecoration").substr(0, 4) !== "none" || text.trim().length !== 0) {
  8932. if (this.support.rangeBounds && !container.parent.hasTransform()) {
  8933. var offset = textList.slice(0, index).join("").length;
  8934. return this.getRangeBounds(container.node, offset, text.length);
  8935. } else if (container.node && typeof container.node.data === "string") {
  8936. var replacementNode = container.node.splitText(text.length);
  8937. var bounds = this.getWrapperBounds(container.node, container.parent.hasTransform());
  8938. container.node = replacementNode;
  8939. return bounds;
  8940. }
  8941. } else if (!this.support.rangeBounds || container.parent.hasTransform()) {
  8942. container.node = container.node.splitText(text.length);
  8943. }
  8944. return {};
  8945. };
  8946. };
  8947. NodeParser.prototype.getWrapperBounds = function (node, transform) {
  8948. var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
  8949. var parent = node.parentNode,
  8950. backupText = node.cloneNode(true);
  8951. wrapper.appendChild(node.cloneNode(true));
  8952. parent.replaceChild(wrapper, node);
  8953. var bounds = transform ? offsetBounds(wrapper) : getBounds(wrapper);
  8954. parent.replaceChild(backupText, wrapper);
  8955. return bounds;
  8956. };
  8957. NodeParser.prototype.getRangeBounds = function (node, offset, length) {
  8958. var range = this.range || (this.range = node.ownerDocument.createRange());
  8959. range.setStart(node, offset);
  8960. range.setEnd(node, offset + length);
  8961. return range.getBoundingClientRect();
  8962. };
  8963. function ClearTransform() {}
  8964. NodeParser.prototype.parse = function (stack) {
  8965. // http://www.w3.org/TR/CSS21/visuren.html#z-index
  8966. var negativeZindex = stack.contexts.filter(negativeZIndex); // 2. the child stacking contexts with negative stack levels (most negative first).
  8967. var descendantElements = stack.children.filter(isElement);
  8968. var descendantNonFloats = descendantElements.filter(not(isFloating));
  8969. var nonInlineNonPositionedDescendants = descendantNonFloats.filter(not(isPositioned)).filter(not(inlineLevel)); // 3 the in-flow, non-inline-level, non-positioned descendants.
  8970. var nonPositionedFloats = descendantElements.filter(not(isPositioned)).filter(isFloating); // 4. the non-positioned floats.
  8971. var inFlow = descendantNonFloats.filter(not(isPositioned)).filter(inlineLevel); // 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
  8972. var stackLevel0 = stack.contexts.concat(descendantNonFloats.filter(isPositioned)).filter(zIndex0); // 6. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.
  8973. var text = stack.children.filter(isTextNode).filter(hasText);
  8974. var positiveZindex = stack.contexts.filter(positiveZIndex); // 7. the child stacking contexts with positive stack levels (least positive first).
  8975. negativeZindex.concat(nonInlineNonPositionedDescendants).concat(nonPositionedFloats).
  8976. concat(inFlow).concat(stackLevel0).concat(text).concat(positiveZindex).forEach(function (container) {
  8977. this.renderQueue.push(container);
  8978. if (isStackingContext(container)) {
  8979. this.parse(container);
  8980. this.renderQueue.push(new ClearTransform());
  8981. }
  8982. }, this);
  8983. };
  8984. NodeParser.prototype.paint = function (container) {
  8985. try {
  8986. if (container instanceof ClearTransform) {
  8987. this.renderer.ctx.restore();
  8988. } else if (isTextNode(container)) {
  8989. if (isPseudoElement(container.parent)) {
  8990. container.parent.appendToDOM();
  8991. }
  8992. this.paintText(container);
  8993. if (isPseudoElement(container.parent)) {
  8994. container.parent.cleanDOM();
  8995. }
  8996. } else {
  8997. this.paintNode(container);
  8998. }
  8999. } catch (e) {
  9000. log(e);
  9001. if (this.options.strict) {
  9002. throw e;
  9003. }
  9004. }
  9005. };
  9006. NodeParser.prototype.paintNode = function (container) {
  9007. if (isStackingContext(container)) {
  9008. this.renderer.setOpacity(container.opacity);
  9009. this.renderer.ctx.save();
  9010. if (container.hasTransform()) {
  9011. this.renderer.setTransform(container.parseTransform());
  9012. }
  9013. }
  9014. if (container.node.nodeName === "INPUT" && container.node.type === "checkbox") {
  9015. this.paintCheckbox(container);
  9016. } else if (container.node.nodeName === "INPUT" && container.node.type === "radio") {
  9017. this.paintRadio(container);
  9018. } else {
  9019. this.paintElement(container);
  9020. }
  9021. };
  9022. NodeParser.prototype.paintElement = function (container) {
  9023. var bounds = container.parseBounds();
  9024. this.renderer.clip(container.backgroundClip, function () {
  9025. this.renderer.renderBackground(container, bounds, container.borders.borders.map(getWidth));
  9026. }, this, container);
  9027. this.renderer.mask(container.backgroundClip, function () {
  9028. this.renderer.renderShadows(container, container.borders.clip);
  9029. }, this, container);
  9030. this.renderer.clip(container.clip, function () {
  9031. this.renderer.renderBorders(container.borders.borders);
  9032. }, this, container);
  9033. this.renderer.clip(container.backgroundClip, function () {
  9034. switch (container.node.nodeName) {
  9035. case "svg":
  9036. case "IFRAME":
  9037. var imgContainer = this.images.get(container.node);
  9038. if (imgContainer) {
  9039. this.renderer.renderImage(container, bounds, container.borders, imgContainer);
  9040. } else {
  9041. log("Error loading <" + container.node.nodeName + ">", container.node);
  9042. }
  9043. break;
  9044. case "IMG":
  9045. var imageContainer = this.images.get(container.node.src);
  9046. if (imageContainer) {
  9047. this.renderer.renderImage(container, bounds, container.borders, imageContainer);
  9048. } else {
  9049. log("Error loading <img>", container.node.src);
  9050. }
  9051. break;
  9052. case "CANVAS":
  9053. this.renderer.renderImage(container, bounds, container.borders, { image: container.node });
  9054. break;
  9055. case "SELECT":
  9056. case "INPUT":
  9057. case "TEXTAREA":
  9058. this.paintFormValue(container);
  9059. break;}
  9060. }, this, container);
  9061. };
  9062. NodeParser.prototype.paintCheckbox = function (container) {
  9063. var b = container.parseBounds();
  9064. var size = Math.min(b.width, b.height);
  9065. var bounds = { width: size - 1, height: size - 1, top: b.top, left: b.left };
  9066. var r = [3, 3];
  9067. var radius = [r, r, r, r];
  9068. var borders = [1, 1, 1, 1].map(function (w) {
  9069. return { color: new Color('#A5A5A5'), width: w };
  9070. });
  9071. var borderPoints = calculateCurvePoints(bounds, radius, borders);
  9072. this.renderer.clip(container.backgroundClip, function () {
  9073. this.renderer.rectangle(bounds.left + 1, bounds.top + 1, bounds.width - 2, bounds.height - 2, new Color("#DEDEDE"));
  9074. this.renderer.renderBorders(calculateBorders(borders, bounds, borderPoints, radius));
  9075. if (container.node.checked) {
  9076. this.renderer.font(new Color('#424242'), 'normal', 'normal', 'bold', size - 3 + "px", 'arial');
  9077. this.renderer.text("\u2714", bounds.left + size / 6, bounds.top + size - 1);
  9078. }
  9079. }, this, container);
  9080. };
  9081. NodeParser.prototype.paintRadio = function (container) {
  9082. var bounds = container.parseBounds();
  9083. var size = Math.min(bounds.width, bounds.height) - 2;
  9084. this.renderer.clip(container.backgroundClip, function () {
  9085. this.renderer.circleStroke(bounds.left + 1, bounds.top + 1, size, new Color('#DEDEDE'), 1, new Color('#A5A5A5'));
  9086. if (container.node.checked) {
  9087. this.renderer.circle(Math.ceil(bounds.left + size / 4) + 1, Math.ceil(bounds.top + size / 4) + 1, Math.floor(size / 2), new Color('#424242'));
  9088. }
  9089. }, this, container);
  9090. };
  9091. NodeParser.prototype.paintFormValue = function (container) {
  9092. var value = container.getValue();
  9093. if (value.length > 0) {
  9094. var document = container.node.ownerDocument;
  9095. var wrapper = document.createElement('html2canvaswrapper');
  9096. var properties = ['lineHeight', 'textAlign', 'fontFamily', 'fontWeight', 'fontSize', 'color',
  9097. 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom',
  9098. 'width', 'height', 'borderLeftStyle', 'borderTopStyle', 'borderLeftWidth', 'borderTopWidth',
  9099. 'boxSizing', 'whiteSpace', 'wordWrap'];
  9100. properties.forEach(function (property) {
  9101. try {
  9102. wrapper.style[property] = container.css(property);
  9103. } catch (e) {
  9104. // Older IE has issues with "border"
  9105. log("html2canvas: Parse: Exception caught in renderFormValue: " + e.message);
  9106. }
  9107. });
  9108. var bounds = container.parseBounds();
  9109. wrapper.style.position = "fixed";
  9110. wrapper.style.left = bounds.left + "px";
  9111. wrapper.style.top = bounds.top + "px";
  9112. wrapper.textContent = value;
  9113. document.body.appendChild(wrapper);
  9114. this.paintText(new TextContainer(wrapper.firstChild, container));
  9115. document.body.removeChild(wrapper);
  9116. }
  9117. };
  9118. NodeParser.prototype.paintText = function (container) {
  9119. container.applyTextTransform();
  9120. var characters = punycode.ucs2.decode(container.node.data);
  9121. var wordRendering = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data);
  9122. var textList = wordRendering ? getWords(characters) : characters.map(function (character) {
  9123. return punycode.ucs2.encode([character]);
  9124. });
  9125. if (!wordRendering) {
  9126. container.parent.node.style.fontVariantLigatures = 'none';
  9127. }
  9128. var weight = container.parent.fontWeight();
  9129. var size = container.parent.css('fontSize');
  9130. var family = container.parent.css('fontFamily');
  9131. var shadows = container.parent.parseTextShadows();
  9132. this.renderer.font(container.parent.color('color'), container.parent.css('fontStyle'), container.parent.css('fontVariant'), weight, size, family);
  9133. if (shadows.length) {
  9134. // TODO: support multiple text shadows
  9135. this.renderer.fontShadow(shadows[0].color, shadows[0].offsetX, shadows[0].offsetY, shadows[0].blur);
  9136. } else {
  9137. this.renderer.clearShadow();
  9138. }
  9139. this.renderer.clip(container.parent.clip, function () {
  9140. textList.map(this.parseTextBounds(container), this).forEach(function (bounds, index) {
  9141. if (bounds) {
  9142. this.renderer.text(textList[index], bounds.left, bounds.bottom);
  9143. this.renderTextDecoration(container.parent, bounds, this.fontMetrics.getMetrics(family, size));
  9144. }
  9145. }, this);
  9146. }, this, container.parent);
  9147. };
  9148. NodeParser.prototype.renderTextDecoration = function (container, bounds, metrics) {
  9149. switch (container.css("textDecoration").split(" ")[0]) {
  9150. case "underline":
  9151. // Draws a line at the baseline of the font
  9152. // TODO As some browsers display the line as more than 1px if the font-size is big, need to take that into account both in position and size
  9153. this.renderer.rectangle(bounds.left, Math.round(bounds.top + metrics.baseline + metrics.lineWidth), bounds.width, 1, container.color("color"));
  9154. break;
  9155. case "overline":
  9156. this.renderer.rectangle(bounds.left, Math.round(bounds.top), bounds.width, 1, container.color("color"));
  9157. break;
  9158. case "line-through":
  9159. // TODO try and find exact position for line-through
  9160. this.renderer.rectangle(bounds.left, Math.ceil(bounds.top + metrics.middle + metrics.lineWidth), bounds.width, 1, container.color("color"));
  9161. break;}
  9162. };
  9163. var borderColorTransforms = {
  9164. inset: [
  9165. ["darken", 0.60],
  9166. ["darken", 0.10],
  9167. ["darken", 0.10],
  9168. ["darken", 0.60]] };
  9169. NodeParser.prototype.parseBorders = function (container) {
  9170. var nodeBounds = container.parseBounds();
  9171. var radius = getBorderRadiusData(container);
  9172. var borders = ["Top", "Right", "Bottom", "Left"].map(function (side, index) {
  9173. var style = container.css('border' + side + 'Style');
  9174. var color = container.color('border' + side + 'Color');
  9175. if (style === "inset" && color.isBlack()) {
  9176. color = new Color([255, 255, 255, color.a]); // this is wrong, but
  9177. }
  9178. var colorTransform = borderColorTransforms[style] ? borderColorTransforms[style][index] : null;
  9179. return {
  9180. width: container.cssInt('border' + side + 'Width'),
  9181. color: colorTransform ? color[colorTransform[0]](colorTransform[1]) : color,
  9182. style: style,
  9183. pathArgs: null,
  9184. args: null };
  9185. });
  9186. var borderPoints = calculateCurvePoints(nodeBounds, radius, borders);
  9187. return {
  9188. clip: this.parseBackgroundClip(container, borderPoints, borders, radius, nodeBounds),
  9189. borders: calculateBorders(borders, nodeBounds, borderPoints, radius) };
  9190. };
  9191. function calculateBorders(borders, nodeBounds, borderPoints, radius) {
  9192. var pathBounds = {
  9193. top: nodeBounds.top + borders[0].width / 2,
  9194. right: nodeBounds.right - borders[1].width / 2,
  9195. bottom: nodeBounds.bottom - borders[2].width / 2,
  9196. left: nodeBounds.left + borders[3].width / 2 };
  9197. return borders.map(function (border, borderSide) {
  9198. if (border.width > 0) {
  9199. var bx = nodeBounds.left;
  9200. var by = nodeBounds.top;
  9201. var bw = nodeBounds.width;
  9202. var bh = nodeBounds.height - borders[2].width;
  9203. switch (borderSide) {
  9204. case 0:
  9205. // top border
  9206. bh = borders[0].width;
  9207. border.args = drawSide({
  9208. c1: [bx, by],
  9209. c2: [bx + bw, by],
  9210. c3: [bx + bw - borders[1].width, by + bh],
  9211. c4: [bx + borders[3].width, by + bh] },
  9212. radius[0], radius[1],
  9213. borderPoints.topLeftOuter, borderPoints.topLeftInner, borderPoints.topRightOuter, borderPoints.topRightInner);
  9214. border.pathArgs = drawSidePath({
  9215. c1: [pathBounds.left, pathBounds.top],
  9216. c2: [pathBounds.right, pathBounds.top] },
  9217. radius[0], radius[1],
  9218. borderPoints.topLeft, borderPoints.topRight);
  9219. break;
  9220. case 1:
  9221. // right border
  9222. bx = nodeBounds.left + nodeBounds.width - borders[1].width;
  9223. bw = borders[1].width;
  9224. border.args = drawSide({
  9225. c1: [bx + bw, by],
  9226. c2: [bx + bw, by + bh + borders[2].width],
  9227. c3: [bx, by + bh],
  9228. c4: [bx, by + borders[0].width] },
  9229. radius[1], radius[2],
  9230. borderPoints.topRightOuter, borderPoints.topRightInner, borderPoints.bottomRightOuter, borderPoints.bottomRightInner);
  9231. border.pathArgs = drawSidePath({
  9232. c1: [pathBounds.right, pathBounds.top],
  9233. c2: [pathBounds.right, pathBounds.bottom] },
  9234. radius[1], radius[2],
  9235. borderPoints.topRight, borderPoints.bottomRight);
  9236. break;
  9237. case 2:
  9238. // bottom border
  9239. by = by + nodeBounds.height - borders[2].width;
  9240. bh = borders[2].width;
  9241. border.args = drawSide({
  9242. c1: [bx + bw, by + bh],
  9243. c2: [bx, by + bh],
  9244. c3: [bx + borders[3].width, by],
  9245. c4: [bx + bw - borders[3].width, by] },
  9246. radius[2], radius[3],
  9247. borderPoints.bottomRightOuter, borderPoints.bottomRightInner, borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner);
  9248. border.pathArgs = drawSidePath({
  9249. c1: [pathBounds.right, pathBounds.bottom],
  9250. c2: [pathBounds.left, pathBounds.bottom] },
  9251. radius[2], radius[3],
  9252. borderPoints.bottomRight, borderPoints.bottomLeft);
  9253. break;
  9254. case 3:
  9255. // left border
  9256. bw = borders[3].width;
  9257. border.args = drawSide({
  9258. c1: [bx, by + bh + borders[2].width],
  9259. c2: [bx, by],
  9260. c3: [bx + bw, by + borders[0].width],
  9261. c4: [bx + bw, by + bh] },
  9262. radius[3], radius[0],
  9263. borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner, borderPoints.topLeftOuter, borderPoints.topLeftInner);
  9264. border.pathArgs = drawSidePath({
  9265. c1: [pathBounds.left, pathBounds.bottom],
  9266. c2: [pathBounds.left, pathBounds.top] },
  9267. radius[3], radius[0],
  9268. borderPoints.bottomLeft, borderPoints.topLeft);
  9269. break;}
  9270. }
  9271. return border;
  9272. });
  9273. }
  9274. NodeParser.prototype.parseBackgroundClip = function (container, borderPoints, borders, radius, bounds) {
  9275. var backgroundClip = container.css('backgroundClip'),
  9276. borderArgs = [];
  9277. switch (backgroundClip) {
  9278. case "content-box":
  9279. case "padding-box":
  9280. parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width);
  9281. parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width);
  9282. parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width);
  9283. parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width);
  9284. break;
  9285. default:
  9286. parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftOuter, borderPoints.topRightOuter, bounds.left, bounds.top);
  9287. parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightOuter, borderPoints.bottomRightOuter, bounds.left + bounds.width, bounds.top);
  9288. parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightOuter, borderPoints.bottomLeftOuter, bounds.left + bounds.width, bounds.top + bounds.height);
  9289. parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftOuter, borderPoints.topLeftOuter, bounds.left, bounds.top + bounds.height);
  9290. break;}
  9291. return borderArgs;
  9292. };
  9293. function getCurvePoints(x, y, r1, r2) {
  9294. var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
  9295. var ox = r1 * kappa, // control point offset horizontal
  9296. oy = r2 * kappa, // control point offset vertical
  9297. xm = x + r1, // x-middle
  9298. ym = y + r2; // y-middle
  9299. return {
  9300. topLeft: bezierCurve({ x: x, y: ym }, { x: x, y: ym - oy }, { x: xm - ox, y: y }, { x: xm, y: y }),
  9301. topRight: bezierCurve({ x: x, y: y }, { x: x + ox, y: y }, { x: xm, y: ym - oy }, { x: xm, y: ym }),
  9302. bottomRight: bezierCurve({ x: xm, y: y }, { x: xm, y: y + oy }, { x: x + ox, y: ym }, { x: x, y: ym }),
  9303. bottomLeft: bezierCurve({ x: xm, y: ym }, { x: xm - ox, y: ym }, { x: x, y: y + oy }, { x: x, y: y }) };
  9304. }
  9305. function calculateCurvePoints(bounds, borderRadius, borders) {
  9306. var x = bounds.left,
  9307. y = bounds.top,
  9308. width = bounds.width,
  9309. height = bounds.height,
  9310. tlh = borderRadius[0][0] < width / 2 ? borderRadius[0][0] : width / 2,
  9311. tlv = borderRadius[0][1] < height / 2 ? borderRadius[0][1] : height / 2,
  9312. trh = borderRadius[1][0] < width / 2 ? borderRadius[1][0] : width / 2,
  9313. trv = borderRadius[1][1] < height / 2 ? borderRadius[1][1] : height / 2,
  9314. brh = borderRadius[2][0] < width / 2 ? borderRadius[2][0] : width / 2,
  9315. brv = borderRadius[2][1] < height / 2 ? borderRadius[2][1] : height / 2,
  9316. blh = borderRadius[3][0] < width / 2 ? borderRadius[3][0] : width / 2,
  9317. blv = borderRadius[3][1] < height / 2 ? borderRadius[3][1] : height / 2;
  9318. var topWidth = width - trh,
  9319. rightHeight = height - brv,
  9320. bottomWidth = width - brh,
  9321. leftHeight = height - blv;
  9322. return {
  9323. topLeft: getCurvePoints(x + borders[3].width / 2, y + borders[0].width / 2, Math.max(0, tlh - borders[3].width / 2), Math.max(0, tlv - borders[0].width / 2)).topLeft.subdivide(0.5),
  9324. topRight: getCurvePoints(x + Math.min(topWidth, width + borders[3].width / 2), y + borders[0].width / 2, topWidth > width + borders[3].width / 2 ? 0 : trh - borders[3].width / 2, trv - borders[0].width / 2).topRight.subdivide(0.5),
  9325. bottomRight: getCurvePoints(x + Math.min(bottomWidth, width - borders[3].width / 2), y + Math.min(rightHeight, height + borders[0].width / 2), Math.max(0, brh - borders[1].width / 2), brv - borders[2].width / 2).bottomRight.subdivide(0.5),
  9326. bottomLeft: getCurvePoints(x + borders[3].width / 2, y + leftHeight, Math.max(0, blh - borders[3].width / 2), blv - borders[2].width / 2).bottomLeft.subdivide(0.5),
  9327. topLeftOuter: getCurvePoints(x, y, tlh, tlv).topLeft.subdivide(0.5),
  9328. topLeftInner: getCurvePoints(x + borders[3].width, y + borders[0].width, Math.max(0, tlh - borders[3].width), Math.max(0, tlv - borders[0].width)).topLeft.subdivide(0.5),
  9329. topRightOuter: getCurvePoints(x + topWidth, y, trh, trv).topRight.subdivide(0.5),
  9330. topRightInner: getCurvePoints(x + Math.min(topWidth, width + borders[3].width), y + borders[0].width, topWidth > width + borders[3].width ? 0 : trh - borders[3].width, trv - borders[0].width).topRight.subdivide(0.5),
  9331. bottomRightOuter: getCurvePoints(x + bottomWidth, y + rightHeight, brh, brv).bottomRight.subdivide(0.5),
  9332. bottomRightInner: getCurvePoints(x + Math.min(bottomWidth, width - borders[3].width), y + Math.min(rightHeight, height + borders[0].width), Math.max(0, brh - borders[1].width), brv - borders[2].width).bottomRight.subdivide(0.5),
  9333. bottomLeftOuter: getCurvePoints(x, y + leftHeight, blh, blv).bottomLeft.subdivide(0.5),
  9334. bottomLeftInner: getCurvePoints(x + borders[3].width, y + leftHeight, Math.max(0, blh - borders[3].width), blv - borders[2].width).bottomLeft.subdivide(0.5) };
  9335. }
  9336. function bezierCurve(start, startControl, endControl, end) {
  9337. var lerp = function lerp(a, b, t) {
  9338. return {
  9339. x: a.x + (b.x - a.x) * t,
  9340. y: a.y + (b.y - a.y) * t };
  9341. };
  9342. return {
  9343. start: start,
  9344. startControl: startControl,
  9345. endControl: endControl,
  9346. end: end,
  9347. subdivide: function subdivide(t) {
  9348. var ab = lerp(start, startControl, t),
  9349. bc = lerp(startControl, endControl, t),
  9350. cd = lerp(endControl, end, t),
  9351. abbc = lerp(ab, bc, t),
  9352. bccd = lerp(bc, cd, t),
  9353. dest = lerp(abbc, bccd, t);
  9354. return [bezierCurve(start, ab, abbc, dest), bezierCurve(dest, bccd, cd, end)];
  9355. },
  9356. curveTo: function curveTo(borderArgs) {
  9357. borderArgs.push(["bezierCurve", startControl.x, startControl.y, endControl.x, endControl.y, end.x, end.y]);
  9358. },
  9359. curveToReversed: function curveToReversed(borderArgs) {
  9360. borderArgs.push(["bezierCurve", endControl.x, endControl.y, startControl.x, startControl.y, start.x, start.y]);
  9361. } };
  9362. }
  9363. function drawSide(borderData, radius1, radius2, outer1, inner1, outer2, inner2) {
  9364. var borderArgs = [];
  9365. if (radius1[0] > 0 || radius1[1] > 0) {
  9366. borderArgs.push(["line", outer1[1].start.x, outer1[1].start.y]);
  9367. outer1[1].curveTo(borderArgs);
  9368. } else {
  9369. borderArgs.push(["line", borderData.c1[0], borderData.c1[1]]);
  9370. }
  9371. if (radius2[0] > 0 || radius2[1] > 0) {
  9372. borderArgs.push(["line", outer2[0].start.x, outer2[0].start.y]);
  9373. outer2[0].curveTo(borderArgs);
  9374. borderArgs.push(["line", inner2[0].end.x, inner2[0].end.y]);
  9375. inner2[0].curveToReversed(borderArgs);
  9376. } else {
  9377. borderArgs.push(["line", borderData.c2[0], borderData.c2[1]]);
  9378. borderArgs.push(["line", borderData.c3[0], borderData.c3[1]]);
  9379. }
  9380. if (radius1[0] > 0 || radius1[1] > 0) {
  9381. borderArgs.push(["line", inner1[1].end.x, inner1[1].end.y]);
  9382. inner1[1].curveToReversed(borderArgs);
  9383. } else {
  9384. borderArgs.push(["line", borderData.c4[0], borderData.c4[1]]);
  9385. }
  9386. return borderArgs;
  9387. }
  9388. function drawSidePath(borderData, radius1, radius2, curve1, curve2) {
  9389. var borderArgs = [];
  9390. if (radius1[0] > 0 || radius1[1] > 0) {
  9391. borderArgs.push(["line", curve1[1].start.x, curve1[1].start.y]);
  9392. curve1[1].curveTo(borderArgs);
  9393. } else {
  9394. borderArgs.push(["line", borderData.c1[0], borderData.c1[1]]);
  9395. }
  9396. if (radius2[0] > 0 || radius2[1] > 0) {
  9397. borderArgs.push(["line", curve2[0].start.x, curve2[0].start.y]);
  9398. curve2[0].curveTo(borderArgs);
  9399. } else {
  9400. borderArgs.push(["line", borderData.c2[0], borderData.c2[1]]);
  9401. }
  9402. return borderArgs;
  9403. }
  9404. function parseCorner(borderArgs, radius1, radius2, corner1, corner2, x, y) {
  9405. if (radius1[0] > 0 || radius1[1] > 0) {
  9406. borderArgs.push(["line", corner1[0].start.x, corner1[0].start.y]);
  9407. corner1[0].curveTo(borderArgs);
  9408. corner1[1].curveTo(borderArgs);
  9409. } else {
  9410. borderArgs.push(["line", x, y]);
  9411. }
  9412. if (radius2[0] > 0 || radius2[1] > 0) {
  9413. borderArgs.push(["line", corner2[0].start.x, corner2[0].start.y]);
  9414. }
  9415. }
  9416. function negativeZIndex(container) {
  9417. return container.cssInt("zIndex") < 0;
  9418. }
  9419. function positiveZIndex(container) {
  9420. return container.cssInt("zIndex") > 0;
  9421. }
  9422. function zIndex0(container) {
  9423. return container.cssInt("zIndex") === 0;
  9424. }
  9425. function inlineLevel(container) {
  9426. return ["inline", "inline-block", "inline-table"].indexOf(container.css("display")) !== -1;
  9427. }
  9428. function isStackingContext(container) {
  9429. return container instanceof StackingContext;
  9430. }
  9431. function hasText(container) {
  9432. return container.node.data.trim().length > 0;
  9433. }
  9434. function noLetterSpacing(container) {
  9435. return /^(normal|none|0px)$/.test(container.parent.css("letterSpacing"));
  9436. }
  9437. function getBorderRadiusData(container) {
  9438. return ["TopLeft", "TopRight", "BottomRight", "BottomLeft"].map(function (side) {
  9439. var value = container.css('border' + side + 'Radius');
  9440. var arr = value.split(" ");
  9441. if (arr.length <= 1) {
  9442. arr[1] = arr[0];
  9443. }
  9444. return arr.map(asInt);
  9445. });
  9446. }
  9447. function renderableNode(node) {
  9448. return node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE;
  9449. }
  9450. function isPositionedForStacking(container) {
  9451. var position = container.css("position");
  9452. var zIndex = ["absolute", "relative", "fixed"].indexOf(position) !== -1 ? container.css("zIndex") : "auto";
  9453. return zIndex !== "auto";
  9454. }
  9455. function isPositioned(container) {
  9456. return container.css("position") !== "static";
  9457. }
  9458. function isFloating(container) {
  9459. return container.css("float") !== "none";
  9460. }
  9461. function isInlineBlock(container) {
  9462. return ["inline-block", "inline-table"].indexOf(container.css("display")) !== -1;
  9463. }
  9464. function not(callback) {
  9465. var context = this;
  9466. return function () {
  9467. return !callback.apply(context, arguments);
  9468. };
  9469. }
  9470. function isElement(container) {
  9471. return container.node.nodeType === Node.ELEMENT_NODE;
  9472. }
  9473. function isPseudoElement(container) {
  9474. return container.isPseudoElement === true;
  9475. }
  9476. function isTextNode(container) {
  9477. return container.node.nodeType === Node.TEXT_NODE;
  9478. }
  9479. function zIndexSort(contexts) {
  9480. return function (a, b) {
  9481. return a.cssInt("zIndex") + contexts.indexOf(a) / contexts.length - (b.cssInt("zIndex") + contexts.indexOf(b) / contexts.length);
  9482. };
  9483. }
  9484. function hasOpacity(container) {
  9485. return container.getOpacity() < 1;
  9486. }
  9487. function asInt(value) {
  9488. return parseInt(value, 10);
  9489. }
  9490. function getWidth(border) {
  9491. return border.width;
  9492. }
  9493. function nonIgnoredElement(nodeContainer) {
  9494. return nodeContainer.node.nodeType !== Node.ELEMENT_NODE || ["SCRIPT", "HEAD", "TITLE", "OBJECT", "BR", "OPTION"].indexOf(nodeContainer.node.nodeName) === -1;
  9495. }
  9496. function flatten(arrays) {
  9497. return [].concat.apply([], arrays);
  9498. }
  9499. function stripQuotes(content) {
  9500. var first = content.substr(0, 1);
  9501. return first === content.substr(content.length - 1) && first.match(/'|"/) ? content.substr(1, content.length - 2) : content;
  9502. }
  9503. function getWords(characters) {
  9504. var words = [],i = 0,onWordBoundary = false,word;
  9505. while (characters.length) {
  9506. if (isWordBoundary(characters[i]) === onWordBoundary) {
  9507. word = characters.splice(0, i);
  9508. if (word.length) {
  9509. words.push(punycode.ucs2.encode(word));
  9510. }
  9511. onWordBoundary = !onWordBoundary;
  9512. i = 0;
  9513. } else {
  9514. i++;
  9515. }
  9516. if (i >= characters.length) {
  9517. word = characters.splice(0, i);
  9518. if (word.length) {
  9519. words.push(punycode.ucs2.encode(word));
  9520. }
  9521. }
  9522. }
  9523. return words;
  9524. }
  9525. function isWordBoundary(characterCode) {
  9526. return [
  9527. 32, // <space>
  9528. 13, // \r
  9529. 10, // \n
  9530. 9, // \t
  9531. 45 // -
  9532. ].indexOf(characterCode) !== -1;
  9533. }
  9534. function hasUnicode(string) {
  9535. return /[^\u0000-\u00ff]/.test(string);
  9536. }
  9537. module.exports = NodeParser;
  9538. }, { "./color": 3, "./fontmetrics": 7, "./log": 13, "./nodecontainer": 14, "./pseudoelementcontainer": 18, "./stackingcontext": 21, "./textcontainer": 25, "./utils": 26, "punycode": 1 }], 16: [function (_dereq_, module, exports) {
  9539. var XHR = _dereq_('./xhr');
  9540. var utils = _dereq_('./utils');
  9541. var log = _dereq_('./log');
  9542. var createWindowClone = _dereq_('./clone');
  9543. var decode64 = utils.decode64;
  9544. function Proxy(src, proxyUrl, document) {
  9545. var supportsCORS = ('withCredentials' in new XMLHttpRequest());
  9546. if (!proxyUrl) {
  9547. return Promise.reject("No proxy configured");
  9548. }
  9549. var callback = createCallback(supportsCORS);
  9550. var url = createProxyUrl(proxyUrl, src, callback);
  9551. return supportsCORS ? XHR(url) : jsonp(document, url, callback).then(function (response) {
  9552. return decode64(response.content);
  9553. });
  9554. }
  9555. var proxyCount = 0;
  9556. function ProxyURL(src, proxyUrl, document) {
  9557. var supportsCORSImage = ('crossOrigin' in new Image());
  9558. var callback = createCallback(supportsCORSImage);
  9559. var url = createProxyUrl(proxyUrl, src, callback);
  9560. return supportsCORSImage ? Promise.resolve(url) : jsonp(document, url, callback).then(function (response) {
  9561. return "data:" + response.type + ";base64," + response.content;
  9562. });
  9563. }
  9564. function jsonp(document, url, callback) {
  9565. return new Promise(function (resolve, reject) {
  9566. var s = document.createElement("script");
  9567. var cleanup = function cleanup() {
  9568. delete window.html2canvas.proxy[callback];
  9569. document.body.removeChild(s);
  9570. };
  9571. window.html2canvas.proxy[callback] = function (response) {
  9572. cleanup();
  9573. resolve(response);
  9574. };
  9575. s.src = url;
  9576. s.onerror = function (e) {
  9577. cleanup();
  9578. reject(e);
  9579. };
  9580. document.body.appendChild(s);
  9581. });
  9582. }
  9583. function createCallback(useCORS) {
  9584. return !useCORS ? "html2canvas_" + Date.now() + "_" + ++proxyCount + "_" + Math.round(Math.random() * 100000) : "";
  9585. }
  9586. function createProxyUrl(proxyUrl, src, callback) {
  9587. return proxyUrl + "?url=" + encodeURIComponent(src) + (callback.length ? "&callback=html2canvas.proxy." + callback : "");
  9588. }
  9589. function documentFromHTML(src) {
  9590. return function (html) {
  9591. var parser = new DOMParser(),doc;
  9592. try {
  9593. doc = parser.parseFromString(html, "text/html");
  9594. } catch (e) {
  9595. log("DOMParser not supported, falling back to createHTMLDocument");
  9596. doc = document.implementation.createHTMLDocument("");
  9597. try {
  9598. doc.open();
  9599. doc.write(html);
  9600. doc.close();
  9601. } catch (ee) {
  9602. log("createHTMLDocument write not supported, falling back to document.body.innerHTML");
  9603. doc.body.innerHTML = html; // ie9 doesnt support writing to documentElement
  9604. }
  9605. }
  9606. var b = doc.querySelector("base");
  9607. if (!b || !b.href.host) {
  9608. var base = doc.createElement("base");
  9609. base.href = src;
  9610. doc.head.insertBefore(base, doc.head.firstChild);
  9611. }
  9612. return doc;
  9613. };
  9614. }
  9615. function loadUrlDocument(src, proxy, document, width, height, options) {
  9616. return new Proxy(src, proxy, window.document).then(documentFromHTML(src)).then(function (doc) {
  9617. return createWindowClone(doc, document, width, height, options, 0, 0);
  9618. });
  9619. }
  9620. exports.Proxy = Proxy;
  9621. exports.ProxyURL = ProxyURL;
  9622. exports.loadUrlDocument = loadUrlDocument;
  9623. }, { "./clone": 2, "./log": 13, "./utils": 26, "./xhr": 28 }], 17: [function (_dereq_, module, exports) {
  9624. var ProxyURL = _dereq_('./proxy').ProxyURL;
  9625. function ProxyImageContainer(src, proxy) {
  9626. var link = document.createElement("a");
  9627. link.href = src;
  9628. src = link.href;
  9629. this.src = src;
  9630. this.image = new Image();
  9631. var self = this;
  9632. this.promise = new Promise(function (resolve, reject) {
  9633. self.image.crossOrigin = "Anonymous";
  9634. self.image.onload = resolve;
  9635. self.image.onerror = reject;
  9636. new ProxyURL(src, proxy, document).then(function (url) {
  9637. self.image.src = url;
  9638. })['catch'](reject);
  9639. });
  9640. }
  9641. module.exports = ProxyImageContainer;
  9642. }, { "./proxy": 16 }], 18: [function (_dereq_, module, exports) {
  9643. var NodeContainer = _dereq_('./nodecontainer');
  9644. function PseudoElementContainer(node, parent, type) {
  9645. NodeContainer.call(this, node, parent);
  9646. this.isPseudoElement = true;
  9647. this.before = type === ":before";
  9648. }
  9649. PseudoElementContainer.prototype.cloneTo = function (stack) {
  9650. PseudoElementContainer.prototype.cloneTo.call(this, stack);
  9651. stack.isPseudoElement = true;
  9652. stack.before = this.before;
  9653. };
  9654. PseudoElementContainer.prototype = Object.create(NodeContainer.prototype);
  9655. PseudoElementContainer.prototype.appendToDOM = function () {
  9656. if (this.before) {
  9657. this.parent.node.insertBefore(this.node, this.parent.node.firstChild);
  9658. } else {
  9659. this.parent.node.appendChild(this.node);
  9660. }
  9661. this.parent.node.className += " " + this.getHideClass();
  9662. };
  9663. PseudoElementContainer.prototype.cleanDOM = function () {
  9664. this.node.parentNode.removeChild(this.node);
  9665. this.parent.node.className = this.parent.node.className.replace(this.getHideClass(), "");
  9666. };
  9667. PseudoElementContainer.prototype.getHideClass = function () {
  9668. return this["PSEUDO_HIDE_ELEMENT_CLASS_" + (this.before ? "BEFORE" : "AFTER")];
  9669. };
  9670. PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before";
  9671. PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after";
  9672. module.exports = PseudoElementContainer;
  9673. }, { "./nodecontainer": 14 }], 19: [function (_dereq_, module, exports) {
  9674. var log = _dereq_('./log');
  9675. function Renderer(width, height, images, options, document) {
  9676. this.width = width;
  9677. this.height = height;
  9678. this.images = images;
  9679. this.options = options;
  9680. this.document = document;
  9681. }
  9682. Renderer.prototype.renderImage = function (container, bounds, borderData, imageContainer) {
  9683. var paddingLeft = container.cssInt('paddingLeft'),
  9684. paddingTop = container.cssInt('paddingTop'),
  9685. paddingRight = container.cssInt('paddingRight'),
  9686. paddingBottom = container.cssInt('paddingBottom'),
  9687. borders = borderData.borders;
  9688. var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);
  9689. var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);
  9690. this.drawImage(
  9691. imageContainer,
  9692. 0,
  9693. 0,
  9694. imageContainer.image.width || width,
  9695. imageContainer.image.height || height,
  9696. bounds.left + paddingLeft + borders[3].width,
  9697. bounds.top + paddingTop + borders[0].width,
  9698. width,
  9699. height);
  9700. };
  9701. Renderer.prototype.renderBackground = function (container, bounds, borderData) {
  9702. if (bounds.height > 0 && bounds.width > 0) {
  9703. this.renderBackgroundColor(container, bounds);
  9704. this.renderBackgroundImage(container, bounds, borderData);
  9705. }
  9706. };
  9707. Renderer.prototype.renderBackgroundColor = function (container, bounds) {
  9708. var color = container.color("backgroundColor");
  9709. if (!color.isTransparent()) {
  9710. this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, color);
  9711. }
  9712. };
  9713. Renderer.prototype.renderShadows = function (container, shape) {
  9714. var boxShadow = container.css('boxShadow');
  9715. if (boxShadow !== 'none') {
  9716. var shadows = boxShadow.split(/,(?![^(]*\))/);
  9717. this.shadow(shape, shadows);
  9718. }
  9719. };
  9720. Renderer.prototype.renderBorders = function (borders) {
  9721. borders.forEach(this.renderBorder, this);
  9722. };
  9723. Renderer.prototype.renderBorder = function (data) {
  9724. if (!data.color.isTransparent() && data.args !== null) {
  9725. if (data.style === 'dashed' || data.style === 'dotted') {
  9726. var dash = data.style === 'dashed' ? 3 : data.width;
  9727. this.ctx.setLineDash([dash]);
  9728. this.path(data.pathArgs);
  9729. this.ctx.strokeStyle = data.color;
  9730. this.ctx.lineWidth = data.width;
  9731. this.ctx.stroke();
  9732. } else {
  9733. this.drawShape(data.args, data.color);
  9734. }
  9735. }
  9736. };
  9737. Renderer.prototype.renderBackgroundImage = function (container, bounds, borderData) {
  9738. var backgroundImages = container.parseBackgroundImages();
  9739. backgroundImages.reverse().forEach(function (backgroundImage, index, arr) {
  9740. switch (backgroundImage.method) {
  9741. case "url":
  9742. var image = this.images.get(backgroundImage.args[0]);
  9743. if (image) {
  9744. this.renderBackgroundRepeating(container, bounds, image, arr.length - (index + 1), borderData);
  9745. } else {
  9746. log("Error loading background-image", backgroundImage.args[0]);
  9747. }
  9748. break;
  9749. case "linear-gradient":
  9750. case "gradient":
  9751. var gradientImage = this.images.get(backgroundImage.value);
  9752. if (gradientImage) {
  9753. this.renderBackgroundGradient(gradientImage, bounds, borderData);
  9754. } else {
  9755. log("Error loading background-image", backgroundImage.args[0]);
  9756. }
  9757. break;
  9758. case "none":
  9759. break;
  9760. default:
  9761. log("Unknown background-image type", backgroundImage.args[0]);}
  9762. }, this);
  9763. };
  9764. Renderer.prototype.renderBackgroundRepeating = function (container, bounds, imageContainer, index, borderData) {
  9765. var size = container.parseBackgroundSize(bounds, imageContainer.image, index);
  9766. var position = container.parseBackgroundPosition(bounds, imageContainer.image, index, size);
  9767. var repeat = container.parseBackgroundRepeat(index);
  9768. switch (repeat) {
  9769. case "repeat-x":
  9770. case "repeat no-repeat":
  9771. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + borderData[3], bounds.top + position.top + borderData[0], 99999, size.height, borderData);
  9772. break;
  9773. case "repeat-y":
  9774. case "no-repeat repeat":
  9775. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + borderData[0], size.width, 99999, borderData);
  9776. break;
  9777. case "no-repeat":
  9778. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], size.width, size.height, borderData);
  9779. break;
  9780. default:
  9781. this.renderBackgroundRepeat(imageContainer, position, size, { top: bounds.top, left: bounds.left }, borderData[3], borderData[0]);
  9782. break;}
  9783. };
  9784. module.exports = Renderer;
  9785. }, { "./log": 13 }], 20: [function (_dereq_, module, exports) {
  9786. var Renderer = _dereq_('../renderer');
  9787. var LinearGradientContainer = _dereq_('../lineargradientcontainer');
  9788. var log = _dereq_('../log');
  9789. function CanvasRenderer(width, height) {
  9790. Renderer.apply(this, arguments);
  9791. this.canvas = this.options.canvas || this.document.createElement("canvas");
  9792. this.ctx = this.canvas.getContext("2d");
  9793. if (!this.options.canvas) {
  9794. if (this.options.dpi) {
  9795. this.options.scale = this.options.dpi / 96; // 1 CSS inch = 96px.
  9796. }
  9797. if (this.options.scale) {
  9798. this.canvas.style.width = width + 'px';
  9799. this.canvas.style.height = height + 'px';
  9800. this.canvas.width = Math.floor(width * this.options.scale);
  9801. this.canvas.height = Math.floor(height * this.options.scale);
  9802. this.ctx.scale(this.options.scale, this.options.scale);
  9803. } else {
  9804. this.canvas.width = width;
  9805. this.canvas.height = height;
  9806. }
  9807. }
  9808. this.taintCtx = this.document.createElement("canvas").getContext("2d");
  9809. this.ctx.textBaseline = "bottom";
  9810. this.variables = {};
  9811. log("Initialized CanvasRenderer with size", width, "x", height);
  9812. }
  9813. CanvasRenderer.prototype = Object.create(Renderer.prototype);
  9814. CanvasRenderer.prototype.setFillStyle = function (fillStyle) {
  9815. this.ctx.fillStyle = typeof fillStyle === "object" && !!fillStyle.isColor ? fillStyle.toString() : fillStyle;
  9816. return this.ctx;
  9817. };
  9818. CanvasRenderer.prototype.rectangle = function (left, top, width, height, color) {
  9819. this.setFillStyle(color).fillRect(left, top, width, height);
  9820. };
  9821. CanvasRenderer.prototype.circle = function (left, top, size, color) {
  9822. this.setFillStyle(color);
  9823. this.ctx.beginPath();
  9824. this.ctx.arc(left + size / 2, top + size / 2, size / 2, 0, Math.PI * 2, true);
  9825. this.ctx.closePath();
  9826. this.ctx.fill();
  9827. };
  9828. CanvasRenderer.prototype.circleStroke = function (left, top, size, color, stroke, strokeColor) {
  9829. this.circle(left, top, size, color);
  9830. this.ctx.strokeStyle = strokeColor.toString();
  9831. this.ctx.stroke();
  9832. };
  9833. CanvasRenderer.prototype.shadow = function (shape, shadows) {
  9834. var parseShadow = function parseShadow(str) {
  9835. var propertyFilters = { color: /^(#|rgb|hsl|(?!(inset|initial|inherit))\D+)/i, inset: /^inset/i, px: /px$/i };
  9836. var pxPropertyNames = ['x', 'y', 'blur', 'spread'];
  9837. var properties = str.split(/ (?![^(]*\))/);
  9838. var info = {};
  9839. for (var key in propertyFilters) {
  9840. info[key] = properties.filter(propertyFilters[key].test.bind(propertyFilters[key]));
  9841. info[key] = info[key].length === 0 ? null : info[key].length === 1 ? info[key][0] : info[key];
  9842. }
  9843. for (var i = 0; i < info.px.length; i++) {
  9844. info[pxPropertyNames[i]] = parseInt(info.px[i]);
  9845. }
  9846. return info;
  9847. };
  9848. var drawShadow = function drawShadow(shadow) {
  9849. var info = parseShadow(shadow);
  9850. if (!info.inset) {
  9851. context.shadowOffsetX = info.x;
  9852. context.shadowOffsetY = info.y;
  9853. context.shadowColor = info.color;
  9854. context.shadowBlur = info.blur;
  9855. context.fill();
  9856. }
  9857. };
  9858. var context = this.setFillStyle('white');
  9859. context.save();
  9860. this.shape(shape);
  9861. shadows.forEach(drawShadow, this);
  9862. context.restore();
  9863. };
  9864. CanvasRenderer.prototype.drawShape = function (shape, color) {
  9865. this.shape(shape);
  9866. this.setFillStyle(color).fill();
  9867. };
  9868. CanvasRenderer.prototype.taints = function (imageContainer) {
  9869. if (imageContainer.tainted === null) {
  9870. this.taintCtx.drawImage(imageContainer.image, 0, 0);
  9871. try {
  9872. this.taintCtx.getImageData(0, 0, 1, 1);
  9873. imageContainer.tainted = false;
  9874. } catch (e) {
  9875. this.taintCtx = document.createElement("canvas").getContext("2d");
  9876. imageContainer.tainted = true;
  9877. }
  9878. }
  9879. return imageContainer.tainted;
  9880. };
  9881. CanvasRenderer.prototype.drawImage = function (imageContainer, sx, sy, sw, sh, dx, dy, dw, dh) {
  9882. if (!this.taints(imageContainer) || this.options.allowTaint) {
  9883. this.ctx.drawImage(imageContainer.image, sx, sy, sw, sh, dx, dy, dw, dh);
  9884. }
  9885. };
  9886. CanvasRenderer.prototype.clip = function (shapes, callback, context, container) {
  9887. this.ctx.save();
  9888. if (container && container.hasTransform()) {
  9889. this.setTransform(container.inverseTransform());
  9890. shapes.filter(hasEntries).forEach(function (shape) {
  9891. this.shape(shape).clip();
  9892. }, this);
  9893. this.setTransform(container.parseTransform());
  9894. } else {
  9895. shapes.filter(hasEntries).forEach(function (shape) {
  9896. this.shape(shape).clip();
  9897. }, this);
  9898. }
  9899. callback.call(context);
  9900. this.ctx.restore();
  9901. };
  9902. CanvasRenderer.prototype.mask = function (shapes, callback, context, container) {
  9903. var borderClip = shapes[shapes.length - 1];
  9904. if (borderClip && borderClip.length) {
  9905. var canvasBorderCCW = ["rect", this.canvas.width, 0, -this.canvas.width, this.canvas.height];
  9906. var maskShape = [canvasBorderCCW].concat(borderClip).concat([borderClip[0]]);
  9907. shapes = shapes.slice(0, -1).concat([maskShape]);
  9908. }
  9909. this.clip(shapes, callback, context, container);
  9910. };
  9911. CanvasRenderer.prototype.shape = function (shape) {
  9912. this.ctx.beginPath();
  9913. shape.forEach(function (point, index) {
  9914. if (point[0] === "rect") {
  9915. this.ctx.rect.apply(this.ctx, point.slice(1));
  9916. } else {
  9917. this.ctx[index === 0 ? "moveTo" : point[0] + "To"].apply(this.ctx, point.slice(1));
  9918. }
  9919. }, this);
  9920. this.ctx.closePath();
  9921. return this.ctx;
  9922. };
  9923. CanvasRenderer.prototype.path = function (shape) {
  9924. this.ctx.beginPath();
  9925. shape.forEach(function (point, index) {
  9926. if (point[0] === "rect") {
  9927. this.ctx.rect.apply(this.ctx, point.slice(1));
  9928. } else {
  9929. this.ctx[index === 0 ? "moveTo" : point[0] + "To"].apply(this.ctx, point.slice(1));
  9930. }
  9931. }, this);
  9932. return this.ctx;
  9933. };
  9934. CanvasRenderer.prototype.font = function (color, style, variant, weight, size, family) {
  9935. variant = /^(normal|small-caps)$/i.test(variant) ? variant : '';
  9936. this.setFillStyle(color).font = [style, variant, weight, size, family].join(" ").split(",")[0];
  9937. };
  9938. CanvasRenderer.prototype.fontShadow = function (color, offsetX, offsetY, blur) {
  9939. this.setVariable("shadowColor", color.toString()).
  9940. setVariable("shadowOffsetY", offsetX).
  9941. setVariable("shadowOffsetX", offsetY).
  9942. setVariable("shadowBlur", blur);
  9943. };
  9944. CanvasRenderer.prototype.clearShadow = function () {
  9945. this.setVariable("shadowColor", "rgba(0,0,0,0)");
  9946. };
  9947. CanvasRenderer.prototype.setOpacity = function (opacity) {
  9948. this.ctx.globalAlpha = opacity;
  9949. };
  9950. CanvasRenderer.prototype.setTransform = function (transform) {
  9951. this.ctx.translate(transform.origin[0], transform.origin[1]);
  9952. this.ctx.transform.apply(this.ctx, transform.matrix);
  9953. this.ctx.translate(-transform.origin[0], -transform.origin[1]);
  9954. };
  9955. CanvasRenderer.prototype.setVariable = function (property, value) {
  9956. if (this.variables[property] !== value) {
  9957. this.variables[property] = this.ctx[property] = value;
  9958. }
  9959. return this;
  9960. };
  9961. CanvasRenderer.prototype.text = function (text, left, bottom) {
  9962. this.ctx.fillText(text, left, bottom);
  9963. };
  9964. CanvasRenderer.prototype.backgroundRepeatShape = function (imageContainer, backgroundPosition, size, bounds, left, top, width, height, borderData) {
  9965. var shape = [
  9966. ["line", Math.round(left), Math.round(top)],
  9967. ["line", Math.round(left + width), Math.round(top)],
  9968. ["line", Math.round(left + width), Math.round(height + top)],
  9969. ["line", Math.round(left), Math.round(height + top)]];
  9970. this.clip([shape], function () {
  9971. this.renderBackgroundRepeat(imageContainer, backgroundPosition, size, bounds, borderData[3], borderData[0]);
  9972. }, this);
  9973. };
  9974. CanvasRenderer.prototype.renderBackgroundRepeat = function (imageContainer, backgroundPosition, size, bounds, borderLeft, borderTop) {
  9975. var offsetX = Math.round(bounds.left + backgroundPosition.left + borderLeft),offsetY = Math.round(bounds.top + backgroundPosition.top + borderTop);
  9976. this.setFillStyle(this.ctx.createPattern(this.resizeImage(imageContainer, size), "repeat"));
  9977. this.ctx.translate(offsetX, offsetY);
  9978. this.ctx.fill();
  9979. this.ctx.translate(-offsetX, -offsetY);
  9980. };
  9981. CanvasRenderer.prototype.renderBackgroundGradient = function (gradientImage, bounds) {
  9982. if (gradientImage instanceof LinearGradientContainer) {
  9983. var gradient = this.ctx.createLinearGradient(
  9984. bounds.left + bounds.width * gradientImage.x0,
  9985. bounds.top + bounds.height * gradientImage.y0,
  9986. bounds.left + bounds.width * gradientImage.x1,
  9987. bounds.top + bounds.height * gradientImage.y1);
  9988. gradientImage.colorStops.forEach(function (colorStop) {
  9989. gradient.addColorStop(colorStop.stop, colorStop.color.toString());
  9990. });
  9991. this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, gradient);
  9992. }
  9993. };
  9994. CanvasRenderer.prototype.resizeImage = function (imageContainer, size) {
  9995. var image = imageContainer.image;
  9996. if (image.width === size.width && image.height === size.height) {
  9997. return image;
  9998. }
  9999. var ctx,canvas = document.createElement('canvas');
  10000. canvas.width = size.width;
  10001. canvas.height = size.height;
  10002. ctx = canvas.getContext("2d");
  10003. ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height);
  10004. return canvas;
  10005. };
  10006. function hasEntries(array) {
  10007. return array.length > 0;
  10008. }
  10009. module.exports = CanvasRenderer;
  10010. }, { "../lineargradientcontainer": 12, "../log": 13, "../renderer": 19 }], 21: [function (_dereq_, module, exports) {
  10011. var NodeContainer = _dereq_('./nodecontainer');
  10012. function StackingContext(hasOwnStacking, opacity, element, parent) {
  10013. NodeContainer.call(this, element, parent);
  10014. this.ownStacking = hasOwnStacking;
  10015. this.contexts = [];
  10016. this.children = [];
  10017. this.opacity = (this.parent ? this.parent.stack.opacity : 1) * opacity;
  10018. }
  10019. StackingContext.prototype = Object.create(NodeContainer.prototype);
  10020. StackingContext.prototype.getParentStack = function (context) {
  10021. var parentStack = this.parent ? this.parent.stack : null;
  10022. return parentStack ? parentStack.ownStacking ? parentStack : parentStack.getParentStack(context) : context.stack;
  10023. };
  10024. module.exports = StackingContext;
  10025. }, { "./nodecontainer": 14 }], 22: [function (_dereq_, module, exports) {
  10026. function Support(document) {
  10027. this.rangeBounds = this.testRangeBounds(document);
  10028. this.cors = this.testCORS();
  10029. this.svg = this.testSVG();
  10030. }
  10031. Support.prototype.testRangeBounds = function (document) {
  10032. var range,testElement,rangeBounds,rangeHeight,support = false;
  10033. if (document.createRange) {
  10034. range = document.createRange();
  10035. if (range.getBoundingClientRect) {
  10036. testElement = document.createElement('boundtest');
  10037. testElement.style.height = "123px";
  10038. testElement.style.display = "block";
  10039. document.body.appendChild(testElement);
  10040. range.selectNode(testElement);
  10041. rangeBounds = range.getBoundingClientRect();
  10042. rangeHeight = rangeBounds.height;
  10043. if (rangeHeight === 123) {
  10044. support = true;
  10045. }
  10046. document.body.removeChild(testElement);
  10047. }
  10048. }
  10049. return support;
  10050. };
  10051. Support.prototype.testCORS = function () {
  10052. return typeof new Image().crossOrigin !== "undefined";
  10053. };
  10054. Support.prototype.testSVG = function () {
  10055. var img = new Image();
  10056. var canvas = document.createElement("canvas");
  10057. var ctx = canvas.getContext("2d");
  10058. img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  10059. try {
  10060. ctx.drawImage(img, 0, 0);
  10061. canvas.toDataURL();
  10062. } catch (e) {
  10063. return false;
  10064. }
  10065. return true;
  10066. };
  10067. module.exports = Support;
  10068. }, {}], 23: [function (_dereq_, module, exports) {
  10069. var XHR = _dereq_('./xhr');
  10070. var decode64 = _dereq_('./utils').decode64;
  10071. function SVGContainer(src) {
  10072. this.src = src;
  10073. this.image = null;
  10074. var self = this;
  10075. this.promise = this.hasFabric().then(function () {
  10076. return self.isInline(src) ? Promise.resolve(self.inlineFormatting(src)) : XHR(src);
  10077. }).then(function (svg) {
  10078. return new Promise(function (resolve) {
  10079. window.html2canvas.svg.fabric.loadSVGFromString(svg, self.createCanvas.call(self, resolve));
  10080. });
  10081. });
  10082. }
  10083. SVGContainer.prototype.hasFabric = function () {
  10084. return !window.html2canvas.svg || !window.html2canvas.svg.fabric ? Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg")) : Promise.resolve();
  10085. };
  10086. SVGContainer.prototype.inlineFormatting = function (src) {
  10087. return /^data:image\/svg\+xml;base64,/.test(src) ? this.decode64(this.removeContentType(src)) : this.removeContentType(src);
  10088. };
  10089. SVGContainer.prototype.removeContentType = function (src) {
  10090. return src.replace(/^data:image\/svg\+xml(;base64)?,/, '');
  10091. };
  10092. SVGContainer.prototype.isInline = function (src) {
  10093. return /^data:image\/svg\+xml/i.test(src);
  10094. };
  10095. SVGContainer.prototype.createCanvas = function (resolve) {
  10096. var self = this;
  10097. return function (objects, options) {
  10098. var canvas = new window.html2canvas.svg.fabric.StaticCanvas('c');
  10099. self.image = canvas.lowerCanvasEl;
  10100. canvas.
  10101. setWidth(options.width).
  10102. setHeight(options.height).
  10103. add(window.html2canvas.svg.fabric.util.groupSVGElements(objects, options)).
  10104. renderAll();
  10105. resolve(canvas.lowerCanvasEl);
  10106. };
  10107. };
  10108. SVGContainer.prototype.decode64 = function (str) {
  10109. return typeof window.atob === "function" ? window.atob(str) : decode64(str);
  10110. };
  10111. module.exports = SVGContainer;
  10112. }, { "./utils": 26, "./xhr": 28 }], 24: [function (_dereq_, module, exports) {
  10113. var SVGContainer = _dereq_('./svgcontainer');
  10114. function SVGNodeContainer(node, _native) {
  10115. this.src = node;
  10116. this.image = null;
  10117. var self = this;
  10118. this.promise = _native ? new Promise(function (resolve, reject) {
  10119. self.image = new Image();
  10120. self.image.onload = resolve;
  10121. self.image.onerror = reject;
  10122. self.image.src = "data:image/svg+xml," + new XMLSerializer().serializeToString(node);
  10123. if (self.image.complete === true) {
  10124. resolve(self.image);
  10125. }
  10126. }) : this.hasFabric().then(function () {
  10127. return new Promise(function (resolve) {
  10128. window.html2canvas.svg.fabric.parseSVGDocument(node, self.createCanvas.call(self, resolve));
  10129. });
  10130. });
  10131. }
  10132. SVGNodeContainer.prototype = Object.create(SVGContainer.prototype);
  10133. module.exports = SVGNodeContainer;
  10134. }, { "./svgcontainer": 23 }], 25: [function (_dereq_, module, exports) {
  10135. var NodeContainer = _dereq_('./nodecontainer');
  10136. function TextContainer(node, parent) {
  10137. NodeContainer.call(this, node, parent);
  10138. }
  10139. TextContainer.prototype = Object.create(NodeContainer.prototype);
  10140. TextContainer.prototype.applyTextTransform = function () {
  10141. this.node.data = this.transform(this.parent.css("textTransform"));
  10142. };
  10143. TextContainer.prototype.transform = function (transform) {
  10144. var text = this.node.data;
  10145. switch (transform) {
  10146. case "lowercase":
  10147. return text.toLowerCase();
  10148. case "capitalize":
  10149. return text.replace(/(^|\s|:|-|\(|\))([a-z])/g, capitalize);
  10150. case "uppercase":
  10151. return text.toUpperCase();
  10152. default:
  10153. return text;}
  10154. };
  10155. function capitalize(m, p1, p2) {
  10156. if (m.length > 0) {
  10157. return p1 + p2.toUpperCase();
  10158. }
  10159. }
  10160. module.exports = TextContainer;
  10161. }, { "./nodecontainer": 14 }], 26: [function (_dereq_, module, exports) {
  10162. exports.smallImage = function smallImage() {
  10163. return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  10164. };
  10165. exports.bind = function (callback, context) {
  10166. return function () {
  10167. return callback.apply(context, arguments);
  10168. };
  10169. };
  10170. /*
  10171. * base64-arraybuffer
  10172. * https://github.com/niklasvh/base64-arraybuffer
  10173. *
  10174. * Copyright (c) 2012 Niklas von Hertzen
  10175. * Licensed under the MIT license.
  10176. */
  10177. exports.decode64 = function (base64) {
  10178. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  10179. var len = base64.length,i,encoded1,encoded2,encoded3,encoded4,byte1,byte2,byte3;
  10180. var output = "";
  10181. for (i = 0; i < len; i += 4) {
  10182. encoded1 = chars.indexOf(base64[i]);
  10183. encoded2 = chars.indexOf(base64[i + 1]);
  10184. encoded3 = chars.indexOf(base64[i + 2]);
  10185. encoded4 = chars.indexOf(base64[i + 3]);
  10186. byte1 = encoded1 << 2 | encoded2 >> 4;
  10187. byte2 = (encoded2 & 15) << 4 | encoded3 >> 2;
  10188. byte3 = (encoded3 & 3) << 6 | encoded4;
  10189. if (encoded3 === 64) {
  10190. output += String.fromCharCode(byte1);
  10191. } else if (encoded4 === 64 || encoded4 === -1) {
  10192. output += String.fromCharCode(byte1, byte2);
  10193. } else {
  10194. output += String.fromCharCode(byte1, byte2, byte3);
  10195. }
  10196. }
  10197. return output;
  10198. };
  10199. exports.getBounds = function (node) {
  10200. if (node.getBoundingClientRect) {
  10201. var clientRect = node.getBoundingClientRect();
  10202. var width = node.offsetWidth == null ? clientRect.width : node.offsetWidth;
  10203. return {
  10204. top: clientRect.top,
  10205. bottom: clientRect.bottom || clientRect.top + clientRect.height,
  10206. right: clientRect.left + width,
  10207. left: clientRect.left,
  10208. width: width,
  10209. height: node.offsetHeight == null ? clientRect.height : node.offsetHeight };
  10210. }
  10211. return {};
  10212. };
  10213. exports.offsetBounds = function (node) {
  10214. var parent = node.offsetParent ? exports.offsetBounds(node.offsetParent) : { top: 0, left: 0 };
  10215. return {
  10216. top: node.offsetTop + parent.top,
  10217. bottom: node.offsetTop + node.offsetHeight + parent.top,
  10218. right: node.offsetLeft + parent.left + node.offsetWidth,
  10219. left: node.offsetLeft + parent.left,
  10220. width: node.offsetWidth,
  10221. height: node.offsetHeight };
  10222. };
  10223. exports.parseBackgrounds = function (backgroundImage) {
  10224. var whitespace = ' \r\n\t',
  10225. method,definition,prefix,prefix_i,block,results = [],
  10226. mode = 0,numParen = 0,quote,args;
  10227. var appendResult = function appendResult() {
  10228. if (method) {
  10229. if (definition.substr(0, 1) === '"') {
  10230. definition = definition.substr(1, definition.length - 2);
  10231. }
  10232. if (definition) {
  10233. args.push(definition);
  10234. }
  10235. if (method.substr(0, 1) === '-' && (prefix_i = method.indexOf('-', 1) + 1) > 0) {
  10236. prefix = method.substr(0, prefix_i);
  10237. method = method.substr(prefix_i);
  10238. }
  10239. results.push({
  10240. prefix: prefix,
  10241. method: method.toLowerCase(),
  10242. value: block,
  10243. args: args,
  10244. image: null });
  10245. }
  10246. args = [];
  10247. method = prefix = definition = block = '';
  10248. };
  10249. args = [];
  10250. method = prefix = definition = block = '';
  10251. backgroundImage.split("").forEach(function (c) {
  10252. if (mode === 0 && whitespace.indexOf(c) > -1) {
  10253. return;
  10254. }
  10255. switch (c) {
  10256. case '"':
  10257. if (!quote) {
  10258. quote = c;
  10259. } else if (quote === c) {
  10260. quote = null;
  10261. }
  10262. break;
  10263. case '(':
  10264. if (quote) {
  10265. break;
  10266. } else if (mode === 0) {
  10267. mode = 1;
  10268. block += c;
  10269. return;
  10270. } else {
  10271. numParen++;
  10272. }
  10273. break;
  10274. case ')':
  10275. if (quote) {
  10276. break;
  10277. } else if (mode === 1) {
  10278. if (numParen === 0) {
  10279. mode = 0;
  10280. block += c;
  10281. appendResult();
  10282. return;
  10283. } else {
  10284. numParen--;
  10285. }
  10286. }
  10287. break;
  10288. case ',':
  10289. if (quote) {
  10290. break;
  10291. } else if (mode === 0) {
  10292. appendResult();
  10293. return;
  10294. } else if (mode === 1) {
  10295. if (numParen === 0 && !method.match(/^url$/i)) {
  10296. args.push(definition);
  10297. definition = '';
  10298. block += c;
  10299. return;
  10300. }
  10301. }
  10302. break;}
  10303. block += c;
  10304. if (mode === 0) {
  10305. method += c;
  10306. } else {
  10307. definition += c;
  10308. }
  10309. });
  10310. appendResult();
  10311. return results;
  10312. };
  10313. }, {}], 27: [function (_dereq_, module, exports) {
  10314. var GradientContainer = _dereq_('./gradientcontainer');
  10315. function WebkitGradientContainer(imageData) {
  10316. GradientContainer.apply(this, arguments);
  10317. this.type = imageData.args[0] === "linear" ? GradientContainer.TYPES.LINEAR : GradientContainer.TYPES.RADIAL;
  10318. }
  10319. WebkitGradientContainer.prototype = Object.create(GradientContainer.prototype);
  10320. module.exports = WebkitGradientContainer;
  10321. }, { "./gradientcontainer": 9 }], 28: [function (_dereq_, module, exports) {
  10322. function XHR(url) {
  10323. return new Promise(function (resolve, reject) {
  10324. var xhr = new XMLHttpRequest();
  10325. xhr.open('GET', url);
  10326. xhr.onload = function () {
  10327. if (xhr.status === 200) {
  10328. resolve(xhr.responseText);
  10329. } else {
  10330. reject(new Error(xhr.statusText));
  10331. }
  10332. };
  10333. xhr.onerror = function () {
  10334. reject(new Error("Network Error"));
  10335. };
  10336. xhr.send();
  10337. });
  10338. }
  10339. module.exports = XHR;
  10340. }, {}] }, {}, [4])(4);
  10341. });
  10342. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/webpack/buildin/global.js */ 3)))
  10343. /***/ }),
  10344. /***/ 49:
  10345. /*!**********************************************************************!*\
  10346. !*** /Users/mead/Code/vue/epidemic-h5/static/html/js/html2canvas.js ***!
  10347. \**********************************************************************/
  10348. /*! no static exports found */
  10349. /***/ (function(module, exports, __webpack_require__) {
  10350. /* WEBPACK VAR INJECTION */(function(global) {var require;var require;/*
  10351. html2canvas 0.5.0-beta3 <http://html2canvas.hertzen.com>
  10352. Copyright (c) 2016 Niklas von Hertzen
  10353. Released under License
  10354. */
  10355. !function (e) {if (true) module.exports = e();else { var f; }}(function () {var define, module, exports;return function e(t, n, r) {function s(o, u) {if (!n[o]) {if (!t[o]) {var a = typeof require == "function" && require;if (!u && a) return require(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;}var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {var n = t[o][1][e];return s(n ? n : e);}, l, l.exports, e, t, n, r);}return n[o].exports;}var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {s(r[o]);}return s;}({ 1: [function (_dereq_, module, exports) {
  10356. (function (global) {
  10357. /*! http://mths.be/punycode v1.2.4 by @mathias */
  10358. ;(function (root) {
  10359. /** Detect free variables */
  10360. var freeExports = typeof exports == 'object' && exports;
  10361. var freeModule = typeof module == 'object' && module &&
  10362. module.exports == freeExports && module;
  10363. var freeGlobal = typeof global == 'object' && global;
  10364. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  10365. root = freeGlobal;
  10366. }
  10367. /**
  10368. * The `punycode` object.
  10369. * @name punycode
  10370. * @type Object
  10371. */
  10372. var punycode,
  10373. /** Highest positive signed 32-bit float value */
  10374. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  10375. /** Bootstring parameters */
  10376. base = 36,
  10377. tMin = 1,
  10378. tMax = 26,
  10379. skew = 38,
  10380. damp = 700,
  10381. initialBias = 72,
  10382. initialN = 128, // 0x80
  10383. delimiter = '-', // '\x2D'
  10384. /** Regular expressions */
  10385. regexPunycode = /^xn--/,
  10386. regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars
  10387. regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators
  10388. /** Error messages */
  10389. errors = {
  10390. 'overflow': 'Overflow: input needs wider integers to process',
  10391. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  10392. 'invalid-input': 'Invalid input' },
  10393. /** Convenience shortcuts */
  10394. baseMinusTMin = base - tMin,
  10395. floor = Math.floor,
  10396. stringFromCharCode = String.fromCharCode,
  10397. /** Temporary variable */
  10398. key;
  10399. /*--------------------------------------------------------------------------*/
  10400. /**
  10401. * A generic error utility function.
  10402. * @private
  10403. * @param {String} type The error type.
  10404. * @returns {Error} Throws a `RangeError` with the applicable error message.
  10405. */
  10406. function error(type) {
  10407. throw RangeError(errors[type]);
  10408. }
  10409. /**
  10410. * A generic `Array#map` utility function.
  10411. * @private
  10412. * @param {Array} array The array to iterate over.
  10413. * @param {Function} callback The function that gets called for every array
  10414. * item.
  10415. * @returns {Array} A new array of values returned by the callback function.
  10416. */
  10417. function map(array, fn) {
  10418. var length = array.length;
  10419. while (length--) {
  10420. array[length] = fn(array[length]);
  10421. }
  10422. return array;
  10423. }
  10424. /**
  10425. * A simple `Array#map`-like wrapper to work with domain name strings.
  10426. * @private
  10427. * @param {String} domain The domain name.
  10428. * @param {Function} callback The function that gets called for every
  10429. * character.
  10430. * @returns {Array} A new string of characters returned by the callback
  10431. * function.
  10432. */
  10433. function mapDomain(string, fn) {
  10434. return map(string.split(regexSeparators), fn).join('.');
  10435. }
  10436. /**
  10437. * Creates an array containing the numeric code points of each Unicode
  10438. * character in the string. While JavaScript uses UCS-2 internally,
  10439. * this function will convert a pair of surrogate halves (each of which
  10440. * UCS-2 exposes as separate characters) into a single code point,
  10441. * matching UTF-16.
  10442. * @see `punycode.ucs2.encode`
  10443. * @see <http://mathiasbynens.be/notes/javascript-encoding>
  10444. * @memberOf punycode.ucs2
  10445. * @name decode
  10446. * @param {String} string The Unicode input string (UCS-2).
  10447. * @returns {Array} The new array of code points.
  10448. */
  10449. function ucs2decode(string) {
  10450. var output = [],
  10451. counter = 0,
  10452. length = string.length,
  10453. value,
  10454. extra;
  10455. while (counter < length) {
  10456. value = string.charCodeAt(counter++);
  10457. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  10458. // high surrogate, and there is a next character
  10459. extra = string.charCodeAt(counter++);
  10460. if ((extra & 0xFC00) == 0xDC00) {// low surrogate
  10461. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  10462. } else {
  10463. // unmatched surrogate; only append this code unit, in case the next
  10464. // code unit is the high surrogate of a surrogate pair
  10465. output.push(value);
  10466. counter--;
  10467. }
  10468. } else {
  10469. output.push(value);
  10470. }
  10471. }
  10472. return output;
  10473. }
  10474. /**
  10475. * Creates a string based on an array of numeric code points.
  10476. * @see `punycode.ucs2.decode`
  10477. * @memberOf punycode.ucs2
  10478. * @name encode
  10479. * @param {Array} codePoints The array of numeric code points.
  10480. * @returns {String} The new Unicode string (UCS-2).
  10481. */
  10482. function ucs2encode(array) {
  10483. return map(array, function (value) {
  10484. var output = '';
  10485. if (value > 0xFFFF) {
  10486. value -= 0x10000;
  10487. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  10488. value = 0xDC00 | value & 0x3FF;
  10489. }
  10490. output += stringFromCharCode(value);
  10491. return output;
  10492. }).join('');
  10493. }
  10494. /**
  10495. * Converts a basic code point into a digit/integer.
  10496. * @see `digitToBasic()`
  10497. * @private
  10498. * @param {Number} codePoint The basic numeric code point value.
  10499. * @returns {Number} The numeric value of a basic code point (for use in
  10500. * representing integers) in the range `0` to `base - 1`, or `base` if
  10501. * the code point does not represent a value.
  10502. */
  10503. function basicToDigit(codePoint) {
  10504. if (codePoint - 48 < 10) {
  10505. return codePoint - 22;
  10506. }
  10507. if (codePoint - 65 < 26) {
  10508. return codePoint - 65;
  10509. }
  10510. if (codePoint - 97 < 26) {
  10511. return codePoint - 97;
  10512. }
  10513. return base;
  10514. }
  10515. /**
  10516. * Converts a digit/integer into a basic code point.
  10517. * @see `basicToDigit()`
  10518. * @private
  10519. * @param {Number} digit The numeric value of a basic code point.
  10520. * @returns {Number} The basic code point whose value (when used for
  10521. * representing integers) is `digit`, which needs to be in the range
  10522. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  10523. * used; else, the lowercase form is used. The behavior is undefined
  10524. * if `flag` is non-zero and `digit` has no uppercase form.
  10525. */
  10526. function digitToBasic(digit, flag) {
  10527. // 0..25 map to ASCII a..z or A..Z
  10528. // 26..35 map to ASCII 0..9
  10529. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  10530. }
  10531. /**
  10532. * Bias adaptation function as per section 3.4 of RFC 3492.
  10533. * http://tools.ietf.org/html/rfc3492#section-3.4
  10534. * @private
  10535. */
  10536. function adapt(delta, numPoints, firstTime) {
  10537. var k = 0;
  10538. delta = firstTime ? floor(delta / damp) : delta >> 1;
  10539. delta += floor(delta / numPoints);
  10540. for (; /* no initialization */delta > baseMinusTMin * tMax >> 1; k += base) {
  10541. delta = floor(delta / baseMinusTMin);
  10542. }
  10543. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  10544. }
  10545. /**
  10546. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  10547. * symbols.
  10548. * @memberOf punycode
  10549. * @param {String} input The Punycode string of ASCII-only symbols.
  10550. * @returns {String} The resulting string of Unicode symbols.
  10551. */
  10552. function decode(input) {
  10553. // Don't use UCS-2
  10554. var output = [],
  10555. inputLength = input.length,
  10556. out,
  10557. i = 0,
  10558. n = initialN,
  10559. bias = initialBias,
  10560. basic,
  10561. j,
  10562. index,
  10563. oldi,
  10564. w,
  10565. k,
  10566. digit,
  10567. t,
  10568. /** Cached calculation results */
  10569. baseMinusT;
  10570. // Handle the basic code points: let `basic` be the number of input code
  10571. // points before the last delimiter, or `0` if there is none, then copy
  10572. // the first basic code points to the output.
  10573. basic = input.lastIndexOf(delimiter);
  10574. if (basic < 0) {
  10575. basic = 0;
  10576. }
  10577. for (j = 0; j < basic; ++j) {
  10578. // if it's not a basic code point
  10579. if (input.charCodeAt(j) >= 0x80) {
  10580. error('not-basic');
  10581. }
  10582. output.push(input.charCodeAt(j));
  10583. }
  10584. // Main decoding loop: start just after the last delimiter if any basic code
  10585. // points were copied; start at the beginning otherwise.
  10586. for (index = basic > 0 ? basic + 1 : 0; index < inputLength;) /* no final expression */{
  10587. // `index` is the index of the next character to be consumed.
  10588. // Decode a generalized variable-length integer into `delta`,
  10589. // which gets added to `i`. The overflow checking is easier
  10590. // if we increase `i` as we go, then subtract off its starting
  10591. // value at the end to obtain `delta`.
  10592. for (oldi = i, w = 1, k = base;; /* no condition */k += base) {
  10593. if (index >= inputLength) {
  10594. error('invalid-input');
  10595. }
  10596. digit = basicToDigit(input.charCodeAt(index++));
  10597. if (digit >= base || digit > floor((maxInt - i) / w)) {
  10598. error('overflow');
  10599. }
  10600. i += digit * w;
  10601. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  10602. if (digit < t) {
  10603. break;
  10604. }
  10605. baseMinusT = base - t;
  10606. if (w > floor(maxInt / baseMinusT)) {
  10607. error('overflow');
  10608. }
  10609. w *= baseMinusT;
  10610. }
  10611. out = output.length + 1;
  10612. bias = adapt(i - oldi, out, oldi == 0);
  10613. // `i` was supposed to wrap around from `out` to `0`,
  10614. // incrementing `n` each time, so we'll fix that now:
  10615. if (floor(i / out) > maxInt - n) {
  10616. error('overflow');
  10617. }
  10618. n += floor(i / out);
  10619. i %= out;
  10620. // Insert `n` at position `i` of the output
  10621. output.splice(i++, 0, n);
  10622. }
  10623. return ucs2encode(output);
  10624. }
  10625. /**
  10626. * Converts a string of Unicode symbols to a Punycode string of ASCII-only
  10627. * symbols.
  10628. * @memberOf punycode
  10629. * @param {String} input The string of Unicode symbols.
  10630. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  10631. */
  10632. function encode(input) {
  10633. var n,
  10634. delta,
  10635. handledCPCount,
  10636. basicLength,
  10637. bias,
  10638. j,
  10639. m,
  10640. q,
  10641. k,
  10642. t,
  10643. currentValue,
  10644. output = [],
  10645. /** `inputLength` will hold the number of code points in `input`. */
  10646. inputLength,
  10647. /** Cached calculation results */
  10648. handledCPCountPlusOne,
  10649. baseMinusT,
  10650. qMinusT;
  10651. // Convert the input in UCS-2 to Unicode
  10652. input = ucs2decode(input);
  10653. // Cache the length
  10654. inputLength = input.length;
  10655. // Initialize the state
  10656. n = initialN;
  10657. delta = 0;
  10658. bias = initialBias;
  10659. // Handle the basic code points
  10660. for (j = 0; j < inputLength; ++j) {
  10661. currentValue = input[j];
  10662. if (currentValue < 0x80) {
  10663. output.push(stringFromCharCode(currentValue));
  10664. }
  10665. }
  10666. handledCPCount = basicLength = output.length;
  10667. // `handledCPCount` is the number of code points that have been handled;
  10668. // `basicLength` is the number of basic code points.
  10669. // Finish the basic string - if it is not empty - with a delimiter
  10670. if (basicLength) {
  10671. output.push(delimiter);
  10672. }
  10673. // Main encoding loop:
  10674. while (handledCPCount < inputLength) {
  10675. // All non-basic code points < n have been handled already. Find the next
  10676. // larger one:
  10677. for (m = maxInt, j = 0; j < inputLength; ++j) {
  10678. currentValue = input[j];
  10679. if (currentValue >= n && currentValue < m) {
  10680. m = currentValue;
  10681. }
  10682. }
  10683. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  10684. // but guard against overflow
  10685. handledCPCountPlusOne = handledCPCount + 1;
  10686. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  10687. error('overflow');
  10688. }
  10689. delta += (m - n) * handledCPCountPlusOne;
  10690. n = m;
  10691. for (j = 0; j < inputLength; ++j) {
  10692. currentValue = input[j];
  10693. if (currentValue < n && ++delta > maxInt) {
  10694. error('overflow');
  10695. }
  10696. if (currentValue == n) {
  10697. // Represent delta as a generalized variable-length integer
  10698. for (q = delta, k = base;; /* no condition */k += base) {
  10699. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  10700. if (q < t) {
  10701. break;
  10702. }
  10703. qMinusT = q - t;
  10704. baseMinusT = base - t;
  10705. output.push(
  10706. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)));
  10707. q = floor(qMinusT / baseMinusT);
  10708. }
  10709. output.push(stringFromCharCode(digitToBasic(q, 0)));
  10710. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  10711. delta = 0;
  10712. ++handledCPCount;
  10713. }
  10714. }
  10715. ++delta;
  10716. ++n;
  10717. }
  10718. return output.join('');
  10719. }
  10720. /**
  10721. * Converts a Punycode string representing a domain name to Unicode. Only the
  10722. * Punycoded parts of the domain name will be converted, i.e. it doesn't
  10723. * matter if you call it on a string that has already been converted to
  10724. * Unicode.
  10725. * @memberOf punycode
  10726. * @param {String} domain The Punycode domain name to convert to Unicode.
  10727. * @returns {String} The Unicode representation of the given Punycode
  10728. * string.
  10729. */
  10730. function toUnicode(domain) {
  10731. return mapDomain(domain, function (string) {
  10732. return regexPunycode.test(string) ?
  10733. decode(string.slice(4).toLowerCase()) :
  10734. string;
  10735. });
  10736. }
  10737. /**
  10738. * Converts a Unicode string representing a domain name to Punycode. Only the
  10739. * non-ASCII parts of the domain name will be converted, i.e. it doesn't
  10740. * matter if you call it with a domain that's already in ASCII.
  10741. * @memberOf punycode
  10742. * @param {String} domain The domain name to convert, as a Unicode string.
  10743. * @returns {String} The Punycode representation of the given domain name.
  10744. */
  10745. function toASCII(domain) {
  10746. return mapDomain(domain, function (string) {
  10747. return regexNonASCII.test(string) ?
  10748. 'xn--' + encode(string) :
  10749. string;
  10750. });
  10751. }
  10752. /*--------------------------------------------------------------------------*/
  10753. /** Define the public API */
  10754. punycode = {
  10755. /**
  10756. * A string representing the current Punycode.js version number.
  10757. * @memberOf punycode
  10758. * @type String
  10759. */
  10760. 'version': '1.2.4',
  10761. /**
  10762. * An object of methods to convert from JavaScript's internal character
  10763. * representation (UCS-2) to Unicode code points, and back.
  10764. * @see <http://mathiasbynens.be/notes/javascript-encoding>
  10765. * @memberOf punycode
  10766. * @type Object
  10767. */
  10768. 'ucs2': {
  10769. 'decode': ucs2decode,
  10770. 'encode': ucs2encode },
  10771. 'decode': decode,
  10772. 'encode': encode,
  10773. 'toASCII': toASCII,
  10774. 'toUnicode': toUnicode };
  10775. /** Expose `punycode` */
  10776. // Some AMD build optimizers, like r.js, check for specific condition patterns
  10777. // like the following:
  10778. if (
  10779. typeof define == 'function' &&
  10780. typeof define.amd == 'object' &&
  10781. define.amd)
  10782. {
  10783. define('punycode', function () {
  10784. return punycode;
  10785. });
  10786. } else if (freeExports && !freeExports.nodeType) {
  10787. if (freeModule) {// in Node.js or RingoJS v0.8.0+
  10788. freeModule.exports = punycode;
  10789. } else {// in Narwhal or RingoJS v0.7.0-
  10790. for (key in punycode) {
  10791. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  10792. }
  10793. }
  10794. } else {// in Rhino or a web browser
  10795. root.punycode = punycode;
  10796. }
  10797. })(this);
  10798. }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
  10799. }, {}], 2: [function (_dereq_, module, exports) {
  10800. var log = _dereq_('./log');
  10801. function restoreOwnerScroll(ownerDocument, x, y) {
  10802. if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
  10803. ownerDocument.defaultView.scrollTo(x, y);
  10804. }
  10805. }
  10806. function cloneCanvasContents(canvas, clonedCanvas) {
  10807. try {
  10808. if (clonedCanvas) {
  10809. clonedCanvas.width = canvas.width;
  10810. clonedCanvas.height = canvas.height;
  10811. clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0);
  10812. }
  10813. } catch (e) {
  10814. log("Unable to copy canvas content from", canvas, e);
  10815. }
  10816. }
  10817. function cloneNode(node, javascriptEnabled) {
  10818. var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false);
  10819. var child = node.firstChild;
  10820. while (child) {
  10821. if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') {
  10822. clone.appendChild(cloneNode(child, javascriptEnabled));
  10823. }
  10824. child = child.nextSibling;
  10825. }
  10826. if (node.nodeType === 1) {
  10827. clone._scrollTop = node.scrollTop;
  10828. clone._scrollLeft = node.scrollLeft;
  10829. if (node.nodeName === "CANVAS") {
  10830. cloneCanvasContents(node, clone);
  10831. } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") {
  10832. clone.value = node.value;
  10833. }
  10834. }
  10835. return clone;
  10836. }
  10837. function initNode(node) {
  10838. if (node.nodeType === 1) {
  10839. node.scrollTop = node._scrollTop;
  10840. node.scrollLeft = node._scrollLeft;
  10841. var child = node.firstChild;
  10842. while (child) {
  10843. initNode(child);
  10844. child = child.nextSibling;
  10845. }
  10846. }
  10847. }
  10848. module.exports = function (ownerDocument, containerDocument, width, height, options, x, y) {
  10849. var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled);
  10850. var container = containerDocument.createElement("iframe");
  10851. container.className = "html2canvas-container";
  10852. container.style.visibility = "hidden";
  10853. container.style.position = "fixed";
  10854. container.style.left = "-10000px";
  10855. container.style.top = "0px";
  10856. container.style.border = "0";
  10857. container.width = width;
  10858. container.height = height;
  10859. container.scrolling = "no"; // ios won't scroll without it
  10860. containerDocument.body.appendChild(container);
  10861. return new Promise(function (resolve) {
  10862. var documentClone = container.contentWindow.document;
  10863. /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
  10864. if window url is about:blank, we can assign the url to current by writing onto the document
  10865. */
  10866. container.contentWindow.onload = container.onload = function () {
  10867. var interval = setInterval(function () {
  10868. if (documentClone.body.childNodes.length > 0) {
  10869. initNode(documentClone.documentElement);
  10870. clearInterval(interval);
  10871. if (options.type === "view") {
  10872. container.contentWindow.scrollTo(x, y);
  10873. if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (container.contentWindow.scrollY !== y || container.contentWindow.scrollX !== x)) {
  10874. documentClone.documentElement.style.top = -y + "px";
  10875. documentClone.documentElement.style.left = -x + "px";
  10876. documentClone.documentElement.style.position = 'absolute';
  10877. }
  10878. }
  10879. resolve(container);
  10880. }
  10881. }, 50);
  10882. };
  10883. documentClone.open();
  10884. documentClone.write("<!DOCTYPE html><html></html>");
  10885. // Chrome scrolls the parent document for some reason after the write to the cloned window???
  10886. restoreOwnerScroll(ownerDocument, x, y);
  10887. documentClone.replaceChild(documentClone.adoptNode(documentElement), documentClone.documentElement);
  10888. documentClone.close();
  10889. });
  10890. };
  10891. }, { "./log": 13 }], 3: [function (_dereq_, module, exports) {
  10892. // http://dev.w3.org/csswg/css-color/
  10893. function Color(value) {
  10894. this.r = 0;
  10895. this.g = 0;
  10896. this.b = 0;
  10897. this.a = null;
  10898. var result = this.fromArray(value) ||
  10899. this.namedColor(value) ||
  10900. this.rgb(value) ||
  10901. this.rgba(value) ||
  10902. this.hex6(value) ||
  10903. this.hex3(value);
  10904. }
  10905. Color.prototype.darken = function (amount) {
  10906. var a = 1 - amount;
  10907. return new Color([
  10908. Math.round(this.r * a),
  10909. Math.round(this.g * a),
  10910. Math.round(this.b * a),
  10911. this.a]);
  10912. };
  10913. Color.prototype.isTransparent = function () {
  10914. return this.a === 0;
  10915. };
  10916. Color.prototype.isBlack = function () {
  10917. return this.r === 0 && this.g === 0 && this.b === 0;
  10918. };
  10919. Color.prototype.fromArray = function (array) {
  10920. if (Array.isArray(array)) {
  10921. this.r = Math.min(array[0], 255);
  10922. this.g = Math.min(array[1], 255);
  10923. this.b = Math.min(array[2], 255);
  10924. if (array.length > 3) {
  10925. this.a = array[3];
  10926. }
  10927. }
  10928. return Array.isArray(array);
  10929. };
  10930. var _hex3 = /^#([a-f0-9]{3})$/i;
  10931. Color.prototype.hex3 = function (value) {
  10932. var match = null;
  10933. if ((match = value.match(_hex3)) !== null) {
  10934. this.r = parseInt(match[1][0] + match[1][0], 16);
  10935. this.g = parseInt(match[1][1] + match[1][1], 16);
  10936. this.b = parseInt(match[1][2] + match[1][2], 16);
  10937. }
  10938. return match !== null;
  10939. };
  10940. var _hex6 = /^#([a-f0-9]{6})$/i;
  10941. Color.prototype.hex6 = function (value) {
  10942. var match = null;
  10943. if ((match = value.match(_hex6)) !== null) {
  10944. this.r = parseInt(match[1].substring(0, 2), 16);
  10945. this.g = parseInt(match[1].substring(2, 4), 16);
  10946. this.b = parseInt(match[1].substring(4, 6), 16);
  10947. }
  10948. return match !== null;
  10949. };
  10950. var _rgb = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/;
  10951. Color.prototype.rgb = function (value) {
  10952. var match = null;
  10953. if ((match = value.match(_rgb)) !== null) {
  10954. this.r = Number(match[1]);
  10955. this.g = Number(match[2]);
  10956. this.b = Number(match[3]);
  10957. }
  10958. return match !== null;
  10959. };
  10960. var _rgba = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/;
  10961. Color.prototype.rgba = function (value) {
  10962. var match = null;
  10963. if ((match = value.match(_rgba)) !== null) {
  10964. this.r = Number(match[1]);
  10965. this.g = Number(match[2]);
  10966. this.b = Number(match[3]);
  10967. this.a = Number(match[4]);
  10968. }
  10969. return match !== null;
  10970. };
  10971. Color.prototype.toString = function () {
  10972. return this.a !== null && this.a !== 1 ?
  10973. "rgba(" + [this.r, this.g, this.b, this.a].join(",") + ")" :
  10974. "rgb(" + [this.r, this.g, this.b].join(",") + ")";
  10975. };
  10976. Color.prototype.namedColor = function (value) {
  10977. value = value.toLowerCase();
  10978. var color = colors[value];
  10979. if (color) {
  10980. this.r = color[0];
  10981. this.g = color[1];
  10982. this.b = color[2];
  10983. } else if (value === "transparent") {
  10984. this.r = this.g = this.b = this.a = 0;
  10985. return true;
  10986. }
  10987. return !!color;
  10988. };
  10989. Color.prototype.isColor = true;
  10990. // JSON.stringify([].slice.call($$('.named-color-table tr'), 1).map(function(row) { return [row.childNodes[3].textContent, row.childNodes[5].textContent.trim().split(",").map(Number)] }).reduce(function(data, row) {data[row[0]] = row[1]; return data}, {}))
  10991. var colors = {
  10992. "aliceblue": [240, 248, 255],
  10993. "antiquewhite": [250, 235, 215],
  10994. "aqua": [0, 255, 255],
  10995. "aquamarine": [127, 255, 212],
  10996. "azure": [240, 255, 255],
  10997. "beige": [245, 245, 220],
  10998. "bisque": [255, 228, 196],
  10999. "black": [0, 0, 0],
  11000. "blanchedalmond": [255, 235, 205],
  11001. "blue": [0, 0, 255],
  11002. "blueviolet": [138, 43, 226],
  11003. "brown": [165, 42, 42],
  11004. "burlywood": [222, 184, 135],
  11005. "cadetblue": [95, 158, 160],
  11006. "chartreuse": [127, 255, 0],
  11007. "chocolate": [210, 105, 30],
  11008. "coral": [255, 127, 80],
  11009. "cornflowerblue": [100, 149, 237],
  11010. "cornsilk": [255, 248, 220],
  11011. "crimson": [220, 20, 60],
  11012. "cyan": [0, 255, 255],
  11013. "darkblue": [0, 0, 139],
  11014. "darkcyan": [0, 139, 139],
  11015. "darkgoldenrod": [184, 134, 11],
  11016. "darkgray": [169, 169, 169],
  11017. "darkgreen": [0, 100, 0],
  11018. "darkgrey": [169, 169, 169],
  11019. "darkkhaki": [189, 183, 107],
  11020. "darkmagenta": [139, 0, 139],
  11021. "darkolivegreen": [85, 107, 47],
  11022. "darkorange": [255, 140, 0],
  11023. "darkorchid": [153, 50, 204],
  11024. "darkred": [139, 0, 0],
  11025. "darksalmon": [233, 150, 122],
  11026. "darkseagreen": [143, 188, 143],
  11027. "darkslateblue": [72, 61, 139],
  11028. "darkslategray": [47, 79, 79],
  11029. "darkslategrey": [47, 79, 79],
  11030. "darkturquoise": [0, 206, 209],
  11031. "darkviolet": [148, 0, 211],
  11032. "deeppink": [255, 20, 147],
  11033. "deepskyblue": [0, 191, 255],
  11034. "dimgray": [105, 105, 105],
  11035. "dimgrey": [105, 105, 105],
  11036. "dodgerblue": [30, 144, 255],
  11037. "firebrick": [178, 34, 34],
  11038. "floralwhite": [255, 250, 240],
  11039. "forestgreen": [34, 139, 34],
  11040. "fuchsia": [255, 0, 255],
  11041. "gainsboro": [220, 220, 220],
  11042. "ghostwhite": [248, 248, 255],
  11043. "gold": [255, 215, 0],
  11044. "goldenrod": [218, 165, 32],
  11045. "gray": [128, 128, 128],
  11046. "green": [0, 128, 0],
  11047. "greenyellow": [173, 255, 47],
  11048. "grey": [128, 128, 128],
  11049. "honeydew": [240, 255, 240],
  11050. "hotpink": [255, 105, 180],
  11051. "indianred": [205, 92, 92],
  11052. "indigo": [75, 0, 130],
  11053. "ivory": [255, 255, 240],
  11054. "khaki": [240, 230, 140],
  11055. "lavender": [230, 230, 250],
  11056. "lavenderblush": [255, 240, 245],
  11057. "lawngreen": [124, 252, 0],
  11058. "lemonchiffon": [255, 250, 205],
  11059. "lightblue": [173, 216, 230],
  11060. "lightcoral": [240, 128, 128],
  11061. "lightcyan": [224, 255, 255],
  11062. "lightgoldenrodyellow": [250, 250, 210],
  11063. "lightgray": [211, 211, 211],
  11064. "lightgreen": [144, 238, 144],
  11065. "lightgrey": [211, 211, 211],
  11066. "lightpink": [255, 182, 193],
  11067. "lightsalmon": [255, 160, 122],
  11068. "lightseagreen": [32, 178, 170],
  11069. "lightskyblue": [135, 206, 250],
  11070. "lightslategray": [119, 136, 153],
  11071. "lightslategrey": [119, 136, 153],
  11072. "lightsteelblue": [176, 196, 222],
  11073. "lightyellow": [255, 255, 224],
  11074. "lime": [0, 255, 0],
  11075. "limegreen": [50, 205, 50],
  11076. "linen": [250, 240, 230],
  11077. "magenta": [255, 0, 255],
  11078. "maroon": [128, 0, 0],
  11079. "mediumaquamarine": [102, 205, 170],
  11080. "mediumblue": [0, 0, 205],
  11081. "mediumorchid": [186, 85, 211],
  11082. "mediumpurple": [147, 112, 219],
  11083. "mediumseagreen": [60, 179, 113],
  11084. "mediumslateblue": [123, 104, 238],
  11085. "mediumspringgreen": [0, 250, 154],
  11086. "mediumturquoise": [72, 209, 204],
  11087. "mediumvioletred": [199, 21, 133],
  11088. "midnightblue": [25, 25, 112],
  11089. "mintcream": [245, 255, 250],
  11090. "mistyrose": [255, 228, 225],
  11091. "moccasin": [255, 228, 181],
  11092. "navajowhite": [255, 222, 173],
  11093. "navy": [0, 0, 128],
  11094. "oldlace": [253, 245, 230],
  11095. "olive": [128, 128, 0],
  11096. "olivedrab": [107, 142, 35],
  11097. "orange": [255, 165, 0],
  11098. "orangered": [255, 69, 0],
  11099. "orchid": [218, 112, 214],
  11100. "palegoldenrod": [238, 232, 170],
  11101. "palegreen": [152, 251, 152],
  11102. "paleturquoise": [175, 238, 238],
  11103. "palevioletred": [219, 112, 147],
  11104. "papayawhip": [255, 239, 213],
  11105. "peachpuff": [255, 218, 185],
  11106. "peru": [205, 133, 63],
  11107. "pink": [255, 192, 203],
  11108. "plum": [221, 160, 221],
  11109. "powderblue": [176, 224, 230],
  11110. "purple": [128, 0, 128],
  11111. "rebeccapurple": [102, 51, 153],
  11112. "red": [255, 0, 0],
  11113. "rosybrown": [188, 143, 143],
  11114. "royalblue": [65, 105, 225],
  11115. "saddlebrown": [139, 69, 19],
  11116. "salmon": [250, 128, 114],
  11117. "sandybrown": [244, 164, 96],
  11118. "seagreen": [46, 139, 87],
  11119. "seashell": [255, 245, 238],
  11120. "sienna": [160, 82, 45],
  11121. "silver": [192, 192, 192],
  11122. "skyblue": [135, 206, 235],
  11123. "slateblue": [106, 90, 205],
  11124. "slategray": [112, 128, 144],
  11125. "slategrey": [112, 128, 144],
  11126. "snow": [255, 250, 250],
  11127. "springgreen": [0, 255, 127],
  11128. "steelblue": [70, 130, 180],
  11129. "tan": [210, 180, 140],
  11130. "teal": [0, 128, 128],
  11131. "thistle": [216, 191, 216],
  11132. "tomato": [255, 99, 71],
  11133. "turquoise": [64, 224, 208],
  11134. "violet": [238, 130, 238],
  11135. "wheat": [245, 222, 179],
  11136. "white": [255, 255, 255],
  11137. "whitesmoke": [245, 245, 245],
  11138. "yellow": [255, 255, 0],
  11139. "yellowgreen": [154, 205, 50] };
  11140. module.exports = Color;
  11141. }, {}], 4: [function (_dereq_, module, exports) {
  11142. var Support = _dereq_('./support');
  11143. var CanvasRenderer = _dereq_('./renderers/canvas');
  11144. var ImageLoader = _dereq_('./imageloader');
  11145. var NodeParser = _dereq_('./nodeparser');
  11146. var NodeContainer = _dereq_('./nodecontainer');
  11147. var log = _dereq_('./log');
  11148. var utils = _dereq_('./utils');
  11149. var createWindowClone = _dereq_('./clone');
  11150. var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;
  11151. var getBounds = utils.getBounds;
  11152. var html2canvasNodeAttribute = "data-html2canvas-node";
  11153. var html2canvasCloneIndex = 0;
  11154. function html2canvas(nodeList, options) {
  11155. var index = html2canvasCloneIndex++;
  11156. options = options || {};
  11157. if (options.logging) {
  11158. log.options.logging = true;
  11159. log.options.start = Date.now();
  11160. }
  11161. options.async = typeof options.async === "undefined" ? true : options.async;
  11162. options.allowTaint = typeof options.allowTaint === "undefined" ? false : options.allowTaint;
  11163. options.removeContainer = typeof options.removeContainer === "undefined" ? true : options.removeContainer;
  11164. options.javascriptEnabled = typeof options.javascriptEnabled === "undefined" ? false : options.javascriptEnabled;
  11165. options.imageTimeout = typeof options.imageTimeout === "undefined" ? 10000 : options.imageTimeout;
  11166. options.renderer = typeof options.renderer === "function" ? options.renderer : CanvasRenderer;
  11167. options.strict = !!options.strict;
  11168. if (typeof nodeList === "string") {
  11169. if (typeof options.proxy !== "string") {
  11170. return Promise.reject("Proxy must be used when rendering url");
  11171. }
  11172. var width = options.width != null ? options.width : window.innerWidth;
  11173. var height = options.height != null ? options.height : window.innerHeight;
  11174. return loadUrlDocument(absoluteUrl(nodeList), options.proxy, document, width, height, options).then(function (container) {
  11175. return renderWindow(container.contentWindow.document.documentElement, container, options, width, height);
  11176. });
  11177. }
  11178. var node = (nodeList === undefined ? [document.documentElement] : nodeList.length ? nodeList : [nodeList])[0];
  11179. node.setAttribute(html2canvasNodeAttribute + index, index);
  11180. return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight, index).then(function (canvas) {
  11181. if (typeof options.onrendered === "function") {
  11182. log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");
  11183. options.onrendered(canvas);
  11184. }
  11185. return canvas;
  11186. });
  11187. }
  11188. html2canvas.CanvasRenderer = CanvasRenderer;
  11189. html2canvas.NodeContainer = NodeContainer;
  11190. html2canvas.log = log;
  11191. html2canvas.utils = utils;
  11192. var html2canvasExport = typeof document === "undefined" || typeof Object.create !== "function" || typeof document.createElement("canvas").getContext !== "function" ? function () {
  11193. return Promise.reject("No canvas support");
  11194. } : html2canvas;
  11195. module.exports = html2canvasExport;
  11196. if (typeof define === 'function' && define.amd) {
  11197. define('html2canvas', [], function () {
  11198. return html2canvasExport;
  11199. });
  11200. }
  11201. function renderDocument(document, options, windowWidth, windowHeight, html2canvasIndex) {
  11202. return createWindowClone(document, document, windowWidth, windowHeight, options, document.defaultView.pageXOffset, document.defaultView.pageYOffset).then(function (container) {
  11203. log("Document cloned");
  11204. var attributeName = html2canvasNodeAttribute + html2canvasIndex;
  11205. var selector = "[" + attributeName + "='" + html2canvasIndex + "']";
  11206. document.querySelector(selector).removeAttribute(attributeName);
  11207. var clonedWindow = container.contentWindow;
  11208. var node = clonedWindow.document.querySelector(selector);
  11209. var oncloneHandler = typeof options.onclone === "function" ? Promise.resolve(options.onclone(clonedWindow.document)) : Promise.resolve(true);
  11210. return oncloneHandler.then(function () {
  11211. return renderWindow(node, container, options, windowWidth, windowHeight);
  11212. });
  11213. });
  11214. }
  11215. function renderWindow(node, container, options, windowWidth, windowHeight) {
  11216. var clonedWindow = container.contentWindow;
  11217. var support = new Support(clonedWindow.document);
  11218. var imageLoader = new ImageLoader(options, support);
  11219. var bounds = getBounds(node);
  11220. var width = options.type === "view" ? windowWidth : documentWidth(clonedWindow.document);
  11221. var height = options.type === "view" ? windowHeight : documentHeight(clonedWindow.document);
  11222. var renderer = new options.renderer(width, height, imageLoader, options, document);
  11223. var parser = new NodeParser(node, renderer, support, imageLoader, options);
  11224. return parser.ready.then(function () {
  11225. log("Finished rendering");
  11226. var canvas;
  11227. if (options.type === "view") {
  11228. canvas = crop(renderer.canvas, { width: renderer.canvas.width, height: renderer.canvas.height, top: 0, left: 0, x: 0, y: 0 });
  11229. } else if (node === clonedWindow.document.body || node === clonedWindow.document.documentElement || options.canvas != null) {
  11230. canvas = renderer.canvas;
  11231. } else {
  11232. canvas = crop(renderer.canvas, { width: options.width != null ? options.width : bounds.width, height: options.height != null ? options.height : bounds.height, top: bounds.top, left: bounds.left, x: 0, y: 0 });
  11233. }
  11234. cleanupContainer(container, options);
  11235. return canvas;
  11236. });
  11237. }
  11238. function cleanupContainer(container, options) {
  11239. if (options.removeContainer) {
  11240. container.parentNode.removeChild(container);
  11241. log("Cleaned up container");
  11242. }
  11243. }
  11244. function crop(canvas, bounds) {
  11245. var croppedCanvas = document.createElement("canvas");
  11246. var x1 = Math.min(canvas.width - 1, Math.max(0, bounds.left));
  11247. var x2 = Math.min(canvas.width, Math.max(1, bounds.left + bounds.width));
  11248. var y1 = Math.min(canvas.height - 1, Math.max(0, bounds.top));
  11249. var y2 = Math.min(canvas.height, Math.max(1, bounds.top + bounds.height));
  11250. croppedCanvas.width = bounds.width;
  11251. croppedCanvas.height = bounds.height;
  11252. var width = x2 - x1;
  11253. var height = y2 - y1;
  11254. log("Cropping canvas at:", "left:", bounds.left, "top:", bounds.top, "width:", width, "height:", height);
  11255. log("Resulting crop with width", bounds.width, "and height", bounds.height, "with x", x1, "and y", y1);
  11256. croppedCanvas.getContext("2d").drawImage(canvas, x1, y1, width, height, bounds.x, bounds.y, width, height);
  11257. return croppedCanvas;
  11258. }
  11259. function documentWidth(doc) {
  11260. return Math.max(
  11261. Math.max(doc.body.scrollWidth, doc.documentElement.scrollWidth),
  11262. Math.max(doc.body.offsetWidth, doc.documentElement.offsetWidth),
  11263. Math.max(doc.body.clientWidth, doc.documentElement.clientWidth));
  11264. }
  11265. function documentHeight(doc) {
  11266. return Math.max(
  11267. Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight),
  11268. Math.max(doc.body.offsetHeight, doc.documentElement.offsetHeight),
  11269. Math.max(doc.body.clientHeight, doc.documentElement.clientHeight));
  11270. }
  11271. function absoluteUrl(url) {
  11272. var link = document.createElement("a");
  11273. link.href = url;
  11274. link.href = link.href;
  11275. return link;
  11276. }
  11277. }, { "./clone": 2, "./imageloader": 11, "./log": 13, "./nodecontainer": 14, "./nodeparser": 15, "./proxy": 16, "./renderers/canvas": 20, "./support": 22, "./utils": 26 }], 5: [function (_dereq_, module, exports) {
  11278. var log = _dereq_('./log');
  11279. var smallImage = _dereq_('./utils').smallImage;
  11280. function DummyImageContainer(src) {
  11281. this.src = src;
  11282. log("DummyImageContainer for", src);
  11283. if (!this.promise || !this.image) {
  11284. log("Initiating DummyImageContainer");
  11285. DummyImageContainer.prototype.image = new Image();
  11286. var image = this.image;
  11287. DummyImageContainer.prototype.promise = new Promise(function (resolve, reject) {
  11288. image.onload = resolve;
  11289. image.onerror = reject;
  11290. image.src = smallImage();
  11291. if (image.complete === true) {
  11292. resolve(image);
  11293. }
  11294. });
  11295. }
  11296. }
  11297. module.exports = DummyImageContainer;
  11298. }, { "./log": 13, "./utils": 26 }], 6: [function (_dereq_, module, exports) {
  11299. var smallImage = _dereq_('./utils').smallImage;
  11300. function Font(family, size) {
  11301. var container = document.createElement('div'),
  11302. img = document.createElement('img'),
  11303. span = document.createElement('span'),
  11304. sampleText = 'Hidden Text',
  11305. baseline,
  11306. middle;
  11307. container.style.visibility = "hidden";
  11308. container.style.fontFamily = family;
  11309. container.style.fontSize = size;
  11310. container.style.margin = 0;
  11311. container.style.padding = 0;
  11312. document.body.appendChild(container);
  11313. img.src = smallImage();
  11314. img.width = 1;
  11315. img.height = 1;
  11316. img.style.margin = 0;
  11317. img.style.padding = 0;
  11318. img.style.verticalAlign = "baseline";
  11319. span.style.fontFamily = family;
  11320. span.style.fontSize = size;
  11321. span.style.margin = 0;
  11322. span.style.padding = 0;
  11323. span.appendChild(document.createTextNode(sampleText));
  11324. container.appendChild(span);
  11325. container.appendChild(img);
  11326. baseline = img.offsetTop - span.offsetTop + 1;
  11327. container.removeChild(span);
  11328. container.appendChild(document.createTextNode(sampleText));
  11329. container.style.lineHeight = "normal";
  11330. img.style.verticalAlign = "super";
  11331. middle = img.offsetTop - container.offsetTop + 1;
  11332. document.body.removeChild(container);
  11333. this.baseline = baseline;
  11334. this.lineWidth = 1;
  11335. this.middle = middle;
  11336. }
  11337. module.exports = Font;
  11338. }, { "./utils": 26 }], 7: [function (_dereq_, module, exports) {
  11339. var Font = _dereq_('./font');
  11340. function FontMetrics() {
  11341. this.data = {};
  11342. }
  11343. FontMetrics.prototype.getMetrics = function (family, size) {
  11344. if (this.data[family + "-" + size] === undefined) {
  11345. this.data[family + "-" + size] = new Font(family, size);
  11346. }
  11347. return this.data[family + "-" + size];
  11348. };
  11349. module.exports = FontMetrics;
  11350. }, { "./font": 6 }], 8: [function (_dereq_, module, exports) {
  11351. var utils = _dereq_('./utils');
  11352. var getBounds = utils.getBounds;
  11353. var loadUrlDocument = _dereq_('./proxy').loadUrlDocument;
  11354. function FrameContainer(container, sameOrigin, options) {
  11355. this.image = null;
  11356. this.src = container;
  11357. var self = this;
  11358. var bounds = getBounds(container);
  11359. this.promise = (!sameOrigin ? this.proxyLoad(options.proxy, bounds, options) : new Promise(function (resolve) {
  11360. if (container.contentWindow.document.URL === "about:blank" || container.contentWindow.document.documentElement == null) {
  11361. container.contentWindow.onload = container.onload = function () {
  11362. resolve(container);
  11363. };
  11364. } else {
  11365. resolve(container);
  11366. }
  11367. })).then(function (container) {
  11368. var html2canvas = _dereq_('./core');
  11369. return html2canvas(container.contentWindow.document.documentElement, { type: 'view', width: container.width, height: container.height, proxy: options.proxy, javascriptEnabled: options.javascriptEnabled, removeContainer: options.removeContainer, allowTaint: options.allowTaint, imageTimeout: options.imageTimeout / 2 });
  11370. }).then(function (canvas) {
  11371. return self.image = canvas;
  11372. });
  11373. }
  11374. FrameContainer.prototype.proxyLoad = function (proxy, bounds, options) {
  11375. var container = this.src;
  11376. return loadUrlDocument(container.src, proxy, container.ownerDocument, bounds.width, bounds.height, options);
  11377. };
  11378. module.exports = FrameContainer;
  11379. }, { "./core": 4, "./proxy": 16, "./utils": 26 }], 9: [function (_dereq_, module, exports) {
  11380. function GradientContainer(imageData) {
  11381. this.src = imageData.value;
  11382. this.colorStops = [];
  11383. this.type = null;
  11384. this.x0 = 0.5;
  11385. this.y0 = 0.5;
  11386. this.x1 = 0.5;
  11387. this.y1 = 0.5;
  11388. this.promise = Promise.resolve(true);
  11389. }
  11390. GradientContainer.TYPES = {
  11391. LINEAR: 1,
  11392. RADIAL: 2 };
  11393. // TODO: support hsl[a], negative %/length values
  11394. // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )
  11395. GradientContainer.REGEXP_COLORSTOP = /^\s*(rgba?\(\s*\d{1,3},\s*\d{1,3},\s*\d{1,3}(?:,\s*[0-9\.]+)?\s*\)|[a-z]{3,20}|#[a-f0-9]{3,6})(?:\s+(\d{1,3}(?:\.\d+)?)(%|px)?)?(?:\s|$)/i;
  11396. module.exports = GradientContainer;
  11397. }, {}], 10: [function (_dereq_, module, exports) {
  11398. function ImageContainer(src, cors) {
  11399. this.src = src;
  11400. this.image = new Image();
  11401. var self = this;
  11402. this.tainted = null;
  11403. this.promise = new Promise(function (resolve, reject) {
  11404. self.image.onload = resolve;
  11405. self.image.onerror = reject;
  11406. if (cors) {
  11407. self.image.crossOrigin = "anonymous";
  11408. }
  11409. self.image.src = src;
  11410. if (self.image.complete === true) {
  11411. resolve(self.image);
  11412. }
  11413. });
  11414. }
  11415. module.exports = ImageContainer;
  11416. }, {}], 11: [function (_dereq_, module, exports) {
  11417. var log = _dereq_('./log');
  11418. var ImageContainer = _dereq_('./imagecontainer');
  11419. var DummyImageContainer = _dereq_('./dummyimagecontainer');
  11420. var ProxyImageContainer = _dereq_('./proxyimagecontainer');
  11421. var FrameContainer = _dereq_('./framecontainer');
  11422. var SVGContainer = _dereq_('./svgcontainer');
  11423. var SVGNodeContainer = _dereq_('./svgnodecontainer');
  11424. var LinearGradientContainer = _dereq_('./lineargradientcontainer');
  11425. var WebkitGradientContainer = _dereq_('./webkitgradientcontainer');
  11426. var bind = _dereq_('./utils').bind;
  11427. function ImageLoader(options, support) {
  11428. this.link = null;
  11429. this.options = options;
  11430. this.support = support;
  11431. this.origin = this.getOrigin(window.location.href);
  11432. }
  11433. ImageLoader.prototype.findImages = function (nodes) {
  11434. var images = [];
  11435. nodes.reduce(function (imageNodes, container) {
  11436. switch (container.node.nodeName) {
  11437. case "IMG":
  11438. return imageNodes.concat([{
  11439. args: [container.node.src],
  11440. method: "url" }]);
  11441. case "svg":
  11442. case "IFRAME":
  11443. return imageNodes.concat([{
  11444. args: [container.node],
  11445. method: container.node.nodeName }]);}
  11446. return imageNodes;
  11447. }, []).forEach(this.addImage(images, this.loadImage), this);
  11448. return images;
  11449. };
  11450. ImageLoader.prototype.findBackgroundImage = function (images, container) {
  11451. container.parseBackgroundImages().filter(this.hasImageBackground).forEach(this.addImage(images, this.loadImage), this);
  11452. return images;
  11453. };
  11454. ImageLoader.prototype.addImage = function (images, callback) {
  11455. return function (newImage) {
  11456. newImage.args.forEach(function (image) {
  11457. if (!this.imageExists(images, image)) {
  11458. images.splice(0, 0, callback.call(this, newImage));
  11459. log('Added image #' + images.length, typeof image === "string" ? image.substring(0, 100) : image);
  11460. }
  11461. }, this);
  11462. };
  11463. };
  11464. ImageLoader.prototype.hasImageBackground = function (imageData) {
  11465. return imageData.method !== "none";
  11466. };
  11467. ImageLoader.prototype.loadImage = function (imageData) {
  11468. if (imageData.method === "url") {
  11469. var src = imageData.args[0];
  11470. if (this.isSVG(src) && !this.support.svg && !this.options.allowTaint) {
  11471. return new SVGContainer(src);
  11472. } else if (src.match(/data:image\/.*;base64,/i)) {
  11473. return new ImageContainer(src.replace(/url\(['"]{0,}|['"]{0,}\)$/ig, ''), false);
  11474. } else if (this.isSameOrigin(src) || this.options.allowTaint === true || this.isSVG(src)) {
  11475. return new ImageContainer(src, false);
  11476. } else if (this.support.cors && !this.options.allowTaint && this.options.useCORS) {
  11477. return new ImageContainer(src, true);
  11478. } else if (this.options.proxy) {
  11479. return new ProxyImageContainer(src, this.options.proxy);
  11480. } else {
  11481. return new DummyImageContainer(src);
  11482. }
  11483. } else if (imageData.method === "linear-gradient") {
  11484. return new LinearGradientContainer(imageData);
  11485. } else if (imageData.method === "gradient") {
  11486. return new WebkitGradientContainer(imageData);
  11487. } else if (imageData.method === "svg") {
  11488. return new SVGNodeContainer(imageData.args[0], this.support.svg);
  11489. } else if (imageData.method === "IFRAME") {
  11490. return new FrameContainer(imageData.args[0], this.isSameOrigin(imageData.args[0].src), this.options);
  11491. } else {
  11492. return new DummyImageContainer(imageData);
  11493. }
  11494. };
  11495. ImageLoader.prototype.isSVG = function (src) {
  11496. return src.substring(src.length - 3).toLowerCase() === "svg" || SVGContainer.prototype.isInline(src);
  11497. };
  11498. ImageLoader.prototype.imageExists = function (images, src) {
  11499. return images.some(function (image) {
  11500. return image.src === src;
  11501. });
  11502. };
  11503. ImageLoader.prototype.isSameOrigin = function (url) {
  11504. return this.getOrigin(url) === this.origin;
  11505. };
  11506. ImageLoader.prototype.getOrigin = function (url) {
  11507. var link = this.link || (this.link = document.createElement("a"));
  11508. link.href = url;
  11509. link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
  11510. return link.protocol + link.hostname + link.port;
  11511. };
  11512. ImageLoader.prototype.getPromise = function (container) {
  11513. return this.timeout(container, this.options.imageTimeout)['catch'](function () {
  11514. var dummy = new DummyImageContainer(container.src);
  11515. return dummy.promise.then(function (image) {
  11516. container.image = image;
  11517. });
  11518. });
  11519. };
  11520. ImageLoader.prototype.get = function (src) {
  11521. var found = null;
  11522. return this.images.some(function (img) {
  11523. return (found = img).src === src;
  11524. }) ? found : null;
  11525. };
  11526. ImageLoader.prototype.fetch = function (nodes) {
  11527. this.images = nodes.reduce(bind(this.findBackgroundImage, this), this.findImages(nodes));
  11528. this.images.forEach(function (image, index) {
  11529. image.promise.then(function () {
  11530. log("Succesfully loaded image #" + (index + 1), image);
  11531. }, function (e) {
  11532. log("Failed loading image #" + (index + 1), image, e);
  11533. });
  11534. });
  11535. this.ready = Promise.all(this.images.map(this.getPromise, this));
  11536. log("Finished searching images");
  11537. return this;
  11538. };
  11539. ImageLoader.prototype.timeout = function (container, timeout) {
  11540. var timer;
  11541. var promise = Promise.race([container.promise, new Promise(function (res, reject) {
  11542. timer = setTimeout(function () {
  11543. log("Timed out loading image", container);
  11544. reject(container);
  11545. }, timeout);
  11546. })]).then(function (container) {
  11547. clearTimeout(timer);
  11548. return container;
  11549. });
  11550. promise['catch'](function () {
  11551. clearTimeout(timer);
  11552. });
  11553. return promise;
  11554. };
  11555. module.exports = ImageLoader;
  11556. }, { "./dummyimagecontainer": 5, "./framecontainer": 8, "./imagecontainer": 10, "./lineargradientcontainer": 12, "./log": 13, "./proxyimagecontainer": 17, "./svgcontainer": 23, "./svgnodecontainer": 24, "./utils": 26, "./webkitgradientcontainer": 27 }], 12: [function (_dereq_, module, exports) {
  11557. var GradientContainer = _dereq_('./gradientcontainer');
  11558. var Color = _dereq_('./color');
  11559. function LinearGradientContainer(imageData) {
  11560. GradientContainer.apply(this, arguments);
  11561. this.type = GradientContainer.TYPES.LINEAR;
  11562. var hasDirection = LinearGradientContainer.REGEXP_DIRECTION.test(imageData.args[0]) ||
  11563. !GradientContainer.REGEXP_COLORSTOP.test(imageData.args[0]);
  11564. if (hasDirection) {
  11565. imageData.args[0].split(/\s+/).reverse().forEach(function (position, index) {
  11566. switch (position) {
  11567. case "left":
  11568. this.x0 = 0;
  11569. this.x1 = 1;
  11570. break;
  11571. case "top":
  11572. this.y0 = 0;
  11573. this.y1 = 1;
  11574. break;
  11575. case "right":
  11576. this.x0 = 1;
  11577. this.x1 = 0;
  11578. break;
  11579. case "bottom":
  11580. this.y0 = 1;
  11581. this.y1 = 0;
  11582. break;
  11583. case "to":
  11584. var y0 = this.y0;
  11585. var x0 = this.x0;
  11586. this.y0 = this.y1;
  11587. this.x0 = this.x1;
  11588. this.x1 = x0;
  11589. this.y1 = y0;
  11590. break;
  11591. case "center":
  11592. break; // centered by default
  11593. // Firefox internally converts position keywords to percentages:
  11594. // http://www.w3.org/TR/2010/WD-CSS2-20101207/colors.html#propdef-background-position
  11595. default: // percentage or absolute length
  11596. // TODO: support absolute start point positions (e.g., use bounds to convert px to a ratio)
  11597. var ratio = parseFloat(position, 10) * 1e-2;
  11598. if (isNaN(ratio)) {// invalid or unhandled value
  11599. break;
  11600. }
  11601. if (index === 0) {
  11602. this.y0 = ratio;
  11603. this.y1 = 1 - this.y0;
  11604. } else {
  11605. this.x0 = ratio;
  11606. this.x1 = 1 - this.x0;
  11607. }
  11608. break;}
  11609. }, this);
  11610. } else {
  11611. this.y0 = 0;
  11612. this.y1 = 1;
  11613. }
  11614. this.colorStops = imageData.args.slice(hasDirection ? 1 : 0).map(function (colorStop) {
  11615. var colorStopMatch = colorStop.match(GradientContainer.REGEXP_COLORSTOP);
  11616. var value = +colorStopMatch[2];
  11617. var unit = value === 0 ? "%" : colorStopMatch[3]; // treat "0" as "0%"
  11618. return {
  11619. color: new Color(colorStopMatch[1]),
  11620. // TODO: support absolute stop positions (e.g., compute gradient line length & convert px to ratio)
  11621. stop: unit === "%" ? value / 100 : null };
  11622. });
  11623. if (this.colorStops[0].stop === null) {
  11624. this.colorStops[0].stop = 0;
  11625. }
  11626. if (this.colorStops[this.colorStops.length - 1].stop === null) {
  11627. this.colorStops[this.colorStops.length - 1].stop = 1;
  11628. }
  11629. // calculates and fills-in explicit stop positions when omitted from rule
  11630. this.colorStops.forEach(function (colorStop, index) {
  11631. if (colorStop.stop === null) {
  11632. this.colorStops.slice(index).some(function (find, count) {
  11633. if (find.stop !== null) {
  11634. colorStop.stop = (find.stop - this.colorStops[index - 1].stop) / (count + 1) + this.colorStops[index - 1].stop;
  11635. return true;
  11636. } else {
  11637. return false;
  11638. }
  11639. }, this);
  11640. }
  11641. }, this);
  11642. }
  11643. LinearGradientContainer.prototype = Object.create(GradientContainer.prototype);
  11644. // TODO: support <angle> (e.g. -?\d{1,3}(?:\.\d+)deg, etc. : https://developer.mozilla.org/docs/Web/CSS/angle )
  11645. LinearGradientContainer.REGEXP_DIRECTION = /^\s*(?:to|left|right|top|bottom|center|\d{1,3}(?:\.\d+)?%?)(?:\s|$)/i;
  11646. module.exports = LinearGradientContainer;
  11647. }, { "./color": 3, "./gradientcontainer": 9 }], 13: [function (_dereq_, module, exports) {
  11648. var logger = function logger() {
  11649. if (logger.options.logging && window.console && window.console.log) {
  11650. Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [Date.now() - logger.options.start + "ms", "html2canvas:"].concat([].slice.call(arguments, 0)));
  11651. }
  11652. };
  11653. logger.options = { logging: false };
  11654. module.exports = logger;
  11655. }, {}], 14: [function (_dereq_, module, exports) {
  11656. var Color = _dereq_('./color');
  11657. var utils = _dereq_('./utils');
  11658. var getBounds = utils.getBounds;
  11659. var parseBackgrounds = utils.parseBackgrounds;
  11660. var offsetBounds = utils.offsetBounds;
  11661. function NodeContainer(node, parent) {
  11662. this.node = node;
  11663. this.parent = parent;
  11664. this.stack = null;
  11665. this.bounds = null;
  11666. this.borders = null;
  11667. this.clip = [];
  11668. this.backgroundClip = [];
  11669. this.offsetBounds = null;
  11670. this.visible = null;
  11671. this.computedStyles = null;
  11672. this.colors = {};
  11673. this.styles = {};
  11674. this.backgroundImages = null;
  11675. this.transformData = null;
  11676. this.transformMatrix = null;
  11677. this.isPseudoElement = false;
  11678. this.opacity = null;
  11679. }
  11680. NodeContainer.prototype.cloneTo = function (stack) {
  11681. stack.visible = this.visible;
  11682. stack.borders = this.borders;
  11683. stack.bounds = this.bounds;
  11684. stack.clip = this.clip;
  11685. stack.backgroundClip = this.backgroundClip;
  11686. stack.computedStyles = this.computedStyles;
  11687. stack.styles = this.styles;
  11688. stack.backgroundImages = this.backgroundImages;
  11689. stack.opacity = this.opacity;
  11690. };
  11691. NodeContainer.prototype.getOpacity = function () {
  11692. return this.opacity === null ? this.opacity = this.cssFloat('opacity') : this.opacity;
  11693. };
  11694. NodeContainer.prototype.assignStack = function (stack) {
  11695. this.stack = stack;
  11696. stack.children.push(this);
  11697. };
  11698. NodeContainer.prototype.isElementVisible = function () {
  11699. return this.node.nodeType === Node.TEXT_NODE ? this.parent.visible :
  11700. this.css('display') !== "none" &&
  11701. this.css('visibility') !== "hidden" &&
  11702. !this.node.hasAttribute("data-html2canvas-ignore") && (
  11703. this.node.nodeName !== "INPUT" || this.node.getAttribute("type") !== "hidden");
  11704. };
  11705. NodeContainer.prototype.css = function (attribute) {
  11706. if (!this.computedStyles) {
  11707. this.computedStyles = this.isPseudoElement ? this.parent.computedStyle(this.before ? ":before" : ":after") : this.computedStyle(null);
  11708. }
  11709. return this.styles[attribute] || (this.styles[attribute] = this.computedStyles[attribute]);
  11710. };
  11711. NodeContainer.prototype.prefixedCss = function (attribute) {
  11712. var prefixes = ["webkit", "moz", "ms", "o"];
  11713. var value = this.css(attribute);
  11714. if (value === undefined) {
  11715. prefixes.some(function (prefix) {
  11716. value = this.css(prefix + attribute.substr(0, 1).toUpperCase() + attribute.substr(1));
  11717. return value !== undefined;
  11718. }, this);
  11719. }
  11720. return value === undefined ? null : value;
  11721. };
  11722. NodeContainer.prototype.computedStyle = function (type) {
  11723. return this.node.ownerDocument.defaultView.getComputedStyle(this.node, type);
  11724. };
  11725. NodeContainer.prototype.cssInt = function (attribute) {
  11726. var value = parseInt(this.css(attribute), 10);
  11727. return isNaN(value) ? 0 : value; // borders in old IE are throwing 'medium' for demo.html
  11728. };
  11729. NodeContainer.prototype.color = function (attribute) {
  11730. return this.colors[attribute] || (this.colors[attribute] = new Color(this.css(attribute)));
  11731. };
  11732. NodeContainer.prototype.cssFloat = function (attribute) {
  11733. var value = parseFloat(this.css(attribute));
  11734. return isNaN(value) ? 0 : value;
  11735. };
  11736. NodeContainer.prototype.fontWeight = function () {
  11737. var weight = this.css("fontWeight");
  11738. switch (parseInt(weight, 10)) {
  11739. case 401:
  11740. weight = "bold";
  11741. break;
  11742. case 400:
  11743. weight = "normal";
  11744. break;}
  11745. return weight;
  11746. };
  11747. NodeContainer.prototype.parseClip = function () {
  11748. var matches = this.css('clip').match(this.CLIP);
  11749. if (matches) {
  11750. return {
  11751. top: parseInt(matches[1], 10),
  11752. right: parseInt(matches[2], 10),
  11753. bottom: parseInt(matches[3], 10),
  11754. left: parseInt(matches[4], 10) };
  11755. }
  11756. return null;
  11757. };
  11758. NodeContainer.prototype.parseBackgroundImages = function () {
  11759. return this.backgroundImages || (this.backgroundImages = parseBackgrounds(this.css("backgroundImage")));
  11760. };
  11761. NodeContainer.prototype.cssList = function (property, index) {
  11762. var value = (this.css(property) || '').split(',');
  11763. value = value[index || 0] || value[0] || 'auto';
  11764. value = value.trim().split(' ');
  11765. if (value.length === 1) {
  11766. value = [value[0], isPercentage(value[0]) ? 'auto' : value[0]];
  11767. }
  11768. return value;
  11769. };
  11770. NodeContainer.prototype.parseBackgroundSize = function (bounds, image, index) {
  11771. var size = this.cssList("backgroundSize", index);
  11772. var width, height;
  11773. if (isPercentage(size[0])) {
  11774. width = bounds.width * parseFloat(size[0]) / 100;
  11775. } else if (/contain|cover/.test(size[0])) {
  11776. var targetRatio = bounds.width / bounds.height,currentRatio = image.width / image.height;
  11777. return targetRatio < currentRatio ^ size[0] === 'contain' ? { width: bounds.height * currentRatio, height: bounds.height } : { width: bounds.width, height: bounds.width / currentRatio };
  11778. } else {
  11779. width = parseInt(size[0], 10);
  11780. }
  11781. if (size[0] === 'auto' && size[1] === 'auto') {
  11782. height = image.height;
  11783. } else if (size[1] === 'auto') {
  11784. height = width / image.width * image.height;
  11785. } else if (isPercentage(size[1])) {
  11786. height = bounds.height * parseFloat(size[1]) / 100;
  11787. } else {
  11788. height = parseInt(size[1], 10);
  11789. }
  11790. if (size[0] === 'auto') {
  11791. width = height / image.height * image.width;
  11792. }
  11793. return { width: width, height: height };
  11794. };
  11795. NodeContainer.prototype.parseBackgroundPosition = function (bounds, image, index, backgroundSize) {
  11796. var position = this.cssList('backgroundPosition', index);
  11797. var left, top;
  11798. if (isPercentage(position[0])) {
  11799. left = (bounds.width - (backgroundSize || image).width) * (parseFloat(position[0]) / 100);
  11800. } else {
  11801. left = parseInt(position[0], 10);
  11802. }
  11803. if (position[1] === 'auto') {
  11804. top = left / image.width * image.height;
  11805. } else if (isPercentage(position[1])) {
  11806. top = (bounds.height - (backgroundSize || image).height) * parseFloat(position[1]) / 100;
  11807. } else {
  11808. top = parseInt(position[1], 10);
  11809. }
  11810. if (position[0] === 'auto') {
  11811. left = top / image.height * image.width;
  11812. }
  11813. return { left: left, top: top };
  11814. };
  11815. NodeContainer.prototype.parseBackgroundRepeat = function (index) {
  11816. return this.cssList("backgroundRepeat", index)[0];
  11817. };
  11818. NodeContainer.prototype.parseTextShadows = function () {
  11819. var textShadow = this.css("textShadow");
  11820. var results = [];
  11821. if (textShadow && textShadow !== 'none') {
  11822. var shadows = textShadow.match(this.TEXT_SHADOW_PROPERTY);
  11823. for (var i = 0; shadows && i < shadows.length; i++) {
  11824. var s = shadows[i].match(this.TEXT_SHADOW_VALUES);
  11825. results.push({
  11826. color: new Color(s[0]),
  11827. offsetX: s[1] ? parseFloat(s[1].replace('px', '')) : 0,
  11828. offsetY: s[2] ? parseFloat(s[2].replace('px', '')) : 0,
  11829. blur: s[3] ? s[3].replace('px', '') : 0 });
  11830. }
  11831. }
  11832. return results;
  11833. };
  11834. NodeContainer.prototype.parseTransform = function () {
  11835. if (!this.transformData) {
  11836. if (this.hasTransform()) {
  11837. var offset = this.parseBounds();
  11838. var origin = this.prefixedCss("transformOrigin").split(" ").map(removePx).map(asFloat);
  11839. origin[0] += offset.left;
  11840. origin[1] += offset.top;
  11841. this.transformData = {
  11842. origin: origin,
  11843. matrix: this.parseTransformMatrix() };
  11844. } else {
  11845. this.transformData = {
  11846. origin: [0, 0],
  11847. matrix: [1, 0, 0, 1, 0, 0] };
  11848. }
  11849. }
  11850. return this.transformData;
  11851. };
  11852. NodeContainer.prototype.parseTransformMatrix = function () {
  11853. if (!this.transformMatrix) {
  11854. var transform = this.prefixedCss("transform");
  11855. var matrix = transform ? parseMatrix(transform.match(this.MATRIX_PROPERTY)) : null;
  11856. this.transformMatrix = matrix ? matrix : [1, 0, 0, 1, 0, 0];
  11857. }
  11858. return this.transformMatrix;
  11859. };
  11860. NodeContainer.prototype.parseBounds = function () {
  11861. return this.bounds || (this.bounds = this.hasTransform() ? offsetBounds(this.node) : getBounds(this.node));
  11862. };
  11863. NodeContainer.prototype.hasTransform = function () {
  11864. return this.parseTransformMatrix().join(",") !== "1,0,0,1,0,0" || this.parent && this.parent.hasTransform();
  11865. };
  11866. NodeContainer.prototype.getValue = function () {
  11867. var value = this.node.value || "";
  11868. if (this.node.tagName === "SELECT") {
  11869. value = selectionValue(this.node);
  11870. } else if (this.node.type === "password") {
  11871. value = Array(value.length + 1).join("\u2022"); // jshint ignore:line
  11872. }
  11873. return value.length === 0 ? this.node.placeholder || "" : value;
  11874. };
  11875. NodeContainer.prototype.MATRIX_PROPERTY = /(matrix|matrix3d)\((.+)\)/;
  11876. NodeContainer.prototype.TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
  11877. NodeContainer.prototype.TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
  11878. NodeContainer.prototype.CLIP = /^rect\((\d+)px,? (\d+)px,? (\d+)px,? (\d+)px\)$/;
  11879. function selectionValue(node) {
  11880. var option = node.options[node.selectedIndex || 0];
  11881. return option ? option.text || "" : "";
  11882. }
  11883. function parseMatrix(match) {
  11884. if (match && match[1] === "matrix") {
  11885. return match[2].split(",").map(function (s) {
  11886. return parseFloat(s.trim());
  11887. });
  11888. } else if (match && match[1] === "matrix3d") {
  11889. var matrix3d = match[2].split(",").map(function (s) {
  11890. return parseFloat(s.trim());
  11891. });
  11892. return [matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13]];
  11893. }
  11894. }
  11895. function isPercentage(value) {
  11896. return value.toString().indexOf("%") !== -1;
  11897. }
  11898. function removePx(str) {
  11899. return str.replace("px", "");
  11900. }
  11901. function asFloat(str) {
  11902. return parseFloat(str);
  11903. }
  11904. module.exports = NodeContainer;
  11905. }, { "./color": 3, "./utils": 26 }], 15: [function (_dereq_, module, exports) {
  11906. var log = _dereq_('./log');
  11907. var punycode = _dereq_('punycode');
  11908. var NodeContainer = _dereq_('./nodecontainer');
  11909. var TextContainer = _dereq_('./textcontainer');
  11910. var PseudoElementContainer = _dereq_('./pseudoelementcontainer');
  11911. var FontMetrics = _dereq_('./fontmetrics');
  11912. var Color = _dereq_('./color');
  11913. var StackingContext = _dereq_('./stackingcontext');
  11914. var utils = _dereq_('./utils');
  11915. var bind = utils.bind;
  11916. var getBounds = utils.getBounds;
  11917. var parseBackgrounds = utils.parseBackgrounds;
  11918. var offsetBounds = utils.offsetBounds;
  11919. function NodeParser(element, renderer, support, imageLoader, options) {
  11920. log("Starting NodeParser");
  11921. this.renderer = renderer;
  11922. this.options = options;
  11923. this.range = null;
  11924. this.support = support;
  11925. this.renderQueue = [];
  11926. this.stack = new StackingContext(true, 1, element.ownerDocument, null);
  11927. var parent = new NodeContainer(element, null);
  11928. if (options.background) {
  11929. renderer.rectangle(0, 0, renderer.width, renderer.height, new Color(options.background));
  11930. }
  11931. if (element === element.ownerDocument.documentElement) {
  11932. // http://www.w3.org/TR/css3-background/#special-backgrounds
  11933. var canvasBackground = new NodeContainer(parent.color('backgroundColor').isTransparent() ? element.ownerDocument.body : element.ownerDocument.documentElement, null);
  11934. renderer.rectangle(0, 0, renderer.width, renderer.height, canvasBackground.color('backgroundColor'));
  11935. }
  11936. parent.visibile = parent.isElementVisible();
  11937. this.createPseudoHideStyles(element.ownerDocument);
  11938. this.disableAnimations(element.ownerDocument);
  11939. this.nodes = flatten([parent].concat(this.getChildren(parent)).filter(function (container) {
  11940. return container.visible = container.isElementVisible();
  11941. }).map(this.getPseudoElements, this));
  11942. this.fontMetrics = new FontMetrics();
  11943. log("Fetched nodes, total:", this.nodes.length);
  11944. log("Calculate overflow clips");
  11945. this.calculateOverflowClips();
  11946. log("Start fetching images");
  11947. this.images = imageLoader.fetch(this.nodes.filter(isElement));
  11948. this.ready = this.images.ready.then(bind(function () {
  11949. log("Images loaded, starting parsing");
  11950. log("Creating stacking contexts");
  11951. this.createStackingContexts();
  11952. log("Sorting stacking contexts");
  11953. this.sortStackingContexts(this.stack);
  11954. this.parse(this.stack);
  11955. log("Render queue created with " + this.renderQueue.length + " items");
  11956. return new Promise(bind(function (resolve) {
  11957. if (!options.async) {
  11958. this.renderQueue.forEach(this.paint, this);
  11959. resolve();
  11960. } else if (typeof options.async === "function") {
  11961. options.async.call(this, this.renderQueue, resolve);
  11962. } else if (this.renderQueue.length > 0) {
  11963. this.renderIndex = 0;
  11964. this.asyncRenderer(this.renderQueue, resolve);
  11965. } else {
  11966. resolve();
  11967. }
  11968. }, this));
  11969. }, this));
  11970. }
  11971. NodeParser.prototype.calculateOverflowClips = function () {
  11972. this.nodes.forEach(function (container) {
  11973. if (isElement(container)) {
  11974. if (isPseudoElement(container)) {
  11975. container.appendToDOM();
  11976. }
  11977. container.borders = this.parseBorders(container);
  11978. var clip = container.css('overflow') === "hidden" ? [container.borders.clip] : [];
  11979. var cssClip = container.parseClip();
  11980. if (cssClip && ["absolute", "fixed"].indexOf(container.css('position')) !== -1) {
  11981. clip.push([["rect",
  11982. container.bounds.left + cssClip.left,
  11983. container.bounds.top + cssClip.top,
  11984. cssClip.right - cssClip.left,
  11985. cssClip.bottom - cssClip.top]]);
  11986. }
  11987. container.clip = hasParentClip(container) ? container.parent.clip.concat(clip) : clip;
  11988. container.backgroundClip = container.css('overflow') !== "hidden" ? container.clip.concat([container.borders.clip]) : container.clip;
  11989. if (isPseudoElement(container)) {
  11990. container.cleanDOM();
  11991. }
  11992. } else if (isTextNode(container)) {
  11993. container.clip = hasParentClip(container) ? container.parent.clip : [];
  11994. }
  11995. if (!isPseudoElement(container)) {
  11996. container.bounds = null;
  11997. }
  11998. }, this);
  11999. };
  12000. function hasParentClip(container) {
  12001. return container.parent && container.parent.clip.length;
  12002. }
  12003. NodeParser.prototype.asyncRenderer = function (queue, resolve, asyncTimer) {
  12004. asyncTimer = asyncTimer || Date.now();
  12005. this.paint(queue[this.renderIndex++]);
  12006. if (queue.length === this.renderIndex) {
  12007. resolve();
  12008. } else if (asyncTimer + 20 > Date.now()) {
  12009. this.asyncRenderer(queue, resolve, asyncTimer);
  12010. } else {
  12011. setTimeout(bind(function () {
  12012. this.asyncRenderer(queue, resolve);
  12013. }, this), 0);
  12014. }
  12015. };
  12016. NodeParser.prototype.createPseudoHideStyles = function (document) {
  12017. this.createStyles(document, '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
  12018. '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }');
  12019. };
  12020. NodeParser.prototype.disableAnimations = function (document) {
  12021. this.createStyles(document, '* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; ' +
  12022. '-webkit-transition: none !important; -moz-transition: none !important; -o-transition: none !important; transition: none !important;}');
  12023. };
  12024. NodeParser.prototype.createStyles = function (document, styles) {
  12025. var hidePseudoElements = document.createElement('style');
  12026. hidePseudoElements.innerHTML = styles;
  12027. document.body.appendChild(hidePseudoElements);
  12028. };
  12029. NodeParser.prototype.getPseudoElements = function (container) {
  12030. var nodes = [[container]];
  12031. if (container.node.nodeType === Node.ELEMENT_NODE) {
  12032. var before = this.getPseudoElement(container, ":before");
  12033. var after = this.getPseudoElement(container, ":after");
  12034. if (before) {
  12035. nodes.push(before);
  12036. }
  12037. if (after) {
  12038. nodes.push(after);
  12039. }
  12040. }
  12041. return flatten(nodes);
  12042. };
  12043. function toCamelCase(str) {
  12044. return str.replace(/(\-[a-z])/g, function (match) {
  12045. return match.toUpperCase().replace('-', '');
  12046. });
  12047. }
  12048. NodeParser.prototype.getPseudoElement = function (container, type) {
  12049. var style = container.computedStyle(type);
  12050. if (!style || !style.content || style.content === "none" || style.content === "-moz-alt-content" || style.display === "none") {
  12051. return null;
  12052. }
  12053. var content = stripQuotes(style.content);
  12054. var isImage = content.substr(0, 3) === 'url';
  12055. var pseudoNode = document.createElement(isImage ? 'img' : 'html2canvaspseudoelement');
  12056. var pseudoContainer = new PseudoElementContainer(pseudoNode, container, type);
  12057. for (var i = style.length - 1; i >= 0; i--) {
  12058. var property = toCamelCase(style.item(i));
  12059. pseudoNode.style[property] = style[property];
  12060. }
  12061. pseudoNode.className = PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  12062. if (isImage) {
  12063. pseudoNode.src = parseBackgrounds(content)[0].args[0];
  12064. return [pseudoContainer];
  12065. } else {
  12066. var text = document.createTextNode(content);
  12067. pseudoNode.appendChild(text);
  12068. return [pseudoContainer, new TextContainer(text, pseudoContainer)];
  12069. }
  12070. };
  12071. NodeParser.prototype.getChildren = function (parentContainer) {
  12072. return flatten([].filter.call(parentContainer.node.childNodes, renderableNode).map(function (node) {
  12073. var container = [node.nodeType === Node.TEXT_NODE ? new TextContainer(node, parentContainer) : new NodeContainer(node, parentContainer)].filter(nonIgnoredElement);
  12074. return node.nodeType === Node.ELEMENT_NODE && container.length && node.tagName !== "TEXTAREA" ? container[0].isElementVisible() ? container.concat(this.getChildren(container[0])) : [] : container;
  12075. }, this));
  12076. };
  12077. NodeParser.prototype.newStackingContext = function (container, hasOwnStacking) {
  12078. var stack = new StackingContext(hasOwnStacking, container.getOpacity(), container.node, container.parent);
  12079. container.cloneTo(stack);
  12080. var parentStack = hasOwnStacking ? stack.getParentStack(this) : stack.parent.stack;
  12081. parentStack.contexts.push(stack);
  12082. container.stack = stack;
  12083. };
  12084. NodeParser.prototype.createStackingContexts = function () {
  12085. this.nodes.forEach(function (container) {
  12086. if (isElement(container) && (this.isRootElement(container) || hasOpacity(container) || isPositionedForStacking(container) || this.isBodyWithTransparentRoot(container) || container.hasTransform())) {
  12087. this.newStackingContext(container, true);
  12088. } else if (isElement(container) && (isPositioned(container) && zIndex0(container) || isInlineBlock(container) || isFloating(container))) {
  12089. this.newStackingContext(container, false);
  12090. } else {
  12091. container.assignStack(container.parent.stack);
  12092. }
  12093. }, this);
  12094. };
  12095. NodeParser.prototype.isBodyWithTransparentRoot = function (container) {
  12096. return container.node.nodeName === "BODY" && container.parent.color('backgroundColor').isTransparent();
  12097. };
  12098. NodeParser.prototype.isRootElement = function (container) {
  12099. return container.parent === null;
  12100. };
  12101. NodeParser.prototype.sortStackingContexts = function (stack) {
  12102. stack.contexts.sort(zIndexSort(stack.contexts.slice(0)));
  12103. stack.contexts.forEach(this.sortStackingContexts, this);
  12104. };
  12105. NodeParser.prototype.parseTextBounds = function (container) {
  12106. return function (text, index, textList) {
  12107. if (container.parent.css("textDecoration").substr(0, 4) !== "none" || text.trim().length !== 0) {
  12108. if (this.support.rangeBounds && !container.parent.hasTransform()) {
  12109. var offset = textList.slice(0, index).join("").length;
  12110. return this.getRangeBounds(container.node, offset, text.length);
  12111. } else if (container.node && typeof container.node.data === "string") {
  12112. var replacementNode = container.node.splitText(text.length);
  12113. var bounds = this.getWrapperBounds(container.node, container.parent.hasTransform());
  12114. container.node = replacementNode;
  12115. return bounds;
  12116. }
  12117. } else if (!this.support.rangeBounds || container.parent.hasTransform()) {
  12118. container.node = container.node.splitText(text.length);
  12119. }
  12120. return {};
  12121. };
  12122. };
  12123. NodeParser.prototype.getWrapperBounds = function (node, transform) {
  12124. var wrapper = node.ownerDocument.createElement('html2canvaswrapper');
  12125. var parent = node.parentNode,
  12126. backupText = node.cloneNode(true);
  12127. wrapper.appendChild(node.cloneNode(true));
  12128. parent.replaceChild(wrapper, node);
  12129. var bounds = transform ? offsetBounds(wrapper) : getBounds(wrapper);
  12130. parent.replaceChild(backupText, wrapper);
  12131. return bounds;
  12132. };
  12133. NodeParser.prototype.getRangeBounds = function (node, offset, length) {
  12134. var range = this.range || (this.range = node.ownerDocument.createRange());
  12135. range.setStart(node, offset);
  12136. range.setEnd(node, offset + length);
  12137. return range.getBoundingClientRect();
  12138. };
  12139. function ClearTransform() {}
  12140. NodeParser.prototype.parse = function (stack) {
  12141. // http://www.w3.org/TR/CSS21/visuren.html#z-index
  12142. var negativeZindex = stack.contexts.filter(negativeZIndex); // 2. the child stacking contexts with negative stack levels (most negative first).
  12143. var descendantElements = stack.children.filter(isElement);
  12144. var descendantNonFloats = descendantElements.filter(not(isFloating));
  12145. var nonInlineNonPositionedDescendants = descendantNonFloats.filter(not(isPositioned)).filter(not(inlineLevel)); // 3 the in-flow, non-inline-level, non-positioned descendants.
  12146. var nonPositionedFloats = descendantElements.filter(not(isPositioned)).filter(isFloating); // 4. the non-positioned floats.
  12147. var inFlow = descendantNonFloats.filter(not(isPositioned)).filter(inlineLevel); // 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
  12148. var stackLevel0 = stack.contexts.concat(descendantNonFloats.filter(isPositioned)).filter(zIndex0); // 6. the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.
  12149. var text = stack.children.filter(isTextNode).filter(hasText);
  12150. var positiveZindex = stack.contexts.filter(positiveZIndex); // 7. the child stacking contexts with positive stack levels (least positive first).
  12151. negativeZindex.concat(nonInlineNonPositionedDescendants).concat(nonPositionedFloats).
  12152. concat(inFlow).concat(stackLevel0).concat(text).concat(positiveZindex).forEach(function (container) {
  12153. this.renderQueue.push(container);
  12154. if (isStackingContext(container)) {
  12155. this.parse(container);
  12156. this.renderQueue.push(new ClearTransform());
  12157. }
  12158. }, this);
  12159. };
  12160. NodeParser.prototype.paint = function (container) {
  12161. try {
  12162. if (container instanceof ClearTransform) {
  12163. this.renderer.ctx.restore();
  12164. } else if (isTextNode(container)) {
  12165. if (isPseudoElement(container.parent)) {
  12166. container.parent.appendToDOM();
  12167. }
  12168. this.paintText(container);
  12169. if (isPseudoElement(container.parent)) {
  12170. container.parent.cleanDOM();
  12171. }
  12172. } else {
  12173. this.paintNode(container);
  12174. }
  12175. } catch (e) {
  12176. log(e);
  12177. if (this.options.strict) {
  12178. throw e;
  12179. }
  12180. }
  12181. };
  12182. NodeParser.prototype.paintNode = function (container) {
  12183. if (isStackingContext(container)) {
  12184. this.renderer.setOpacity(container.opacity);
  12185. this.renderer.ctx.save();
  12186. if (container.hasTransform()) {
  12187. this.renderer.setTransform(container.parseTransform());
  12188. }
  12189. }
  12190. if (container.node.nodeName === "INPUT" && container.node.type === "checkbox") {
  12191. this.paintCheckbox(container);
  12192. } else if (container.node.nodeName === "INPUT" && container.node.type === "radio") {
  12193. this.paintRadio(container);
  12194. } else {
  12195. this.paintElement(container);
  12196. }
  12197. };
  12198. NodeParser.prototype.paintElement = function (container) {
  12199. var bounds = container.parseBounds();
  12200. this.renderer.clip(container.backgroundClip, function () {
  12201. this.renderer.renderBackground(container, bounds, container.borders.borders.map(getWidth));
  12202. }, this);
  12203. this.renderer.clip(container.clip, function () {
  12204. this.renderer.renderBorders(container.borders.borders);
  12205. }, this);
  12206. this.renderer.clip(container.backgroundClip, function () {
  12207. switch (container.node.nodeName) {
  12208. case "svg":
  12209. case "IFRAME":
  12210. var imgContainer = this.images.get(container.node);
  12211. if (imgContainer) {
  12212. this.renderer.renderImage(container, bounds, container.borders, imgContainer);
  12213. } else {
  12214. log("Error loading <" + container.node.nodeName + ">", container.node);
  12215. }
  12216. break;
  12217. case "IMG":
  12218. var imageContainer = this.images.get(container.node.src);
  12219. if (imageContainer) {
  12220. this.renderer.renderImage(container, bounds, container.borders, imageContainer);
  12221. } else {
  12222. log("Error loading <img>", container.node.src);
  12223. }
  12224. break;
  12225. case "CANVAS":
  12226. this.renderer.renderImage(container, bounds, container.borders, { image: container.node });
  12227. break;
  12228. case "SELECT":
  12229. case "INPUT":
  12230. case "TEXTAREA":
  12231. this.paintFormValue(container);
  12232. break;}
  12233. }, this);
  12234. };
  12235. NodeParser.prototype.paintCheckbox = function (container) {
  12236. var b = container.parseBounds();
  12237. var size = Math.min(b.width, b.height);
  12238. var bounds = { width: size - 1, height: size - 1, top: b.top, left: b.left };
  12239. var r = [3, 3];
  12240. var radius = [r, r, r, r];
  12241. var borders = [1, 1, 1, 1].map(function (w) {
  12242. return { color: new Color('#A5A5A5'), width: w };
  12243. });
  12244. var borderPoints = calculateCurvePoints(bounds, radius, borders);
  12245. this.renderer.clip(container.backgroundClip, function () {
  12246. this.renderer.rectangle(bounds.left + 1, bounds.top + 1, bounds.width - 2, bounds.height - 2, new Color("#DEDEDE"));
  12247. this.renderer.renderBorders(calculateBorders(borders, bounds, borderPoints, radius));
  12248. if (container.node.checked) {
  12249. this.renderer.font(new Color('#424242'), 'normal', 'normal', 'bold', size - 3 + "px", 'arial');
  12250. this.renderer.text("\u2714", bounds.left + size / 6, bounds.top + size - 1);
  12251. }
  12252. }, this);
  12253. };
  12254. NodeParser.prototype.paintRadio = function (container) {
  12255. var bounds = container.parseBounds();
  12256. var size = Math.min(bounds.width, bounds.height) - 2;
  12257. this.renderer.clip(container.backgroundClip, function () {
  12258. this.renderer.circleStroke(bounds.left + 1, bounds.top + 1, size, new Color('#DEDEDE'), 1, new Color('#A5A5A5'));
  12259. if (container.node.checked) {
  12260. this.renderer.circle(Math.ceil(bounds.left + size / 4) + 1, Math.ceil(bounds.top + size / 4) + 1, Math.floor(size / 2), new Color('#424242'));
  12261. }
  12262. }, this);
  12263. };
  12264. NodeParser.prototype.paintFormValue = function (container) {
  12265. var value = container.getValue();
  12266. if (value.length > 0) {
  12267. var document = container.node.ownerDocument;
  12268. var wrapper = document.createElement('html2canvaswrapper');
  12269. var properties = ['lineHeight', 'textAlign', 'fontFamily', 'fontWeight', 'fontSize', 'color',
  12270. 'paddingLeft', 'paddingTop', 'paddingRight', 'paddingBottom',
  12271. 'width', 'height', 'borderLeftStyle', 'borderTopStyle', 'borderLeftWidth', 'borderTopWidth',
  12272. 'boxSizing', 'whiteSpace', 'wordWrap'];
  12273. properties.forEach(function (property) {
  12274. try {
  12275. wrapper.style[property] = container.css(property);
  12276. } catch (e) {
  12277. // Older IE has issues with "border"
  12278. log("html2canvas: Parse: Exception caught in renderFormValue: " + e.message);
  12279. }
  12280. });
  12281. var bounds = container.parseBounds();
  12282. wrapper.style.position = "fixed";
  12283. wrapper.style.left = bounds.left + "px";
  12284. wrapper.style.top = bounds.top + "px";
  12285. wrapper.textContent = value;
  12286. document.body.appendChild(wrapper);
  12287. this.paintText(new TextContainer(wrapper.firstChild, container));
  12288. document.body.removeChild(wrapper);
  12289. }
  12290. };
  12291. NodeParser.prototype.paintText = function (container) {
  12292. container.applyTextTransform();
  12293. var characters = punycode.ucs2.decode(container.node.data);
  12294. var textList = (!this.options.letterRendering || noLetterSpacing(container)) && !hasUnicode(container.node.data) ? getWords(characters) : characters.map(function (character) {
  12295. return punycode.ucs2.encode([character]);
  12296. });
  12297. var weight = container.parent.fontWeight();
  12298. var size = container.parent.css('fontSize');
  12299. var family = container.parent.css('fontFamily');
  12300. var shadows = container.parent.parseTextShadows();
  12301. this.renderer.font(container.parent.color('color'), container.parent.css('fontStyle'), container.parent.css('fontVariant'), weight, size, family);
  12302. if (shadows.length) {
  12303. // TODO: support multiple text shadows
  12304. this.renderer.fontShadow(shadows[0].color, shadows[0].offsetX, shadows[0].offsetY, shadows[0].blur);
  12305. } else {
  12306. this.renderer.clearShadow();
  12307. }
  12308. this.renderer.clip(container.parent.clip, function () {
  12309. textList.map(this.parseTextBounds(container), this).forEach(function (bounds, index) {
  12310. if (bounds) {
  12311. this.renderer.text(textList[index], bounds.left, bounds.bottom);
  12312. this.renderTextDecoration(container.parent, bounds, this.fontMetrics.getMetrics(family, size));
  12313. }
  12314. }, this);
  12315. }, this);
  12316. };
  12317. NodeParser.prototype.renderTextDecoration = function (container, bounds, metrics) {
  12318. switch (container.css("textDecoration").split(" ")[0]) {
  12319. case "underline":
  12320. // Draws a line at the baseline of the font
  12321. // TODO As some browsers display the line as more than 1px if the font-size is big, need to take that into account both in position and size
  12322. this.renderer.rectangle(bounds.left, Math.round(bounds.top + metrics.baseline + metrics.lineWidth), bounds.width, 1, container.color("color"));
  12323. break;
  12324. case "overline":
  12325. this.renderer.rectangle(bounds.left, Math.round(bounds.top), bounds.width, 1, container.color("color"));
  12326. break;
  12327. case "line-through":
  12328. // TODO try and find exact position for line-through
  12329. this.renderer.rectangle(bounds.left, Math.ceil(bounds.top + metrics.middle + metrics.lineWidth), bounds.width, 1, container.color("color"));
  12330. break;}
  12331. };
  12332. var borderColorTransforms = {
  12333. inset: [
  12334. ["darken", 0.60],
  12335. ["darken", 0.10],
  12336. ["darken", 0.10],
  12337. ["darken", 0.60]] };
  12338. NodeParser.prototype.parseBorders = function (container) {
  12339. var nodeBounds = container.parseBounds();
  12340. var radius = getBorderRadiusData(container);
  12341. var borders = ["Top", "Right", "Bottom", "Left"].map(function (side, index) {
  12342. var style = container.css('border' + side + 'Style');
  12343. var color = container.color('border' + side + 'Color');
  12344. if (style === "inset" && color.isBlack()) {
  12345. color = new Color([255, 255, 255, color.a]); // this is wrong, but
  12346. }
  12347. var colorTransform = borderColorTransforms[style] ? borderColorTransforms[style][index] : null;
  12348. return {
  12349. width: container.cssInt('border' + side + 'Width'),
  12350. color: colorTransform ? color[colorTransform[0]](colorTransform[1]) : color,
  12351. args: null };
  12352. });
  12353. var borderPoints = calculateCurvePoints(nodeBounds, radius, borders);
  12354. return {
  12355. clip: this.parseBackgroundClip(container, borderPoints, borders, radius, nodeBounds),
  12356. borders: calculateBorders(borders, nodeBounds, borderPoints, radius) };
  12357. };
  12358. function calculateBorders(borders, nodeBounds, borderPoints, radius) {
  12359. return borders.map(function (border, borderSide) {
  12360. if (border.width > 0) {
  12361. var bx = nodeBounds.left;
  12362. var by = nodeBounds.top;
  12363. var bw = nodeBounds.width;
  12364. var bh = nodeBounds.height - borders[2].width;
  12365. switch (borderSide) {
  12366. case 0:
  12367. // top border
  12368. bh = borders[0].width;
  12369. border.args = drawSide({
  12370. c1: [bx, by],
  12371. c2: [bx + bw, by],
  12372. c3: [bx + bw - borders[1].width, by + bh],
  12373. c4: [bx + borders[3].width, by + bh] },
  12374. radius[0], radius[1],
  12375. borderPoints.topLeftOuter, borderPoints.topLeftInner, borderPoints.topRightOuter, borderPoints.topRightInner);
  12376. break;
  12377. case 1:
  12378. // right border
  12379. bx = nodeBounds.left + nodeBounds.width - borders[1].width;
  12380. bw = borders[1].width;
  12381. border.args = drawSide({
  12382. c1: [bx + bw, by],
  12383. c2: [bx + bw, by + bh + borders[2].width],
  12384. c3: [bx, by + bh],
  12385. c4: [bx, by + borders[0].width] },
  12386. radius[1], radius[2],
  12387. borderPoints.topRightOuter, borderPoints.topRightInner, borderPoints.bottomRightOuter, borderPoints.bottomRightInner);
  12388. break;
  12389. case 2:
  12390. // bottom border
  12391. by = by + nodeBounds.height - borders[2].width;
  12392. bh = borders[2].width;
  12393. border.args = drawSide({
  12394. c1: [bx + bw, by + bh],
  12395. c2: [bx, by + bh],
  12396. c3: [bx + borders[3].width, by],
  12397. c4: [bx + bw - borders[3].width, by] },
  12398. radius[2], radius[3],
  12399. borderPoints.bottomRightOuter, borderPoints.bottomRightInner, borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner);
  12400. break;
  12401. case 3:
  12402. // left border
  12403. bw = borders[3].width;
  12404. border.args = drawSide({
  12405. c1: [bx, by + bh + borders[2].width],
  12406. c2: [bx, by],
  12407. c3: [bx + bw, by + borders[0].width],
  12408. c4: [bx + bw, by + bh] },
  12409. radius[3], radius[0],
  12410. borderPoints.bottomLeftOuter, borderPoints.bottomLeftInner, borderPoints.topLeftOuter, borderPoints.topLeftInner);
  12411. break;}
  12412. }
  12413. return border;
  12414. });
  12415. }
  12416. NodeParser.prototype.parseBackgroundClip = function (container, borderPoints, borders, radius, bounds) {
  12417. var backgroundClip = container.css('backgroundClip'),
  12418. borderArgs = [];
  12419. switch (backgroundClip) {
  12420. case "content-box":
  12421. case "padding-box":
  12422. parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftInner, borderPoints.topRightInner, bounds.left + borders[3].width, bounds.top + borders[0].width);
  12423. parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightInner, borderPoints.bottomRightInner, bounds.left + bounds.width - borders[1].width, bounds.top + borders[0].width);
  12424. parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightInner, borderPoints.bottomLeftInner, bounds.left + bounds.width - borders[1].width, bounds.top + bounds.height - borders[2].width);
  12425. parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftInner, borderPoints.topLeftInner, bounds.left + borders[3].width, bounds.top + bounds.height - borders[2].width);
  12426. break;
  12427. default:
  12428. parseCorner(borderArgs, radius[0], radius[1], borderPoints.topLeftOuter, borderPoints.topRightOuter, bounds.left, bounds.top);
  12429. parseCorner(borderArgs, radius[1], radius[2], borderPoints.topRightOuter, borderPoints.bottomRightOuter, bounds.left + bounds.width, bounds.top);
  12430. parseCorner(borderArgs, radius[2], radius[3], borderPoints.bottomRightOuter, borderPoints.bottomLeftOuter, bounds.left + bounds.width, bounds.top + bounds.height);
  12431. parseCorner(borderArgs, radius[3], radius[0], borderPoints.bottomLeftOuter, borderPoints.topLeftOuter, bounds.left, bounds.top + bounds.height);
  12432. break;}
  12433. return borderArgs;
  12434. };
  12435. function getCurvePoints(x, y, r1, r2) {
  12436. var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
  12437. var ox = r1 * kappa, // control point offset horizontal
  12438. oy = r2 * kappa, // control point offset vertical
  12439. xm = x + r1, // x-middle
  12440. ym = y + r2; // y-middle
  12441. return {
  12442. topLeft: bezierCurve({ x: x, y: ym }, { x: x, y: ym - oy }, { x: xm - ox, y: y }, { x: xm, y: y }),
  12443. topRight: bezierCurve({ x: x, y: y }, { x: x + ox, y: y }, { x: xm, y: ym - oy }, { x: xm, y: ym }),
  12444. bottomRight: bezierCurve({ x: xm, y: y }, { x: xm, y: y + oy }, { x: x + ox, y: ym }, { x: x, y: ym }),
  12445. bottomLeft: bezierCurve({ x: xm, y: ym }, { x: xm - ox, y: ym }, { x: x, y: y + oy }, { x: x, y: y }) };
  12446. }
  12447. function calculateCurvePoints(bounds, borderRadius, borders) {
  12448. var x = bounds.left,
  12449. y = bounds.top,
  12450. width = bounds.width,
  12451. height = bounds.height,
  12452. tlh = borderRadius[0][0] < width / 2 ? borderRadius[0][0] : width / 2,
  12453. tlv = borderRadius[0][1] < height / 2 ? borderRadius[0][1] : height / 2,
  12454. trh = borderRadius[1][0] < width / 2 ? borderRadius[1][0] : width / 2,
  12455. trv = borderRadius[1][1] < height / 2 ? borderRadius[1][1] : height / 2,
  12456. brh = borderRadius[2][0] < width / 2 ? borderRadius[2][0] : width / 2,
  12457. brv = borderRadius[2][1] < height / 2 ? borderRadius[2][1] : height / 2,
  12458. blh = borderRadius[3][0] < width / 2 ? borderRadius[3][0] : width / 2,
  12459. blv = borderRadius[3][1] < height / 2 ? borderRadius[3][1] : height / 2;
  12460. var topWidth = width - trh,
  12461. rightHeight = height - brv,
  12462. bottomWidth = width - brh,
  12463. leftHeight = height - blv;
  12464. return {
  12465. topLeftOuter: getCurvePoints(x, y, tlh, tlv).topLeft.subdivide(0.5),
  12466. topLeftInner: getCurvePoints(x + borders[3].width, y + borders[0].width, Math.max(0, tlh - borders[3].width), Math.max(0, tlv - borders[0].width)).topLeft.subdivide(0.5),
  12467. topRightOuter: getCurvePoints(x + topWidth, y, trh, trv).topRight.subdivide(0.5),
  12468. topRightInner: getCurvePoints(x + Math.min(topWidth, width + borders[3].width), y + borders[0].width, topWidth > width + borders[3].width ? 0 : trh - borders[3].width, trv - borders[0].width).topRight.subdivide(0.5),
  12469. bottomRightOuter: getCurvePoints(x + bottomWidth, y + rightHeight, brh, brv).bottomRight.subdivide(0.5),
  12470. bottomRightInner: getCurvePoints(x + Math.min(bottomWidth, width - borders[3].width), y + Math.min(rightHeight, height + borders[0].width), Math.max(0, brh - borders[1].width), brv - borders[2].width).bottomRight.subdivide(0.5),
  12471. bottomLeftOuter: getCurvePoints(x, y + leftHeight, blh, blv).bottomLeft.subdivide(0.5),
  12472. bottomLeftInner: getCurvePoints(x + borders[3].width, y + leftHeight, Math.max(0, blh - borders[3].width), blv - borders[2].width).bottomLeft.subdivide(0.5) };
  12473. }
  12474. function bezierCurve(start, startControl, endControl, end) {
  12475. var lerp = function lerp(a, b, t) {
  12476. return {
  12477. x: a.x + (b.x - a.x) * t,
  12478. y: a.y + (b.y - a.y) * t };
  12479. };
  12480. return {
  12481. start: start,
  12482. startControl: startControl,
  12483. endControl: endControl,
  12484. end: end,
  12485. subdivide: function subdivide(t) {
  12486. var ab = lerp(start, startControl, t),
  12487. bc = lerp(startControl, endControl, t),
  12488. cd = lerp(endControl, end, t),
  12489. abbc = lerp(ab, bc, t),
  12490. bccd = lerp(bc, cd, t),
  12491. dest = lerp(abbc, bccd, t);
  12492. return [bezierCurve(start, ab, abbc, dest), bezierCurve(dest, bccd, cd, end)];
  12493. },
  12494. curveTo: function curveTo(borderArgs) {
  12495. borderArgs.push(["bezierCurve", startControl.x, startControl.y, endControl.x, endControl.y, end.x, end.y]);
  12496. },
  12497. curveToReversed: function curveToReversed(borderArgs) {
  12498. borderArgs.push(["bezierCurve", endControl.x, endControl.y, startControl.x, startControl.y, start.x, start.y]);
  12499. } };
  12500. }
  12501. function drawSide(borderData, radius1, radius2, outer1, inner1, outer2, inner2) {
  12502. var borderArgs = [];
  12503. if (radius1[0] > 0 || radius1[1] > 0) {
  12504. borderArgs.push(["line", outer1[1].start.x, outer1[1].start.y]);
  12505. outer1[1].curveTo(borderArgs);
  12506. } else {
  12507. borderArgs.push(["line", borderData.c1[0], borderData.c1[1]]);
  12508. }
  12509. if (radius2[0] > 0 || radius2[1] > 0) {
  12510. borderArgs.push(["line", outer2[0].start.x, outer2[0].start.y]);
  12511. outer2[0].curveTo(borderArgs);
  12512. borderArgs.push(["line", inner2[0].end.x, inner2[0].end.y]);
  12513. inner2[0].curveToReversed(borderArgs);
  12514. } else {
  12515. borderArgs.push(["line", borderData.c2[0], borderData.c2[1]]);
  12516. borderArgs.push(["line", borderData.c3[0], borderData.c3[1]]);
  12517. }
  12518. if (radius1[0] > 0 || radius1[1] > 0) {
  12519. borderArgs.push(["line", inner1[1].end.x, inner1[1].end.y]);
  12520. inner1[1].curveToReversed(borderArgs);
  12521. } else {
  12522. borderArgs.push(["line", borderData.c4[0], borderData.c4[1]]);
  12523. }
  12524. return borderArgs;
  12525. }
  12526. function parseCorner(borderArgs, radius1, radius2, corner1, corner2, x, y) {
  12527. if (radius1[0] > 0 || radius1[1] > 0) {
  12528. borderArgs.push(["line", corner1[0].start.x, corner1[0].start.y]);
  12529. corner1[0].curveTo(borderArgs);
  12530. corner1[1].curveTo(borderArgs);
  12531. } else {
  12532. borderArgs.push(["line", x, y]);
  12533. }
  12534. if (radius2[0] > 0 || radius2[1] > 0) {
  12535. borderArgs.push(["line", corner2[0].start.x, corner2[0].start.y]);
  12536. }
  12537. }
  12538. function negativeZIndex(container) {
  12539. return container.cssInt("zIndex") < 0;
  12540. }
  12541. function positiveZIndex(container) {
  12542. return container.cssInt("zIndex") > 0;
  12543. }
  12544. function zIndex0(container) {
  12545. return container.cssInt("zIndex") === 0;
  12546. }
  12547. function inlineLevel(container) {
  12548. return ["inline", "inline-block", "inline-table"].indexOf(container.css("display")) !== -1;
  12549. }
  12550. function isStackingContext(container) {
  12551. return container instanceof StackingContext;
  12552. }
  12553. function hasText(container) {
  12554. return container.node.data.trim().length > 0;
  12555. }
  12556. function noLetterSpacing(container) {
  12557. return /^(normal|none|0px)$/.test(container.parent.css("letterSpacing"));
  12558. }
  12559. function getBorderRadiusData(container) {
  12560. return ["TopLeft", "TopRight", "BottomRight", "BottomLeft"].map(function (side) {
  12561. var value = container.css('border' + side + 'Radius');
  12562. var arr = value.split(" ");
  12563. if (arr.length <= 1) {
  12564. arr[1] = arr[0];
  12565. }
  12566. return arr.map(asInt);
  12567. });
  12568. }
  12569. function renderableNode(node) {
  12570. return node.nodeType === Node.TEXT_NODE || node.nodeType === Node.ELEMENT_NODE;
  12571. }
  12572. function isPositionedForStacking(container) {
  12573. var position = container.css("position");
  12574. var zIndex = ["absolute", "relative", "fixed"].indexOf(position) !== -1 ? container.css("zIndex") : "auto";
  12575. return zIndex !== "auto";
  12576. }
  12577. function isPositioned(container) {
  12578. return container.css("position") !== "static";
  12579. }
  12580. function isFloating(container) {
  12581. return container.css("float") !== "none";
  12582. }
  12583. function isInlineBlock(container) {
  12584. return ["inline-block", "inline-table"].indexOf(container.css("display")) !== -1;
  12585. }
  12586. function not(callback) {
  12587. var context = this;
  12588. return function () {
  12589. return !callback.apply(context, arguments);
  12590. };
  12591. }
  12592. function isElement(container) {
  12593. return container.node.nodeType === Node.ELEMENT_NODE;
  12594. }
  12595. function isPseudoElement(container) {
  12596. return container.isPseudoElement === true;
  12597. }
  12598. function isTextNode(container) {
  12599. return container.node.nodeType === Node.TEXT_NODE;
  12600. }
  12601. function zIndexSort(contexts) {
  12602. return function (a, b) {
  12603. return a.cssInt("zIndex") + contexts.indexOf(a) / contexts.length - (b.cssInt("zIndex") + contexts.indexOf(b) / contexts.length);
  12604. };
  12605. }
  12606. function hasOpacity(container) {
  12607. return container.getOpacity() < 1;
  12608. }
  12609. function asInt(value) {
  12610. return parseInt(value, 10);
  12611. }
  12612. function getWidth(border) {
  12613. return border.width;
  12614. }
  12615. function nonIgnoredElement(nodeContainer) {
  12616. return nodeContainer.node.nodeType !== Node.ELEMENT_NODE || ["SCRIPT", "HEAD", "TITLE", "OBJECT", "BR", "OPTION"].indexOf(nodeContainer.node.nodeName) === -1;
  12617. }
  12618. function flatten(arrays) {
  12619. return [].concat.apply([], arrays);
  12620. }
  12621. function stripQuotes(content) {
  12622. var first = content.substr(0, 1);
  12623. return first === content.substr(content.length - 1) && first.match(/'|"/) ? content.substr(1, content.length - 2) : content;
  12624. }
  12625. function getWords(characters) {
  12626. var words = [],i = 0,onWordBoundary = false,word;
  12627. while (characters.length) {
  12628. if (isWordBoundary(characters[i]) === onWordBoundary) {
  12629. word = characters.splice(0, i);
  12630. if (word.length) {
  12631. words.push(punycode.ucs2.encode(word));
  12632. }
  12633. onWordBoundary = !onWordBoundary;
  12634. i = 0;
  12635. } else {
  12636. i++;
  12637. }
  12638. if (i >= characters.length) {
  12639. word = characters.splice(0, i);
  12640. if (word.length) {
  12641. words.push(punycode.ucs2.encode(word));
  12642. }
  12643. }
  12644. }
  12645. return words;
  12646. }
  12647. function isWordBoundary(characterCode) {
  12648. return [
  12649. 32, // <space>
  12650. 13, // \r
  12651. 10, // \n
  12652. 9, // \t
  12653. 45 // -
  12654. ].indexOf(characterCode) !== -1;
  12655. }
  12656. function hasUnicode(string) {
  12657. return /[^\u0000-\u00ff]/.test(string);
  12658. }
  12659. module.exports = NodeParser;
  12660. }, { "./color": 3, "./fontmetrics": 7, "./log": 13, "./nodecontainer": 14, "./pseudoelementcontainer": 18, "./stackingcontext": 21, "./textcontainer": 25, "./utils": 26, "punycode": 1 }], 16: [function (_dereq_, module, exports) {
  12661. var XHR = _dereq_('./xhr');
  12662. var utils = _dereq_('./utils');
  12663. var log = _dereq_('./log');
  12664. var createWindowClone = _dereq_('./clone');
  12665. var decode64 = utils.decode64;
  12666. function Proxy(src, proxyUrl, document) {
  12667. var supportsCORS = ('withCredentials' in new XMLHttpRequest());
  12668. if (!proxyUrl) {
  12669. return Promise.reject("No proxy configured");
  12670. }
  12671. var callback = createCallback(supportsCORS);
  12672. var url = createProxyUrl(proxyUrl, src, callback);
  12673. return supportsCORS ? XHR(url) : jsonp(document, url, callback).then(function (response) {
  12674. return decode64(response.content);
  12675. });
  12676. }
  12677. var proxyCount = 0;
  12678. function ProxyURL(src, proxyUrl, document) {
  12679. var supportsCORSImage = ('crossOrigin' in new Image());
  12680. var callback = createCallback(supportsCORSImage);
  12681. var url = createProxyUrl(proxyUrl, src, callback);
  12682. return supportsCORSImage ? Promise.resolve(url) : jsonp(document, url, callback).then(function (response) {
  12683. return "data:" + response.type + ";base64," + response.content;
  12684. });
  12685. }
  12686. function jsonp(document, url, callback) {
  12687. return new Promise(function (resolve, reject) {
  12688. var s = document.createElement("script");
  12689. var cleanup = function cleanup() {
  12690. delete window.html2canvas.proxy[callback];
  12691. document.body.removeChild(s);
  12692. };
  12693. window.html2canvas.proxy[callback] = function (response) {
  12694. cleanup();
  12695. resolve(response);
  12696. };
  12697. s.src = url;
  12698. s.onerror = function (e) {
  12699. cleanup();
  12700. reject(e);
  12701. };
  12702. document.body.appendChild(s);
  12703. });
  12704. }
  12705. function createCallback(useCORS) {
  12706. return !useCORS ? "html2canvas_" + Date.now() + "_" + ++proxyCount + "_" + Math.round(Math.random() * 100000) : "";
  12707. }
  12708. function createProxyUrl(proxyUrl, src, callback) {
  12709. return proxyUrl + "?url=" + encodeURIComponent(src) + (callback.length ? "&callback=html2canvas.proxy." + callback : "");
  12710. }
  12711. function documentFromHTML(src) {
  12712. return function (html) {
  12713. var parser = new DOMParser(),doc;
  12714. try {
  12715. doc = parser.parseFromString(html, "text/html");
  12716. } catch (e) {
  12717. log("DOMParser not supported, falling back to createHTMLDocument");
  12718. doc = document.implementation.createHTMLDocument("");
  12719. try {
  12720. doc.open();
  12721. doc.write(html);
  12722. doc.close();
  12723. } catch (ee) {
  12724. log("createHTMLDocument write not supported, falling back to document.body.innerHTML");
  12725. doc.body.innerHTML = html; // ie9 doesnt support writing to documentElement
  12726. }
  12727. }
  12728. var b = doc.querySelector("base");
  12729. if (!b || !b.href.host) {
  12730. var base = doc.createElement("base");
  12731. base.href = src;
  12732. doc.head.insertBefore(base, doc.head.firstChild);
  12733. }
  12734. return doc;
  12735. };
  12736. }
  12737. function loadUrlDocument(src, proxy, document, width, height, options) {
  12738. return new Proxy(src, proxy, window.document).then(documentFromHTML(src)).then(function (doc) {
  12739. return createWindowClone(doc, document, width, height, options, 0, 0);
  12740. });
  12741. }
  12742. exports.Proxy = Proxy;
  12743. exports.ProxyURL = ProxyURL;
  12744. exports.loadUrlDocument = loadUrlDocument;
  12745. }, { "./clone": 2, "./log": 13, "./utils": 26, "./xhr": 28 }], 17: [function (_dereq_, module, exports) {
  12746. var ProxyURL = _dereq_('./proxy').ProxyURL;
  12747. function ProxyImageContainer(src, proxy) {
  12748. var link = document.createElement("a");
  12749. link.href = src;
  12750. src = link.href;
  12751. this.src = src;
  12752. this.image = new Image();
  12753. var self = this;
  12754. this.promise = new Promise(function (resolve, reject) {
  12755. self.image.crossOrigin = "Anonymous";
  12756. self.image.onload = resolve;
  12757. self.image.onerror = reject;
  12758. new ProxyURL(src, proxy, document).then(function (url) {
  12759. self.image.src = url;
  12760. })['catch'](reject);
  12761. });
  12762. }
  12763. module.exports = ProxyImageContainer;
  12764. }, { "./proxy": 16 }], 18: [function (_dereq_, module, exports) {
  12765. var NodeContainer = _dereq_('./nodecontainer');
  12766. function PseudoElementContainer(node, parent, type) {
  12767. NodeContainer.call(this, node, parent);
  12768. this.isPseudoElement = true;
  12769. this.before = type === ":before";
  12770. }
  12771. PseudoElementContainer.prototype.cloneTo = function (stack) {
  12772. PseudoElementContainer.prototype.cloneTo.call(this, stack);
  12773. stack.isPseudoElement = true;
  12774. stack.before = this.before;
  12775. };
  12776. PseudoElementContainer.prototype = Object.create(NodeContainer.prototype);
  12777. PseudoElementContainer.prototype.appendToDOM = function () {
  12778. if (this.before) {
  12779. this.parent.node.insertBefore(this.node, this.parent.node.firstChild);
  12780. } else {
  12781. this.parent.node.appendChild(this.node);
  12782. }
  12783. this.parent.node.className += " " + this.getHideClass();
  12784. };
  12785. PseudoElementContainer.prototype.cleanDOM = function () {
  12786. this.node.parentNode.removeChild(this.node);
  12787. this.parent.node.className = this.parent.node.className.replace(this.getHideClass(), "");
  12788. };
  12789. PseudoElementContainer.prototype.getHideClass = function () {
  12790. return this["PSEUDO_HIDE_ELEMENT_CLASS_" + (this.before ? "BEFORE" : "AFTER")];
  12791. };
  12792. PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before";
  12793. PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after";
  12794. module.exports = PseudoElementContainer;
  12795. }, { "./nodecontainer": 14 }], 19: [function (_dereq_, module, exports) {
  12796. var log = _dereq_('./log');
  12797. function Renderer(width, height, images, options, document) {
  12798. this.width = width;
  12799. this.height = height;
  12800. this.images = images;
  12801. this.options = options;
  12802. this.document = document;
  12803. }
  12804. Renderer.prototype.renderImage = function (container, bounds, borderData, imageContainer) {
  12805. var paddingLeft = container.cssInt('paddingLeft'),
  12806. paddingTop = container.cssInt('paddingTop'),
  12807. paddingRight = container.cssInt('paddingRight'),
  12808. paddingBottom = container.cssInt('paddingBottom'),
  12809. borders = borderData.borders;
  12810. var width = bounds.width - (borders[1].width + borders[3].width + paddingLeft + paddingRight);
  12811. var height = bounds.height - (borders[0].width + borders[2].width + paddingTop + paddingBottom);
  12812. this.drawImage(
  12813. imageContainer,
  12814. 0,
  12815. 0,
  12816. imageContainer.image.width || width,
  12817. imageContainer.image.height || height,
  12818. bounds.left + paddingLeft + borders[3].width,
  12819. bounds.top + paddingTop + borders[0].width,
  12820. width,
  12821. height);
  12822. };
  12823. Renderer.prototype.renderBackground = function (container, bounds, borderData) {
  12824. if (bounds.height > 0 && bounds.width > 0) {
  12825. this.renderBackgroundColor(container, bounds);
  12826. this.renderBackgroundImage(container, bounds, borderData);
  12827. }
  12828. };
  12829. Renderer.prototype.renderBackgroundColor = function (container, bounds) {
  12830. var color = container.color("backgroundColor");
  12831. if (!color.isTransparent()) {
  12832. this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, color);
  12833. }
  12834. };
  12835. Renderer.prototype.renderBorders = function (borders) {
  12836. borders.forEach(this.renderBorder, this);
  12837. };
  12838. Renderer.prototype.renderBorder = function (data) {
  12839. if (!data.color.isTransparent() && data.args !== null) {
  12840. this.drawShape(data.args, data.color);
  12841. }
  12842. };
  12843. Renderer.prototype.renderBackgroundImage = function (container, bounds, borderData) {
  12844. var backgroundImages = container.parseBackgroundImages();
  12845. backgroundImages.reverse().forEach(function (backgroundImage, index, arr) {
  12846. switch (backgroundImage.method) {
  12847. case "url":
  12848. var image = this.images.get(backgroundImage.args[0]);
  12849. if (image) {
  12850. this.renderBackgroundRepeating(container, bounds, image, arr.length - (index + 1), borderData);
  12851. } else {
  12852. log("Error loading background-image", backgroundImage.args[0]);
  12853. }
  12854. break;
  12855. case "linear-gradient":
  12856. case "gradient":
  12857. var gradientImage = this.images.get(backgroundImage.value);
  12858. if (gradientImage) {
  12859. this.renderBackgroundGradient(gradientImage, bounds, borderData);
  12860. } else {
  12861. log("Error loading background-image", backgroundImage.args[0]);
  12862. }
  12863. break;
  12864. case "none":
  12865. break;
  12866. default:
  12867. log("Unknown background-image type", backgroundImage.args[0]);}
  12868. }, this);
  12869. };
  12870. Renderer.prototype.renderBackgroundRepeating = function (container, bounds, imageContainer, index, borderData) {
  12871. var size = container.parseBackgroundSize(bounds, imageContainer.image, index);
  12872. var position = container.parseBackgroundPosition(bounds, imageContainer.image, index, size);
  12873. var repeat = container.parseBackgroundRepeat(index);
  12874. switch (repeat) {
  12875. case "repeat-x":
  12876. case "repeat no-repeat":
  12877. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + borderData[3], bounds.top + position.top + borderData[0], 99999, size.height, borderData);
  12878. break;
  12879. case "repeat-y":
  12880. case "no-repeat repeat":
  12881. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + borderData[0], size.width, 99999, borderData);
  12882. break;
  12883. case "no-repeat":
  12884. this.backgroundRepeatShape(imageContainer, position, size, bounds, bounds.left + position.left + borderData[3], bounds.top + position.top + borderData[0], size.width, size.height, borderData);
  12885. break;
  12886. default:
  12887. this.renderBackgroundRepeat(imageContainer, position, size, { top: bounds.top, left: bounds.left }, borderData[3], borderData[0]);
  12888. break;}
  12889. };
  12890. module.exports = Renderer;
  12891. }, { "./log": 13 }], 20: [function (_dereq_, module, exports) {
  12892. var Renderer = _dereq_('../renderer');
  12893. var LinearGradientContainer = _dereq_('../lineargradientcontainer');
  12894. var log = _dereq_('../log');
  12895. function CanvasRenderer(width, height) {
  12896. Renderer.apply(this, arguments);
  12897. this.canvas = this.options.canvas || this.document.createElement("canvas");
  12898. if (!this.options.canvas) {
  12899. this.canvas.width = width;
  12900. this.canvas.height = height;
  12901. }
  12902. this.ctx = this.canvas.getContext("2d");
  12903. this.taintCtx = this.document.createElement("canvas").getContext("2d");
  12904. this.ctx.textBaseline = "bottom";
  12905. this.variables = {};
  12906. log("Initialized CanvasRenderer with size", width, "x", height);
  12907. }
  12908. CanvasRenderer.prototype = Object.create(Renderer.prototype);
  12909. CanvasRenderer.prototype.setFillStyle = function (fillStyle) {
  12910. this.ctx.fillStyle = typeof fillStyle === "object" && !!fillStyle.isColor ? fillStyle.toString() : fillStyle;
  12911. return this.ctx;
  12912. };
  12913. CanvasRenderer.prototype.rectangle = function (left, top, width, height, color) {
  12914. this.setFillStyle(color).fillRect(left, top, width, height);
  12915. };
  12916. CanvasRenderer.prototype.circle = function (left, top, size, color) {
  12917. this.setFillStyle(color);
  12918. this.ctx.beginPath();
  12919. this.ctx.arc(left + size / 2, top + size / 2, size / 2, 0, Math.PI * 2, true);
  12920. this.ctx.closePath();
  12921. this.ctx.fill();
  12922. };
  12923. CanvasRenderer.prototype.circleStroke = function (left, top, size, color, stroke, strokeColor) {
  12924. this.circle(left, top, size, color);
  12925. this.ctx.strokeStyle = strokeColor.toString();
  12926. this.ctx.stroke();
  12927. };
  12928. CanvasRenderer.prototype.drawShape = function (shape, color) {
  12929. this.shape(shape);
  12930. this.setFillStyle(color).fill();
  12931. };
  12932. CanvasRenderer.prototype.taints = function (imageContainer) {
  12933. if (imageContainer.tainted === null) {
  12934. this.taintCtx.drawImage(imageContainer.image, 0, 0);
  12935. try {
  12936. this.taintCtx.getImageData(0, 0, 1, 1);
  12937. imageContainer.tainted = false;
  12938. } catch (e) {
  12939. this.taintCtx = document.createElement("canvas").getContext("2d");
  12940. imageContainer.tainted = true;
  12941. }
  12942. }
  12943. return imageContainer.tainted;
  12944. };
  12945. CanvasRenderer.prototype.drawImage = function (imageContainer, sx, sy, sw, sh, dx, dy, dw, dh) {
  12946. if (!this.taints(imageContainer) || this.options.allowTaint) {
  12947. this.ctx.drawImage(imageContainer.image, sx, sy, sw, sh, dx, dy, dw, dh);
  12948. }
  12949. };
  12950. CanvasRenderer.prototype.clip = function (shapes, callback, context) {
  12951. this.ctx.save();
  12952. shapes.filter(hasEntries).forEach(function (shape) {
  12953. this.shape(shape).clip();
  12954. }, this);
  12955. callback.call(context);
  12956. this.ctx.restore();
  12957. };
  12958. CanvasRenderer.prototype.shape = function (shape) {
  12959. this.ctx.beginPath();
  12960. shape.forEach(function (point, index) {
  12961. if (point[0] === "rect") {
  12962. this.ctx.rect.apply(this.ctx, point.slice(1));
  12963. } else {
  12964. this.ctx[index === 0 ? "moveTo" : point[0] + "To"].apply(this.ctx, point.slice(1));
  12965. }
  12966. }, this);
  12967. this.ctx.closePath();
  12968. return this.ctx;
  12969. };
  12970. CanvasRenderer.prototype.font = function (color, style, variant, weight, size, family) {
  12971. this.setFillStyle(color).font = [style, variant, weight, size, family].join(" ").split(",")[0];
  12972. };
  12973. CanvasRenderer.prototype.fontShadow = function (color, offsetX, offsetY, blur) {
  12974. this.setVariable("shadowColor", color.toString()).
  12975. setVariable("shadowOffsetY", offsetX).
  12976. setVariable("shadowOffsetX", offsetY).
  12977. setVariable("shadowBlur", blur);
  12978. };
  12979. CanvasRenderer.prototype.clearShadow = function () {
  12980. this.setVariable("shadowColor", "rgba(0,0,0,0)");
  12981. };
  12982. CanvasRenderer.prototype.setOpacity = function (opacity) {
  12983. this.ctx.globalAlpha = opacity;
  12984. };
  12985. CanvasRenderer.prototype.setTransform = function (transform) {
  12986. this.ctx.translate(transform.origin[0], transform.origin[1]);
  12987. this.ctx.transform.apply(this.ctx, transform.matrix);
  12988. this.ctx.translate(-transform.origin[0], -transform.origin[1]);
  12989. };
  12990. CanvasRenderer.prototype.setVariable = function (property, value) {
  12991. if (this.variables[property] !== value) {
  12992. this.variables[property] = this.ctx[property] = value;
  12993. }
  12994. return this;
  12995. };
  12996. CanvasRenderer.prototype.text = function (text, left, bottom) {
  12997. this.ctx.fillText(text, left, bottom);
  12998. };
  12999. CanvasRenderer.prototype.backgroundRepeatShape = function (imageContainer, backgroundPosition, size, bounds, left, top, width, height, borderData) {
  13000. var shape = [
  13001. ["line", Math.round(left), Math.round(top)],
  13002. ["line", Math.round(left + width), Math.round(top)],
  13003. ["line", Math.round(left + width), Math.round(height + top)],
  13004. ["line", Math.round(left), Math.round(height + top)]];
  13005. this.clip([shape], function () {
  13006. this.renderBackgroundRepeat(imageContainer, backgroundPosition, size, bounds, borderData[3], borderData[0]);
  13007. }, this);
  13008. };
  13009. CanvasRenderer.prototype.renderBackgroundRepeat = function (imageContainer, backgroundPosition, size, bounds, borderLeft, borderTop) {
  13010. var offsetX = Math.round(bounds.left + backgroundPosition.left + borderLeft),offsetY = Math.round(bounds.top + backgroundPosition.top + borderTop);
  13011. this.setFillStyle(this.ctx.createPattern(this.resizeImage(imageContainer, size), "repeat"));
  13012. this.ctx.translate(offsetX, offsetY);
  13013. this.ctx.fill();
  13014. this.ctx.translate(-offsetX, -offsetY);
  13015. };
  13016. CanvasRenderer.prototype.renderBackgroundGradient = function (gradientImage, bounds) {
  13017. if (gradientImage instanceof LinearGradientContainer) {
  13018. var gradient = this.ctx.createLinearGradient(
  13019. bounds.left + bounds.width * gradientImage.x0,
  13020. bounds.top + bounds.height * gradientImage.y0,
  13021. bounds.left + bounds.width * gradientImage.x1,
  13022. bounds.top + bounds.height * gradientImage.y1);
  13023. gradientImage.colorStops.forEach(function (colorStop) {
  13024. gradient.addColorStop(colorStop.stop, colorStop.color.toString());
  13025. });
  13026. this.rectangle(bounds.left, bounds.top, bounds.width, bounds.height, gradient);
  13027. }
  13028. };
  13029. CanvasRenderer.prototype.resizeImage = function (imageContainer, size) {
  13030. var image = imageContainer.image;
  13031. if (image.width === size.width && image.height === size.height) {
  13032. return image;
  13033. }
  13034. var ctx,canvas = document.createElement('canvas');
  13035. canvas.width = size.width;
  13036. canvas.height = size.height;
  13037. ctx = canvas.getContext("2d");
  13038. ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height);
  13039. return canvas;
  13040. };
  13041. function hasEntries(array) {
  13042. return array.length > 0;
  13043. }
  13044. module.exports = CanvasRenderer;
  13045. }, { "../lineargradientcontainer": 12, "../log": 13, "../renderer": 19 }], 21: [function (_dereq_, module, exports) {
  13046. var NodeContainer = _dereq_('./nodecontainer');
  13047. function StackingContext(hasOwnStacking, opacity, element, parent) {
  13048. NodeContainer.call(this, element, parent);
  13049. this.ownStacking = hasOwnStacking;
  13050. this.contexts = [];
  13051. this.children = [];
  13052. this.opacity = (this.parent ? this.parent.stack.opacity : 1) * opacity;
  13053. }
  13054. StackingContext.prototype = Object.create(NodeContainer.prototype);
  13055. StackingContext.prototype.getParentStack = function (context) {
  13056. var parentStack = this.parent ? this.parent.stack : null;
  13057. return parentStack ? parentStack.ownStacking ? parentStack : parentStack.getParentStack(context) : context.stack;
  13058. };
  13059. module.exports = StackingContext;
  13060. }, { "./nodecontainer": 14 }], 22: [function (_dereq_, module, exports) {
  13061. function Support(document) {
  13062. this.rangeBounds = this.testRangeBounds(document);
  13063. this.cors = this.testCORS();
  13064. this.svg = this.testSVG();
  13065. }
  13066. Support.prototype.testRangeBounds = function (document) {
  13067. var range,testElement,rangeBounds,rangeHeight,support = false;
  13068. if (document.createRange) {
  13069. range = document.createRange();
  13070. if (range.getBoundingClientRect) {
  13071. testElement = document.createElement('boundtest');
  13072. testElement.style.height = "123px";
  13073. testElement.style.display = "block";
  13074. document.body.appendChild(testElement);
  13075. range.selectNode(testElement);
  13076. rangeBounds = range.getBoundingClientRect();
  13077. rangeHeight = rangeBounds.height;
  13078. if (rangeHeight === 123) {
  13079. support = true;
  13080. }
  13081. document.body.removeChild(testElement);
  13082. }
  13083. }
  13084. return support;
  13085. };
  13086. Support.prototype.testCORS = function () {
  13087. return typeof new Image().crossOrigin !== "undefined";
  13088. };
  13089. Support.prototype.testSVG = function () {
  13090. var img = new Image();
  13091. var canvas = document.createElement("canvas");
  13092. var ctx = canvas.getContext("2d");
  13093. img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  13094. try {
  13095. ctx.drawImage(img, 0, 0);
  13096. canvas.toDataURL();
  13097. } catch (e) {
  13098. return false;
  13099. }
  13100. return true;
  13101. };
  13102. module.exports = Support;
  13103. }, {}], 23: [function (_dereq_, module, exports) {
  13104. var XHR = _dereq_('./xhr');
  13105. var decode64 = _dereq_('./utils').decode64;
  13106. function SVGContainer(src) {
  13107. this.src = src;
  13108. this.image = null;
  13109. var self = this;
  13110. this.promise = this.hasFabric().then(function () {
  13111. return self.isInline(src) ? Promise.resolve(self.inlineFormatting(src)) : XHR(src);
  13112. }).then(function (svg) {
  13113. return new Promise(function (resolve) {
  13114. window.html2canvas.svg.fabric.loadSVGFromString(svg, self.createCanvas.call(self, resolve));
  13115. });
  13116. });
  13117. }
  13118. SVGContainer.prototype.hasFabric = function () {
  13119. return !window.html2canvas.svg || !window.html2canvas.svg.fabric ? Promise.reject(new Error("html2canvas.svg.js is not loaded, cannot render svg")) : Promise.resolve();
  13120. };
  13121. SVGContainer.prototype.inlineFormatting = function (src) {
  13122. return /^data:image\/svg\+xml;base64,/.test(src) ? this.decode64(this.removeContentType(src)) : this.removeContentType(src);
  13123. };
  13124. SVGContainer.prototype.removeContentType = function (src) {
  13125. return src.replace(/^data:image\/svg\+xml(;base64)?,/, '');
  13126. };
  13127. SVGContainer.prototype.isInline = function (src) {
  13128. return /^data:image\/svg\+xml/i.test(src);
  13129. };
  13130. SVGContainer.prototype.createCanvas = function (resolve) {
  13131. var self = this;
  13132. return function (objects, options) {
  13133. var canvas = new window.html2canvas.svg.fabric.StaticCanvas('c');
  13134. self.image = canvas.lowerCanvasEl;
  13135. canvas.
  13136. setWidth(options.width).
  13137. setHeight(options.height).
  13138. add(window.html2canvas.svg.fabric.util.groupSVGElements(objects, options)).
  13139. renderAll();
  13140. resolve(canvas.lowerCanvasEl);
  13141. };
  13142. };
  13143. SVGContainer.prototype.decode64 = function (str) {
  13144. return typeof window.atob === "function" ? window.atob(str) : decode64(str);
  13145. };
  13146. module.exports = SVGContainer;
  13147. }, { "./utils": 26, "./xhr": 28 }], 24: [function (_dereq_, module, exports) {
  13148. var SVGContainer = _dereq_('./svgcontainer');
  13149. function SVGNodeContainer(node, _native) {
  13150. this.src = node;
  13151. this.image = null;
  13152. var self = this;
  13153. this.promise = _native ? new Promise(function (resolve, reject) {
  13154. self.image = new Image();
  13155. self.image.onload = resolve;
  13156. self.image.onerror = reject;
  13157. self.image.src = "data:image/svg+xml," + new XMLSerializer().serializeToString(node);
  13158. if (self.image.complete === true) {
  13159. resolve(self.image);
  13160. }
  13161. }) : this.hasFabric().then(function () {
  13162. return new Promise(function (resolve) {
  13163. window.html2canvas.svg.fabric.parseSVGDocument(node, self.createCanvas.call(self, resolve));
  13164. });
  13165. });
  13166. }
  13167. SVGNodeContainer.prototype = Object.create(SVGContainer.prototype);
  13168. module.exports = SVGNodeContainer;
  13169. }, { "./svgcontainer": 23 }], 25: [function (_dereq_, module, exports) {
  13170. var NodeContainer = _dereq_('./nodecontainer');
  13171. function TextContainer(node, parent) {
  13172. NodeContainer.call(this, node, parent);
  13173. }
  13174. TextContainer.prototype = Object.create(NodeContainer.prototype);
  13175. TextContainer.prototype.applyTextTransform = function () {
  13176. this.node.data = this.transform(this.parent.css("textTransform"));
  13177. };
  13178. TextContainer.prototype.transform = function (transform) {
  13179. var text = this.node.data;
  13180. switch (transform) {
  13181. case "lowercase":
  13182. return text.toLowerCase();
  13183. case "capitalize":
  13184. return text.replace(/(^|\s|:|-|\(|\))([a-z])/g, capitalize);
  13185. case "uppercase":
  13186. return text.toUpperCase();
  13187. default:
  13188. return text;}
  13189. };
  13190. function capitalize(m, p1, p2) {
  13191. if (m.length > 0) {
  13192. return p1 + p2.toUpperCase();
  13193. }
  13194. }
  13195. module.exports = TextContainer;
  13196. }, { "./nodecontainer": 14 }], 26: [function (_dereq_, module, exports) {
  13197. exports.smallImage = function smallImage() {
  13198. return "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  13199. };
  13200. exports.bind = function (callback, context) {
  13201. return function () {
  13202. return callback.apply(context, arguments);
  13203. };
  13204. };
  13205. /*
  13206. * base64-arraybuffer
  13207. * https://github.com/niklasvh/base64-arraybuffer
  13208. *
  13209. * Copyright (c) 2012 Niklas von Hertzen
  13210. * Licensed under the MIT license.
  13211. */
  13212. exports.decode64 = function (base64) {
  13213. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  13214. var len = base64.length,i,encoded1,encoded2,encoded3,encoded4,byte1,byte2,byte3;
  13215. var output = "";
  13216. for (i = 0; i < len; i += 4) {
  13217. encoded1 = chars.indexOf(base64[i]);
  13218. encoded2 = chars.indexOf(base64[i + 1]);
  13219. encoded3 = chars.indexOf(base64[i + 2]);
  13220. encoded4 = chars.indexOf(base64[i + 3]);
  13221. byte1 = encoded1 << 2 | encoded2 >> 4;
  13222. byte2 = (encoded2 & 15) << 4 | encoded3 >> 2;
  13223. byte3 = (encoded3 & 3) << 6 | encoded4;
  13224. if (encoded3 === 64) {
  13225. output += String.fromCharCode(byte1);
  13226. } else if (encoded4 === 64 || encoded4 === -1) {
  13227. output += String.fromCharCode(byte1, byte2);
  13228. } else {
  13229. output += String.fromCharCode(byte1, byte2, byte3);
  13230. }
  13231. }
  13232. return output;
  13233. };
  13234. exports.getBounds = function (node) {
  13235. if (node.getBoundingClientRect) {
  13236. var clientRect = node.getBoundingClientRect();
  13237. var width = node.offsetWidth == null ? clientRect.width : node.offsetWidth;
  13238. return {
  13239. top: clientRect.top,
  13240. bottom: clientRect.bottom || clientRect.top + clientRect.height,
  13241. right: clientRect.left + width,
  13242. left: clientRect.left,
  13243. width: width,
  13244. height: node.offsetHeight == null ? clientRect.height : node.offsetHeight };
  13245. }
  13246. return {};
  13247. };
  13248. exports.offsetBounds = function (node) {
  13249. var parent = node.offsetParent ? exports.offsetBounds(node.offsetParent) : { top: 0, left: 0 };
  13250. return {
  13251. top: node.offsetTop + parent.top,
  13252. bottom: node.offsetTop + node.offsetHeight + parent.top,
  13253. right: node.offsetLeft + parent.left + node.offsetWidth,
  13254. left: node.offsetLeft + parent.left,
  13255. width: node.offsetWidth,
  13256. height: node.offsetHeight };
  13257. };
  13258. exports.parseBackgrounds = function (backgroundImage) {
  13259. var whitespace = ' \r\n\t',
  13260. method,definition,prefix,prefix_i,block,results = [],
  13261. mode = 0,numParen = 0,quote,args;
  13262. var appendResult = function appendResult() {
  13263. if (method) {
  13264. if (definition.substr(0, 1) === '"') {
  13265. definition = definition.substr(1, definition.length - 2);
  13266. }
  13267. if (definition) {
  13268. args.push(definition);
  13269. }
  13270. if (method.substr(0, 1) === '-' && (prefix_i = method.indexOf('-', 1) + 1) > 0) {
  13271. prefix = method.substr(0, prefix_i);
  13272. method = method.substr(prefix_i);
  13273. }
  13274. results.push({
  13275. prefix: prefix,
  13276. method: method.toLowerCase(),
  13277. value: block,
  13278. args: args,
  13279. image: null });
  13280. }
  13281. args = [];
  13282. method = prefix = definition = block = '';
  13283. };
  13284. args = [];
  13285. method = prefix = definition = block = '';
  13286. backgroundImage.split("").forEach(function (c) {
  13287. if (mode === 0 && whitespace.indexOf(c) > -1) {
  13288. return;
  13289. }
  13290. switch (c) {
  13291. case '"':
  13292. if (!quote) {
  13293. quote = c;
  13294. } else if (quote === c) {
  13295. quote = null;
  13296. }
  13297. break;
  13298. case '(':
  13299. if (quote) {
  13300. break;
  13301. } else if (mode === 0) {
  13302. mode = 1;
  13303. block += c;
  13304. return;
  13305. } else {
  13306. numParen++;
  13307. }
  13308. break;
  13309. case ')':
  13310. if (quote) {
  13311. break;
  13312. } else if (mode === 1) {
  13313. if (numParen === 0) {
  13314. mode = 0;
  13315. block += c;
  13316. appendResult();
  13317. return;
  13318. } else {
  13319. numParen--;
  13320. }
  13321. }
  13322. break;
  13323. case ',':
  13324. if (quote) {
  13325. break;
  13326. } else if (mode === 0) {
  13327. appendResult();
  13328. return;
  13329. } else if (mode === 1) {
  13330. if (numParen === 0 && !method.match(/^url$/i)) {
  13331. args.push(definition);
  13332. definition = '';
  13333. block += c;
  13334. return;
  13335. }
  13336. }
  13337. break;}
  13338. block += c;
  13339. if (mode === 0) {
  13340. method += c;
  13341. } else {
  13342. definition += c;
  13343. }
  13344. });
  13345. appendResult();
  13346. return results;
  13347. };
  13348. }, {}], 27: [function (_dereq_, module, exports) {
  13349. var GradientContainer = _dereq_('./gradientcontainer');
  13350. function WebkitGradientContainer(imageData) {
  13351. GradientContainer.apply(this, arguments);
  13352. this.type = imageData.args[0] === "linear" ? GradientContainer.TYPES.LINEAR : GradientContainer.TYPES.RADIAL;
  13353. }
  13354. WebkitGradientContainer.prototype = Object.create(GradientContainer.prototype);
  13355. module.exports = WebkitGradientContainer;
  13356. }, { "./gradientcontainer": 9 }], 28: [function (_dereq_, module, exports) {
  13357. function XHR(url) {
  13358. return new Promise(function (resolve, reject) {
  13359. var xhr = new XMLHttpRequest();
  13360. xhr.open('GET', url);
  13361. xhr.onload = function () {
  13362. if (xhr.status === 200) {
  13363. resolve(xhr.responseText);
  13364. } else {
  13365. reject(new Error(xhr.statusText));
  13366. }
  13367. };
  13368. xhr.onerror = function () {
  13369. reject(new Error("Network Error"));
  13370. };
  13371. xhr.send();
  13372. });
  13373. }
  13374. module.exports = XHR;
  13375. }, {}] }, {}, [4])(4);
  13376. });
  13377. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/webpack/buildin/global.js */ 3)))
  13378. /***/ }),
  13379. /***/ 62:
  13380. /*!**************************************************************!*\
  13381. !*** /Users/mead/Code/vue/epidemic-h5/static/html2canvas.js ***!
  13382. \**************************************************************/
  13383. /*! no static exports found */
  13384. /***/ (function(module, exports, __webpack_require__) {
  13385. /*!
  13386. * html2canvas 1.0.0-rc.7 <https://html2canvas.hertzen.com>
  13387. * Copyright (c) 2020 Niklas von Hertzen <https://hertzen.com>
  13388. * Released under MIT License
  13389. */
  13390. (function (global, factory) {
  13391. true ? module.exports = factory() :
  13392. undefined;
  13393. })(this, function () {'use strict';
  13394. /*! *****************************************************************************
  13395. Copyright (c) Microsoft Corporation. All rights reserved.
  13396. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  13397. this file except in compliance with the License. You may obtain a copy of the
  13398. License at http://www.apache.org/licenses/LICENSE-2.0
  13399. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13400. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  13401. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  13402. MERCHANTABLITY OR NON-INFRINGEMENT.
  13403. See the Apache Version 2.0 License for specific language governing permissions
  13404. and limitations under the License.
  13405. ***************************************************************************** */
  13406. /* global Reflect, Promise */
  13407. var _extendStatics = function extendStatics(d, b) {
  13408. _extendStatics = Object.setPrototypeOf ||
  13409. { __proto__: [] } instanceof Array && function (d, b) {d.__proto__ = b;} ||
  13410. function (d, b) {for (var p in b) {if (b.hasOwnProperty(p)) d[p] = b[p];}};
  13411. return _extendStatics(d, b);
  13412. };
  13413. function __extends(d, b) {
  13414. _extendStatics(d, b);
  13415. function __() {this.constructor = d;}
  13416. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13417. }
  13418. var _assign = function __assign() {
  13419. _assign = Object.assign || function __assign(t) {
  13420. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13421. s = arguments[i];
  13422. for (var p in s) {if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];}
  13423. }
  13424. return t;
  13425. };
  13426. return _assign.apply(this, arguments);
  13427. };
  13428. function __awaiter(thisArg, _arguments, P, generator) {
  13429. return new (P || (P = Promise))(function (resolve, reject) {
  13430. function fulfilled(value) {try {step(generator.next(value));} catch (e) {reject(e);}}
  13431. function rejected(value) {try {step(generator["throw"](value));} catch (e) {reject(e);}}
  13432. function step(result) {result.done ? resolve(result.value) : new P(function (resolve) {resolve(result.value);}).then(fulfilled, rejected);}
  13433. step((generator = generator.apply(thisArg, _arguments || [])).next());
  13434. });
  13435. }
  13436. function __generator(thisArg, body) {
  13437. var _ = { label: 0, sent: function sent() {if (t[0] & 1) throw t[1];return t[1];}, trys: [], ops: [] },f,y,t,g;
  13438. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {return this;}), g;
  13439. function verb(n) {return function (v) {return step([n, v]);};}
  13440. function step(op) {
  13441. if (f) throw new TypeError("Generator is already executing.");
  13442. while (_) {try {
  13443. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  13444. if (y = 0, t) op = [op[0] & 2, t.value];
  13445. switch (op[0]) {
  13446. case 0:case 1:t = op;break;
  13447. case 4:_.label++;return { value: op[1], done: false };
  13448. case 5:_.label++;y = op[1];op = [0];continue;
  13449. case 7:op = _.ops.pop();_.trys.pop();continue;
  13450. default:
  13451. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {_ = 0;continue;}
  13452. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {_.label = op[1];break;}
  13453. if (op[0] === 6 && _.label < t[1]) {_.label = t[1];t = op;break;}
  13454. if (t && _.label < t[2]) {_.label = t[2];_.ops.push(op);break;}
  13455. if (t[2]) _.ops.pop();
  13456. _.trys.pop();continue;}
  13457. op = body.call(thisArg, _);
  13458. } catch (e) {op = [6, e];y = 0;} finally {f = t = 0;}}
  13459. if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true };
  13460. }
  13461. }
  13462. var Bounds = /** @class */function () {
  13463. function Bounds(x, y, w, h) {
  13464. this.left = x;
  13465. this.top = y;
  13466. this.width = w;
  13467. this.height = h;
  13468. }
  13469. Bounds.prototype.add = function (x, y, w, h) {
  13470. return new Bounds(this.left + x, this.top + y, this.width + w, this.height + h);
  13471. };
  13472. Bounds.fromClientRect = function (clientRect) {
  13473. return new Bounds(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
  13474. };
  13475. return Bounds;
  13476. }();
  13477. var parseBounds = function parseBounds(node) {
  13478. return Bounds.fromClientRect(node.getBoundingClientRect());
  13479. };
  13480. var parseDocumentSize = function parseDocumentSize(document) {
  13481. var body = document.body;
  13482. var documentElement = document.documentElement;
  13483. if (!body || !documentElement) {
  13484. throw new Error("Unable to get document size");
  13485. }
  13486. var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
  13487. var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
  13488. return new Bounds(0, 0, width, height);
  13489. };
  13490. /*
  13491. * css-line-break 1.1.1 <https://github.com/niklasvh/css-line-break#readme>
  13492. * Copyright (c) 2019 Niklas von Hertzen <https://hertzen.com>
  13493. * Released under MIT License
  13494. */
  13495. var toCodePoints = function toCodePoints(str) {
  13496. var codePoints = [];
  13497. var i = 0;
  13498. var length = str.length;
  13499. while (i < length) {
  13500. var value = str.charCodeAt(i++);
  13501. if (value >= 0xd800 && value <= 0xdbff && i < length) {
  13502. var extra = str.charCodeAt(i++);
  13503. if ((extra & 0xfc00) === 0xdc00) {
  13504. codePoints.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000);
  13505. } else
  13506. {
  13507. codePoints.push(value);
  13508. i--;
  13509. }
  13510. } else
  13511. {
  13512. codePoints.push(value);
  13513. }
  13514. }
  13515. return codePoints;
  13516. };
  13517. var fromCodePoint = function fromCodePoint() {
  13518. var codePoints = [];
  13519. for (var _i = 0; _i < arguments.length; _i++) {
  13520. codePoints[_i] = arguments[_i];
  13521. }
  13522. if (String.fromCodePoint) {
  13523. return String.fromCodePoint.apply(String, codePoints);
  13524. }
  13525. var length = codePoints.length;
  13526. if (!length) {
  13527. return '';
  13528. }
  13529. var codeUnits = [];
  13530. var index = -1;
  13531. var result = '';
  13532. while (++index < length) {
  13533. var codePoint = codePoints[index];
  13534. if (codePoint <= 0xffff) {
  13535. codeUnits.push(codePoint);
  13536. } else
  13537. {
  13538. codePoint -= 0x10000;
  13539. codeUnits.push((codePoint >> 10) + 0xd800, codePoint % 0x400 + 0xdc00);
  13540. }
  13541. if (index + 1 === length || codeUnits.length > 0x4000) {
  13542. result += String.fromCharCode.apply(String, codeUnits);
  13543. codeUnits.length = 0;
  13544. }
  13545. }
  13546. return result;
  13547. };
  13548. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  13549. // Use a lookup table to find the index.
  13550. var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
  13551. for (var i = 0; i < chars.length; i++) {
  13552. lookup[chars.charCodeAt(i)] = i;
  13553. }
  13554. var decode = function decode(base64) {
  13555. var bufferLength = base64.length * 0.75,len = base64.length,i,p = 0,encoded1,encoded2,encoded3,encoded4;
  13556. if (base64[base64.length - 1] === '=') {
  13557. bufferLength--;
  13558. if (base64[base64.length - 2] === '=') {
  13559. bufferLength--;
  13560. }
  13561. }
  13562. var buffer = typeof ArrayBuffer !== 'undefined' &&
  13563. typeof Uint8Array !== 'undefined' &&
  13564. typeof Uint8Array.prototype.slice !== 'undefined' ?
  13565. new ArrayBuffer(bufferLength) :
  13566. new Array(bufferLength);
  13567. var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
  13568. for (i = 0; i < len; i += 4) {
  13569. encoded1 = lookup[base64.charCodeAt(i)];
  13570. encoded2 = lookup[base64.charCodeAt(i + 1)];
  13571. encoded3 = lookup[base64.charCodeAt(i + 2)];
  13572. encoded4 = lookup[base64.charCodeAt(i + 3)];
  13573. bytes[p++] = encoded1 << 2 | encoded2 >> 4;
  13574. bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
  13575. bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
  13576. }
  13577. return buffer;
  13578. };
  13579. var polyUint16Array = function polyUint16Array(buffer) {
  13580. var length = buffer.length;
  13581. var bytes = [];
  13582. for (var i = 0; i < length; i += 2) {
  13583. bytes.push(buffer[i + 1] << 8 | buffer[i]);
  13584. }
  13585. return bytes;
  13586. };
  13587. var polyUint32Array = function polyUint32Array(buffer) {
  13588. var length = buffer.length;
  13589. var bytes = [];
  13590. for (var i = 0; i < length; i += 4) {
  13591. bytes.push(buffer[i + 3] << 24 | buffer[i + 2] << 16 | buffer[i + 1] << 8 | buffer[i]);
  13592. }
  13593. return bytes;
  13594. };
  13595. /** Shift size for getting the index-2 table offset. */
  13596. var UTRIE2_SHIFT_2 = 5;
  13597. /** Shift size for getting the index-1 table offset. */
  13598. var UTRIE2_SHIFT_1 = 6 + 5;
  13599. /**
  13600. * Shift size for shifting left the index array values.
  13601. * Increases possible data size with 16-bit index values at the cost
  13602. * of compactability.
  13603. * This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
  13604. */
  13605. var UTRIE2_INDEX_SHIFT = 2;
  13606. /**
  13607. * Difference between the two shift sizes,
  13608. * for getting an index-1 offset from an index-2 offset. 6=11-5
  13609. */
  13610. var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2;
  13611. /**
  13612. * The part of the index-2 table for U+D800..U+DBFF stores values for
  13613. * lead surrogate code _units_ not code _points_.
  13614. * Values for lead surrogate code _points_ are indexed with this portion of the table.
  13615. * Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
  13616. */
  13617. var UTRIE2_LSCP_INDEX_2_OFFSET = 0x10000 >> UTRIE2_SHIFT_2;
  13618. /** Number of entries in a data block. 32=0x20 */
  13619. var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2;
  13620. /** Mask for getting the lower bits for the in-data-block offset. */
  13621. var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1;
  13622. var UTRIE2_LSCP_INDEX_2_LENGTH = 0x400 >> UTRIE2_SHIFT_2;
  13623. /** Count the lengths of both BMP pieces. 2080=0x820 */
  13624. var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH;
  13625. /**
  13626. * The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
  13627. * Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
  13628. */
  13629. var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH;
  13630. var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 0x800 >> 6; /* U+0800 is the first code point after 2-byte UTF-8 */
  13631. /**
  13632. * The index-1 table, only used for supplementary code points, at offset 2112=0x840.
  13633. * Variable length, for code points up to highStart, where the last single-value range starts.
  13634. * Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
  13635. * (For 0x100000 supplementary code points U+10000..U+10ffff.)
  13636. *
  13637. * The part of the index-2 table for supplementary code points starts
  13638. * after this index-1 table.
  13639. *
  13640. * Both the index-1 table and the following part of the index-2 table
  13641. * are omitted completely if there is only BMP data.
  13642. */
  13643. var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH;
  13644. /**
  13645. * Number of index-1 entries for the BMP. 32=0x20
  13646. * This part of the index-1 table is omitted from the serialized form.
  13647. */
  13648. var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 0x10000 >> UTRIE2_SHIFT_1;
  13649. /** Number of entries in an index-2 block. 64=0x40 */
  13650. var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2;
  13651. /** Mask for getting the lower bits for the in-index-2-block offset. */
  13652. var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1;
  13653. var slice16 = function slice16(view, start, end) {
  13654. if (view.slice) {
  13655. return view.slice(start, end);
  13656. }
  13657. return new Uint16Array(Array.prototype.slice.call(view, start, end));
  13658. };
  13659. var slice32 = function slice32(view, start, end) {
  13660. if (view.slice) {
  13661. return view.slice(start, end);
  13662. }
  13663. return new Uint32Array(Array.prototype.slice.call(view, start, end));
  13664. };
  13665. var createTrieFromBase64 = function createTrieFromBase64(base64) {
  13666. var buffer = decode(base64);
  13667. var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer);
  13668. var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer);
  13669. var headerLength = 24;
  13670. var index = slice16(view16, headerLength / 2, view32[4] / 2);
  13671. var data = view32[5] === 2 ?
  13672. slice16(view16, (headerLength + view32[4]) / 2) :
  13673. slice32(view32, Math.ceil((headerLength + view32[4]) / 4));
  13674. return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
  13675. };
  13676. var Trie = /** @class */function () {
  13677. function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
  13678. this.initialValue = initialValue;
  13679. this.errorValue = errorValue;
  13680. this.highStart = highStart;
  13681. this.highValueIndex = highValueIndex;
  13682. this.index = index;
  13683. this.data = data;
  13684. }
  13685. /**
  13686. * Get the value for a code point as stored in the Trie.
  13687. *
  13688. * @param codePoint the code point
  13689. * @return the value
  13690. */
  13691. Trie.prototype.get = function (codePoint) {
  13692. var ix;
  13693. if (codePoint >= 0) {
  13694. if (codePoint < 0x0d800 || codePoint > 0x0dbff && codePoint <= 0x0ffff) {
  13695. // Ordinary BMP code point, excluding leading surrogates.
  13696. // BMP uses a single level lookup. BMP index starts at offset 0 in the Trie2 index.
  13697. // 16 bit data is stored in the index array itself.
  13698. ix = this.index[codePoint >> UTRIE2_SHIFT_2];
  13699. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  13700. return this.data[ix];
  13701. }
  13702. if (codePoint <= 0xffff) {
  13703. // Lead Surrogate Code Point. A Separate index section is stored for
  13704. // lead surrogate code units and code points.
  13705. // The main index has the code unit data.
  13706. // For this function, we need the code point data.
  13707. // Note: this expression could be refactored for slightly improved efficiency, but
  13708. // surrogate code points will be so rare in practice that it's not worth it.
  13709. ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 0xd800 >> UTRIE2_SHIFT_2)];
  13710. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  13711. return this.data[ix];
  13712. }
  13713. if (codePoint < this.highStart) {
  13714. // Supplemental code point, use two-level lookup.
  13715. ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1);
  13716. ix = this.index[ix];
  13717. ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK;
  13718. ix = this.index[ix];
  13719. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  13720. return this.data[ix];
  13721. }
  13722. if (codePoint <= 0x10ffff) {
  13723. return this.data[this.highValueIndex];
  13724. }
  13725. }
  13726. // Fall through. The code point is outside of the legal range of 0..0x10ffff.
  13727. return this.errorValue;
  13728. };
  13729. return Trie;
  13730. }();
  13731. var base64 = 'KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgBacFXgBeAF4AXgBeAKsFXgCyBbEFugW7BcIFwgXIBcIFwgXQBdQF3AXkBesF8wX7BQMGCwYTBhsGIwYrBjMGOwZeAD8GRwZNBl4AVAZbBl4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAGMGXgBqBnEGXgBeAF4AXgBeAF4AXgBeAF4AXgB5BoAG4wSGBo4GkwaAAIADHgR5AF4AXgBeAJsGgABGA4AAowarBrMGswagALsGwwbLBjAA0wbaBtoG3QbaBtoG2gbaBtoG2gblBusG8wb7BgMHCwcTBxsHCwcjBysHMAc1BzUHOgdCB9oGSgdSB1oHYAfaBloHaAfaBlIH2gbaBtoG2gbaBtoG2gbaBjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHbQdeAF4ANQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQd1B30HNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B4MH2gaKB68EgACAAIAAgACAAIAAgACAAI8HlwdeAJ8HpweAAIAArwe3B14AXgC/B8UHygcwANAH2AfgB4AA6AfwBz4B+AcACFwBCAgPCBcIogEYAR8IJwiAAC8INwg/CCADRwhPCFcIXwhnCEoDGgSAAIAAgABvCHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIhAiLCI4IMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAAXgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADUHNQc1BzUHNQc1BzUHNQc2BzAAMAA5DDUHNQc1BzUHNQc1BzUHNQc1BzUHNQdFDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAATQxSDFoMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAF4AXgBeAF4AXgBeAF4AYgxeAGoMXgBxDHkMfwxeAIUMXgBeAI0MMAAwADAAMAAwAF4AXgCVDJ0MMAAwADAAMABeAF4ApQxeAKsMswy7DF4Awgy9DMoMXgBeAF4AXgBeAF4AXgBeAF4AXgDRDNkMeQBqCeAM3Ax8AOYM7Az0DPgMXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgCgAAANoAAHDQ4NFg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAeDSYNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAC4NMABeAF4ANg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAD4NRg1ODVYNXg1mDTAAbQ0wADAAMAAwADAAMAAwADAA2gbaBtoG2gbaBtoG2gbaBnUNeg3CBYANwgWFDdoGjA3aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gaUDZwNpA2oDdoG2gawDbcNvw3HDdoG2gbPDdYN3A3fDeYN2gbsDfMN2gbaBvoN/g3aBgYODg7aBl4AXgBeABYOXgBeACUG2gYeDl4AJA5eACwO2w3aBtoGMQ45DtoG2gbaBtoGQQ7aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B1EO2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQdZDjUHNQc1BzUHNQc1B2EONQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHaA41BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B3AO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B2EO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwAKAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkAFgAaABsAGwAbAB4AHQAdAB4ATwAXAB4ADQAeAB4AGgAbAE8ATwAOAFAAHQAdAB0ATwBPABcATwBPAE8AFgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwArAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAKwAeAB4AHgAeAB4AHgAeAA4AHgArAA0ADQANAA0ADQANAA0ACQANAA0ADQAIAAQACwAEAAQADQAJAA0ADQAMAB0AHQAeABcAFwAWABcAFwAXABYAFwAdAB0AHgAeABQAFAAUAA0AAQABAAQABAAEAAQABAAJABoAGgAaABoAGgAaABoAGgAeABcAFwAdABUAFQAeAB4AHgAeAB4AHgAYABYAEQAVABUAFQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgANAB4ADQANAA0ADQAeAA0ADQANAAcAHgAeAB4AHgArAAQABAAEAAQABAAEAAQABAAEAAQAUABQACsAKwBPAFAAUABQAFAAUAAeAB4AHgAWABEATwBQAE8ATwBPAE8AUABQAFAAUABQAB4AHgAeABYAEQArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGgAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgBQABoAHgAdAB4AUAAeABoAHgAeAB4AHgAeAB4AHgAeAB4ATwAeAFAAGwAeAB4AUABQAFAAUABQAB4AHgAeAB0AHQAeAFAAHgBQAB4AUAAeAFAATwBQAFAAHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AUABQAFAAUABPAE8AUABQAFAAUABQAE8AUABQAE8AUABPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAE8ATwBPAE8ATwBPAE8ATwBPAE8AUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAATwAeAB4AKwArACsAKwAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB0AHQAeAB4AHgAdAB0AHgAeAB0AHgAeAB4AHQAeAB0AGwAbAB4AHQAeAB4AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB0AHgAdAB4AHQAdAB0AHQAdAB0AHgAdAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAdAB0AHQAdAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAlACUAHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB0AHQAeAB4AHgAeAB0AHQAdAB4AHgAdAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB0AHQAeAB4AHQAeAB4AHgAeAB0AHQAeAB4AHgAeACUAJQAdAB0AJQAeACUAJQAlACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHQAdAB0AHgAdACUAHQAdAB4AHQAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHQAdAB0AHQAlAB4AJQAlACUAHQAlACUAHQAdAB0AJQAlAB0AHQAlAB0AHQAlACUAJQAeAB0AHgAeAB4AHgAdAB0AJQAdAB0AHQAdAB0AHQAlACUAJQAlACUAHQAlACUAIAAlAB0AHQAlACUAJQAlACUAJQAlACUAHgAeAB4AJQAlACAAIAAgACAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeABcAFwAXABcAFwAXAB4AEwATACUAHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACUAJQBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwArACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAE8ATwBPAE8ATwBPAE8ATwAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAEAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUAArACsAUAArACsAUABQACsAKwBQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAIAAgACAAIAAgAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFwAXABcAFQAVABUAHgAeAB4AHgAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAlACAAIAAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA';
  13732. /* @flow */
  13733. var LETTER_NUMBER_MODIFIER = 50;
  13734. // Non-tailorable Line Breaking Classes
  13735. var BK = 1; // Cause a line break (after)
  13736. var CR = 2; // Cause a line break (after), except between CR and LF
  13737. var LF = 3; // Cause a line break (after)
  13738. var CM = 4; // Prohibit a line break between the character and the preceding character
  13739. var NL = 5; // Cause a line break (after)
  13740. var WJ = 7; // Prohibit line breaks before and after
  13741. var ZW = 8; // Provide a break opportunity
  13742. var GL = 9; // Prohibit line breaks before and after
  13743. var SP = 10; // Enable indirect line breaks
  13744. var ZWJ = 11; // Prohibit line breaks within joiner sequences
  13745. // Break Opportunities
  13746. var B2 = 12; // Provide a line break opportunity before and after the character
  13747. var BA = 13; // Generally provide a line break opportunity after the character
  13748. var BB = 14; // Generally provide a line break opportunity before the character
  13749. var HY = 15; // Provide a line break opportunity after the character, except in numeric context
  13750. var CB = 16; // Provide a line break opportunity contingent on additional information
  13751. // Characters Prohibiting Certain Breaks
  13752. var CL = 17; // Prohibit line breaks before
  13753. var CP = 18; // Prohibit line breaks before
  13754. var EX = 19; // Prohibit line breaks before
  13755. var IN = 20; // Allow only indirect line breaks between pairs
  13756. var NS = 21; // Allow only indirect line breaks before
  13757. var OP = 22; // Prohibit line breaks after
  13758. var QU = 23; // Act like they are both opening and closing
  13759. // Numeric Context
  13760. var IS = 24; // Prevent breaks after any and before numeric
  13761. var NU = 25; // Form numeric expressions for line breaking purposes
  13762. var PO = 26; // Do not break following a numeric expression
  13763. var PR = 27; // Do not break in front of a numeric expression
  13764. var SY = 28; // Prevent a break before; and allow a break after
  13765. // Other Characters
  13766. var AI = 29; // Act like AL when the resolvedEAW is N; otherwise; act as ID
  13767. var AL = 30; // Are alphabetic characters or symbols that are used with alphabetic characters
  13768. var CJ = 31; // Treat as NS or ID for strict or normal breaking.
  13769. var EB = 32; // Do not break from following Emoji Modifier
  13770. var EM = 33; // Do not break from preceding Emoji Base
  13771. var H2 = 34; // Form Korean syllable blocks
  13772. var H3 = 35; // Form Korean syllable blocks
  13773. var HL = 36; // Do not break around a following hyphen; otherwise act as Alphabetic
  13774. var ID = 37; // Break before or after; except in some numeric context
  13775. var JL = 38; // Form Korean syllable blocks
  13776. var JV = 39; // Form Korean syllable blocks
  13777. var JT = 40; // Form Korean syllable blocks
  13778. var RI = 41; // Keep pairs together. For pairs; break before and after other classes
  13779. var SA = 42; // Provide a line break opportunity contingent on additional, language-specific context analysis
  13780. var XX = 43; // Have as yet unknown line breaking behavior or unassigned code positions
  13781. var BREAK_MANDATORY = '!';
  13782. var BREAK_NOT_ALLOWED = '×';
  13783. var BREAK_ALLOWED = '÷';
  13784. var UnicodeTrie = createTrieFromBase64(base64);
  13785. var ALPHABETICS = [AL, HL];
  13786. var HARD_LINE_BREAKS = [BK, CR, LF, NL];
  13787. var SPACE = [SP, ZW];
  13788. var PREFIX_POSTFIX = [PR, PO];
  13789. var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE);
  13790. var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
  13791. var HYPHEN = [HY, BA];
  13792. var codePointsToCharacterClasses = function codePointsToCharacterClasses(codePoints, lineBreak) {
  13793. if (lineBreak === void 0) {lineBreak = 'strict';}
  13794. var types = [];
  13795. var indicies = [];
  13796. var categories = [];
  13797. codePoints.forEach(function (codePoint, index) {
  13798. var classType = UnicodeTrie.get(codePoint);
  13799. if (classType > LETTER_NUMBER_MODIFIER) {
  13800. categories.push(true);
  13801. classType -= LETTER_NUMBER_MODIFIER;
  13802. } else
  13803. {
  13804. categories.push(false);
  13805. }
  13806. if (['normal', 'auto', 'loose'].indexOf(lineBreak) !== -1) {
  13807. // U+2010, – U+2013, 〜 U+301C, ゠ U+30A0
  13808. if ([0x2010, 0x2013, 0x301c, 0x30a0].indexOf(codePoint) !== -1) {
  13809. indicies.push(index);
  13810. return types.push(CB);
  13811. }
  13812. }
  13813. if (classType === CM || classType === ZWJ) {
  13814. // LB10 Treat any remaining combining mark or ZWJ as AL.
  13815. if (index === 0) {
  13816. indicies.push(index);
  13817. return types.push(AL);
  13818. }
  13819. // LB9 Do not break a combining character sequence; treat it as if it has the line breaking class of
  13820. // the base character in all of the following rules. Treat ZWJ as if it were CM.
  13821. var prev = types[index - 1];
  13822. if (LINE_BREAKS.indexOf(prev) === -1) {
  13823. indicies.push(indicies[index - 1]);
  13824. return types.push(prev);
  13825. }
  13826. indicies.push(index);
  13827. return types.push(AL);
  13828. }
  13829. indicies.push(index);
  13830. if (classType === CJ) {
  13831. return types.push(lineBreak === 'strict' ? NS : ID);
  13832. }
  13833. if (classType === SA) {
  13834. return types.push(AL);
  13835. }
  13836. if (classType === AI) {
  13837. return types.push(AL);
  13838. }
  13839. // For supplementary characters, a useful default is to treat characters in the range 10000..1FFFD as AL
  13840. // and characters in the ranges 20000..2FFFD and 30000..3FFFD as ID, until the implementation can be revised
  13841. // to take into account the actual line breaking properties for these characters.
  13842. if (classType === XX) {
  13843. if (codePoint >= 0x20000 && codePoint <= 0x2fffd || codePoint >= 0x30000 && codePoint <= 0x3fffd) {
  13844. return types.push(ID);
  13845. } else
  13846. {
  13847. return types.push(AL);
  13848. }
  13849. }
  13850. types.push(classType);
  13851. });
  13852. return [indicies, types, categories];
  13853. };
  13854. var isAdjacentWithSpaceIgnored = function isAdjacentWithSpaceIgnored(a, b, currentIndex, classTypes) {
  13855. var current = classTypes[currentIndex];
  13856. if (Array.isArray(a) ? a.indexOf(current) !== -1 : a === current) {
  13857. var i = currentIndex;
  13858. while (i <= classTypes.length) {
  13859. i++;
  13860. var next = classTypes[i];
  13861. if (next === b) {
  13862. return true;
  13863. }
  13864. if (next !== SP) {
  13865. break;
  13866. }
  13867. }
  13868. }
  13869. if (current === SP) {
  13870. var i = currentIndex;
  13871. while (i > 0) {
  13872. i--;
  13873. var prev = classTypes[i];
  13874. if (Array.isArray(a) ? a.indexOf(prev) !== -1 : a === prev) {
  13875. var n = currentIndex;
  13876. while (n <= classTypes.length) {
  13877. n++;
  13878. var next = classTypes[n];
  13879. if (next === b) {
  13880. return true;
  13881. }
  13882. if (next !== SP) {
  13883. break;
  13884. }
  13885. }
  13886. }
  13887. if (prev !== SP) {
  13888. break;
  13889. }
  13890. }
  13891. }
  13892. return false;
  13893. };
  13894. var previousNonSpaceClassType = function previousNonSpaceClassType(currentIndex, classTypes) {
  13895. var i = currentIndex;
  13896. while (i >= 0) {
  13897. var type = classTypes[i];
  13898. if (type === SP) {
  13899. i--;
  13900. } else
  13901. {
  13902. return type;
  13903. }
  13904. }
  13905. return 0;
  13906. };
  13907. var _lineBreakAtIndex = function _lineBreakAtIndex(codePoints, classTypes, indicies, index, forbiddenBreaks) {
  13908. if (indicies[index] === 0) {
  13909. return BREAK_NOT_ALLOWED;
  13910. }
  13911. var currentIndex = index - 1;
  13912. if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
  13913. return BREAK_NOT_ALLOWED;
  13914. }
  13915. var beforeIndex = currentIndex - 1;
  13916. var afterIndex = currentIndex + 1;
  13917. var current = classTypes[currentIndex];
  13918. // LB4 Always break after hard line breaks.
  13919. // LB5 Treat CR followed by LF, as well as CR, LF, and NL as hard line breaks.
  13920. var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
  13921. var next = classTypes[afterIndex];
  13922. if (current === CR && next === LF) {
  13923. return BREAK_NOT_ALLOWED;
  13924. }
  13925. if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
  13926. return BREAK_MANDATORY;
  13927. }
  13928. // LB6 Do not break before hard line breaks.
  13929. if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
  13930. return BREAK_NOT_ALLOWED;
  13931. }
  13932. // LB7 Do not break before spaces or zero width space.
  13933. if (SPACE.indexOf(next) !== -1) {
  13934. return BREAK_NOT_ALLOWED;
  13935. }
  13936. // LB8 Break before any character following a zero-width space, even if one or more spaces intervene.
  13937. if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
  13938. return BREAK_ALLOWED;
  13939. }
  13940. // LB8a Do not break between a zero width joiner and an ideograph, emoji base or emoji modifier.
  13941. if (UnicodeTrie.get(codePoints[currentIndex]) === ZWJ && (next === ID || next === EB || next === EM)) {
  13942. return BREAK_NOT_ALLOWED;
  13943. }
  13944. // LB11 Do not break before or after Word joiner and related characters.
  13945. if (current === WJ || next === WJ) {
  13946. return BREAK_NOT_ALLOWED;
  13947. }
  13948. // LB12 Do not break after NBSP and related characters.
  13949. if (current === GL) {
  13950. return BREAK_NOT_ALLOWED;
  13951. }
  13952. // LB12a Do not break before NBSP and related characters, except after spaces and hyphens.
  13953. if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
  13954. return BREAK_NOT_ALLOWED;
  13955. }
  13956. // LB13 Do not break before ‘]’ or ‘!’ or ‘;’ or ‘/’, even after spaces.
  13957. if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
  13958. return BREAK_NOT_ALLOWED;
  13959. }
  13960. // LB14 Do not break after ‘[’, even after spaces.
  13961. if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
  13962. return BREAK_NOT_ALLOWED;
  13963. }
  13964. // LB15 Do not break within ‘”[’, even with intervening spaces.
  13965. if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
  13966. return BREAK_NOT_ALLOWED;
  13967. }
  13968. // LB16 Do not break between closing punctuation and a nonstarter (lb=NS), even with intervening spaces.
  13969. if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
  13970. return BREAK_NOT_ALLOWED;
  13971. }
  13972. // LB17 Do not break within ‘——’, even with intervening spaces.
  13973. if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
  13974. return BREAK_NOT_ALLOWED;
  13975. }
  13976. // LB18 Break after spaces.
  13977. if (current === SP) {
  13978. return BREAK_ALLOWED;
  13979. }
  13980. // LB19 Do not break before or after quotation marks, such as ‘ ” ’.
  13981. if (current === QU || next === QU) {
  13982. return BREAK_NOT_ALLOWED;
  13983. }
  13984. // LB20 Break before and after unresolved CB.
  13985. if (next === CB || current === CB) {
  13986. return BREAK_ALLOWED;
  13987. }
  13988. // LB21 Do not break before hyphen-minus, other hyphens, fixed-width spaces, small kana, and other non-starters, or after acute accents.
  13989. if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
  13990. return BREAK_NOT_ALLOWED;
  13991. }
  13992. // LB21a Don't break after Hebrew + Hyphen.
  13993. if (before === HL && HYPHEN.indexOf(current) !== -1) {
  13994. return BREAK_NOT_ALLOWED;
  13995. }
  13996. // LB21b Don’t break between Solidus and Hebrew letters.
  13997. if (current === SY && next === HL) {
  13998. return BREAK_NOT_ALLOWED;
  13999. }
  14000. // LB22 Do not break between two ellipses, or between letters, numbers or exclamations and ellipsis.
  14001. if (next === IN && ALPHABETICS.concat(IN, EX, NU, ID, EB, EM).indexOf(current) !== -1) {
  14002. return BREAK_NOT_ALLOWED;
  14003. }
  14004. // LB23 Do not break between digits and letters.
  14005. if (ALPHABETICS.indexOf(next) !== -1 && current === NU || ALPHABETICS.indexOf(current) !== -1 && next === NU) {
  14006. return BREAK_NOT_ALLOWED;
  14007. }
  14008. // LB23a Do not break between numeric prefixes and ideographs, or between ideographs and numeric postfixes.
  14009. if (current === PR && [ID, EB, EM].indexOf(next) !== -1 ||
  14010. [ID, EB, EM].indexOf(current) !== -1 && next === PO) {
  14011. return BREAK_NOT_ALLOWED;
  14012. }
  14013. // LB24 Do not break between numeric prefix/postfix and letters, or between letters and prefix/postfix.
  14014. if (ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1 ||
  14015. PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
  14016. return BREAK_NOT_ALLOWED;
  14017. }
  14018. // LB25 Do not break between the following pairs of classes relevant to numbers:
  14019. if (
  14020. // (PR | PO) × ( OP | HY )? NU
  14021. [PR, PO].indexOf(current) !== -1 && (
  14022. next === NU || [OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU) ||
  14023. // ( OP | HY ) × NU
  14024. [OP, HY].indexOf(current) !== -1 && next === NU ||
  14025. // NU × (NU | SY | IS)
  14026. current === NU && [NU, SY, IS].indexOf(next) !== -1) {
  14027. return BREAK_NOT_ALLOWED;
  14028. }
  14029. // NU (NU | SY | IS)* × (NU | SY | IS | CL | CP)
  14030. if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
  14031. var prevIndex = currentIndex;
  14032. while (prevIndex >= 0) {
  14033. var type = classTypes[prevIndex];
  14034. if (type === NU) {
  14035. return BREAK_NOT_ALLOWED;
  14036. } else
  14037. if ([SY, IS].indexOf(type) !== -1) {
  14038. prevIndex--;
  14039. } else
  14040. {
  14041. break;
  14042. }
  14043. }
  14044. }
  14045. // NU (NU | SY | IS)* (CL | CP)? × (PO | PR))
  14046. if ([PR, PO].indexOf(next) !== -1) {
  14047. var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
  14048. while (prevIndex >= 0) {
  14049. var type = classTypes[prevIndex];
  14050. if (type === NU) {
  14051. return BREAK_NOT_ALLOWED;
  14052. } else
  14053. if ([SY, IS].indexOf(type) !== -1) {
  14054. prevIndex--;
  14055. } else
  14056. {
  14057. break;
  14058. }
  14059. }
  14060. }
  14061. // LB26 Do not break a Korean syllable.
  14062. if (JL === current && [JL, JV, H2, H3].indexOf(next) !== -1 ||
  14063. [JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1 ||
  14064. [JT, H3].indexOf(current) !== -1 && next === JT) {
  14065. return BREAK_NOT_ALLOWED;
  14066. }
  14067. // LB27 Treat a Korean Syllable Block the same as ID.
  14068. if (KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1 ||
  14069. KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR) {
  14070. return BREAK_NOT_ALLOWED;
  14071. }
  14072. // LB28 Do not break between alphabetics (“at”).
  14073. if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
  14074. return BREAK_NOT_ALLOWED;
  14075. }
  14076. // LB29 Do not break between numeric punctuation and alphabetics (“e.g.”).
  14077. if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
  14078. return BREAK_NOT_ALLOWED;
  14079. }
  14080. // LB30 Do not break between letters, numbers, or ordinary symbols and opening or closing parentheses.
  14081. if (ALPHABETICS.concat(NU).indexOf(current) !== -1 && next === OP ||
  14082. ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP) {
  14083. return BREAK_NOT_ALLOWED;
  14084. }
  14085. // LB30a Break between two regional indicator symbols if and only if there are an even number of regional
  14086. // indicators preceding the position of the break.
  14087. if (current === RI && next === RI) {
  14088. var i = indicies[currentIndex];
  14089. var count = 1;
  14090. while (i > 0) {
  14091. i--;
  14092. if (classTypes[i] === RI) {
  14093. count++;
  14094. } else
  14095. {
  14096. break;
  14097. }
  14098. }
  14099. if (count % 2 !== 0) {
  14100. return BREAK_NOT_ALLOWED;
  14101. }
  14102. }
  14103. // LB30b Do not break between an emoji base and an emoji modifier.
  14104. if (current === EB && next === EM) {
  14105. return BREAK_NOT_ALLOWED;
  14106. }
  14107. return BREAK_ALLOWED;
  14108. };
  14109. var cssFormattedClasses = function cssFormattedClasses(codePoints, options) {
  14110. if (!options) {
  14111. options = { lineBreak: 'normal', wordBreak: 'normal' };
  14112. }
  14113. var _a = codePointsToCharacterClasses(codePoints, options.lineBreak),indicies = _a[0],classTypes = _a[1],isLetterNumber = _a[2];
  14114. if (options.wordBreak === 'break-all' || options.wordBreak === 'break-word') {
  14115. classTypes = classTypes.map(function (type) {return [NU, AL, SA].indexOf(type) !== -1 ? ID : type;});
  14116. }
  14117. var forbiddenBreakpoints = options.wordBreak === 'keep-all' ?
  14118. isLetterNumber.map(function (letterNumber, i) {
  14119. return letterNumber && codePoints[i] >= 0x4e00 && codePoints[i] <= 0x9fff;
  14120. }) :
  14121. undefined;
  14122. return [indicies, classTypes, forbiddenBreakpoints];
  14123. };
  14124. var Break = /** @class */function () {
  14125. function Break(codePoints, lineBreak, start, end) {
  14126. this.codePoints = codePoints;
  14127. this.required = lineBreak === BREAK_MANDATORY;
  14128. this.start = start;
  14129. this.end = end;
  14130. }
  14131. Break.prototype.slice = function () {
  14132. return fromCodePoint.apply(void 0, this.codePoints.slice(this.start, this.end));
  14133. };
  14134. return Break;
  14135. }();
  14136. var LineBreaker = function LineBreaker(str, options) {
  14137. var codePoints = toCodePoints(str);
  14138. var _a = cssFormattedClasses(codePoints, options),indicies = _a[0],classTypes = _a[1],forbiddenBreakpoints = _a[2];
  14139. var length = codePoints.length;
  14140. var lastEnd = 0;
  14141. var nextIndex = 0;
  14142. return {
  14143. next: function next() {
  14144. if (nextIndex >= length) {
  14145. return { done: true, value: null };
  14146. }
  14147. var lineBreak = BREAK_NOT_ALLOWED;
  14148. while (nextIndex < length &&
  14149. (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) ===
  14150. BREAK_NOT_ALLOWED) {}
  14151. if (lineBreak !== BREAK_NOT_ALLOWED || nextIndex === length) {
  14152. var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
  14153. lastEnd = nextIndex;
  14154. return { value: value, done: false };
  14155. }
  14156. return { done: true, value: null };
  14157. } };
  14158. };
  14159. // https://www.w3.org/TR/css-syntax-3
  14160. var TokenType;
  14161. (function (TokenType) {
  14162. TokenType[TokenType["STRING_TOKEN"] = 0] = "STRING_TOKEN";
  14163. TokenType[TokenType["BAD_STRING_TOKEN"] = 1] = "BAD_STRING_TOKEN";
  14164. TokenType[TokenType["LEFT_PARENTHESIS_TOKEN"] = 2] = "LEFT_PARENTHESIS_TOKEN";
  14165. TokenType[TokenType["RIGHT_PARENTHESIS_TOKEN"] = 3] = "RIGHT_PARENTHESIS_TOKEN";
  14166. TokenType[TokenType["COMMA_TOKEN"] = 4] = "COMMA_TOKEN";
  14167. TokenType[TokenType["HASH_TOKEN"] = 5] = "HASH_TOKEN";
  14168. TokenType[TokenType["DELIM_TOKEN"] = 6] = "DELIM_TOKEN";
  14169. TokenType[TokenType["AT_KEYWORD_TOKEN"] = 7] = "AT_KEYWORD_TOKEN";
  14170. TokenType[TokenType["PREFIX_MATCH_TOKEN"] = 8] = "PREFIX_MATCH_TOKEN";
  14171. TokenType[TokenType["DASH_MATCH_TOKEN"] = 9] = "DASH_MATCH_TOKEN";
  14172. TokenType[TokenType["INCLUDE_MATCH_TOKEN"] = 10] = "INCLUDE_MATCH_TOKEN";
  14173. TokenType[TokenType["LEFT_CURLY_BRACKET_TOKEN"] = 11] = "LEFT_CURLY_BRACKET_TOKEN";
  14174. TokenType[TokenType["RIGHT_CURLY_BRACKET_TOKEN"] = 12] = "RIGHT_CURLY_BRACKET_TOKEN";
  14175. TokenType[TokenType["SUFFIX_MATCH_TOKEN"] = 13] = "SUFFIX_MATCH_TOKEN";
  14176. TokenType[TokenType["SUBSTRING_MATCH_TOKEN"] = 14] = "SUBSTRING_MATCH_TOKEN";
  14177. TokenType[TokenType["DIMENSION_TOKEN"] = 15] = "DIMENSION_TOKEN";
  14178. TokenType[TokenType["PERCENTAGE_TOKEN"] = 16] = "PERCENTAGE_TOKEN";
  14179. TokenType[TokenType["NUMBER_TOKEN"] = 17] = "NUMBER_TOKEN";
  14180. TokenType[TokenType["FUNCTION"] = 18] = "FUNCTION";
  14181. TokenType[TokenType["FUNCTION_TOKEN"] = 19] = "FUNCTION_TOKEN";
  14182. TokenType[TokenType["IDENT_TOKEN"] = 20] = "IDENT_TOKEN";
  14183. TokenType[TokenType["COLUMN_TOKEN"] = 21] = "COLUMN_TOKEN";
  14184. TokenType[TokenType["URL_TOKEN"] = 22] = "URL_TOKEN";
  14185. TokenType[TokenType["BAD_URL_TOKEN"] = 23] = "BAD_URL_TOKEN";
  14186. TokenType[TokenType["CDC_TOKEN"] = 24] = "CDC_TOKEN";
  14187. TokenType[TokenType["CDO_TOKEN"] = 25] = "CDO_TOKEN";
  14188. TokenType[TokenType["COLON_TOKEN"] = 26] = "COLON_TOKEN";
  14189. TokenType[TokenType["SEMICOLON_TOKEN"] = 27] = "SEMICOLON_TOKEN";
  14190. TokenType[TokenType["LEFT_SQUARE_BRACKET_TOKEN"] = 28] = "LEFT_SQUARE_BRACKET_TOKEN";
  14191. TokenType[TokenType["RIGHT_SQUARE_BRACKET_TOKEN"] = 29] = "RIGHT_SQUARE_BRACKET_TOKEN";
  14192. TokenType[TokenType["UNICODE_RANGE_TOKEN"] = 30] = "UNICODE_RANGE_TOKEN";
  14193. TokenType[TokenType["WHITESPACE_TOKEN"] = 31] = "WHITESPACE_TOKEN";
  14194. TokenType[TokenType["EOF_TOKEN"] = 32] = "EOF_TOKEN";
  14195. })(TokenType || (TokenType = {}));
  14196. var FLAG_UNRESTRICTED = 1 << 0;
  14197. var FLAG_ID = 1 << 1;
  14198. var FLAG_INTEGER = 1 << 2;
  14199. var FLAG_NUMBER = 1 << 3;
  14200. var LINE_FEED = 0x000a;
  14201. var SOLIDUS = 0x002f;
  14202. var REVERSE_SOLIDUS = 0x005c;
  14203. var CHARACTER_TABULATION = 0x0009;
  14204. var SPACE$1 = 0x0020;
  14205. var QUOTATION_MARK = 0x0022;
  14206. var EQUALS_SIGN = 0x003d;
  14207. var NUMBER_SIGN = 0x0023;
  14208. var DOLLAR_SIGN = 0x0024;
  14209. var PERCENTAGE_SIGN = 0x0025;
  14210. var APOSTROPHE = 0x0027;
  14211. var LEFT_PARENTHESIS = 0x0028;
  14212. var RIGHT_PARENTHESIS = 0x0029;
  14213. var LOW_LINE = 0x005f;
  14214. var HYPHEN_MINUS = 0x002d;
  14215. var EXCLAMATION_MARK = 0x0021;
  14216. var LESS_THAN_SIGN = 0x003c;
  14217. var GREATER_THAN_SIGN = 0x003e;
  14218. var COMMERCIAL_AT = 0x0040;
  14219. var LEFT_SQUARE_BRACKET = 0x005b;
  14220. var RIGHT_SQUARE_BRACKET = 0x005d;
  14221. var CIRCUMFLEX_ACCENT = 0x003d;
  14222. var LEFT_CURLY_BRACKET = 0x007b;
  14223. var QUESTION_MARK = 0x003f;
  14224. var RIGHT_CURLY_BRACKET = 0x007d;
  14225. var VERTICAL_LINE = 0x007c;
  14226. var TILDE = 0x007e;
  14227. var CONTROL = 0x0080;
  14228. var REPLACEMENT_CHARACTER = 0xfffd;
  14229. var ASTERISK = 0x002a;
  14230. var PLUS_SIGN = 0x002b;
  14231. var COMMA = 0x002c;
  14232. var COLON = 0x003a;
  14233. var SEMICOLON = 0x003b;
  14234. var FULL_STOP = 0x002e;
  14235. var NULL = 0x0000;
  14236. var BACKSPACE = 0x0008;
  14237. var LINE_TABULATION = 0x000b;
  14238. var SHIFT_OUT = 0x000e;
  14239. var INFORMATION_SEPARATOR_ONE = 0x001f;
  14240. var DELETE = 0x007f;
  14241. var EOF = -1;
  14242. var ZERO = 0x0030;
  14243. var a = 0x0061;
  14244. var e = 0x0065;
  14245. var f = 0x0066;
  14246. var u = 0x0075;
  14247. var z = 0x007a;
  14248. var A = 0x0041;
  14249. var E = 0x0045;
  14250. var F = 0x0046;
  14251. var U = 0x0055;
  14252. var Z = 0x005a;
  14253. var isDigit = function isDigit(codePoint) {return codePoint >= ZERO && codePoint <= 0x0039;};
  14254. var isSurrogateCodePoint = function isSurrogateCodePoint(codePoint) {return codePoint >= 0xd800 && codePoint <= 0xdfff;};
  14255. var isHex = function isHex(codePoint) {
  14256. return isDigit(codePoint) || codePoint >= A && codePoint <= F || codePoint >= a && codePoint <= f;
  14257. };
  14258. var isLowerCaseLetter = function isLowerCaseLetter(codePoint) {return codePoint >= a && codePoint <= z;};
  14259. var isUpperCaseLetter = function isUpperCaseLetter(codePoint) {return codePoint >= A && codePoint <= Z;};
  14260. var isLetter = function isLetter(codePoint) {return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint);};
  14261. var isNonASCIICodePoint = function isNonASCIICodePoint(codePoint) {return codePoint >= CONTROL;};
  14262. var isWhiteSpace = function isWhiteSpace(codePoint) {
  14263. return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE$1;
  14264. };
  14265. var isNameStartCodePoint = function isNameStartCodePoint(codePoint) {
  14266. return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
  14267. };
  14268. var isNameCodePoint = function isNameCodePoint(codePoint) {
  14269. return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
  14270. };
  14271. var isNonPrintableCodePoint = function isNonPrintableCodePoint(codePoint) {
  14272. return codePoint >= NULL && codePoint <= BACKSPACE ||
  14273. codePoint === LINE_TABULATION ||
  14274. codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE ||
  14275. codePoint === DELETE;
  14276. };
  14277. var isValidEscape = function isValidEscape(c1, c2) {
  14278. if (c1 !== REVERSE_SOLIDUS) {
  14279. return false;
  14280. }
  14281. return c2 !== LINE_FEED;
  14282. };
  14283. var isIdentifierStart = function isIdentifierStart(c1, c2, c3) {
  14284. if (c1 === HYPHEN_MINUS) {
  14285. return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
  14286. } else
  14287. if (isNameStartCodePoint(c1)) {
  14288. return true;
  14289. } else
  14290. if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
  14291. return true;
  14292. }
  14293. return false;
  14294. };
  14295. var isNumberStart = function isNumberStart(c1, c2, c3) {
  14296. if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
  14297. if (isDigit(c2)) {
  14298. return true;
  14299. }
  14300. return c2 === FULL_STOP && isDigit(c3);
  14301. }
  14302. if (c1 === FULL_STOP) {
  14303. return isDigit(c2);
  14304. }
  14305. return isDigit(c1);
  14306. };
  14307. var stringToNumber = function stringToNumber(codePoints) {
  14308. var c = 0;
  14309. var sign = 1;
  14310. if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
  14311. if (codePoints[c] === HYPHEN_MINUS) {
  14312. sign = -1;
  14313. }
  14314. c++;
  14315. }
  14316. var integers = [];
  14317. while (isDigit(codePoints[c])) {
  14318. integers.push(codePoints[c++]);
  14319. }
  14320. var _int = integers.length ? parseInt(fromCodePoint.apply(void 0, integers), 10) : 0;
  14321. if (codePoints[c] === FULL_STOP) {
  14322. c++;
  14323. }
  14324. var fraction = [];
  14325. while (isDigit(codePoints[c])) {
  14326. fraction.push(codePoints[c++]);
  14327. }
  14328. var fracd = fraction.length;
  14329. var frac = fracd ? parseInt(fromCodePoint.apply(void 0, fraction), 10) : 0;
  14330. if (codePoints[c] === E || codePoints[c] === e) {
  14331. c++;
  14332. }
  14333. var expsign = 1;
  14334. if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
  14335. if (codePoints[c] === HYPHEN_MINUS) {
  14336. expsign = -1;
  14337. }
  14338. c++;
  14339. }
  14340. var exponent = [];
  14341. while (isDigit(codePoints[c])) {
  14342. exponent.push(codePoints[c++]);
  14343. }
  14344. var exp = exponent.length ? parseInt(fromCodePoint.apply(void 0, exponent), 10) : 0;
  14345. return sign * (_int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
  14346. };
  14347. var LEFT_PARENTHESIS_TOKEN = {
  14348. type: TokenType.LEFT_PARENTHESIS_TOKEN };
  14349. var RIGHT_PARENTHESIS_TOKEN = {
  14350. type: TokenType.RIGHT_PARENTHESIS_TOKEN };
  14351. var COMMA_TOKEN = { type: TokenType.COMMA_TOKEN };
  14352. var SUFFIX_MATCH_TOKEN = { type: TokenType.SUFFIX_MATCH_TOKEN };
  14353. var PREFIX_MATCH_TOKEN = { type: TokenType.PREFIX_MATCH_TOKEN };
  14354. var COLUMN_TOKEN = { type: TokenType.COLUMN_TOKEN };
  14355. var DASH_MATCH_TOKEN = { type: TokenType.DASH_MATCH_TOKEN };
  14356. var INCLUDE_MATCH_TOKEN = { type: TokenType.INCLUDE_MATCH_TOKEN };
  14357. var LEFT_CURLY_BRACKET_TOKEN = {
  14358. type: TokenType.LEFT_CURLY_BRACKET_TOKEN };
  14359. var RIGHT_CURLY_BRACKET_TOKEN = {
  14360. type: TokenType.RIGHT_CURLY_BRACKET_TOKEN };
  14361. var SUBSTRING_MATCH_TOKEN = { type: TokenType.SUBSTRING_MATCH_TOKEN };
  14362. var BAD_URL_TOKEN = { type: TokenType.BAD_URL_TOKEN };
  14363. var BAD_STRING_TOKEN = { type: TokenType.BAD_STRING_TOKEN };
  14364. var CDO_TOKEN = { type: TokenType.CDO_TOKEN };
  14365. var CDC_TOKEN = { type: TokenType.CDC_TOKEN };
  14366. var COLON_TOKEN = { type: TokenType.COLON_TOKEN };
  14367. var SEMICOLON_TOKEN = { type: TokenType.SEMICOLON_TOKEN };
  14368. var LEFT_SQUARE_BRACKET_TOKEN = {
  14369. type: TokenType.LEFT_SQUARE_BRACKET_TOKEN };
  14370. var RIGHT_SQUARE_BRACKET_TOKEN = {
  14371. type: TokenType.RIGHT_SQUARE_BRACKET_TOKEN };
  14372. var WHITESPACE_TOKEN = { type: TokenType.WHITESPACE_TOKEN };
  14373. var EOF_TOKEN = { type: TokenType.EOF_TOKEN };
  14374. var Tokenizer = /** @class */function () {
  14375. function Tokenizer() {
  14376. this._value = [];
  14377. }
  14378. Tokenizer.prototype.write = function (chunk) {
  14379. this._value = this._value.concat(toCodePoints(chunk));
  14380. };
  14381. Tokenizer.prototype.read = function () {
  14382. var tokens = [];
  14383. var token = this.consumeToken();
  14384. while (token !== EOF_TOKEN) {
  14385. tokens.push(token);
  14386. token = this.consumeToken();
  14387. }
  14388. return tokens;
  14389. };
  14390. Tokenizer.prototype.consumeToken = function () {
  14391. var codePoint = this.consumeCodePoint();
  14392. switch (codePoint) {
  14393. case QUOTATION_MARK:
  14394. return this.consumeStringToken(QUOTATION_MARK);
  14395. case NUMBER_SIGN:
  14396. var c1 = this.peekCodePoint(0);
  14397. var c2 = this.peekCodePoint(1);
  14398. var c3 = this.peekCodePoint(2);
  14399. if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
  14400. var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
  14401. var value = this.consumeName();
  14402. return { type: TokenType.HASH_TOKEN, value: value, flags: flags };
  14403. }
  14404. break;
  14405. case DOLLAR_SIGN:
  14406. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  14407. this.consumeCodePoint();
  14408. return SUFFIX_MATCH_TOKEN;
  14409. }
  14410. break;
  14411. case APOSTROPHE:
  14412. return this.consumeStringToken(APOSTROPHE);
  14413. case LEFT_PARENTHESIS:
  14414. return LEFT_PARENTHESIS_TOKEN;
  14415. case RIGHT_PARENTHESIS:
  14416. return RIGHT_PARENTHESIS_TOKEN;
  14417. case ASTERISK:
  14418. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  14419. this.consumeCodePoint();
  14420. return SUBSTRING_MATCH_TOKEN;
  14421. }
  14422. break;
  14423. case PLUS_SIGN:
  14424. if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
  14425. this.reconsumeCodePoint(codePoint);
  14426. return this.consumeNumericToken();
  14427. }
  14428. break;
  14429. case COMMA:
  14430. return COMMA_TOKEN;
  14431. case HYPHEN_MINUS:
  14432. var e1 = codePoint;
  14433. var e2 = this.peekCodePoint(0);
  14434. var e3 = this.peekCodePoint(1);
  14435. if (isNumberStart(e1, e2, e3)) {
  14436. this.reconsumeCodePoint(codePoint);
  14437. return this.consumeNumericToken();
  14438. }
  14439. if (isIdentifierStart(e1, e2, e3)) {
  14440. this.reconsumeCodePoint(codePoint);
  14441. return this.consumeIdentLikeToken();
  14442. }
  14443. if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) {
  14444. this.consumeCodePoint();
  14445. this.consumeCodePoint();
  14446. return CDC_TOKEN;
  14447. }
  14448. break;
  14449. case FULL_STOP:
  14450. if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
  14451. this.reconsumeCodePoint(codePoint);
  14452. return this.consumeNumericToken();
  14453. }
  14454. break;
  14455. case SOLIDUS:
  14456. if (this.peekCodePoint(0) === ASTERISK) {
  14457. this.consumeCodePoint();
  14458. while (true) {
  14459. var c = this.consumeCodePoint();
  14460. if (c === ASTERISK) {
  14461. c = this.consumeCodePoint();
  14462. if (c === SOLIDUS) {
  14463. return this.consumeToken();
  14464. }
  14465. }
  14466. if (c === EOF) {
  14467. return this.consumeToken();
  14468. }
  14469. }
  14470. }
  14471. break;
  14472. case COLON:
  14473. return COLON_TOKEN;
  14474. case SEMICOLON:
  14475. return SEMICOLON_TOKEN;
  14476. case LESS_THAN_SIGN:
  14477. if (this.peekCodePoint(0) === EXCLAMATION_MARK &&
  14478. this.peekCodePoint(1) === HYPHEN_MINUS &&
  14479. this.peekCodePoint(2) === HYPHEN_MINUS) {
  14480. this.consumeCodePoint();
  14481. this.consumeCodePoint();
  14482. return CDO_TOKEN;
  14483. }
  14484. break;
  14485. case COMMERCIAL_AT:
  14486. var a1 = this.peekCodePoint(0);
  14487. var a2 = this.peekCodePoint(1);
  14488. var a3 = this.peekCodePoint(2);
  14489. if (isIdentifierStart(a1, a2, a3)) {
  14490. var value = this.consumeName();
  14491. return { type: TokenType.AT_KEYWORD_TOKEN, value: value };
  14492. }
  14493. break;
  14494. case LEFT_SQUARE_BRACKET:
  14495. return LEFT_SQUARE_BRACKET_TOKEN;
  14496. case REVERSE_SOLIDUS:
  14497. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  14498. this.reconsumeCodePoint(codePoint);
  14499. return this.consumeIdentLikeToken();
  14500. }
  14501. break;
  14502. case RIGHT_SQUARE_BRACKET:
  14503. return RIGHT_SQUARE_BRACKET_TOKEN;
  14504. case CIRCUMFLEX_ACCENT:
  14505. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  14506. this.consumeCodePoint();
  14507. return PREFIX_MATCH_TOKEN;
  14508. }
  14509. break;
  14510. case LEFT_CURLY_BRACKET:
  14511. return LEFT_CURLY_BRACKET_TOKEN;
  14512. case RIGHT_CURLY_BRACKET:
  14513. return RIGHT_CURLY_BRACKET_TOKEN;
  14514. case u:
  14515. case U:
  14516. var u1 = this.peekCodePoint(0);
  14517. var u2 = this.peekCodePoint(1);
  14518. if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) {
  14519. this.consumeCodePoint();
  14520. this.consumeUnicodeRangeToken();
  14521. }
  14522. this.reconsumeCodePoint(codePoint);
  14523. return this.consumeIdentLikeToken();
  14524. case VERTICAL_LINE:
  14525. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  14526. this.consumeCodePoint();
  14527. return DASH_MATCH_TOKEN;
  14528. }
  14529. if (this.peekCodePoint(0) === VERTICAL_LINE) {
  14530. this.consumeCodePoint();
  14531. return COLUMN_TOKEN;
  14532. }
  14533. break;
  14534. case TILDE:
  14535. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  14536. this.consumeCodePoint();
  14537. return INCLUDE_MATCH_TOKEN;
  14538. }
  14539. break;
  14540. case EOF:
  14541. return EOF_TOKEN;}
  14542. if (isWhiteSpace(codePoint)) {
  14543. this.consumeWhiteSpace();
  14544. return WHITESPACE_TOKEN;
  14545. }
  14546. if (isDigit(codePoint)) {
  14547. this.reconsumeCodePoint(codePoint);
  14548. return this.consumeNumericToken();
  14549. }
  14550. if (isNameStartCodePoint(codePoint)) {
  14551. this.reconsumeCodePoint(codePoint);
  14552. return this.consumeIdentLikeToken();
  14553. }
  14554. return { type: TokenType.DELIM_TOKEN, value: fromCodePoint(codePoint) };
  14555. };
  14556. Tokenizer.prototype.consumeCodePoint = function () {
  14557. var value = this._value.shift();
  14558. return typeof value === 'undefined' ? -1 : value;
  14559. };
  14560. Tokenizer.prototype.reconsumeCodePoint = function (codePoint) {
  14561. this._value.unshift(codePoint);
  14562. };
  14563. Tokenizer.prototype.peekCodePoint = function (delta) {
  14564. if (delta >= this._value.length) {
  14565. return -1;
  14566. }
  14567. return this._value[delta];
  14568. };
  14569. Tokenizer.prototype.consumeUnicodeRangeToken = function () {
  14570. var digits = [];
  14571. var codePoint = this.consumeCodePoint();
  14572. while (isHex(codePoint) && digits.length < 6) {
  14573. digits.push(codePoint);
  14574. codePoint = this.consumeCodePoint();
  14575. }
  14576. var questionMarks = false;
  14577. while (codePoint === QUESTION_MARK && digits.length < 6) {
  14578. digits.push(codePoint);
  14579. codePoint = this.consumeCodePoint();
  14580. questionMarks = true;
  14581. }
  14582. if (questionMarks) {
  14583. var start_1 = parseInt(fromCodePoint.apply(void 0, digits.map(function (digit) {return digit === QUESTION_MARK ? ZERO : digit;})), 16);
  14584. var end = parseInt(fromCodePoint.apply(void 0, digits.map(function (digit) {return digit === QUESTION_MARK ? F : digit;})), 16);
  14585. return { type: TokenType.UNICODE_RANGE_TOKEN, start: start_1, end: end };
  14586. }
  14587. var start = parseInt(fromCodePoint.apply(void 0, digits), 16);
  14588. if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
  14589. this.consumeCodePoint();
  14590. codePoint = this.consumeCodePoint();
  14591. var endDigits = [];
  14592. while (isHex(codePoint) && endDigits.length < 6) {
  14593. endDigits.push(codePoint);
  14594. codePoint = this.consumeCodePoint();
  14595. }
  14596. var end = parseInt(fromCodePoint.apply(void 0, endDigits), 16);
  14597. return { type: TokenType.UNICODE_RANGE_TOKEN, start: start, end: end };
  14598. } else
  14599. {
  14600. return { type: TokenType.UNICODE_RANGE_TOKEN, start: start, end: start };
  14601. }
  14602. };
  14603. Tokenizer.prototype.consumeIdentLikeToken = function () {
  14604. var value = this.consumeName();
  14605. if (value.toLowerCase() === 'url' && this.peekCodePoint(0) === LEFT_PARENTHESIS) {
  14606. this.consumeCodePoint();
  14607. return this.consumeUrlToken();
  14608. } else
  14609. if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
  14610. this.consumeCodePoint();
  14611. return { type: TokenType.FUNCTION_TOKEN, value: value };
  14612. }
  14613. return { type: TokenType.IDENT_TOKEN, value: value };
  14614. };
  14615. Tokenizer.prototype.consumeUrlToken = function () {
  14616. var value = [];
  14617. this.consumeWhiteSpace();
  14618. if (this.peekCodePoint(0) === EOF) {
  14619. return { type: TokenType.URL_TOKEN, value: '' };
  14620. }
  14621. var next = this.peekCodePoint(0);
  14622. if (next === APOSTROPHE || next === QUOTATION_MARK) {
  14623. var stringToken = this.consumeStringToken(this.consumeCodePoint());
  14624. if (stringToken.type === TokenType.STRING_TOKEN) {
  14625. this.consumeWhiteSpace();
  14626. if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
  14627. this.consumeCodePoint();
  14628. return { type: TokenType.URL_TOKEN, value: stringToken.value };
  14629. }
  14630. }
  14631. this.consumeBadUrlRemnants();
  14632. return BAD_URL_TOKEN;
  14633. }
  14634. while (true) {
  14635. var codePoint = this.consumeCodePoint();
  14636. if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
  14637. return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) };
  14638. } else
  14639. if (isWhiteSpace(codePoint)) {
  14640. this.consumeWhiteSpace();
  14641. if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
  14642. this.consumeCodePoint();
  14643. return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) };
  14644. }
  14645. this.consumeBadUrlRemnants();
  14646. return BAD_URL_TOKEN;
  14647. } else
  14648. if (codePoint === QUOTATION_MARK ||
  14649. codePoint === APOSTROPHE ||
  14650. codePoint === LEFT_PARENTHESIS ||
  14651. isNonPrintableCodePoint(codePoint)) {
  14652. this.consumeBadUrlRemnants();
  14653. return BAD_URL_TOKEN;
  14654. } else
  14655. if (codePoint === REVERSE_SOLIDUS) {
  14656. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  14657. value.push(this.consumeEscapedCodePoint());
  14658. } else
  14659. {
  14660. this.consumeBadUrlRemnants();
  14661. return BAD_URL_TOKEN;
  14662. }
  14663. } else
  14664. {
  14665. value.push(codePoint);
  14666. }
  14667. }
  14668. };
  14669. Tokenizer.prototype.consumeWhiteSpace = function () {
  14670. while (isWhiteSpace(this.peekCodePoint(0))) {
  14671. this.consumeCodePoint();
  14672. }
  14673. };
  14674. Tokenizer.prototype.consumeBadUrlRemnants = function () {
  14675. while (true) {
  14676. var codePoint = this.consumeCodePoint();
  14677. if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) {
  14678. return;
  14679. }
  14680. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  14681. this.consumeEscapedCodePoint();
  14682. }
  14683. }
  14684. };
  14685. Tokenizer.prototype.consumeStringSlice = function (count) {
  14686. var SLICE_STACK_SIZE = 60000;
  14687. var value = '';
  14688. while (count > 0) {
  14689. var amount = Math.min(SLICE_STACK_SIZE, count);
  14690. value += fromCodePoint.apply(void 0, this._value.splice(0, amount));
  14691. count -= amount;
  14692. }
  14693. this._value.shift();
  14694. return value;
  14695. };
  14696. Tokenizer.prototype.consumeStringToken = function (endingCodePoint) {
  14697. var value = '';
  14698. var i = 0;
  14699. do {
  14700. var codePoint = this._value[i];
  14701. if (codePoint === EOF || codePoint === undefined || codePoint === endingCodePoint) {
  14702. value += this.consumeStringSlice(i);
  14703. return { type: TokenType.STRING_TOKEN, value: value };
  14704. }
  14705. if (codePoint === LINE_FEED) {
  14706. this._value.splice(0, i);
  14707. return BAD_STRING_TOKEN;
  14708. }
  14709. if (codePoint === REVERSE_SOLIDUS) {
  14710. var next = this._value[i + 1];
  14711. if (next !== EOF && next !== undefined) {
  14712. if (next === LINE_FEED) {
  14713. value += this.consumeStringSlice(i);
  14714. i = -1;
  14715. this._value.shift();
  14716. } else
  14717. if (isValidEscape(codePoint, next)) {
  14718. value += this.consumeStringSlice(i);
  14719. value += fromCodePoint(this.consumeEscapedCodePoint());
  14720. i = -1;
  14721. }
  14722. }
  14723. }
  14724. i++;
  14725. } while (true);
  14726. };
  14727. Tokenizer.prototype.consumeNumber = function () {
  14728. var repr = [];
  14729. var type = FLAG_INTEGER;
  14730. var c1 = this.peekCodePoint(0);
  14731. if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
  14732. repr.push(this.consumeCodePoint());
  14733. }
  14734. while (isDigit(this.peekCodePoint(0))) {
  14735. repr.push(this.consumeCodePoint());
  14736. }
  14737. c1 = this.peekCodePoint(0);
  14738. var c2 = this.peekCodePoint(1);
  14739. if (c1 === FULL_STOP && isDigit(c2)) {
  14740. repr.push(this.consumeCodePoint(), this.consumeCodePoint());
  14741. type = FLAG_NUMBER;
  14742. while (isDigit(this.peekCodePoint(0))) {
  14743. repr.push(this.consumeCodePoint());
  14744. }
  14745. }
  14746. c1 = this.peekCodePoint(0);
  14747. c2 = this.peekCodePoint(1);
  14748. var c3 = this.peekCodePoint(2);
  14749. if ((c1 === E || c1 === e) && ((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3) || isDigit(c2))) {
  14750. repr.push(this.consumeCodePoint(), this.consumeCodePoint());
  14751. type = FLAG_NUMBER;
  14752. while (isDigit(this.peekCodePoint(0))) {
  14753. repr.push(this.consumeCodePoint());
  14754. }
  14755. }
  14756. return [stringToNumber(repr), type];
  14757. };
  14758. Tokenizer.prototype.consumeNumericToken = function () {
  14759. var _a = this.consumeNumber(),number = _a[0],flags = _a[1];
  14760. var c1 = this.peekCodePoint(0);
  14761. var c2 = this.peekCodePoint(1);
  14762. var c3 = this.peekCodePoint(2);
  14763. if (isIdentifierStart(c1, c2, c3)) {
  14764. var unit = this.consumeName();
  14765. return { type: TokenType.DIMENSION_TOKEN, number: number, flags: flags, unit: unit };
  14766. }
  14767. if (c1 === PERCENTAGE_SIGN) {
  14768. this.consumeCodePoint();
  14769. return { type: TokenType.PERCENTAGE_TOKEN, number: number, flags: flags };
  14770. }
  14771. return { type: TokenType.NUMBER_TOKEN, number: number, flags: flags };
  14772. };
  14773. Tokenizer.prototype.consumeEscapedCodePoint = function () {
  14774. var codePoint = this.consumeCodePoint();
  14775. if (isHex(codePoint)) {
  14776. var hex = fromCodePoint(codePoint);
  14777. while (isHex(this.peekCodePoint(0)) && hex.length < 6) {
  14778. hex += fromCodePoint(this.consumeCodePoint());
  14779. }
  14780. if (isWhiteSpace(this.peekCodePoint(0))) {
  14781. this.consumeCodePoint();
  14782. }
  14783. var hexCodePoint = parseInt(hex, 16);
  14784. if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) {
  14785. return REPLACEMENT_CHARACTER;
  14786. }
  14787. return hexCodePoint;
  14788. }
  14789. if (codePoint === EOF) {
  14790. return REPLACEMENT_CHARACTER;
  14791. }
  14792. return codePoint;
  14793. };
  14794. Tokenizer.prototype.consumeName = function () {
  14795. var result = '';
  14796. while (true) {
  14797. var codePoint = this.consumeCodePoint();
  14798. if (isNameCodePoint(codePoint)) {
  14799. result += fromCodePoint(codePoint);
  14800. } else
  14801. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  14802. result += fromCodePoint(this.consumeEscapedCodePoint());
  14803. } else
  14804. {
  14805. this.reconsumeCodePoint(codePoint);
  14806. return result;
  14807. }
  14808. }
  14809. };
  14810. return Tokenizer;
  14811. }();
  14812. var Parser = /** @class */function () {
  14813. function Parser(tokens) {
  14814. this._tokens = tokens;
  14815. }
  14816. Parser.create = function (value) {
  14817. var tokenizer = new Tokenizer();
  14818. tokenizer.write(value);
  14819. return new Parser(tokenizer.read());
  14820. };
  14821. Parser.parseValue = function (value) {
  14822. return Parser.create(value).parseComponentValue();
  14823. };
  14824. Parser.parseValues = function (value) {
  14825. return Parser.create(value).parseComponentValues();
  14826. };
  14827. Parser.prototype.parseComponentValue = function () {
  14828. var token = this.consumeToken();
  14829. while (token.type === TokenType.WHITESPACE_TOKEN) {
  14830. token = this.consumeToken();
  14831. }
  14832. if (token.type === TokenType.EOF_TOKEN) {
  14833. throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
  14834. }
  14835. this.reconsumeToken(token);
  14836. var value = this.consumeComponentValue();
  14837. do {
  14838. token = this.consumeToken();
  14839. } while (token.type === TokenType.WHITESPACE_TOKEN);
  14840. if (token.type === TokenType.EOF_TOKEN) {
  14841. return value;
  14842. }
  14843. throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
  14844. };
  14845. Parser.prototype.parseComponentValues = function () {
  14846. var values = [];
  14847. while (true) {
  14848. var value = this.consumeComponentValue();
  14849. if (value.type === TokenType.EOF_TOKEN) {
  14850. return values;
  14851. }
  14852. values.push(value);
  14853. values.push();
  14854. }
  14855. };
  14856. Parser.prototype.consumeComponentValue = function () {
  14857. var token = this.consumeToken();
  14858. switch (token.type) {
  14859. case TokenType.LEFT_CURLY_BRACKET_TOKEN:
  14860. case TokenType.LEFT_SQUARE_BRACKET_TOKEN:
  14861. case TokenType.LEFT_PARENTHESIS_TOKEN:
  14862. return this.consumeSimpleBlock(token.type);
  14863. case TokenType.FUNCTION_TOKEN:
  14864. return this.consumeFunction(token);}
  14865. return token;
  14866. };
  14867. Parser.prototype.consumeSimpleBlock = function (type) {
  14868. var block = { type: type, values: [] };
  14869. var token = this.consumeToken();
  14870. while (true) {
  14871. if (token.type === TokenType.EOF_TOKEN || isEndingTokenFor(token, type)) {
  14872. return block;
  14873. }
  14874. this.reconsumeToken(token);
  14875. block.values.push(this.consumeComponentValue());
  14876. token = this.consumeToken();
  14877. }
  14878. };
  14879. Parser.prototype.consumeFunction = function (functionToken) {
  14880. var cssFunction = {
  14881. name: functionToken.value,
  14882. values: [],
  14883. type: TokenType.FUNCTION };
  14884. while (true) {
  14885. var token = this.consumeToken();
  14886. if (token.type === TokenType.EOF_TOKEN || token.type === TokenType.RIGHT_PARENTHESIS_TOKEN) {
  14887. return cssFunction;
  14888. }
  14889. this.reconsumeToken(token);
  14890. cssFunction.values.push(this.consumeComponentValue());
  14891. }
  14892. };
  14893. Parser.prototype.consumeToken = function () {
  14894. var token = this._tokens.shift();
  14895. return typeof token === 'undefined' ? EOF_TOKEN : token;
  14896. };
  14897. Parser.prototype.reconsumeToken = function (token) {
  14898. this._tokens.unshift(token);
  14899. };
  14900. return Parser;
  14901. }();
  14902. var isDimensionToken = function isDimensionToken(token) {return token.type === TokenType.DIMENSION_TOKEN;};
  14903. var isNumberToken = function isNumberToken(token) {return token.type === TokenType.NUMBER_TOKEN;};
  14904. var isIdentToken = function isIdentToken(token) {return token.type === TokenType.IDENT_TOKEN;};
  14905. var isStringToken = function isStringToken(token) {return token.type === TokenType.STRING_TOKEN;};
  14906. var isIdentWithValue = function isIdentWithValue(token, value) {
  14907. return isIdentToken(token) && token.value === value;
  14908. };
  14909. var nonWhiteSpace = function nonWhiteSpace(token) {return token.type !== TokenType.WHITESPACE_TOKEN;};
  14910. var nonFunctionArgSeparator = function nonFunctionArgSeparator(token) {
  14911. return token.type !== TokenType.WHITESPACE_TOKEN && token.type !== TokenType.COMMA_TOKEN;
  14912. };
  14913. var parseFunctionArgs = function parseFunctionArgs(tokens) {
  14914. var args = [];
  14915. var arg = [];
  14916. tokens.forEach(function (token) {
  14917. if (token.type === TokenType.COMMA_TOKEN) {
  14918. if (arg.length === 0) {
  14919. throw new Error("Error parsing function args, zero tokens for arg");
  14920. }
  14921. args.push(arg);
  14922. arg = [];
  14923. return;
  14924. }
  14925. if (token.type !== TokenType.WHITESPACE_TOKEN) {
  14926. arg.push(token);
  14927. }
  14928. });
  14929. if (arg.length) {
  14930. args.push(arg);
  14931. }
  14932. return args;
  14933. };
  14934. var isEndingTokenFor = function isEndingTokenFor(token, type) {
  14935. if (type === TokenType.LEFT_CURLY_BRACKET_TOKEN && token.type === TokenType.RIGHT_CURLY_BRACKET_TOKEN) {
  14936. return true;
  14937. }
  14938. if (type === TokenType.LEFT_SQUARE_BRACKET_TOKEN && token.type === TokenType.RIGHT_SQUARE_BRACKET_TOKEN) {
  14939. return true;
  14940. }
  14941. return type === TokenType.LEFT_PARENTHESIS_TOKEN && token.type === TokenType.RIGHT_PARENTHESIS_TOKEN;
  14942. };
  14943. var isLength = function isLength(token) {
  14944. return token.type === TokenType.NUMBER_TOKEN || token.type === TokenType.DIMENSION_TOKEN;
  14945. };
  14946. var isLengthPercentage = function isLengthPercentage(token) {
  14947. return token.type === TokenType.PERCENTAGE_TOKEN || isLength(token);
  14948. };
  14949. var parseLengthPercentageTuple = function parseLengthPercentageTuple(tokens) {
  14950. return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
  14951. };
  14952. var ZERO_LENGTH = {
  14953. type: TokenType.NUMBER_TOKEN,
  14954. number: 0,
  14955. flags: FLAG_INTEGER };
  14956. var FIFTY_PERCENT = {
  14957. type: TokenType.PERCENTAGE_TOKEN,
  14958. number: 50,
  14959. flags: FLAG_INTEGER };
  14960. var HUNDRED_PERCENT = {
  14961. type: TokenType.PERCENTAGE_TOKEN,
  14962. number: 100,
  14963. flags: FLAG_INTEGER };
  14964. var getAbsoluteValueForTuple = function getAbsoluteValueForTuple(tuple, width, height) {
  14965. var x = tuple[0],y = tuple[1];
  14966. return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== 'undefined' ? y : x, height)];
  14967. };
  14968. var getAbsoluteValue = function getAbsoluteValue(token, parent) {
  14969. if (token.type === TokenType.PERCENTAGE_TOKEN) {
  14970. return token.number / 100 * parent;
  14971. }
  14972. if (isDimensionToken(token)) {
  14973. switch (token.unit) {
  14974. case 'rem':
  14975. case 'em':
  14976. return 16 * token.number; // TODO use correct font-size
  14977. case 'px':
  14978. default:
  14979. return token.number;}
  14980. }
  14981. return token.number;
  14982. };
  14983. var DEG = 'deg';
  14984. var GRAD = 'grad';
  14985. var RAD = 'rad';
  14986. var TURN = 'turn';
  14987. var angle = {
  14988. name: 'angle',
  14989. parse: function parse(value) {
  14990. if (value.type === TokenType.DIMENSION_TOKEN) {
  14991. switch (value.unit) {
  14992. case DEG:
  14993. return Math.PI * value.number / 180;
  14994. case GRAD:
  14995. return Math.PI / 200 * value.number;
  14996. case RAD:
  14997. return value.number;
  14998. case TURN:
  14999. return Math.PI * 2 * value.number;}
  15000. }
  15001. throw new Error("Unsupported angle type");
  15002. } };
  15003. var isAngle = function isAngle(value) {
  15004. if (value.type === TokenType.DIMENSION_TOKEN) {
  15005. if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
  15006. return true;
  15007. }
  15008. }
  15009. return false;
  15010. };
  15011. var parseNamedSide = function parseNamedSide(tokens) {
  15012. var sideOrCorner = tokens.
  15013. filter(isIdentToken).
  15014. map(function (ident) {return ident.value;}).
  15015. join(' ');
  15016. switch (sideOrCorner) {
  15017. case 'to bottom right':
  15018. case 'to right bottom':
  15019. case 'left top':
  15020. case 'top left':
  15021. return [ZERO_LENGTH, ZERO_LENGTH];
  15022. case 'to top':
  15023. case 'bottom':
  15024. return deg(0);
  15025. case 'to bottom left':
  15026. case 'to left bottom':
  15027. case 'right top':
  15028. case 'top right':
  15029. return [ZERO_LENGTH, HUNDRED_PERCENT];
  15030. case 'to right':
  15031. case 'left':
  15032. return deg(90);
  15033. case 'to top left':
  15034. case 'to left top':
  15035. case 'right bottom':
  15036. case 'bottom right':
  15037. return [HUNDRED_PERCENT, HUNDRED_PERCENT];
  15038. case 'to bottom':
  15039. case 'top':
  15040. return deg(180);
  15041. case 'to top right':
  15042. case 'to right top':
  15043. case 'left bottom':
  15044. case 'bottom left':
  15045. return [HUNDRED_PERCENT, ZERO_LENGTH];
  15046. case 'to left':
  15047. case 'right':
  15048. return deg(270);}
  15049. return 0;
  15050. };
  15051. var deg = function deg(_deg) {return Math.PI * _deg / 180;};
  15052. var color = {
  15053. name: 'color',
  15054. parse: function parse(value) {
  15055. if (value.type === TokenType.FUNCTION) {
  15056. var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
  15057. if (typeof colorFunction === 'undefined') {
  15058. throw new Error("Attempting to parse an unsupported color function \"" + value.name + "\"");
  15059. }
  15060. return colorFunction(value.values);
  15061. }
  15062. if (value.type === TokenType.HASH_TOKEN) {
  15063. if (value.value.length === 3) {
  15064. var r = value.value.substring(0, 1);
  15065. var g = value.value.substring(1, 2);
  15066. var b = value.value.substring(2, 3);
  15067. return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
  15068. }
  15069. if (value.value.length === 4) {
  15070. var r = value.value.substring(0, 1);
  15071. var g = value.value.substring(1, 2);
  15072. var b = value.value.substring(2, 3);
  15073. var a = value.value.substring(3, 4);
  15074. return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a + a, 16) / 255);
  15075. }
  15076. if (value.value.length === 6) {
  15077. var r = value.value.substring(0, 2);
  15078. var g = value.value.substring(2, 4);
  15079. var b = value.value.substring(4, 6);
  15080. return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
  15081. }
  15082. if (value.value.length === 8) {
  15083. var r = value.value.substring(0, 2);
  15084. var g = value.value.substring(2, 4);
  15085. var b = value.value.substring(4, 6);
  15086. var a = value.value.substring(6, 8);
  15087. return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16) / 255);
  15088. }
  15089. }
  15090. if (value.type === TokenType.IDENT_TOKEN) {
  15091. var namedColor = COLORS[value.value.toUpperCase()];
  15092. if (typeof namedColor !== 'undefined') {
  15093. return namedColor;
  15094. }
  15095. }
  15096. return COLORS.TRANSPARENT;
  15097. } };
  15098. var isTransparent = function isTransparent(color) {return (0xff & color) === 0;};
  15099. var asString = function asString(color) {
  15100. var alpha = 0xff & color;
  15101. var blue = 0xff & color >> 8;
  15102. var green = 0xff & color >> 16;
  15103. var red = 0xff & color >> 24;
  15104. return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")";
  15105. };
  15106. var pack = function pack(r, g, b, a) {
  15107. return (r << 24 | g << 16 | b << 8 | Math.round(a * 255) << 0) >>> 0;
  15108. };
  15109. var getTokenColorValue = function getTokenColorValue(token, i) {
  15110. if (token.type === TokenType.NUMBER_TOKEN) {
  15111. return token.number;
  15112. }
  15113. if (token.type === TokenType.PERCENTAGE_TOKEN) {
  15114. var max = i === 3 ? 1 : 255;
  15115. return i === 3 ? token.number / 100 * max : Math.round(token.number / 100 * max);
  15116. }
  15117. return 0;
  15118. };
  15119. var rgb = function rgb(args) {
  15120. var tokens = args.filter(nonFunctionArgSeparator);
  15121. if (tokens.length === 3) {
  15122. var _a = tokens.map(getTokenColorValue),r = _a[0],g = _a[1],b = _a[2];
  15123. return pack(r, g, b, 1);
  15124. }
  15125. if (tokens.length === 4) {
  15126. var _b = tokens.map(getTokenColorValue),r = _b[0],g = _b[1],b = _b[2],a = _b[3];
  15127. return pack(r, g, b, a);
  15128. }
  15129. return 0;
  15130. };
  15131. function hue2rgb(t1, t2, hue) {
  15132. if (hue < 0) {
  15133. hue += 1;
  15134. }
  15135. if (hue >= 1) {
  15136. hue -= 1;
  15137. }
  15138. if (hue < 1 / 6) {
  15139. return (t2 - t1) * hue * 6 + t1;
  15140. } else
  15141. if (hue < 1 / 2) {
  15142. return t2;
  15143. } else
  15144. if (hue < 2 / 3) {
  15145. return (t2 - t1) * 6 * (2 / 3 - hue) + t1;
  15146. } else
  15147. {
  15148. return t1;
  15149. }
  15150. }
  15151. var hsl = function hsl(args) {
  15152. var tokens = args.filter(nonFunctionArgSeparator);
  15153. var hue = tokens[0],saturation = tokens[1],lightness = tokens[2],alpha = tokens[3];
  15154. var h = (hue.type === TokenType.NUMBER_TOKEN ? deg(hue.number) : angle.parse(hue)) / (Math.PI * 2);
  15155. var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
  15156. var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
  15157. var a = typeof alpha !== 'undefined' && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
  15158. if (s === 0) {
  15159. return pack(l * 255, l * 255, l * 255, 1);
  15160. }
  15161. var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
  15162. var t1 = l * 2 - t2;
  15163. var r = hue2rgb(t1, t2, h + 1 / 3);
  15164. var g = hue2rgb(t1, t2, h);
  15165. var b = hue2rgb(t1, t2, h - 1 / 3);
  15166. return pack(r * 255, g * 255, b * 255, a);
  15167. };
  15168. var SUPPORTED_COLOR_FUNCTIONS = {
  15169. hsl: hsl,
  15170. hsla: hsl,
  15171. rgb: rgb,
  15172. rgba: rgb };
  15173. var COLORS = {
  15174. ALICEBLUE: 0xf0f8ffff,
  15175. ANTIQUEWHITE: 0xfaebd7ff,
  15176. AQUA: 0x00ffffff,
  15177. AQUAMARINE: 0x7fffd4ff,
  15178. AZURE: 0xf0ffffff,
  15179. BEIGE: 0xf5f5dcff,
  15180. BISQUE: 0xffe4c4ff,
  15181. BLACK: 0x000000ff,
  15182. BLANCHEDALMOND: 0xffebcdff,
  15183. BLUE: 0x0000ffff,
  15184. BLUEVIOLET: 0x8a2be2ff,
  15185. BROWN: 0xa52a2aff,
  15186. BURLYWOOD: 0xdeb887ff,
  15187. CADETBLUE: 0x5f9ea0ff,
  15188. CHARTREUSE: 0x7fff00ff,
  15189. CHOCOLATE: 0xd2691eff,
  15190. CORAL: 0xff7f50ff,
  15191. CORNFLOWERBLUE: 0x6495edff,
  15192. CORNSILK: 0xfff8dcff,
  15193. CRIMSON: 0xdc143cff,
  15194. CYAN: 0x00ffffff,
  15195. DARKBLUE: 0x00008bff,
  15196. DARKCYAN: 0x008b8bff,
  15197. DARKGOLDENROD: 0xb886bbff,
  15198. DARKGRAY: 0xa9a9a9ff,
  15199. DARKGREEN: 0x006400ff,
  15200. DARKGREY: 0xa9a9a9ff,
  15201. DARKKHAKI: 0xbdb76bff,
  15202. DARKMAGENTA: 0x8b008bff,
  15203. DARKOLIVEGREEN: 0x556b2fff,
  15204. DARKORANGE: 0xff8c00ff,
  15205. DARKORCHID: 0x9932ccff,
  15206. DARKRED: 0x8b0000ff,
  15207. DARKSALMON: 0xe9967aff,
  15208. DARKSEAGREEN: 0x8fbc8fff,
  15209. DARKSLATEBLUE: 0x483d8bff,
  15210. DARKSLATEGRAY: 0x2f4f4fff,
  15211. DARKSLATEGREY: 0x2f4f4fff,
  15212. DARKTURQUOISE: 0x00ced1ff,
  15213. DARKVIOLET: 0x9400d3ff,
  15214. DEEPPINK: 0xff1493ff,
  15215. DEEPSKYBLUE: 0x00bfffff,
  15216. DIMGRAY: 0x696969ff,
  15217. DIMGREY: 0x696969ff,
  15218. DODGERBLUE: 0x1e90ffff,
  15219. FIREBRICK: 0xb22222ff,
  15220. FLORALWHITE: 0xfffaf0ff,
  15221. FORESTGREEN: 0x228b22ff,
  15222. FUCHSIA: 0xff00ffff,
  15223. GAINSBORO: 0xdcdcdcff,
  15224. GHOSTWHITE: 0xf8f8ffff,
  15225. GOLD: 0xffd700ff,
  15226. GOLDENROD: 0xdaa520ff,
  15227. GRAY: 0x808080ff,
  15228. GREEN: 0x008000ff,
  15229. GREENYELLOW: 0xadff2fff,
  15230. GREY: 0x808080ff,
  15231. HONEYDEW: 0xf0fff0ff,
  15232. HOTPINK: 0xff69b4ff,
  15233. INDIANRED: 0xcd5c5cff,
  15234. INDIGO: 0x4b0082ff,
  15235. IVORY: 0xfffff0ff,
  15236. KHAKI: 0xf0e68cff,
  15237. LAVENDER: 0xe6e6faff,
  15238. LAVENDERBLUSH: 0xfff0f5ff,
  15239. LAWNGREEN: 0x7cfc00ff,
  15240. LEMONCHIFFON: 0xfffacdff,
  15241. LIGHTBLUE: 0xadd8e6ff,
  15242. LIGHTCORAL: 0xf08080ff,
  15243. LIGHTCYAN: 0xe0ffffff,
  15244. LIGHTGOLDENRODYELLOW: 0xfafad2ff,
  15245. LIGHTGRAY: 0xd3d3d3ff,
  15246. LIGHTGREEN: 0x90ee90ff,
  15247. LIGHTGREY: 0xd3d3d3ff,
  15248. LIGHTPINK: 0xffb6c1ff,
  15249. LIGHTSALMON: 0xffa07aff,
  15250. LIGHTSEAGREEN: 0x20b2aaff,
  15251. LIGHTSKYBLUE: 0x87cefaff,
  15252. LIGHTSLATEGRAY: 0x778899ff,
  15253. LIGHTSLATEGREY: 0x778899ff,
  15254. LIGHTSTEELBLUE: 0xb0c4deff,
  15255. LIGHTYELLOW: 0xffffe0ff,
  15256. LIME: 0x00ff00ff,
  15257. LIMEGREEN: 0x32cd32ff,
  15258. LINEN: 0xfaf0e6ff,
  15259. MAGENTA: 0xff00ffff,
  15260. MAROON: 0x800000ff,
  15261. MEDIUMAQUAMARINE: 0x66cdaaff,
  15262. MEDIUMBLUE: 0x0000cdff,
  15263. MEDIUMORCHID: 0xba55d3ff,
  15264. MEDIUMPURPLE: 0x9370dbff,
  15265. MEDIUMSEAGREEN: 0x3cb371ff,
  15266. MEDIUMSLATEBLUE: 0x7b68eeff,
  15267. MEDIUMSPRINGGREEN: 0x00fa9aff,
  15268. MEDIUMTURQUOISE: 0x48d1ccff,
  15269. MEDIUMVIOLETRED: 0xc71585ff,
  15270. MIDNIGHTBLUE: 0x191970ff,
  15271. MINTCREAM: 0xf5fffaff,
  15272. MISTYROSE: 0xffe4e1ff,
  15273. MOCCASIN: 0xffe4b5ff,
  15274. NAVAJOWHITE: 0xffdeadff,
  15275. NAVY: 0x000080ff,
  15276. OLDLACE: 0xfdf5e6ff,
  15277. OLIVE: 0x808000ff,
  15278. OLIVEDRAB: 0x6b8e23ff,
  15279. ORANGE: 0xffa500ff,
  15280. ORANGERED: 0xff4500ff,
  15281. ORCHID: 0xda70d6ff,
  15282. PALEGOLDENROD: 0xeee8aaff,
  15283. PALEGREEN: 0x98fb98ff,
  15284. PALETURQUOISE: 0xafeeeeff,
  15285. PALEVIOLETRED: 0xdb7093ff,
  15286. PAPAYAWHIP: 0xffefd5ff,
  15287. PEACHPUFF: 0xffdab9ff,
  15288. PERU: 0xcd853fff,
  15289. PINK: 0xffc0cbff,
  15290. PLUM: 0xdda0ddff,
  15291. POWDERBLUE: 0xb0e0e6ff,
  15292. PURPLE: 0x800080ff,
  15293. REBECCAPURPLE: 0x663399ff,
  15294. RED: 0xff0000ff,
  15295. ROSYBROWN: 0xbc8f8fff,
  15296. ROYALBLUE: 0x4169e1ff,
  15297. SADDLEBROWN: 0x8b4513ff,
  15298. SALMON: 0xfa8072ff,
  15299. SANDYBROWN: 0xf4a460ff,
  15300. SEAGREEN: 0x2e8b57ff,
  15301. SEASHELL: 0xfff5eeff,
  15302. SIENNA: 0xa0522dff,
  15303. SILVER: 0xc0c0c0ff,
  15304. SKYBLUE: 0x87ceebff,
  15305. SLATEBLUE: 0x6a5acdff,
  15306. SLATEGRAY: 0x708090ff,
  15307. SLATEGREY: 0x708090ff,
  15308. SNOW: 0xfffafaff,
  15309. SPRINGGREEN: 0x00ff7fff,
  15310. STEELBLUE: 0x4682b4ff,
  15311. TAN: 0xd2b48cff,
  15312. TEAL: 0x008080ff,
  15313. THISTLE: 0xd8bfd8ff,
  15314. TOMATO: 0xff6347ff,
  15315. TRANSPARENT: 0x00000000,
  15316. TURQUOISE: 0x40e0d0ff,
  15317. VIOLET: 0xee82eeff,
  15318. WHEAT: 0xf5deb3ff,
  15319. WHITE: 0xffffffff,
  15320. WHITESMOKE: 0xf5f5f5ff,
  15321. YELLOW: 0xffff00ff,
  15322. YELLOWGREEN: 0x9acd32ff };
  15323. var PropertyDescriptorParsingType;
  15324. (function (PropertyDescriptorParsingType) {
  15325. PropertyDescriptorParsingType[PropertyDescriptorParsingType["VALUE"] = 0] = "VALUE";
  15326. PropertyDescriptorParsingType[PropertyDescriptorParsingType["LIST"] = 1] = "LIST";
  15327. PropertyDescriptorParsingType[PropertyDescriptorParsingType["IDENT_VALUE"] = 2] = "IDENT_VALUE";
  15328. PropertyDescriptorParsingType[PropertyDescriptorParsingType["TYPE_VALUE"] = 3] = "TYPE_VALUE";
  15329. PropertyDescriptorParsingType[PropertyDescriptorParsingType["TOKEN_VALUE"] = 4] = "TOKEN_VALUE";
  15330. })(PropertyDescriptorParsingType || (PropertyDescriptorParsingType = {}));
  15331. var BACKGROUND_CLIP;
  15332. (function (BACKGROUND_CLIP) {
  15333. BACKGROUND_CLIP[BACKGROUND_CLIP["BORDER_BOX"] = 0] = "BORDER_BOX";
  15334. BACKGROUND_CLIP[BACKGROUND_CLIP["PADDING_BOX"] = 1] = "PADDING_BOX";
  15335. BACKGROUND_CLIP[BACKGROUND_CLIP["CONTENT_BOX"] = 2] = "CONTENT_BOX";
  15336. })(BACKGROUND_CLIP || (BACKGROUND_CLIP = {}));
  15337. var backgroundClip = {
  15338. name: 'background-clip',
  15339. initialValue: 'border-box',
  15340. prefix: false,
  15341. type: PropertyDescriptorParsingType.LIST,
  15342. parse: function parse(tokens) {
  15343. return tokens.map(function (token) {
  15344. if (isIdentToken(token)) {
  15345. switch (token.value) {
  15346. case 'padding-box':
  15347. return BACKGROUND_CLIP.PADDING_BOX;
  15348. case 'content-box':
  15349. return BACKGROUND_CLIP.CONTENT_BOX;}
  15350. }
  15351. return BACKGROUND_CLIP.BORDER_BOX;
  15352. });
  15353. } };
  15354. var backgroundColor = {
  15355. name: "background-color",
  15356. initialValue: 'transparent',
  15357. prefix: false,
  15358. type: PropertyDescriptorParsingType.TYPE_VALUE,
  15359. format: 'color' };
  15360. var parseColorStop = function parseColorStop(args) {
  15361. var color$1 = color.parse(args[0]);
  15362. var stop = args[1];
  15363. return stop && isLengthPercentage(stop) ? { color: color$1, stop: stop } : { color: color$1, stop: null };
  15364. };
  15365. var processColorStops = function processColorStops(stops, lineLength) {
  15366. var first = stops[0];
  15367. var last = stops[stops.length - 1];
  15368. if (first.stop === null) {
  15369. first.stop = ZERO_LENGTH;
  15370. }
  15371. if (last.stop === null) {
  15372. last.stop = HUNDRED_PERCENT;
  15373. }
  15374. var processStops = [];
  15375. var previous = 0;
  15376. for (var i = 0; i < stops.length; i++) {
  15377. var stop_1 = stops[i].stop;
  15378. if (stop_1 !== null) {
  15379. var absoluteValue = getAbsoluteValue(stop_1, lineLength);
  15380. if (absoluteValue > previous) {
  15381. processStops.push(absoluteValue);
  15382. } else
  15383. {
  15384. processStops.push(previous);
  15385. }
  15386. previous = absoluteValue;
  15387. } else
  15388. {
  15389. processStops.push(null);
  15390. }
  15391. }
  15392. var gapBegin = null;
  15393. for (var i = 0; i < processStops.length; i++) {
  15394. var stop_2 = processStops[i];
  15395. if (stop_2 === null) {
  15396. if (gapBegin === null) {
  15397. gapBegin = i;
  15398. }
  15399. } else
  15400. if (gapBegin !== null) {
  15401. var gapLength = i - gapBegin;
  15402. var beforeGap = processStops[gapBegin - 1];
  15403. var gapValue = (stop_2 - beforeGap) / (gapLength + 1);
  15404. for (var g = 1; g <= gapLength; g++) {
  15405. processStops[gapBegin + g - 1] = gapValue * g;
  15406. }
  15407. gapBegin = null;
  15408. }
  15409. }
  15410. return stops.map(function (_a, i) {
  15411. var color = _a.color;
  15412. return { color: color, stop: Math.max(Math.min(1, processStops[i] / lineLength), 0) };
  15413. });
  15414. };
  15415. var getAngleFromCorner = function getAngleFromCorner(corner, width, height) {
  15416. var centerX = width / 2;
  15417. var centerY = height / 2;
  15418. var x = getAbsoluteValue(corner[0], width) - centerX;
  15419. var y = centerY - getAbsoluteValue(corner[1], height);
  15420. return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2);
  15421. };
  15422. var calculateGradientDirection = function calculateGradientDirection(angle, width, height) {
  15423. var radian = typeof angle === 'number' ? angle : getAngleFromCorner(angle, width, height);
  15424. var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
  15425. var halfWidth = width / 2;
  15426. var halfHeight = height / 2;
  15427. var halfLineLength = lineLength / 2;
  15428. var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength;
  15429. var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength;
  15430. return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff];
  15431. };
  15432. var distance = function distance(a, b) {return Math.sqrt(a * a + b * b);};
  15433. var findCorner = function findCorner(width, height, x, y, closest) {
  15434. var corners = [[0, 0], [0, height], [width, 0], [width, height]];
  15435. return corners.reduce(function (stat, corner) {
  15436. var cx = corner[0],cy = corner[1];
  15437. var d = distance(x - cx, y - cy);
  15438. if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
  15439. return {
  15440. optimumCorner: corner,
  15441. optimumDistance: d };
  15442. }
  15443. return stat;
  15444. }, {
  15445. optimumDistance: closest ? Infinity : -Infinity,
  15446. optimumCorner: null }).
  15447. optimumCorner;
  15448. };
  15449. var calculateRadius = function calculateRadius(gradient, x, y, width, height) {
  15450. var rx = 0;
  15451. var ry = 0;
  15452. switch (gradient.size) {
  15453. case CSSRadialExtent.CLOSEST_SIDE:
  15454. // The ending shape is sized so that that it exactly meets the side of the gradient box closest to the gradient’s center.
  15455. // If the shape is an ellipse, it exactly meets the closest side in each dimension.
  15456. if (gradient.shape === CSSRadialShape.CIRCLE) {
  15457. rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
  15458. } else
  15459. if (gradient.shape === CSSRadialShape.ELLIPSE) {
  15460. rx = Math.min(Math.abs(x), Math.abs(x - width));
  15461. ry = Math.min(Math.abs(y), Math.abs(y - height));
  15462. }
  15463. break;
  15464. case CSSRadialExtent.CLOSEST_CORNER:
  15465. // The ending shape is sized so that that it passes through the corner of the gradient box closest to the gradient’s center.
  15466. // If the shape is an ellipse, the ending shape is given the same aspect-ratio it would have if closest-side were specified.
  15467. if (gradient.shape === CSSRadialShape.CIRCLE) {
  15468. rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
  15469. } else
  15470. if (gradient.shape === CSSRadialShape.ELLIPSE) {
  15471. // Compute the ratio ry/rx (which is to be the same as for "closest-side")
  15472. var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
  15473. var _a = findCorner(width, height, x, y, true),cx = _a[0],cy = _a[1];
  15474. rx = distance(cx - x, (cy - y) / c);
  15475. ry = c * rx;
  15476. }
  15477. break;
  15478. case CSSRadialExtent.FARTHEST_SIDE:
  15479. // Same as closest-side, except the ending shape is sized based on the farthest side(s)
  15480. if (gradient.shape === CSSRadialShape.CIRCLE) {
  15481. rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
  15482. } else
  15483. if (gradient.shape === CSSRadialShape.ELLIPSE) {
  15484. rx = Math.max(Math.abs(x), Math.abs(x - width));
  15485. ry = Math.max(Math.abs(y), Math.abs(y - height));
  15486. }
  15487. break;
  15488. case CSSRadialExtent.FARTHEST_CORNER:
  15489. // Same as closest-corner, except the ending shape is sized based on the farthest corner.
  15490. // If the shape is an ellipse, the ending shape is given the same aspect ratio it would have if farthest-side were specified.
  15491. if (gradient.shape === CSSRadialShape.CIRCLE) {
  15492. rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
  15493. } else
  15494. if (gradient.shape === CSSRadialShape.ELLIPSE) {
  15495. // Compute the ratio ry/rx (which is to be the same as for "farthest-side")
  15496. var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
  15497. var _b = findCorner(width, height, x, y, false),cx = _b[0],cy = _b[1];
  15498. rx = distance(cx - x, (cy - y) / c);
  15499. ry = c * rx;
  15500. }
  15501. break;}
  15502. if (Array.isArray(gradient.size)) {
  15503. rx = getAbsoluteValue(gradient.size[0], width);
  15504. ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx;
  15505. }
  15506. return [rx, ry];
  15507. };
  15508. var linearGradient = function linearGradient(tokens) {
  15509. var angle$1 = deg(180);
  15510. var stops = [];
  15511. parseFunctionArgs(tokens).forEach(function (arg, i) {
  15512. if (i === 0) {
  15513. var firstToken = arg[0];
  15514. if (firstToken.type === TokenType.IDENT_TOKEN && firstToken.value === 'to') {
  15515. angle$1 = parseNamedSide(arg);
  15516. return;
  15517. } else
  15518. if (isAngle(firstToken)) {
  15519. angle$1 = angle.parse(firstToken);
  15520. return;
  15521. }
  15522. }
  15523. var colorStop = parseColorStop(arg);
  15524. stops.push(colorStop);
  15525. });
  15526. return { angle: angle$1, stops: stops, type: CSSImageType.LINEAR_GRADIENT };
  15527. };
  15528. var prefixLinearGradient = function prefixLinearGradient(tokens) {
  15529. var angle$1 = deg(180);
  15530. var stops = [];
  15531. parseFunctionArgs(tokens).forEach(function (arg, i) {
  15532. if (i === 0) {
  15533. var firstToken = arg[0];
  15534. if (firstToken.type === TokenType.IDENT_TOKEN &&
  15535. ['top', 'left', 'right', 'bottom'].indexOf(firstToken.value) !== -1) {
  15536. angle$1 = parseNamedSide(arg);
  15537. return;
  15538. } else
  15539. if (isAngle(firstToken)) {
  15540. angle$1 = (angle.parse(firstToken) + deg(270)) % deg(360);
  15541. return;
  15542. }
  15543. }
  15544. var colorStop = parseColorStop(arg);
  15545. stops.push(colorStop);
  15546. });
  15547. return {
  15548. angle: angle$1,
  15549. stops: stops,
  15550. type: CSSImageType.LINEAR_GRADIENT };
  15551. };
  15552. var testRangeBounds = function testRangeBounds(document) {
  15553. var TEST_HEIGHT = 123;
  15554. if (document.createRange) {
  15555. var range = document.createRange();
  15556. if (range.getBoundingClientRect) {
  15557. var testElement = document.createElement('boundtest');
  15558. testElement.style.height = TEST_HEIGHT + "px";
  15559. testElement.style.display = 'block';
  15560. document.body.appendChild(testElement);
  15561. range.selectNode(testElement);
  15562. var rangeBounds = range.getBoundingClientRect();
  15563. var rangeHeight = Math.round(rangeBounds.height);
  15564. document.body.removeChild(testElement);
  15565. if (rangeHeight === TEST_HEIGHT) {
  15566. return true;
  15567. }
  15568. }
  15569. }
  15570. return false;
  15571. };
  15572. var testCORS = function testCORS() {return typeof new Image().crossOrigin !== 'undefined';};
  15573. var testResponseType = function testResponseType() {return typeof new XMLHttpRequest().responseType === 'string';};
  15574. var testSVG = function testSVG(document) {
  15575. var img = new Image();
  15576. var canvas = document.createElement('canvas');
  15577. var ctx = canvas.getContext('2d');
  15578. if (!ctx) {
  15579. return false;
  15580. }
  15581. img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  15582. try {
  15583. ctx.drawImage(img, 0, 0);
  15584. canvas.toDataURL();
  15585. }
  15586. catch (e) {
  15587. return false;
  15588. }
  15589. return true;
  15590. };
  15591. var isGreenPixel = function isGreenPixel(data) {
  15592. return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
  15593. };
  15594. var testForeignObject = function testForeignObject(document) {
  15595. var canvas = document.createElement('canvas');
  15596. var size = 100;
  15597. canvas.width = size;
  15598. canvas.height = size;
  15599. var ctx = canvas.getContext('2d');
  15600. if (!ctx) {
  15601. return Promise.reject(false);
  15602. }
  15603. ctx.fillStyle = 'rgb(0, 255, 0)';
  15604. ctx.fillRect(0, 0, size, size);
  15605. var img = new Image();
  15606. var greenImageSrc = canvas.toDataURL();
  15607. img.src = greenImageSrc;
  15608. var svg = createForeignObjectSVG(size, size, 0, 0, img);
  15609. ctx.fillStyle = 'red';
  15610. ctx.fillRect(0, 0, size, size);
  15611. return loadSerializedSVG(svg).
  15612. then(function (img) {
  15613. ctx.drawImage(img, 0, 0);
  15614. var data = ctx.getImageData(0, 0, size, size).data;
  15615. ctx.fillStyle = 'red';
  15616. ctx.fillRect(0, 0, size, size);
  15617. var node = document.createElement('div');
  15618. node.style.backgroundImage = "url(" + greenImageSrc + ")";
  15619. node.style.height = size + "px";
  15620. // Firefox 55 does not render inline <img /> tags
  15621. return isGreenPixel(data) ?
  15622. loadSerializedSVG(createForeignObjectSVG(size, size, 0, 0, node)) :
  15623. Promise.reject(false);
  15624. }).
  15625. then(function (img) {
  15626. ctx.drawImage(img, 0, 0);
  15627. // Edge does not render background-images
  15628. return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
  15629. }).
  15630. catch(function () {return false;});
  15631. };
  15632. var createForeignObjectSVG = function createForeignObjectSVG(width, height, x, y, node) {
  15633. var xmlns = 'http://www.w3.org/2000/svg';
  15634. var svg = document.createElementNS(xmlns, 'svg');
  15635. var foreignObject = document.createElementNS(xmlns, 'foreignObject');
  15636. svg.setAttributeNS(null, 'width', width.toString());
  15637. svg.setAttributeNS(null, 'height', height.toString());
  15638. foreignObject.setAttributeNS(null, 'width', '100%');
  15639. foreignObject.setAttributeNS(null, 'height', '100%');
  15640. foreignObject.setAttributeNS(null, 'x', x.toString());
  15641. foreignObject.setAttributeNS(null, 'y', y.toString());
  15642. foreignObject.setAttributeNS(null, 'externalResourcesRequired', 'true');
  15643. svg.appendChild(foreignObject);
  15644. foreignObject.appendChild(node);
  15645. return svg;
  15646. };
  15647. var loadSerializedSVG = function loadSerializedSVG(svg) {
  15648. return new Promise(function (resolve, reject) {
  15649. var img = new Image();
  15650. img.onload = function () {return resolve(img);};
  15651. img.onerror = reject;
  15652. img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  15653. });
  15654. };
  15655. var FEATURES = {
  15656. get SUPPORT_RANGE_BOUNDS() {
  15657. var value = testRangeBounds(document);
  15658. Object.defineProperty(FEATURES, 'SUPPORT_RANGE_BOUNDS', { value: value });
  15659. return value;
  15660. },
  15661. get SUPPORT_SVG_DRAWING() {
  15662. var value = testSVG(document);
  15663. Object.defineProperty(FEATURES, 'SUPPORT_SVG_DRAWING', { value: value });
  15664. return value;
  15665. },
  15666. get SUPPORT_FOREIGNOBJECT_DRAWING() {
  15667. var value = typeof Array.from === 'function' && typeof window.fetch === 'function' ?
  15668. testForeignObject(document) :
  15669. Promise.resolve(false);
  15670. Object.defineProperty(FEATURES, 'SUPPORT_FOREIGNOBJECT_DRAWING', { value: value });
  15671. return value;
  15672. },
  15673. get SUPPORT_CORS_IMAGES() {
  15674. var value = testCORS();
  15675. Object.defineProperty(FEATURES, 'SUPPORT_CORS_IMAGES', { value: value });
  15676. return value;
  15677. },
  15678. get SUPPORT_RESPONSE_TYPE() {
  15679. var value = testResponseType();
  15680. Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });
  15681. return value;
  15682. },
  15683. get SUPPORT_CORS_XHR() {
  15684. var value = ('withCredentials' in new XMLHttpRequest());
  15685. Object.defineProperty(FEATURES, 'SUPPORT_CORS_XHR', { value: value });
  15686. return value;
  15687. } };
  15688. var Logger = /** @class */function () {
  15689. function Logger(_a) {
  15690. var id = _a.id,enabled = _a.enabled;
  15691. this.id = id;
  15692. this.enabled = enabled;
  15693. this.start = Date.now();
  15694. }
  15695. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  15696. Logger.prototype.debug = function () {
  15697. var args = [];
  15698. for (var _i = 0; _i < arguments.length; _i++) {
  15699. args[_i] = arguments[_i];
  15700. }
  15701. if (this.enabled) {
  15702. // eslint-disable-next-line no-console
  15703. if (typeof window !== 'undefined' && window.console && typeof console.debug === 'function') {
  15704. // eslint-disable-next-line no-console
  15705. console.debug.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  15706. } else
  15707. {
  15708. this.info.apply(this, args);
  15709. }
  15710. }
  15711. };
  15712. Logger.prototype.getTime = function () {
  15713. return Date.now() - this.start;
  15714. };
  15715. Logger.create = function (options) {
  15716. Logger.instances[options.id] = new Logger(options);
  15717. };
  15718. Logger.destroy = function (id) {
  15719. delete Logger.instances[id];
  15720. };
  15721. Logger.getInstance = function (id) {
  15722. var instance = Logger.instances[id];
  15723. if (typeof instance === 'undefined') {
  15724. throw new Error("No logger instance found with id " + id);
  15725. }
  15726. return instance;
  15727. };
  15728. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  15729. Logger.prototype.info = function () {
  15730. var args = [];
  15731. for (var _i = 0; _i < arguments.length; _i++) {
  15732. args[_i] = arguments[_i];
  15733. }
  15734. if (this.enabled) {
  15735. // eslint-disable-next-line no-console
  15736. if (typeof window !== 'undefined' && window.console && typeof console.info === 'function') {
  15737. // eslint-disable-next-line no-console
  15738. console.info.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  15739. }
  15740. }
  15741. };
  15742. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  15743. Logger.prototype.error = function () {
  15744. var args = [];
  15745. for (var _i = 0; _i < arguments.length; _i++) {
  15746. args[_i] = arguments[_i];
  15747. }
  15748. if (this.enabled) {
  15749. // eslint-disable-next-line no-console
  15750. if (typeof window !== 'undefined' && window.console && typeof console.error === 'function') {
  15751. // eslint-disable-next-line no-console
  15752. console.error.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  15753. } else
  15754. {
  15755. this.info.apply(this, args);
  15756. }
  15757. }
  15758. };
  15759. Logger.instances = {};
  15760. return Logger;
  15761. }();
  15762. var CacheStorage = /** @class */function () {
  15763. function CacheStorage() {
  15764. }
  15765. CacheStorage.create = function (name, options) {
  15766. return CacheStorage._caches[name] = new Cache(name, options);
  15767. };
  15768. CacheStorage.destroy = function (name) {
  15769. delete CacheStorage._caches[name];
  15770. };
  15771. CacheStorage.open = function (name) {
  15772. var cache = CacheStorage._caches[name];
  15773. if (typeof cache !== 'undefined') {
  15774. return cache;
  15775. }
  15776. throw new Error("Cache with key \"" + name + "\" not found");
  15777. };
  15778. CacheStorage.getOrigin = function (url) {
  15779. var link = CacheStorage._link;
  15780. if (!link) {
  15781. return 'about:blank';
  15782. }
  15783. link.href = url;
  15784. link.href = link.href; // IE9, LOL! - http://jsfiddle.net/niklasvh/2e48b/
  15785. return link.protocol + link.hostname + link.port;
  15786. };
  15787. CacheStorage.isSameOrigin = function (src) {
  15788. return CacheStorage.getOrigin(src) === CacheStorage._origin;
  15789. };
  15790. CacheStorage.setContext = function (window) {
  15791. CacheStorage._link = window.document.createElement('a');
  15792. CacheStorage._origin = CacheStorage.getOrigin(window.location.href);
  15793. };
  15794. CacheStorage.getInstance = function () {
  15795. var current = CacheStorage._current;
  15796. if (current === null) {
  15797. throw new Error("No cache instance attached");
  15798. }
  15799. return current;
  15800. };
  15801. CacheStorage.attachInstance = function (cache) {
  15802. CacheStorage._current = cache;
  15803. };
  15804. CacheStorage.detachInstance = function () {
  15805. CacheStorage._current = null;
  15806. };
  15807. CacheStorage._caches = {};
  15808. CacheStorage._origin = 'about:blank';
  15809. CacheStorage._current = null;
  15810. return CacheStorage;
  15811. }();
  15812. var Cache = /** @class */function () {
  15813. function Cache(id, options) {
  15814. this.id = id;
  15815. this._options = options;
  15816. this._cache = {};
  15817. }
  15818. Cache.prototype.addImage = function (src) {
  15819. var result = Promise.resolve();
  15820. if (this.has(src)) {
  15821. return result;
  15822. }
  15823. if (isBlobImage(src) || isRenderable(src)) {
  15824. this._cache[src] = this.loadImage(src);
  15825. return result;
  15826. }
  15827. return result;
  15828. };
  15829. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  15830. Cache.prototype.match = function (src) {
  15831. return this._cache[src];
  15832. };
  15833. Cache.prototype.loadImage = function (key) {
  15834. return __awaiter(this, void 0, void 0, function () {
  15835. var isSameOrigin, useCORS, useProxy, src;
  15836. var _this = this;
  15837. return __generator(this, function (_a) {
  15838. switch (_a.label) {
  15839. case 0:
  15840. isSameOrigin = CacheStorage.isSameOrigin(key);
  15841. useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
  15842. useProxy = !isInlineImage(key) &&
  15843. !isSameOrigin &&
  15844. typeof this._options.proxy === 'string' &&
  15845. FEATURES.SUPPORT_CORS_XHR &&
  15846. !useCORS;
  15847. if (!isSameOrigin && this._options.allowTaint === false && !isInlineImage(key) && !useProxy && !useCORS) {
  15848. return [2 /*return*/];
  15849. }
  15850. src = key;
  15851. if (!useProxy) return [3 /*break*/, 2];
  15852. return [4 /*yield*/, this.proxy(src)];
  15853. case 1:
  15854. src = _a.sent();
  15855. _a.label = 2;
  15856. case 2:
  15857. Logger.getInstance(this.id).debug("Added image " + key.substring(0, 256));
  15858. return [4 /*yield*/, new Promise(function (resolve, reject) {
  15859. var img = new Image();
  15860. img.onload = function () {return resolve(img);};
  15861. img.onerror = reject;
  15862. //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
  15863. if (isInlineBase64Image(src) || useCORS) {
  15864. img.crossOrigin = 'anonymous';
  15865. }
  15866. img.src = src;
  15867. if (img.complete === true) {
  15868. // Inline XML images may fail to parse, throwing an Error later on
  15869. setTimeout(function () {return resolve(img);}, 500);
  15870. }
  15871. if (_this._options.imageTimeout > 0) {
  15872. setTimeout(function () {return reject("Timed out (" + _this._options.imageTimeout + "ms) loading image");}, _this._options.imageTimeout);
  15873. }
  15874. })];
  15875. case 3:return [2 /*return*/, _a.sent()];}
  15876. });
  15877. });
  15878. };
  15879. Cache.prototype.has = function (key) {
  15880. return typeof this._cache[key] !== 'undefined';
  15881. };
  15882. Cache.prototype.keys = function () {
  15883. return Promise.resolve(Object.keys(this._cache));
  15884. };
  15885. Cache.prototype.proxy = function (src) {
  15886. var _this = this;
  15887. var proxy = this._options.proxy;
  15888. if (!proxy) {
  15889. throw new Error('No proxy defined');
  15890. }
  15891. var key = src.substring(0, 256);
  15892. return new Promise(function (resolve, reject) {
  15893. var responseType = FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
  15894. var xhr = new XMLHttpRequest();
  15895. xhr.onload = function () {
  15896. if (xhr.status === 200) {
  15897. if (responseType === 'text') {
  15898. resolve(xhr.response);
  15899. } else
  15900. {
  15901. var reader_1 = new FileReader();
  15902. reader_1.addEventListener('load', function () {return resolve(reader_1.result);}, false);
  15903. reader_1.addEventListener('error', function (e) {return reject(e);}, false);
  15904. reader_1.readAsDataURL(xhr.response);
  15905. }
  15906. } else
  15907. {
  15908. reject("Failed to proxy resource " + key + " with status code " + xhr.status);
  15909. }
  15910. };
  15911. xhr.onerror = reject;
  15912. xhr.open('GET', proxy + "?url=" + encodeURIComponent(src) + "&responseType=" + responseType);
  15913. if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
  15914. xhr.responseType = responseType;
  15915. }
  15916. if (_this._options.imageTimeout) {
  15917. var timeout_1 = _this._options.imageTimeout;
  15918. xhr.timeout = timeout_1;
  15919. xhr.ontimeout = function () {return reject("Timed out (" + timeout_1 + "ms) proxying " + key);};
  15920. }
  15921. xhr.send();
  15922. });
  15923. };
  15924. return Cache;
  15925. }();
  15926. var INLINE_SVG = /^data:image\/svg\+xml/i;
  15927. var INLINE_BASE64 = /^data:image\/.*;base64,/i;
  15928. var INLINE_IMG = /^data:image\/.*/i;
  15929. var isRenderable = function isRenderable(src) {return FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);};
  15930. var isInlineImage = function isInlineImage(src) {return INLINE_IMG.test(src);};
  15931. var isInlineBase64Image = function isInlineBase64Image(src) {return INLINE_BASE64.test(src);};
  15932. var isBlobImage = function isBlobImage(src) {return src.substr(0, 4) === 'blob';};
  15933. var isSVG = function isSVG(src) {return src.substr(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);};
  15934. var webkitGradient = function webkitGradient(tokens) {
  15935. var angle = deg(180);
  15936. var stops = [];
  15937. var type = CSSImageType.LINEAR_GRADIENT;
  15938. var shape = CSSRadialShape.CIRCLE;
  15939. var size = CSSRadialExtent.FARTHEST_CORNER;
  15940. var position = [];
  15941. parseFunctionArgs(tokens).forEach(function (arg, i) {
  15942. var firstToken = arg[0];
  15943. if (i === 0) {
  15944. if (isIdentToken(firstToken) && firstToken.value === 'linear') {
  15945. type = CSSImageType.LINEAR_GRADIENT;
  15946. return;
  15947. } else
  15948. if (isIdentToken(firstToken) && firstToken.value === 'radial') {
  15949. type = CSSImageType.RADIAL_GRADIENT;
  15950. return;
  15951. }
  15952. }
  15953. if (firstToken.type === TokenType.FUNCTION) {
  15954. if (firstToken.name === 'from') {
  15955. var color$1 = color.parse(firstToken.values[0]);
  15956. stops.push({ stop: ZERO_LENGTH, color: color$1 });
  15957. } else
  15958. if (firstToken.name === 'to') {
  15959. var color$1 = color.parse(firstToken.values[0]);
  15960. stops.push({ stop: HUNDRED_PERCENT, color: color$1 });
  15961. } else
  15962. if (firstToken.name === 'color-stop') {
  15963. var values = firstToken.values.filter(nonFunctionArgSeparator);
  15964. if (values.length === 2) {
  15965. var color$1 = color.parse(values[1]);
  15966. var stop_1 = values[0];
  15967. if (isNumberToken(stop_1)) {
  15968. stops.push({
  15969. stop: { type: TokenType.PERCENTAGE_TOKEN, number: stop_1.number * 100, flags: stop_1.flags },
  15970. color: color$1 });
  15971. }
  15972. }
  15973. }
  15974. }
  15975. });
  15976. return type === CSSImageType.LINEAR_GRADIENT ?
  15977. {
  15978. angle: (angle + deg(180)) % deg(360),
  15979. stops: stops,
  15980. type: type } :
  15981. { size: size, shape: shape, stops: stops, position: position, type: type };
  15982. };
  15983. var CLOSEST_SIDE = 'closest-side';
  15984. var FARTHEST_SIDE = 'farthest-side';
  15985. var CLOSEST_CORNER = 'closest-corner';
  15986. var FARTHEST_CORNER = 'farthest-corner';
  15987. var CIRCLE = 'circle';
  15988. var ELLIPSE = 'ellipse';
  15989. var COVER = 'cover';
  15990. var CONTAIN = 'contain';
  15991. var radialGradient = function radialGradient(tokens) {
  15992. var shape = CSSRadialShape.CIRCLE;
  15993. var size = CSSRadialExtent.FARTHEST_CORNER;
  15994. var stops = [];
  15995. var position = [];
  15996. parseFunctionArgs(tokens).forEach(function (arg, i) {
  15997. var isColorStop = true;
  15998. if (i === 0) {
  15999. var isAtPosition_1 = false;
  16000. isColorStop = arg.reduce(function (acc, token) {
  16001. if (isAtPosition_1) {
  16002. if (isIdentToken(token)) {
  16003. switch (token.value) {
  16004. case 'center':
  16005. position.push(FIFTY_PERCENT);
  16006. return acc;
  16007. case 'top':
  16008. case 'left':
  16009. position.push(ZERO_LENGTH);
  16010. return acc;
  16011. case 'right':
  16012. case 'bottom':
  16013. position.push(HUNDRED_PERCENT);
  16014. return acc;}
  16015. } else
  16016. if (isLengthPercentage(token) || isLength(token)) {
  16017. position.push(token);
  16018. }
  16019. } else
  16020. if (isIdentToken(token)) {
  16021. switch (token.value) {
  16022. case CIRCLE:
  16023. shape = CSSRadialShape.CIRCLE;
  16024. return false;
  16025. case ELLIPSE:
  16026. shape = CSSRadialShape.ELLIPSE;
  16027. return false;
  16028. case 'at':
  16029. isAtPosition_1 = true;
  16030. return false;
  16031. case CLOSEST_SIDE:
  16032. size = CSSRadialExtent.CLOSEST_SIDE;
  16033. return false;
  16034. case COVER:
  16035. case FARTHEST_SIDE:
  16036. size = CSSRadialExtent.FARTHEST_SIDE;
  16037. return false;
  16038. case CONTAIN:
  16039. case CLOSEST_CORNER:
  16040. size = CSSRadialExtent.CLOSEST_CORNER;
  16041. return false;
  16042. case FARTHEST_CORNER:
  16043. size = CSSRadialExtent.FARTHEST_CORNER;
  16044. return false;}
  16045. } else
  16046. if (isLength(token) || isLengthPercentage(token)) {
  16047. if (!Array.isArray(size)) {
  16048. size = [];
  16049. }
  16050. size.push(token);
  16051. return false;
  16052. }
  16053. return acc;
  16054. }, isColorStop);
  16055. }
  16056. if (isColorStop) {
  16057. var colorStop = parseColorStop(arg);
  16058. stops.push(colorStop);
  16059. }
  16060. });
  16061. return { size: size, shape: shape, stops: stops, position: position, type: CSSImageType.RADIAL_GRADIENT };
  16062. };
  16063. var prefixRadialGradient = function prefixRadialGradient(tokens) {
  16064. var shape = CSSRadialShape.CIRCLE;
  16065. var size = CSSRadialExtent.FARTHEST_CORNER;
  16066. var stops = [];
  16067. var position = [];
  16068. parseFunctionArgs(tokens).forEach(function (arg, i) {
  16069. var isColorStop = true;
  16070. if (i === 0) {
  16071. isColorStop = arg.reduce(function (acc, token) {
  16072. if (isIdentToken(token)) {
  16073. switch (token.value) {
  16074. case 'center':
  16075. position.push(FIFTY_PERCENT);
  16076. return false;
  16077. case 'top':
  16078. case 'left':
  16079. position.push(ZERO_LENGTH);
  16080. return false;
  16081. case 'right':
  16082. case 'bottom':
  16083. position.push(HUNDRED_PERCENT);
  16084. return false;}
  16085. } else
  16086. if (isLengthPercentage(token) || isLength(token)) {
  16087. position.push(token);
  16088. return false;
  16089. }
  16090. return acc;
  16091. }, isColorStop);
  16092. } else
  16093. if (i === 1) {
  16094. isColorStop = arg.reduce(function (acc, token) {
  16095. if (isIdentToken(token)) {
  16096. switch (token.value) {
  16097. case CIRCLE:
  16098. shape = CSSRadialShape.CIRCLE;
  16099. return false;
  16100. case ELLIPSE:
  16101. shape = CSSRadialShape.ELLIPSE;
  16102. return false;
  16103. case CONTAIN:
  16104. case CLOSEST_SIDE:
  16105. size = CSSRadialExtent.CLOSEST_SIDE;
  16106. return false;
  16107. case FARTHEST_SIDE:
  16108. size = CSSRadialExtent.FARTHEST_SIDE;
  16109. return false;
  16110. case CLOSEST_CORNER:
  16111. size = CSSRadialExtent.CLOSEST_CORNER;
  16112. return false;
  16113. case COVER:
  16114. case FARTHEST_CORNER:
  16115. size = CSSRadialExtent.FARTHEST_CORNER;
  16116. return false;}
  16117. } else
  16118. if (isLength(token) || isLengthPercentage(token)) {
  16119. if (!Array.isArray(size)) {
  16120. size = [];
  16121. }
  16122. size.push(token);
  16123. return false;
  16124. }
  16125. return acc;
  16126. }, isColorStop);
  16127. }
  16128. if (isColorStop) {
  16129. var colorStop = parseColorStop(arg);
  16130. stops.push(colorStop);
  16131. }
  16132. });
  16133. return { size: size, shape: shape, stops: stops, position: position, type: CSSImageType.RADIAL_GRADIENT };
  16134. };
  16135. var CSSImageType;
  16136. (function (CSSImageType) {
  16137. CSSImageType[CSSImageType["URL"] = 0] = "URL";
  16138. CSSImageType[CSSImageType["LINEAR_GRADIENT"] = 1] = "LINEAR_GRADIENT";
  16139. CSSImageType[CSSImageType["RADIAL_GRADIENT"] = 2] = "RADIAL_GRADIENT";
  16140. })(CSSImageType || (CSSImageType = {}));
  16141. var isLinearGradient = function isLinearGradient(background) {
  16142. return background.type === CSSImageType.LINEAR_GRADIENT;
  16143. };
  16144. var isRadialGradient = function isRadialGradient(background) {
  16145. return background.type === CSSImageType.RADIAL_GRADIENT;
  16146. };
  16147. var CSSRadialShape;
  16148. (function (CSSRadialShape) {
  16149. CSSRadialShape[CSSRadialShape["CIRCLE"] = 0] = "CIRCLE";
  16150. CSSRadialShape[CSSRadialShape["ELLIPSE"] = 1] = "ELLIPSE";
  16151. })(CSSRadialShape || (CSSRadialShape = {}));
  16152. var CSSRadialExtent;
  16153. (function (CSSRadialExtent) {
  16154. CSSRadialExtent[CSSRadialExtent["CLOSEST_SIDE"] = 0] = "CLOSEST_SIDE";
  16155. CSSRadialExtent[CSSRadialExtent["FARTHEST_SIDE"] = 1] = "FARTHEST_SIDE";
  16156. CSSRadialExtent[CSSRadialExtent["CLOSEST_CORNER"] = 2] = "CLOSEST_CORNER";
  16157. CSSRadialExtent[CSSRadialExtent["FARTHEST_CORNER"] = 3] = "FARTHEST_CORNER";
  16158. })(CSSRadialExtent || (CSSRadialExtent = {}));
  16159. var image = {
  16160. name: 'image',
  16161. parse: function parse(value) {
  16162. if (value.type === TokenType.URL_TOKEN) {
  16163. var image_1 = { url: value.value, type: CSSImageType.URL };
  16164. CacheStorage.getInstance().addImage(value.value);
  16165. return image_1;
  16166. }
  16167. if (value.type === TokenType.FUNCTION) {
  16168. var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
  16169. if (typeof imageFunction === 'undefined') {
  16170. throw new Error("Attempting to parse an unsupported image function \"" + value.name + "\"");
  16171. }
  16172. return imageFunction(value.values);
  16173. }
  16174. throw new Error("Unsupported image type");
  16175. } };
  16176. function isSupportedImage(value) {
  16177. return value.type !== TokenType.FUNCTION || SUPPORTED_IMAGE_FUNCTIONS[value.name];
  16178. }
  16179. var SUPPORTED_IMAGE_FUNCTIONS = {
  16180. 'linear-gradient': linearGradient,
  16181. '-moz-linear-gradient': prefixLinearGradient,
  16182. '-ms-linear-gradient': prefixLinearGradient,
  16183. '-o-linear-gradient': prefixLinearGradient,
  16184. '-webkit-linear-gradient': prefixLinearGradient,
  16185. 'radial-gradient': radialGradient,
  16186. '-moz-radial-gradient': prefixRadialGradient,
  16187. '-ms-radial-gradient': prefixRadialGradient,
  16188. '-o-radial-gradient': prefixRadialGradient,
  16189. '-webkit-radial-gradient': prefixRadialGradient,
  16190. '-webkit-gradient': webkitGradient };
  16191. var backgroundImage = {
  16192. name: 'background-image',
  16193. initialValue: 'none',
  16194. type: PropertyDescriptorParsingType.LIST,
  16195. prefix: false,
  16196. parse: function parse(tokens) {
  16197. if (tokens.length === 0) {
  16198. return [];
  16199. }
  16200. var first = tokens[0];
  16201. if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') {
  16202. return [];
  16203. }
  16204. return tokens.filter(function (value) {return nonFunctionArgSeparator(value) && isSupportedImage(value);}).map(image.parse);
  16205. } };
  16206. var backgroundOrigin = {
  16207. name: 'background-origin',
  16208. initialValue: 'border-box',
  16209. prefix: false,
  16210. type: PropertyDescriptorParsingType.LIST,
  16211. parse: function parse(tokens) {
  16212. return tokens.map(function (token) {
  16213. if (isIdentToken(token)) {
  16214. switch (token.value) {
  16215. case 'padding-box':
  16216. return 1 /* PADDING_BOX */;
  16217. case 'content-box':
  16218. return 2 /* CONTENT_BOX */;}
  16219. }
  16220. return 0 /* BORDER_BOX */;
  16221. });
  16222. } };
  16223. var backgroundPosition = {
  16224. name: 'background-position',
  16225. initialValue: '0% 0%',
  16226. type: PropertyDescriptorParsingType.LIST,
  16227. prefix: false,
  16228. parse: function parse(tokens) {
  16229. return parseFunctionArgs(tokens).
  16230. map(function (values) {return values.filter(isLengthPercentage);}).
  16231. map(parseLengthPercentageTuple);
  16232. } };
  16233. var BACKGROUND_REPEAT;
  16234. (function (BACKGROUND_REPEAT) {
  16235. BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT"] = 0] = "REPEAT";
  16236. BACKGROUND_REPEAT[BACKGROUND_REPEAT["NO_REPEAT"] = 1] = "NO_REPEAT";
  16237. BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT_X"] = 2] = "REPEAT_X";
  16238. BACKGROUND_REPEAT[BACKGROUND_REPEAT["REPEAT_Y"] = 3] = "REPEAT_Y";
  16239. })(BACKGROUND_REPEAT || (BACKGROUND_REPEAT = {}));
  16240. var backgroundRepeat = {
  16241. name: 'background-repeat',
  16242. initialValue: 'repeat',
  16243. prefix: false,
  16244. type: PropertyDescriptorParsingType.LIST,
  16245. parse: function parse(tokens) {
  16246. return parseFunctionArgs(tokens).
  16247. map(function (values) {
  16248. return values.
  16249. filter(isIdentToken).
  16250. map(function (token) {return token.value;}).
  16251. join(' ');
  16252. }).
  16253. map(parseBackgroundRepeat);
  16254. } };
  16255. var parseBackgroundRepeat = function parseBackgroundRepeat(value) {
  16256. switch (value) {
  16257. case 'no-repeat':
  16258. return BACKGROUND_REPEAT.NO_REPEAT;
  16259. case 'repeat-x':
  16260. case 'repeat no-repeat':
  16261. return BACKGROUND_REPEAT.REPEAT_X;
  16262. case 'repeat-y':
  16263. case 'no-repeat repeat':
  16264. return BACKGROUND_REPEAT.REPEAT_Y;
  16265. case 'repeat':
  16266. default:
  16267. return BACKGROUND_REPEAT.REPEAT;}
  16268. };
  16269. var BACKGROUND_SIZE;
  16270. (function (BACKGROUND_SIZE) {
  16271. BACKGROUND_SIZE["AUTO"] = "auto";
  16272. BACKGROUND_SIZE["CONTAIN"] = "contain";
  16273. BACKGROUND_SIZE["COVER"] = "cover";
  16274. })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {}));
  16275. var backgroundSize = {
  16276. name: 'background-size',
  16277. initialValue: '0',
  16278. prefix: false,
  16279. type: PropertyDescriptorParsingType.LIST,
  16280. parse: function parse(tokens) {
  16281. return parseFunctionArgs(tokens).map(function (values) {return values.filter(isBackgroundSizeInfoToken);});
  16282. } };
  16283. var isBackgroundSizeInfoToken = function isBackgroundSizeInfoToken(value) {
  16284. return isIdentToken(value) || isLengthPercentage(value);
  16285. };
  16286. var borderColorForSide = function borderColorForSide(side) {return {
  16287. name: "border-" + side + "-color",
  16288. initialValue: 'transparent',
  16289. prefix: false,
  16290. type: PropertyDescriptorParsingType.TYPE_VALUE,
  16291. format: 'color' };
  16292. };
  16293. var borderTopColor = borderColorForSide('top');
  16294. var borderRightColor = borderColorForSide('right');
  16295. var borderBottomColor = borderColorForSide('bottom');
  16296. var borderLeftColor = borderColorForSide('left');
  16297. var borderRadiusForSide = function borderRadiusForSide(side) {return {
  16298. name: "border-radius-" + side,
  16299. initialValue: '0 0',
  16300. prefix: false,
  16301. type: PropertyDescriptorParsingType.LIST,
  16302. parse: function parse(tokens) {return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));} };
  16303. };
  16304. var borderTopLeftRadius = borderRadiusForSide('top-left');
  16305. var borderTopRightRadius = borderRadiusForSide('top-right');
  16306. var borderBottomRightRadius = borderRadiusForSide('bottom-right');
  16307. var borderBottomLeftRadius = borderRadiusForSide('bottom-left');
  16308. var BORDER_STYLE;
  16309. (function (BORDER_STYLE) {
  16310. BORDER_STYLE[BORDER_STYLE["NONE"] = 0] = "NONE";
  16311. BORDER_STYLE[BORDER_STYLE["SOLID"] = 1] = "SOLID";
  16312. })(BORDER_STYLE || (BORDER_STYLE = {}));
  16313. var borderStyleForSide = function borderStyleForSide(side) {return {
  16314. name: "border-" + side + "-style",
  16315. initialValue: 'solid',
  16316. prefix: false,
  16317. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16318. parse: function parse(style) {
  16319. switch (style) {
  16320. case 'none':
  16321. return BORDER_STYLE.NONE;}
  16322. return BORDER_STYLE.SOLID;
  16323. } };
  16324. };
  16325. var borderTopStyle = borderStyleForSide('top');
  16326. var borderRightStyle = borderStyleForSide('right');
  16327. var borderBottomStyle = borderStyleForSide('bottom');
  16328. var borderLeftStyle = borderStyleForSide('left');
  16329. var borderWidthForSide = function borderWidthForSide(side) {return {
  16330. name: "border-" + side + "-width",
  16331. initialValue: '0',
  16332. type: PropertyDescriptorParsingType.VALUE,
  16333. prefix: false,
  16334. parse: function parse(token) {
  16335. if (isDimensionToken(token)) {
  16336. return token.number;
  16337. }
  16338. return 0;
  16339. } };
  16340. };
  16341. var borderTopWidth = borderWidthForSide('top');
  16342. var borderRightWidth = borderWidthForSide('right');
  16343. var borderBottomWidth = borderWidthForSide('bottom');
  16344. var borderLeftWidth = borderWidthForSide('left');
  16345. var color$1 = {
  16346. name: "color",
  16347. initialValue: 'transparent',
  16348. prefix: false,
  16349. type: PropertyDescriptorParsingType.TYPE_VALUE,
  16350. format: 'color' };
  16351. var display = {
  16352. name: 'display',
  16353. initialValue: 'inline-block',
  16354. prefix: false,
  16355. type: PropertyDescriptorParsingType.LIST,
  16356. parse: function parse(tokens) {
  16357. return tokens.filter(isIdentToken).reduce(function (bit, token) {
  16358. return bit | parseDisplayValue(token.value);
  16359. }, 0 /* NONE */);
  16360. } };
  16361. var parseDisplayValue = function parseDisplayValue(display) {
  16362. switch (display) {
  16363. case 'block':
  16364. return 2 /* BLOCK */;
  16365. case 'inline':
  16366. return 4 /* INLINE */;
  16367. case 'run-in':
  16368. return 8 /* RUN_IN */;
  16369. case 'flow':
  16370. return 16 /* FLOW */;
  16371. case 'flow-root':
  16372. return 32 /* FLOW_ROOT */;
  16373. case 'table':
  16374. return 64 /* TABLE */;
  16375. case 'flex':
  16376. case '-webkit-flex':
  16377. return 128 /* FLEX */;
  16378. case 'grid':
  16379. case '-ms-grid':
  16380. return 256 /* GRID */;
  16381. case 'ruby':
  16382. return 512 /* RUBY */;
  16383. case 'subgrid':
  16384. return 1024 /* SUBGRID */;
  16385. case 'list-item':
  16386. return 2048 /* LIST_ITEM */;
  16387. case 'table-row-group':
  16388. return 4096 /* TABLE_ROW_GROUP */;
  16389. case 'table-header-group':
  16390. return 8192 /* TABLE_HEADER_GROUP */;
  16391. case 'table-footer-group':
  16392. return 16384 /* TABLE_FOOTER_GROUP */;
  16393. case 'table-row':
  16394. return 32768 /* TABLE_ROW */;
  16395. case 'table-cell':
  16396. return 65536 /* TABLE_CELL */;
  16397. case 'table-column-group':
  16398. return 131072 /* TABLE_COLUMN_GROUP */;
  16399. case 'table-column':
  16400. return 262144 /* TABLE_COLUMN */;
  16401. case 'table-caption':
  16402. return 524288 /* TABLE_CAPTION */;
  16403. case 'ruby-base':
  16404. return 1048576 /* RUBY_BASE */;
  16405. case 'ruby-text':
  16406. return 2097152 /* RUBY_TEXT */;
  16407. case 'ruby-base-container':
  16408. return 4194304 /* RUBY_BASE_CONTAINER */;
  16409. case 'ruby-text-container':
  16410. return 8388608 /* RUBY_TEXT_CONTAINER */;
  16411. case 'contents':
  16412. return 16777216 /* CONTENTS */;
  16413. case 'inline-block':
  16414. return 33554432 /* INLINE_BLOCK */;
  16415. case 'inline-list-item':
  16416. return 67108864 /* INLINE_LIST_ITEM */;
  16417. case 'inline-table':
  16418. return 134217728 /* INLINE_TABLE */;
  16419. case 'inline-flex':
  16420. return 268435456 /* INLINE_FLEX */;
  16421. case 'inline-grid':
  16422. return 536870912 /* INLINE_GRID */;}
  16423. return 0 /* NONE */;
  16424. };
  16425. var FLOAT;
  16426. (function (FLOAT) {
  16427. FLOAT[FLOAT["NONE"] = 0] = "NONE";
  16428. FLOAT[FLOAT["LEFT"] = 1] = "LEFT";
  16429. FLOAT[FLOAT["RIGHT"] = 2] = "RIGHT";
  16430. FLOAT[FLOAT["INLINE_START"] = 3] = "INLINE_START";
  16431. FLOAT[FLOAT["INLINE_END"] = 4] = "INLINE_END";
  16432. })(FLOAT || (FLOAT = {}));
  16433. var _float = {
  16434. name: 'float',
  16435. initialValue: 'none',
  16436. prefix: false,
  16437. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16438. parse: function parse(_float2) {
  16439. switch (_float2) {
  16440. case 'left':
  16441. return FLOAT.LEFT;
  16442. case 'right':
  16443. return FLOAT.RIGHT;
  16444. case 'inline-start':
  16445. return FLOAT.INLINE_START;
  16446. case 'inline-end':
  16447. return FLOAT.INLINE_END;}
  16448. return FLOAT.NONE;
  16449. } };
  16450. var letterSpacing = {
  16451. name: 'letter-spacing',
  16452. initialValue: '0',
  16453. prefix: false,
  16454. type: PropertyDescriptorParsingType.VALUE,
  16455. parse: function parse(token) {
  16456. if (token.type === TokenType.IDENT_TOKEN && token.value === 'normal') {
  16457. return 0;
  16458. }
  16459. if (token.type === TokenType.NUMBER_TOKEN) {
  16460. return token.number;
  16461. }
  16462. if (token.type === TokenType.DIMENSION_TOKEN) {
  16463. return token.number;
  16464. }
  16465. return 0;
  16466. } };
  16467. var LINE_BREAK;
  16468. (function (LINE_BREAK) {
  16469. LINE_BREAK["NORMAL"] = "normal";
  16470. LINE_BREAK["STRICT"] = "strict";
  16471. })(LINE_BREAK || (LINE_BREAK = {}));
  16472. var lineBreak = {
  16473. name: 'line-break',
  16474. initialValue: 'normal',
  16475. prefix: false,
  16476. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16477. parse: function parse(lineBreak) {
  16478. switch (lineBreak) {
  16479. case 'strict':
  16480. return LINE_BREAK.STRICT;
  16481. case 'normal':
  16482. default:
  16483. return LINE_BREAK.NORMAL;}
  16484. } };
  16485. var lineHeight = {
  16486. name: 'line-height',
  16487. initialValue: 'normal',
  16488. prefix: false,
  16489. type: PropertyDescriptorParsingType.TOKEN_VALUE };
  16490. var computeLineHeight = function computeLineHeight(token, fontSize) {
  16491. if (isIdentToken(token) && token.value === 'normal') {
  16492. return 1.2 * fontSize;
  16493. } else
  16494. if (token.type === TokenType.NUMBER_TOKEN) {
  16495. return fontSize * token.number;
  16496. } else
  16497. if (isLengthPercentage(token)) {
  16498. return getAbsoluteValue(token, fontSize);
  16499. }
  16500. return fontSize;
  16501. };
  16502. var listStyleImage = {
  16503. name: 'list-style-image',
  16504. initialValue: 'none',
  16505. type: PropertyDescriptorParsingType.VALUE,
  16506. prefix: false,
  16507. parse: function parse(token) {
  16508. if (token.type === TokenType.IDENT_TOKEN && token.value === 'none') {
  16509. return null;
  16510. }
  16511. return image.parse(token);
  16512. } };
  16513. var LIST_STYLE_POSITION;
  16514. (function (LIST_STYLE_POSITION) {
  16515. LIST_STYLE_POSITION[LIST_STYLE_POSITION["INSIDE"] = 0] = "INSIDE";
  16516. LIST_STYLE_POSITION[LIST_STYLE_POSITION["OUTSIDE"] = 1] = "OUTSIDE";
  16517. })(LIST_STYLE_POSITION || (LIST_STYLE_POSITION = {}));
  16518. var listStylePosition = {
  16519. name: 'list-style-position',
  16520. initialValue: 'outside',
  16521. prefix: false,
  16522. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16523. parse: function parse(position) {
  16524. switch (position) {
  16525. case 'inside':
  16526. return LIST_STYLE_POSITION.INSIDE;
  16527. case 'outside':
  16528. default:
  16529. return LIST_STYLE_POSITION.OUTSIDE;}
  16530. } };
  16531. var LIST_STYLE_TYPE;
  16532. (function (LIST_STYLE_TYPE) {
  16533. LIST_STYLE_TYPE[LIST_STYLE_TYPE["NONE"] = -1] = "NONE";
  16534. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISC"] = 0] = "DISC";
  16535. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CIRCLE"] = 1] = "CIRCLE";
  16536. LIST_STYLE_TYPE[LIST_STYLE_TYPE["SQUARE"] = 2] = "SQUARE";
  16537. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DECIMAL"] = 3] = "DECIMAL";
  16538. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_DECIMAL"] = 4] = "CJK_DECIMAL";
  16539. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DECIMAL_LEADING_ZERO"] = 5] = "DECIMAL_LEADING_ZERO";
  16540. LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ROMAN"] = 6] = "LOWER_ROMAN";
  16541. LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ROMAN"] = 7] = "UPPER_ROMAN";
  16542. LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_GREEK"] = 8] = "LOWER_GREEK";
  16543. LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ALPHA"] = 9] = "LOWER_ALPHA";
  16544. LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ALPHA"] = 10] = "UPPER_ALPHA";
  16545. LIST_STYLE_TYPE[LIST_STYLE_TYPE["ARABIC_INDIC"] = 11] = "ARABIC_INDIC";
  16546. LIST_STYLE_TYPE[LIST_STYLE_TYPE["ARMENIAN"] = 12] = "ARMENIAN";
  16547. LIST_STYLE_TYPE[LIST_STYLE_TYPE["BENGALI"] = 13] = "BENGALI";
  16548. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CAMBODIAN"] = 14] = "CAMBODIAN";
  16549. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_EARTHLY_BRANCH"] = 15] = "CJK_EARTHLY_BRANCH";
  16550. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_HEAVENLY_STEM"] = 16] = "CJK_HEAVENLY_STEM";
  16551. LIST_STYLE_TYPE[LIST_STYLE_TYPE["CJK_IDEOGRAPHIC"] = 17] = "CJK_IDEOGRAPHIC";
  16552. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DEVANAGARI"] = 18] = "DEVANAGARI";
  16553. LIST_STYLE_TYPE[LIST_STYLE_TYPE["ETHIOPIC_NUMERIC"] = 19] = "ETHIOPIC_NUMERIC";
  16554. LIST_STYLE_TYPE[LIST_STYLE_TYPE["GEORGIAN"] = 20] = "GEORGIAN";
  16555. LIST_STYLE_TYPE[LIST_STYLE_TYPE["GUJARATI"] = 21] = "GUJARATI";
  16556. LIST_STYLE_TYPE[LIST_STYLE_TYPE["GURMUKHI"] = 22] = "GURMUKHI";
  16557. LIST_STYLE_TYPE[LIST_STYLE_TYPE["HEBREW"] = 22] = "HEBREW";
  16558. LIST_STYLE_TYPE[LIST_STYLE_TYPE["HIRAGANA"] = 23] = "HIRAGANA";
  16559. LIST_STYLE_TYPE[LIST_STYLE_TYPE["HIRAGANA_IROHA"] = 24] = "HIRAGANA_IROHA";
  16560. LIST_STYLE_TYPE[LIST_STYLE_TYPE["JAPANESE_FORMAL"] = 25] = "JAPANESE_FORMAL";
  16561. LIST_STYLE_TYPE[LIST_STYLE_TYPE["JAPANESE_INFORMAL"] = 26] = "JAPANESE_INFORMAL";
  16562. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KANNADA"] = 27] = "KANNADA";
  16563. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KATAKANA"] = 28] = "KATAKANA";
  16564. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KATAKANA_IROHA"] = 29] = "KATAKANA_IROHA";
  16565. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KHMER"] = 30] = "KHMER";
  16566. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANGUL_FORMAL"] = 31] = "KOREAN_HANGUL_FORMAL";
  16567. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANJA_FORMAL"] = 32] = "KOREAN_HANJA_FORMAL";
  16568. LIST_STYLE_TYPE[LIST_STYLE_TYPE["KOREAN_HANJA_INFORMAL"] = 33] = "KOREAN_HANJA_INFORMAL";
  16569. LIST_STYLE_TYPE[LIST_STYLE_TYPE["LAO"] = 34] = "LAO";
  16570. LIST_STYLE_TYPE[LIST_STYLE_TYPE["LOWER_ARMENIAN"] = 35] = "LOWER_ARMENIAN";
  16571. LIST_STYLE_TYPE[LIST_STYLE_TYPE["MALAYALAM"] = 36] = "MALAYALAM";
  16572. LIST_STYLE_TYPE[LIST_STYLE_TYPE["MONGOLIAN"] = 37] = "MONGOLIAN";
  16573. LIST_STYLE_TYPE[LIST_STYLE_TYPE["MYANMAR"] = 38] = "MYANMAR";
  16574. LIST_STYLE_TYPE[LIST_STYLE_TYPE["ORIYA"] = 39] = "ORIYA";
  16575. LIST_STYLE_TYPE[LIST_STYLE_TYPE["PERSIAN"] = 40] = "PERSIAN";
  16576. LIST_STYLE_TYPE[LIST_STYLE_TYPE["SIMP_CHINESE_FORMAL"] = 41] = "SIMP_CHINESE_FORMAL";
  16577. LIST_STYLE_TYPE[LIST_STYLE_TYPE["SIMP_CHINESE_INFORMAL"] = 42] = "SIMP_CHINESE_INFORMAL";
  16578. LIST_STYLE_TYPE[LIST_STYLE_TYPE["TAMIL"] = 43] = "TAMIL";
  16579. LIST_STYLE_TYPE[LIST_STYLE_TYPE["TELUGU"] = 44] = "TELUGU";
  16580. LIST_STYLE_TYPE[LIST_STYLE_TYPE["THAI"] = 45] = "THAI";
  16581. LIST_STYLE_TYPE[LIST_STYLE_TYPE["TIBETAN"] = 46] = "TIBETAN";
  16582. LIST_STYLE_TYPE[LIST_STYLE_TYPE["TRAD_CHINESE_FORMAL"] = 47] = "TRAD_CHINESE_FORMAL";
  16583. LIST_STYLE_TYPE[LIST_STYLE_TYPE["TRAD_CHINESE_INFORMAL"] = 48] = "TRAD_CHINESE_INFORMAL";
  16584. LIST_STYLE_TYPE[LIST_STYLE_TYPE["UPPER_ARMENIAN"] = 49] = "UPPER_ARMENIAN";
  16585. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISCLOSURE_OPEN"] = 50] = "DISCLOSURE_OPEN";
  16586. LIST_STYLE_TYPE[LIST_STYLE_TYPE["DISCLOSURE_CLOSED"] = 51] = "DISCLOSURE_CLOSED";
  16587. })(LIST_STYLE_TYPE || (LIST_STYLE_TYPE = {}));
  16588. var listStyleType = {
  16589. name: 'list-style-type',
  16590. initialValue: 'none',
  16591. prefix: false,
  16592. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16593. parse: function parse(type) {
  16594. switch (type) {
  16595. case 'disc':
  16596. return LIST_STYLE_TYPE.DISC;
  16597. case 'circle':
  16598. return LIST_STYLE_TYPE.CIRCLE;
  16599. case 'square':
  16600. return LIST_STYLE_TYPE.SQUARE;
  16601. case 'decimal':
  16602. return LIST_STYLE_TYPE.DECIMAL;
  16603. case 'cjk-decimal':
  16604. return LIST_STYLE_TYPE.CJK_DECIMAL;
  16605. case 'decimal-leading-zero':
  16606. return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
  16607. case 'lower-roman':
  16608. return LIST_STYLE_TYPE.LOWER_ROMAN;
  16609. case 'upper-roman':
  16610. return LIST_STYLE_TYPE.UPPER_ROMAN;
  16611. case 'lower-greek':
  16612. return LIST_STYLE_TYPE.LOWER_GREEK;
  16613. case 'lower-alpha':
  16614. return LIST_STYLE_TYPE.LOWER_ALPHA;
  16615. case 'upper-alpha':
  16616. return LIST_STYLE_TYPE.UPPER_ALPHA;
  16617. case 'arabic-indic':
  16618. return LIST_STYLE_TYPE.ARABIC_INDIC;
  16619. case 'armenian':
  16620. return LIST_STYLE_TYPE.ARMENIAN;
  16621. case 'bengali':
  16622. return LIST_STYLE_TYPE.BENGALI;
  16623. case 'cambodian':
  16624. return LIST_STYLE_TYPE.CAMBODIAN;
  16625. case 'cjk-earthly-branch':
  16626. return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;
  16627. case 'cjk-heavenly-stem':
  16628. return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;
  16629. case 'cjk-ideographic':
  16630. return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;
  16631. case 'devanagari':
  16632. return LIST_STYLE_TYPE.DEVANAGARI;
  16633. case 'ethiopic-numeric':
  16634. return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;
  16635. case 'georgian':
  16636. return LIST_STYLE_TYPE.GEORGIAN;
  16637. case 'gujarati':
  16638. return LIST_STYLE_TYPE.GUJARATI;
  16639. case 'gurmukhi':
  16640. return LIST_STYLE_TYPE.GURMUKHI;
  16641. case 'hebrew':
  16642. return LIST_STYLE_TYPE.HEBREW;
  16643. case 'hiragana':
  16644. return LIST_STYLE_TYPE.HIRAGANA;
  16645. case 'hiragana-iroha':
  16646. return LIST_STYLE_TYPE.HIRAGANA_IROHA;
  16647. case 'japanese-formal':
  16648. return LIST_STYLE_TYPE.JAPANESE_FORMAL;
  16649. case 'japanese-informal':
  16650. return LIST_STYLE_TYPE.JAPANESE_INFORMAL;
  16651. case 'kannada':
  16652. return LIST_STYLE_TYPE.KANNADA;
  16653. case 'katakana':
  16654. return LIST_STYLE_TYPE.KATAKANA;
  16655. case 'katakana-iroha':
  16656. return LIST_STYLE_TYPE.KATAKANA_IROHA;
  16657. case 'khmer':
  16658. return LIST_STYLE_TYPE.KHMER;
  16659. case 'korean-hangul-formal':
  16660. return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;
  16661. case 'korean-hanja-formal':
  16662. return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;
  16663. case 'korean-hanja-informal':
  16664. return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;
  16665. case 'lao':
  16666. return LIST_STYLE_TYPE.LAO;
  16667. case 'lower-armenian':
  16668. return LIST_STYLE_TYPE.LOWER_ARMENIAN;
  16669. case 'malayalam':
  16670. return LIST_STYLE_TYPE.MALAYALAM;
  16671. case 'mongolian':
  16672. return LIST_STYLE_TYPE.MONGOLIAN;
  16673. case 'myanmar':
  16674. return LIST_STYLE_TYPE.MYANMAR;
  16675. case 'oriya':
  16676. return LIST_STYLE_TYPE.ORIYA;
  16677. case 'persian':
  16678. return LIST_STYLE_TYPE.PERSIAN;
  16679. case 'simp-chinese-formal':
  16680. return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;
  16681. case 'simp-chinese-informal':
  16682. return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;
  16683. case 'tamil':
  16684. return LIST_STYLE_TYPE.TAMIL;
  16685. case 'telugu':
  16686. return LIST_STYLE_TYPE.TELUGU;
  16687. case 'thai':
  16688. return LIST_STYLE_TYPE.THAI;
  16689. case 'tibetan':
  16690. return LIST_STYLE_TYPE.TIBETAN;
  16691. case 'trad-chinese-formal':
  16692. return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;
  16693. case 'trad-chinese-informal':
  16694. return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;
  16695. case 'upper-armenian':
  16696. return LIST_STYLE_TYPE.UPPER_ARMENIAN;
  16697. case 'disclosure-open':
  16698. return LIST_STYLE_TYPE.DISCLOSURE_OPEN;
  16699. case 'disclosure-closed':
  16700. return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;
  16701. case 'none':
  16702. default:
  16703. return LIST_STYLE_TYPE.NONE;}
  16704. } };
  16705. var marginForSide = function marginForSide(side) {return {
  16706. name: "margin-" + side,
  16707. initialValue: '0',
  16708. prefix: false,
  16709. type: PropertyDescriptorParsingType.TOKEN_VALUE };
  16710. };
  16711. var marginTop = marginForSide('top');
  16712. var marginRight = marginForSide('right');
  16713. var marginBottom = marginForSide('bottom');
  16714. var marginLeft = marginForSide('left');
  16715. var OVERFLOW;
  16716. (function (OVERFLOW) {
  16717. OVERFLOW[OVERFLOW["VISIBLE"] = 0] = "VISIBLE";
  16718. OVERFLOW[OVERFLOW["HIDDEN"] = 1] = "HIDDEN";
  16719. OVERFLOW[OVERFLOW["SCROLL"] = 2] = "SCROLL";
  16720. OVERFLOW[OVERFLOW["AUTO"] = 3] = "AUTO";
  16721. })(OVERFLOW || (OVERFLOW = {}));
  16722. var overflow = {
  16723. name: 'overflow',
  16724. initialValue: 'visible',
  16725. prefix: false,
  16726. type: PropertyDescriptorParsingType.LIST,
  16727. parse: function parse(tokens) {
  16728. return tokens.filter(isIdentToken).map(function (overflow) {
  16729. switch (overflow.value) {
  16730. case 'hidden':
  16731. return OVERFLOW.HIDDEN;
  16732. case 'scroll':
  16733. return OVERFLOW.SCROLL;
  16734. case 'auto':
  16735. return OVERFLOW.AUTO;
  16736. case 'visible':
  16737. default:
  16738. return OVERFLOW.VISIBLE;}
  16739. });
  16740. } };
  16741. var OVERFLOW_WRAP;
  16742. (function (OVERFLOW_WRAP) {
  16743. OVERFLOW_WRAP["NORMAL"] = "normal";
  16744. OVERFLOW_WRAP["BREAK_WORD"] = "break-word";
  16745. })(OVERFLOW_WRAP || (OVERFLOW_WRAP = {}));
  16746. var overflowWrap = {
  16747. name: 'overflow-wrap',
  16748. initialValue: 'normal',
  16749. prefix: false,
  16750. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16751. parse: function parse(overflow) {
  16752. switch (overflow) {
  16753. case 'break-word':
  16754. return OVERFLOW_WRAP.BREAK_WORD;
  16755. case 'normal':
  16756. default:
  16757. return OVERFLOW_WRAP.NORMAL;}
  16758. } };
  16759. var paddingForSide = function paddingForSide(side) {return {
  16760. name: "padding-" + side,
  16761. initialValue: '0',
  16762. prefix: false,
  16763. type: PropertyDescriptorParsingType.TYPE_VALUE,
  16764. format: 'length-percentage' };
  16765. };
  16766. var paddingTop = paddingForSide('top');
  16767. var paddingRight = paddingForSide('right');
  16768. var paddingBottom = paddingForSide('bottom');
  16769. var paddingLeft = paddingForSide('left');
  16770. var TEXT_ALIGN;
  16771. (function (TEXT_ALIGN) {
  16772. TEXT_ALIGN[TEXT_ALIGN["LEFT"] = 0] = "LEFT";
  16773. TEXT_ALIGN[TEXT_ALIGN["CENTER"] = 1] = "CENTER";
  16774. TEXT_ALIGN[TEXT_ALIGN["RIGHT"] = 2] = "RIGHT";
  16775. })(TEXT_ALIGN || (TEXT_ALIGN = {}));
  16776. var textAlign = {
  16777. name: 'text-align',
  16778. initialValue: 'left',
  16779. prefix: false,
  16780. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16781. parse: function parse(textAlign) {
  16782. switch (textAlign) {
  16783. case 'right':
  16784. return TEXT_ALIGN.RIGHT;
  16785. case 'center':
  16786. case 'justify':
  16787. return TEXT_ALIGN.CENTER;
  16788. case 'left':
  16789. default:
  16790. return TEXT_ALIGN.LEFT;}
  16791. } };
  16792. var POSITION;
  16793. (function (POSITION) {
  16794. POSITION[POSITION["STATIC"] = 0] = "STATIC";
  16795. POSITION[POSITION["RELATIVE"] = 1] = "RELATIVE";
  16796. POSITION[POSITION["ABSOLUTE"] = 2] = "ABSOLUTE";
  16797. POSITION[POSITION["FIXED"] = 3] = "FIXED";
  16798. POSITION[POSITION["STICKY"] = 4] = "STICKY";
  16799. })(POSITION || (POSITION = {}));
  16800. var position = {
  16801. name: 'position',
  16802. initialValue: 'static',
  16803. prefix: false,
  16804. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16805. parse: function parse(position) {
  16806. switch (position) {
  16807. case 'relative':
  16808. return POSITION.RELATIVE;
  16809. case 'absolute':
  16810. return POSITION.ABSOLUTE;
  16811. case 'fixed':
  16812. return POSITION.FIXED;
  16813. case 'sticky':
  16814. return POSITION.STICKY;}
  16815. return POSITION.STATIC;
  16816. } };
  16817. var textShadow = {
  16818. name: 'text-shadow',
  16819. initialValue: 'none',
  16820. type: PropertyDescriptorParsingType.LIST,
  16821. prefix: false,
  16822. parse: function parse(tokens) {
  16823. if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
  16824. return [];
  16825. }
  16826. return parseFunctionArgs(tokens).map(function (values) {
  16827. var shadow = {
  16828. color: COLORS.TRANSPARENT,
  16829. offsetX: ZERO_LENGTH,
  16830. offsetY: ZERO_LENGTH,
  16831. blur: ZERO_LENGTH };
  16832. var c = 0;
  16833. for (var i = 0; i < values.length; i++) {
  16834. var token = values[i];
  16835. if (isLength(token)) {
  16836. if (c === 0) {
  16837. shadow.offsetX = token;
  16838. } else
  16839. if (c === 1) {
  16840. shadow.offsetY = token;
  16841. } else
  16842. {
  16843. shadow.blur = token;
  16844. }
  16845. c++;
  16846. } else
  16847. {
  16848. shadow.color = color.parse(token);
  16849. }
  16850. }
  16851. return shadow;
  16852. });
  16853. } };
  16854. var TEXT_TRANSFORM;
  16855. (function (TEXT_TRANSFORM) {
  16856. TEXT_TRANSFORM[TEXT_TRANSFORM["NONE"] = 0] = "NONE";
  16857. TEXT_TRANSFORM[TEXT_TRANSFORM["LOWERCASE"] = 1] = "LOWERCASE";
  16858. TEXT_TRANSFORM[TEXT_TRANSFORM["UPPERCASE"] = 2] = "UPPERCASE";
  16859. TEXT_TRANSFORM[TEXT_TRANSFORM["CAPITALIZE"] = 3] = "CAPITALIZE";
  16860. })(TEXT_TRANSFORM || (TEXT_TRANSFORM = {}));
  16861. var textTransform = {
  16862. name: 'text-transform',
  16863. initialValue: 'none',
  16864. prefix: false,
  16865. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16866. parse: function parse(textTransform) {
  16867. switch (textTransform) {
  16868. case 'uppercase':
  16869. return TEXT_TRANSFORM.UPPERCASE;
  16870. case 'lowercase':
  16871. return TEXT_TRANSFORM.LOWERCASE;
  16872. case 'capitalize':
  16873. return TEXT_TRANSFORM.CAPITALIZE;}
  16874. return TEXT_TRANSFORM.NONE;
  16875. } };
  16876. var transform = {
  16877. name: 'transform',
  16878. initialValue: 'none',
  16879. prefix: true,
  16880. type: PropertyDescriptorParsingType.VALUE,
  16881. parse: function parse(token) {
  16882. if (token.type === TokenType.IDENT_TOKEN && token.value === 'none') {
  16883. return null;
  16884. }
  16885. if (token.type === TokenType.FUNCTION) {
  16886. var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
  16887. if (typeof transformFunction === 'undefined') {
  16888. throw new Error("Attempting to parse an unsupported transform function \"" + token.name + "\"");
  16889. }
  16890. return transformFunction(token.values);
  16891. }
  16892. return null;
  16893. } };
  16894. var matrix = function matrix(args) {
  16895. var values = args.filter(function (arg) {return arg.type === TokenType.NUMBER_TOKEN;}).map(function (arg) {return arg.number;});
  16896. return values.length === 6 ? values : null;
  16897. };
  16898. // doesn't support 3D transforms at the moment
  16899. var matrix3d = function matrix3d(args) {
  16900. var values = args.filter(function (arg) {return arg.type === TokenType.NUMBER_TOKEN;}).map(function (arg) {return arg.number;});
  16901. var a1 = values[0],b1 = values[1],_a = values[2],_b = values[3],a2 = values[4],b2 = values[5],_c = values[6],_d = values[7],_e = values[8],_f = values[9],_g = values[10],_h = values[11],a4 = values[12],b4 = values[13],_j = values[14],_k = values[15];
  16902. return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
  16903. };
  16904. var SUPPORTED_TRANSFORM_FUNCTIONS = {
  16905. matrix: matrix,
  16906. matrix3d: matrix3d };
  16907. var DEFAULT_VALUE = {
  16908. type: TokenType.PERCENTAGE_TOKEN,
  16909. number: 50,
  16910. flags: FLAG_INTEGER };
  16911. var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
  16912. var transformOrigin = {
  16913. name: 'transform-origin',
  16914. initialValue: '50% 50%',
  16915. prefix: true,
  16916. type: PropertyDescriptorParsingType.LIST,
  16917. parse: function parse(tokens) {
  16918. var origins = tokens.filter(isLengthPercentage);
  16919. if (origins.length !== 2) {
  16920. return DEFAULT;
  16921. }
  16922. return [origins[0], origins[1]];
  16923. } };
  16924. var VISIBILITY;
  16925. (function (VISIBILITY) {
  16926. VISIBILITY[VISIBILITY["VISIBLE"] = 0] = "VISIBLE";
  16927. VISIBILITY[VISIBILITY["HIDDEN"] = 1] = "HIDDEN";
  16928. VISIBILITY[VISIBILITY["COLLAPSE"] = 2] = "COLLAPSE";
  16929. })(VISIBILITY || (VISIBILITY = {}));
  16930. var visibility = {
  16931. name: 'visible',
  16932. initialValue: 'none',
  16933. prefix: false,
  16934. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16935. parse: function parse(visibility) {
  16936. switch (visibility) {
  16937. case 'hidden':
  16938. return VISIBILITY.HIDDEN;
  16939. case 'collapse':
  16940. return VISIBILITY.COLLAPSE;
  16941. case 'visible':
  16942. default:
  16943. return VISIBILITY.VISIBLE;}
  16944. } };
  16945. var WORD_BREAK;
  16946. (function (WORD_BREAK) {
  16947. WORD_BREAK["NORMAL"] = "normal";
  16948. WORD_BREAK["BREAK_ALL"] = "break-all";
  16949. WORD_BREAK["KEEP_ALL"] = "keep-all";
  16950. })(WORD_BREAK || (WORD_BREAK = {}));
  16951. var wordBreak = {
  16952. name: 'word-break',
  16953. initialValue: 'normal',
  16954. prefix: false,
  16955. type: PropertyDescriptorParsingType.IDENT_VALUE,
  16956. parse: function parse(wordBreak) {
  16957. switch (wordBreak) {
  16958. case 'break-all':
  16959. return WORD_BREAK.BREAK_ALL;
  16960. case 'keep-all':
  16961. return WORD_BREAK.KEEP_ALL;
  16962. case 'normal':
  16963. default:
  16964. return WORD_BREAK.NORMAL;}
  16965. } };
  16966. var zIndex = {
  16967. name: 'z-index',
  16968. initialValue: 'auto',
  16969. prefix: false,
  16970. type: PropertyDescriptorParsingType.VALUE,
  16971. parse: function parse(token) {
  16972. if (token.type === TokenType.IDENT_TOKEN) {
  16973. return { auto: true, order: 0 };
  16974. }
  16975. if (isNumberToken(token)) {
  16976. return { auto: false, order: token.number };
  16977. }
  16978. throw new Error("Invalid z-index number parsed");
  16979. } };
  16980. var opacity = {
  16981. name: 'opacity',
  16982. initialValue: '1',
  16983. type: PropertyDescriptorParsingType.VALUE,
  16984. prefix: false,
  16985. parse: function parse(token) {
  16986. if (isNumberToken(token)) {
  16987. return token.number;
  16988. }
  16989. return 1;
  16990. } };
  16991. var textDecorationColor = {
  16992. name: "text-decoration-color",
  16993. initialValue: 'transparent',
  16994. prefix: false,
  16995. type: PropertyDescriptorParsingType.TYPE_VALUE,
  16996. format: 'color' };
  16997. var textDecorationLine = {
  16998. name: 'text-decoration-line',
  16999. initialValue: 'none',
  17000. prefix: false,
  17001. type: PropertyDescriptorParsingType.LIST,
  17002. parse: function parse(tokens) {
  17003. return tokens.
  17004. filter(isIdentToken).
  17005. map(function (token) {
  17006. switch (token.value) {
  17007. case 'underline':
  17008. return 1 /* UNDERLINE */;
  17009. case 'overline':
  17010. return 2 /* OVERLINE */;
  17011. case 'line-through':
  17012. return 3 /* LINE_THROUGH */;
  17013. case 'none':
  17014. return 4 /* BLINK */;}
  17015. return 0 /* NONE */;
  17016. }).
  17017. filter(function (line) {return line !== 0 /* NONE */;});
  17018. } };
  17019. var fontFamily = {
  17020. name: "font-family",
  17021. initialValue: '',
  17022. prefix: false,
  17023. type: PropertyDescriptorParsingType.LIST,
  17024. parse: function parse(tokens) {
  17025. var accumulator = [];
  17026. var results = [];
  17027. tokens.forEach(function (token) {
  17028. switch (token.type) {
  17029. case TokenType.IDENT_TOKEN:
  17030. case TokenType.STRING_TOKEN:
  17031. accumulator.push(token.value);
  17032. break;
  17033. case TokenType.NUMBER_TOKEN:
  17034. accumulator.push(token.number.toString());
  17035. break;
  17036. case TokenType.COMMA_TOKEN:
  17037. results.push(accumulator.join(' '));
  17038. accumulator.length = 0;
  17039. break;}
  17040. });
  17041. if (accumulator.length) {
  17042. results.push(accumulator.join(' '));
  17043. }
  17044. return results.map(function (result) {return result.indexOf(' ') === -1 ? result : "'" + result + "'";});
  17045. } };
  17046. var fontSize = {
  17047. name: "font-size",
  17048. initialValue: '0',
  17049. prefix: false,
  17050. type: PropertyDescriptorParsingType.TYPE_VALUE,
  17051. format: 'length' };
  17052. var fontWeight = {
  17053. name: 'font-weight',
  17054. initialValue: 'normal',
  17055. type: PropertyDescriptorParsingType.VALUE,
  17056. prefix: false,
  17057. parse: function parse(token) {
  17058. if (isNumberToken(token)) {
  17059. return token.number;
  17060. }
  17061. if (isIdentToken(token)) {
  17062. switch (token.value) {
  17063. case 'bold':
  17064. return 700;
  17065. case 'normal':
  17066. default:
  17067. return 400;}
  17068. }
  17069. return 400;
  17070. } };
  17071. var fontVariant = {
  17072. name: 'font-variant',
  17073. initialValue: 'none',
  17074. type: PropertyDescriptorParsingType.LIST,
  17075. prefix: false,
  17076. parse: function parse(tokens) {
  17077. return tokens.filter(isIdentToken).map(function (token) {return token.value;});
  17078. } };
  17079. var FONT_STYLE;
  17080. (function (FONT_STYLE) {
  17081. FONT_STYLE["NORMAL"] = "normal";
  17082. FONT_STYLE["ITALIC"] = "italic";
  17083. FONT_STYLE["OBLIQUE"] = "oblique";
  17084. })(FONT_STYLE || (FONT_STYLE = {}));
  17085. var fontStyle = {
  17086. name: 'font-style',
  17087. initialValue: 'normal',
  17088. prefix: false,
  17089. type: PropertyDescriptorParsingType.IDENT_VALUE,
  17090. parse: function parse(overflow) {
  17091. switch (overflow) {
  17092. case 'oblique':
  17093. return FONT_STYLE.OBLIQUE;
  17094. case 'italic':
  17095. return FONT_STYLE.ITALIC;
  17096. case 'normal':
  17097. default:
  17098. return FONT_STYLE.NORMAL;}
  17099. } };
  17100. var contains = function contains(bit, value) {return (bit & value) !== 0;};
  17101. var content = {
  17102. name: 'content',
  17103. initialValue: 'none',
  17104. type: PropertyDescriptorParsingType.LIST,
  17105. prefix: false,
  17106. parse: function parse(tokens) {
  17107. if (tokens.length === 0) {
  17108. return [];
  17109. }
  17110. var first = tokens[0];
  17111. if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') {
  17112. return [];
  17113. }
  17114. return tokens;
  17115. } };
  17116. var counterIncrement = {
  17117. name: 'counter-increment',
  17118. initialValue: 'none',
  17119. prefix: true,
  17120. type: PropertyDescriptorParsingType.LIST,
  17121. parse: function parse(tokens) {
  17122. if (tokens.length === 0) {
  17123. return null;
  17124. }
  17125. var first = tokens[0];
  17126. if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') {
  17127. return null;
  17128. }
  17129. var increments = [];
  17130. var filtered = tokens.filter(nonWhiteSpace);
  17131. for (var i = 0; i < filtered.length; i++) {
  17132. var counter = filtered[i];
  17133. var next = filtered[i + 1];
  17134. if (counter.type === TokenType.IDENT_TOKEN) {
  17135. var increment = next && isNumberToken(next) ? next.number : 1;
  17136. increments.push({ counter: counter.value, increment: increment });
  17137. }
  17138. }
  17139. return increments;
  17140. } };
  17141. var counterReset = {
  17142. name: 'counter-reset',
  17143. initialValue: 'none',
  17144. prefix: true,
  17145. type: PropertyDescriptorParsingType.LIST,
  17146. parse: function parse(tokens) {
  17147. if (tokens.length === 0) {
  17148. return [];
  17149. }
  17150. var resets = [];
  17151. var filtered = tokens.filter(nonWhiteSpace);
  17152. for (var i = 0; i < filtered.length; i++) {
  17153. var counter = filtered[i];
  17154. var next = filtered[i + 1];
  17155. if (isIdentToken(counter) && counter.value !== 'none') {
  17156. var reset = next && isNumberToken(next) ? next.number : 0;
  17157. resets.push({ counter: counter.value, reset: reset });
  17158. }
  17159. }
  17160. return resets;
  17161. } };
  17162. var quotes = {
  17163. name: 'quotes',
  17164. initialValue: 'none',
  17165. prefix: true,
  17166. type: PropertyDescriptorParsingType.LIST,
  17167. parse: function parse(tokens) {
  17168. if (tokens.length === 0) {
  17169. return null;
  17170. }
  17171. var first = tokens[0];
  17172. if (first.type === TokenType.IDENT_TOKEN && first.value === 'none') {
  17173. return null;
  17174. }
  17175. var quotes = [];
  17176. var filtered = tokens.filter(isStringToken);
  17177. if (filtered.length % 2 !== 0) {
  17178. return null;
  17179. }
  17180. for (var i = 0; i < filtered.length; i += 2) {
  17181. var open_1 = filtered[i].value;
  17182. var close_1 = filtered[i + 1].value;
  17183. quotes.push({ open: open_1, close: close_1 });
  17184. }
  17185. return quotes;
  17186. } };
  17187. var getQuote = function getQuote(quotes, depth, open) {
  17188. if (!quotes) {
  17189. return '';
  17190. }
  17191. var quote = quotes[Math.min(depth, quotes.length - 1)];
  17192. if (!quote) {
  17193. return '';
  17194. }
  17195. return open ? quote.open : quote.close;
  17196. };
  17197. var boxShadow = {
  17198. name: 'box-shadow',
  17199. initialValue: 'none',
  17200. type: PropertyDescriptorParsingType.LIST,
  17201. prefix: false,
  17202. parse: function parse(tokens) {
  17203. if (tokens.length === 1 && isIdentWithValue(tokens[0], 'none')) {
  17204. return [];
  17205. }
  17206. return parseFunctionArgs(tokens).map(function (values) {
  17207. var shadow = {
  17208. color: 0x000000ff,
  17209. offsetX: ZERO_LENGTH,
  17210. offsetY: ZERO_LENGTH,
  17211. blur: ZERO_LENGTH,
  17212. spread: ZERO_LENGTH,
  17213. inset: false };
  17214. var c = 0;
  17215. for (var i = 0; i < values.length; i++) {
  17216. var token = values[i];
  17217. if (isIdentWithValue(token, 'inset')) {
  17218. shadow.inset = true;
  17219. } else
  17220. if (isLength(token)) {
  17221. if (c === 0) {
  17222. shadow.offsetX = token;
  17223. } else
  17224. if (c === 1) {
  17225. shadow.offsetY = token;
  17226. } else
  17227. if (c === 2) {
  17228. shadow.blur = token;
  17229. } else
  17230. {
  17231. shadow.spread = token;
  17232. }
  17233. c++;
  17234. } else
  17235. {
  17236. shadow.color = color.parse(token);
  17237. }
  17238. }
  17239. return shadow;
  17240. });
  17241. } };
  17242. var CSSParsedDeclaration = /** @class */function () {
  17243. function CSSParsedDeclaration(declaration) {
  17244. this.backgroundClip = parse(backgroundClip, declaration.backgroundClip);
  17245. this.backgroundColor = parse(backgroundColor, declaration.backgroundColor);
  17246. this.backgroundImage = parse(backgroundImage, declaration.backgroundImage);
  17247. this.backgroundOrigin = parse(backgroundOrigin, declaration.backgroundOrigin);
  17248. this.backgroundPosition = parse(backgroundPosition, declaration.backgroundPosition);
  17249. this.backgroundRepeat = parse(backgroundRepeat, declaration.backgroundRepeat);
  17250. this.backgroundSize = parse(backgroundSize, declaration.backgroundSize);
  17251. this.borderTopColor = parse(borderTopColor, declaration.borderTopColor);
  17252. this.borderRightColor = parse(borderRightColor, declaration.borderRightColor);
  17253. this.borderBottomColor = parse(borderBottomColor, declaration.borderBottomColor);
  17254. this.borderLeftColor = parse(borderLeftColor, declaration.borderLeftColor);
  17255. this.borderTopLeftRadius = parse(borderTopLeftRadius, declaration.borderTopLeftRadius);
  17256. this.borderTopRightRadius = parse(borderTopRightRadius, declaration.borderTopRightRadius);
  17257. this.borderBottomRightRadius = parse(borderBottomRightRadius, declaration.borderBottomRightRadius);
  17258. this.borderBottomLeftRadius = parse(borderBottomLeftRadius, declaration.borderBottomLeftRadius);
  17259. this.borderTopStyle = parse(borderTopStyle, declaration.borderTopStyle);
  17260. this.borderRightStyle = parse(borderRightStyle, declaration.borderRightStyle);
  17261. this.borderBottomStyle = parse(borderBottomStyle, declaration.borderBottomStyle);
  17262. this.borderLeftStyle = parse(borderLeftStyle, declaration.borderLeftStyle);
  17263. this.borderTopWidth = parse(borderTopWidth, declaration.borderTopWidth);
  17264. this.borderRightWidth = parse(borderRightWidth, declaration.borderRightWidth);
  17265. this.borderBottomWidth = parse(borderBottomWidth, declaration.borderBottomWidth);
  17266. this.borderLeftWidth = parse(borderLeftWidth, declaration.borderLeftWidth);
  17267. this.boxShadow = parse(boxShadow, declaration.boxShadow);
  17268. this.color = parse(color$1, declaration.color);
  17269. this.display = parse(display, declaration.display);
  17270. this.float = parse(_float, declaration.cssFloat);
  17271. this.fontFamily = parse(fontFamily, declaration.fontFamily);
  17272. this.fontSize = parse(fontSize, declaration.fontSize);
  17273. this.fontStyle = parse(fontStyle, declaration.fontStyle);
  17274. this.fontVariant = parse(fontVariant, declaration.fontVariant);
  17275. this.fontWeight = parse(fontWeight, declaration.fontWeight);
  17276. this.letterSpacing = parse(letterSpacing, declaration.letterSpacing);
  17277. this.lineBreak = parse(lineBreak, declaration.lineBreak);
  17278. this.lineHeight = parse(lineHeight, declaration.lineHeight);
  17279. this.listStyleImage = parse(listStyleImage, declaration.listStyleImage);
  17280. this.listStylePosition = parse(listStylePosition, declaration.listStylePosition);
  17281. this.listStyleType = parse(listStyleType, declaration.listStyleType);
  17282. this.marginTop = parse(marginTop, declaration.marginTop);
  17283. this.marginRight = parse(marginRight, declaration.marginRight);
  17284. this.marginBottom = parse(marginBottom, declaration.marginBottom);
  17285. this.marginLeft = parse(marginLeft, declaration.marginLeft);
  17286. this.opacity = parse(opacity, declaration.opacity);
  17287. var overflowTuple = parse(overflow, declaration.overflow);
  17288. this.overflowX = overflowTuple[0];
  17289. this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0];
  17290. this.overflowWrap = parse(overflowWrap, declaration.overflowWrap);
  17291. this.paddingTop = parse(paddingTop, declaration.paddingTop);
  17292. this.paddingRight = parse(paddingRight, declaration.paddingRight);
  17293. this.paddingBottom = parse(paddingBottom, declaration.paddingBottom);
  17294. this.paddingLeft = parse(paddingLeft, declaration.paddingLeft);
  17295. this.position = parse(position, declaration.position);
  17296. this.textAlign = parse(textAlign, declaration.textAlign);
  17297. this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color);
  17298. this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine);
  17299. this.textShadow = parse(textShadow, declaration.textShadow);
  17300. this.textTransform = parse(textTransform, declaration.textTransform);
  17301. this.transform = parse(transform, declaration.transform);
  17302. this.transformOrigin = parse(transformOrigin, declaration.transformOrigin);
  17303. this.visibility = parse(visibility, declaration.visibility);
  17304. this.wordBreak = parse(wordBreak, declaration.wordBreak);
  17305. this.zIndex = parse(zIndex, declaration.zIndex);
  17306. }
  17307. CSSParsedDeclaration.prototype.isVisible = function () {
  17308. return this.display > 0 && this.opacity > 0 && this.visibility === VISIBILITY.VISIBLE;
  17309. };
  17310. CSSParsedDeclaration.prototype.isTransparent = function () {
  17311. return isTransparent(this.backgroundColor);
  17312. };
  17313. CSSParsedDeclaration.prototype.isTransformed = function () {
  17314. return this.transform !== null;
  17315. };
  17316. CSSParsedDeclaration.prototype.isPositioned = function () {
  17317. return this.position !== POSITION.STATIC;
  17318. };
  17319. CSSParsedDeclaration.prototype.isPositionedWithZIndex = function () {
  17320. return this.isPositioned() && !this.zIndex.auto;
  17321. };
  17322. CSSParsedDeclaration.prototype.isFloating = function () {
  17323. return this.float !== FLOAT.NONE;
  17324. };
  17325. CSSParsedDeclaration.prototype.isInlineLevel = function () {
  17326. return contains(this.display, 4 /* INLINE */) ||
  17327. contains(this.display, 33554432 /* INLINE_BLOCK */) ||
  17328. contains(this.display, 268435456 /* INLINE_FLEX */) ||
  17329. contains(this.display, 536870912 /* INLINE_GRID */) ||
  17330. contains(this.display, 67108864 /* INLINE_LIST_ITEM */) ||
  17331. contains(this.display, 134217728 /* INLINE_TABLE */);
  17332. };
  17333. return CSSParsedDeclaration;
  17334. }();
  17335. var CSSParsedPseudoDeclaration = /** @class */function () {
  17336. function CSSParsedPseudoDeclaration(declaration) {
  17337. this.content = parse(content, declaration.content);
  17338. this.quotes = parse(quotes, declaration.quotes);
  17339. }
  17340. return CSSParsedPseudoDeclaration;
  17341. }();
  17342. var CSSParsedCounterDeclaration = /** @class */function () {
  17343. function CSSParsedCounterDeclaration(declaration) {
  17344. this.counterIncrement = parse(counterIncrement, declaration.counterIncrement);
  17345. this.counterReset = parse(counterReset, declaration.counterReset);
  17346. }
  17347. return CSSParsedCounterDeclaration;
  17348. }();
  17349. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  17350. var parse = function parse(descriptor, style) {
  17351. var tokenizer = new Tokenizer();
  17352. var value = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue;
  17353. tokenizer.write(value);
  17354. var parser = new Parser(tokenizer.read());
  17355. switch (descriptor.type) {
  17356. case PropertyDescriptorParsingType.IDENT_VALUE:
  17357. var token = parser.parseComponentValue();
  17358. return descriptor.parse(isIdentToken(token) ? token.value : descriptor.initialValue);
  17359. case PropertyDescriptorParsingType.VALUE:
  17360. return descriptor.parse(parser.parseComponentValue());
  17361. case PropertyDescriptorParsingType.LIST:
  17362. return descriptor.parse(parser.parseComponentValues());
  17363. case PropertyDescriptorParsingType.TOKEN_VALUE:
  17364. return parser.parseComponentValue();
  17365. case PropertyDescriptorParsingType.TYPE_VALUE:
  17366. switch (descriptor.format) {
  17367. case 'angle':
  17368. return angle.parse(parser.parseComponentValue());
  17369. case 'color':
  17370. return color.parse(parser.parseComponentValue());
  17371. case 'image':
  17372. return image.parse(parser.parseComponentValue());
  17373. case 'length':
  17374. var length_1 = parser.parseComponentValue();
  17375. return isLength(length_1) ? length_1 : ZERO_LENGTH;
  17376. case 'length-percentage':
  17377. var value_1 = parser.parseComponentValue();
  17378. return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH;}}
  17379. throw new Error("Attempting to parse unsupported css format type " + descriptor.format);
  17380. };
  17381. var ElementContainer = /** @class */function () {
  17382. function ElementContainer(element) {
  17383. this.styles = new CSSParsedDeclaration(window.getComputedStyle(element, null));
  17384. this.textNodes = [];
  17385. this.elements = [];
  17386. if (this.styles.transform !== null && isHTMLElementNode(element)) {
  17387. // getBoundingClientRect takes transforms into account
  17388. element.style.transform = 'none';
  17389. }
  17390. this.bounds = parseBounds(element);
  17391. this.flags = 0;
  17392. }
  17393. return ElementContainer;
  17394. }();
  17395. var TextBounds = /** @class */function () {
  17396. function TextBounds(text, bounds) {
  17397. this.text = text;
  17398. this.bounds = bounds;
  17399. }
  17400. return TextBounds;
  17401. }();
  17402. var parseTextBounds = function parseTextBounds(value, styles, node) {
  17403. var textList = breakText(value, styles);
  17404. var textBounds = [];
  17405. var offset = 0;
  17406. textList.forEach(function (text) {
  17407. if (styles.textDecorationLine.length || text.trim().length > 0) {
  17408. if (FEATURES.SUPPORT_RANGE_BOUNDS) {
  17409. textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length)));
  17410. } else
  17411. {
  17412. var replacementNode = node.splitText(text.length);
  17413. textBounds.push(new TextBounds(text, getWrapperBounds(node)));
  17414. node = replacementNode;
  17415. }
  17416. } else
  17417. if (!FEATURES.SUPPORT_RANGE_BOUNDS) {
  17418. node = node.splitText(text.length);
  17419. }
  17420. offset += text.length;
  17421. });
  17422. return textBounds;
  17423. };
  17424. var getWrapperBounds = function getWrapperBounds(node) {
  17425. var ownerDocument = node.ownerDocument;
  17426. if (ownerDocument) {
  17427. var wrapper = ownerDocument.createElement('html2canvaswrapper');
  17428. wrapper.appendChild(node.cloneNode(true));
  17429. var parentNode = node.parentNode;
  17430. if (parentNode) {
  17431. parentNode.replaceChild(wrapper, node);
  17432. var bounds = parseBounds(wrapper);
  17433. if (wrapper.firstChild) {
  17434. parentNode.replaceChild(wrapper.firstChild, wrapper);
  17435. }
  17436. return bounds;
  17437. }
  17438. }
  17439. return new Bounds(0, 0, 0, 0);
  17440. };
  17441. var getRangeBounds = function getRangeBounds(node, offset, length) {
  17442. var ownerDocument = node.ownerDocument;
  17443. if (!ownerDocument) {
  17444. throw new Error('Node has no owner document');
  17445. }
  17446. var range = ownerDocument.createRange();
  17447. range.setStart(node, offset);
  17448. range.setEnd(node, offset + length);
  17449. return Bounds.fromClientRect(range.getBoundingClientRect());
  17450. };
  17451. var breakText = function breakText(value, styles) {
  17452. return styles.letterSpacing !== 0 ? toCodePoints(value).map(function (i) {return fromCodePoint(i);}) : breakWords(value, styles);
  17453. };
  17454. var breakWords = function breakWords(str, styles) {
  17455. var breaker = LineBreaker(str, {
  17456. lineBreak: styles.lineBreak,
  17457. wordBreak: styles.overflowWrap === OVERFLOW_WRAP.BREAK_WORD ? 'break-word' : styles.wordBreak });
  17458. var words = [];
  17459. var bk;
  17460. while (!(bk = breaker.next()).done) {
  17461. if (bk.value) {
  17462. words.push(bk.value.slice());
  17463. }
  17464. }
  17465. return words;
  17466. };
  17467. var TextContainer = /** @class */function () {
  17468. function TextContainer(node, styles) {
  17469. this.text = transform$1(node.data, styles.textTransform);
  17470. this.textBounds = parseTextBounds(this.text, styles, node);
  17471. }
  17472. return TextContainer;
  17473. }();
  17474. var transform$1 = function transform$1(text, transform) {
  17475. switch (transform) {
  17476. case TEXT_TRANSFORM.LOWERCASE:
  17477. return text.toLowerCase();
  17478. case TEXT_TRANSFORM.CAPITALIZE:
  17479. return text.replace(CAPITALIZE, capitalize);
  17480. case TEXT_TRANSFORM.UPPERCASE:
  17481. return text.toUpperCase();
  17482. default:
  17483. return text;}
  17484. };
  17485. var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
  17486. var capitalize = function capitalize(m, p1, p2) {
  17487. if (m.length > 0) {
  17488. return p1 + p2.toUpperCase();
  17489. }
  17490. return m;
  17491. };
  17492. var ImageElementContainer = /** @class */function (_super) {
  17493. __extends(ImageElementContainer, _super);
  17494. function ImageElementContainer(img) {
  17495. var _this = _super.call(this, img) || this;
  17496. _this.src = img.currentSrc || img.src;
  17497. _this.intrinsicWidth = img.naturalWidth;
  17498. _this.intrinsicHeight = img.naturalHeight;
  17499. CacheStorage.getInstance().addImage(_this.src);
  17500. return _this;
  17501. }
  17502. return ImageElementContainer;
  17503. }(ElementContainer);
  17504. var CanvasElementContainer = /** @class */function (_super) {
  17505. __extends(CanvasElementContainer, _super);
  17506. function CanvasElementContainer(canvas) {
  17507. var _this = _super.call(this, canvas) || this;
  17508. _this.canvas = canvas;
  17509. _this.intrinsicWidth = canvas.width;
  17510. _this.intrinsicHeight = canvas.height;
  17511. return _this;
  17512. }
  17513. return CanvasElementContainer;
  17514. }(ElementContainer);
  17515. var SVGElementContainer = /** @class */function (_super) {
  17516. __extends(SVGElementContainer, _super);
  17517. function SVGElementContainer(img) {
  17518. var _this = _super.call(this, img) || this;
  17519. var s = new XMLSerializer();
  17520. _this.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img));
  17521. _this.intrinsicWidth = img.width.baseVal.value;
  17522. _this.intrinsicHeight = img.height.baseVal.value;
  17523. CacheStorage.getInstance().addImage(_this.svg);
  17524. return _this;
  17525. }
  17526. return SVGElementContainer;
  17527. }(ElementContainer);
  17528. var LIElementContainer = /** @class */function (_super) {
  17529. __extends(LIElementContainer, _super);
  17530. function LIElementContainer(element) {
  17531. var _this = _super.call(this, element) || this;
  17532. _this.value = element.value;
  17533. return _this;
  17534. }
  17535. return LIElementContainer;
  17536. }(ElementContainer);
  17537. var OLElementContainer = /** @class */function (_super) {
  17538. __extends(OLElementContainer, _super);
  17539. function OLElementContainer(element) {
  17540. var _this = _super.call(this, element) || this;
  17541. _this.start = element.start;
  17542. _this.reversed = typeof element.reversed === 'boolean' && element.reversed === true;
  17543. return _this;
  17544. }
  17545. return OLElementContainer;
  17546. }(ElementContainer);
  17547. var CHECKBOX_BORDER_RADIUS = [
  17548. {
  17549. type: TokenType.DIMENSION_TOKEN,
  17550. flags: 0,
  17551. unit: 'px',
  17552. number: 3 }];
  17553. var RADIO_BORDER_RADIUS = [
  17554. {
  17555. type: TokenType.PERCENTAGE_TOKEN,
  17556. flags: 0,
  17557. number: 50 }];
  17558. var reformatInputBounds = function reformatInputBounds(bounds) {
  17559. if (bounds.width > bounds.height) {
  17560. return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height);
  17561. } else
  17562. if (bounds.width < bounds.height) {
  17563. return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width);
  17564. }
  17565. return bounds;
  17566. };
  17567. var getInputValue = function getInputValue(node) {
  17568. var value = node.type === PASSWORD ? new Array(node.value.length + 1).join("\u2022") : node.value;
  17569. return value.length === 0 ? node.placeholder || '' : value;
  17570. };
  17571. var CHECKBOX = 'checkbox';
  17572. var RADIO = 'radio';
  17573. var PASSWORD = 'password';
  17574. var INPUT_COLOR = 0x2a2a2aff;
  17575. var InputElementContainer = /** @class */function (_super) {
  17576. __extends(InputElementContainer, _super);
  17577. function InputElementContainer(input) {
  17578. var _this = _super.call(this, input) || this;
  17579. _this.type = input.type.toLowerCase();
  17580. _this.checked = input.checked;
  17581. _this.value = getInputValue(input);
  17582. if (_this.type === CHECKBOX || _this.type === RADIO) {
  17583. _this.styles.backgroundColor = 0xdededeff;
  17584. _this.styles.borderTopColor = _this.styles.borderRightColor = _this.styles.borderBottomColor = _this.styles.borderLeftColor = 0xa5a5a5ff;
  17585. _this.styles.borderTopWidth = _this.styles.borderRightWidth = _this.styles.borderBottomWidth = _this.styles.borderLeftWidth = 1;
  17586. _this.styles.borderTopStyle = _this.styles.borderRightStyle = _this.styles.borderBottomStyle = _this.styles.borderLeftStyle =
  17587. BORDER_STYLE.SOLID;
  17588. _this.styles.backgroundClip = [BACKGROUND_CLIP.BORDER_BOX];
  17589. _this.styles.backgroundOrigin = [0 /* BORDER_BOX */];
  17590. _this.bounds = reformatInputBounds(_this.bounds);
  17591. }
  17592. switch (_this.type) {
  17593. case CHECKBOX:
  17594. _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = CHECKBOX_BORDER_RADIUS;
  17595. break;
  17596. case RADIO:
  17597. _this.styles.borderTopRightRadius = _this.styles.borderTopLeftRadius = _this.styles.borderBottomRightRadius = _this.styles.borderBottomLeftRadius = RADIO_BORDER_RADIUS;
  17598. break;}
  17599. return _this;
  17600. }
  17601. return InputElementContainer;
  17602. }(ElementContainer);
  17603. var SelectElementContainer = /** @class */function (_super) {
  17604. __extends(SelectElementContainer, _super);
  17605. function SelectElementContainer(element) {
  17606. var _this = _super.call(this, element) || this;
  17607. var option = element.options[element.selectedIndex || 0];
  17608. _this.value = option ? option.text || '' : '';
  17609. return _this;
  17610. }
  17611. return SelectElementContainer;
  17612. }(ElementContainer);
  17613. var TextareaElementContainer = /** @class */function (_super) {
  17614. __extends(TextareaElementContainer, _super);
  17615. function TextareaElementContainer(element) {
  17616. var _this = _super.call(this, element) || this;
  17617. _this.value = element.value;
  17618. return _this;
  17619. }
  17620. return TextareaElementContainer;
  17621. }(ElementContainer);
  17622. var parseColor = function parseColor(value) {return color.parse(Parser.create(value).parseComponentValue());};
  17623. var IFrameElementContainer = /** @class */function (_super) {
  17624. __extends(IFrameElementContainer, _super);
  17625. function IFrameElementContainer(iframe) {
  17626. var _this = _super.call(this, iframe) || this;
  17627. _this.src = iframe.src;
  17628. _this.width = parseInt(iframe.width, 10) || 0;
  17629. _this.height = parseInt(iframe.height, 10) || 0;
  17630. _this.backgroundColor = _this.styles.backgroundColor;
  17631. try {
  17632. if (iframe.contentWindow &&
  17633. iframe.contentWindow.document &&
  17634. iframe.contentWindow.document.documentElement) {
  17635. _this.tree = parseTree(iframe.contentWindow.document.documentElement);
  17636. // http://www.w3.org/TR/css3-background/#special-backgrounds
  17637. var documentBackgroundColor = iframe.contentWindow.document.documentElement ?
  17638. parseColor(getComputedStyle(iframe.contentWindow.document.documentElement).
  17639. backgroundColor) :
  17640. COLORS.TRANSPARENT;
  17641. var bodyBackgroundColor = iframe.contentWindow.document.body ?
  17642. parseColor(getComputedStyle(iframe.contentWindow.document.body).backgroundColor) :
  17643. COLORS.TRANSPARENT;
  17644. _this.backgroundColor = isTransparent(documentBackgroundColor) ?
  17645. isTransparent(bodyBackgroundColor) ?
  17646. _this.styles.backgroundColor :
  17647. bodyBackgroundColor :
  17648. documentBackgroundColor;
  17649. }
  17650. }
  17651. catch (e) {}
  17652. return _this;
  17653. }
  17654. return IFrameElementContainer;
  17655. }(ElementContainer);
  17656. var LIST_OWNERS = ['OL', 'UL', 'MENU'];
  17657. var parseNodeTree = function parseNodeTree(node, parent, root) {
  17658. for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
  17659. nextNode = childNode.nextSibling;
  17660. if (isTextNode(childNode) && childNode.data.trim().length > 0) {
  17661. parent.textNodes.push(new TextContainer(childNode, parent.styles));
  17662. } else
  17663. if (isElementNode(childNode)) {
  17664. var container = createContainer(childNode);
  17665. if (container.styles.isVisible()) {
  17666. if (createsRealStackingContext(childNode, container, root)) {
  17667. container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
  17668. } else
  17669. if (createsStackingContext(container.styles)) {
  17670. container.flags |= 2 /* CREATES_STACKING_CONTEXT */;
  17671. }
  17672. if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
  17673. container.flags |= 8 /* IS_LIST_OWNER */;
  17674. }
  17675. parent.elements.push(container);
  17676. if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) {
  17677. parseNodeTree(childNode, container, root);
  17678. }
  17679. }
  17680. }
  17681. }
  17682. };
  17683. var createContainer = function createContainer(element) {
  17684. if (isImageElement(element)) {
  17685. return new ImageElementContainer(element);
  17686. }
  17687. if (isCanvasElement(element)) {
  17688. return new CanvasElementContainer(element);
  17689. }
  17690. if (isSVGElement(element)) {
  17691. return new SVGElementContainer(element);
  17692. }
  17693. if (isLIElement(element)) {
  17694. return new LIElementContainer(element);
  17695. }
  17696. if (isOLElement(element)) {
  17697. return new OLElementContainer(element);
  17698. }
  17699. if (isInputElement(element)) {
  17700. return new InputElementContainer(element);
  17701. }
  17702. if (isSelectElement(element)) {
  17703. return new SelectElementContainer(element);
  17704. }
  17705. if (isTextareaElement(element)) {
  17706. return new TextareaElementContainer(element);
  17707. }
  17708. if (isIFrameElement(element)) {
  17709. return new IFrameElementContainer(element);
  17710. }
  17711. return new ElementContainer(element);
  17712. };
  17713. var parseTree = function parseTree(element) {
  17714. var container = createContainer(element);
  17715. container.flags |= 4 /* CREATES_REAL_STACKING_CONTEXT */;
  17716. parseNodeTree(element, container, container);
  17717. return container;
  17718. };
  17719. var createsRealStackingContext = function createsRealStackingContext(node, container, root) {
  17720. return container.styles.isPositionedWithZIndex() ||
  17721. container.styles.opacity < 1 ||
  17722. container.styles.isTransformed() ||
  17723. isBodyElement(node) && root.styles.isTransparent();
  17724. };
  17725. var createsStackingContext = function createsStackingContext(styles) {return styles.isPositioned() || styles.isFloating();};
  17726. var isTextNode = function isTextNode(node) {return node.nodeType === Node.TEXT_NODE;};
  17727. var isElementNode = function isElementNode(node) {return node.nodeType === Node.ELEMENT_NODE;};
  17728. var isHTMLElementNode = function isHTMLElementNode(node) {
  17729. return isElementNode(node) && typeof node.style !== 'undefined' && !isSVGElementNode(node);
  17730. };
  17731. var isSVGElementNode = function isSVGElementNode(element) {
  17732. return typeof element.className === 'object';
  17733. };
  17734. var isLIElement = function isLIElement(node) {return node.tagName === 'LI';};
  17735. var isOLElement = function isOLElement(node) {return node.tagName === 'OL';};
  17736. var isInputElement = function isInputElement(node) {return node.tagName === 'INPUT';};
  17737. var isHTMLElement = function isHTMLElement(node) {return node.tagName === 'HTML';};
  17738. var isSVGElement = function isSVGElement(node) {return node.tagName === 'svg';};
  17739. var isBodyElement = function isBodyElement(node) {return node.tagName === 'BODY';};
  17740. var isCanvasElement = function isCanvasElement(node) {return node.tagName === 'CANVAS';};
  17741. var isImageElement = function isImageElement(node) {return node.tagName === 'IMG';};
  17742. var isIFrameElement = function isIFrameElement(node) {return node.tagName === 'IFRAME';};
  17743. var isStyleElement = function isStyleElement(node) {return node.tagName === 'STYLE';};
  17744. var isScriptElement = function isScriptElement(node) {return node.tagName === 'SCRIPT';};
  17745. var isTextareaElement = function isTextareaElement(node) {return node.tagName === 'TEXTAREA';};
  17746. var isSelectElement = function isSelectElement(node) {return node.tagName === 'SELECT';};
  17747. var CounterState = /** @class */function () {
  17748. function CounterState() {
  17749. this.counters = {};
  17750. }
  17751. CounterState.prototype.getCounterValue = function (name) {
  17752. var counter = this.counters[name];
  17753. if (counter && counter.length) {
  17754. return counter[counter.length - 1];
  17755. }
  17756. return 1;
  17757. };
  17758. CounterState.prototype.getCounterValues = function (name) {
  17759. var counter = this.counters[name];
  17760. return counter ? counter : [];
  17761. };
  17762. CounterState.prototype.pop = function (counters) {
  17763. var _this = this;
  17764. counters.forEach(function (counter) {return _this.counters[counter].pop();});
  17765. };
  17766. CounterState.prototype.parse = function (style) {
  17767. var _this = this;
  17768. var counterIncrement = style.counterIncrement;
  17769. var counterReset = style.counterReset;
  17770. var canReset = true;
  17771. if (counterIncrement !== null) {
  17772. counterIncrement.forEach(function (entry) {
  17773. var counter = _this.counters[entry.counter];
  17774. if (counter && entry.increment !== 0) {
  17775. canReset = false;
  17776. counter[Math.max(0, counter.length - 1)] += entry.increment;
  17777. }
  17778. });
  17779. }
  17780. var counterNames = [];
  17781. if (canReset) {
  17782. counterReset.forEach(function (entry) {
  17783. var counter = _this.counters[entry.counter];
  17784. counterNames.push(entry.counter);
  17785. if (!counter) {
  17786. counter = _this.counters[entry.counter] = [];
  17787. }
  17788. counter.push(entry.reset);
  17789. });
  17790. }
  17791. return counterNames;
  17792. };
  17793. return CounterState;
  17794. }();
  17795. var ROMAN_UPPER = {
  17796. integers: [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
  17797. values: ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] };
  17798. var ARMENIAN = {
  17799. integers: [
  17800. 9000,
  17801. 8000,
  17802. 7000,
  17803. 6000,
  17804. 5000,
  17805. 4000,
  17806. 3000,
  17807. 2000,
  17808. 1000,
  17809. 900,
  17810. 800,
  17811. 700,
  17812. 600,
  17813. 500,
  17814. 400,
  17815. 300,
  17816. 200,
  17817. 100,
  17818. 90,
  17819. 80,
  17820. 70,
  17821. 60,
  17822. 50,
  17823. 40,
  17824. 30,
  17825. 20,
  17826. 10,
  17827. 9,
  17828. 8,
  17829. 7,
  17830. 6,
  17831. 5,
  17832. 4,
  17833. 3,
  17834. 2,
  17835. 1],
  17836. values: [
  17837. 'Ք',
  17838. 'Փ',
  17839. 'Ւ',
  17840. 'Ց',
  17841. 'Ր',
  17842. 'Տ',
  17843. 'Վ',
  17844. 'Ս',
  17845. 'Ռ',
  17846. 'Ջ',
  17847. 'Պ',
  17848. 'Չ',
  17849. 'Ո',
  17850. 'Շ',
  17851. 'Ն',
  17852. 'Յ',
  17853. 'Մ',
  17854. 'Ճ',
  17855. 'Ղ',
  17856. 'Ձ',
  17857. 'Հ',
  17858. 'Կ',
  17859. 'Ծ',
  17860. 'Խ',
  17861. 'Լ',
  17862. 'Ի',
  17863. 'Ժ',
  17864. 'Թ',
  17865. 'Ը',
  17866. 'Է',
  17867. 'Զ',
  17868. 'Ե',
  17869. 'Դ',
  17870. 'Գ',
  17871. 'Բ',
  17872. 'Ա'] };
  17873. var HEBREW = {
  17874. integers: [
  17875. 10000,
  17876. 9000,
  17877. 8000,
  17878. 7000,
  17879. 6000,
  17880. 5000,
  17881. 4000,
  17882. 3000,
  17883. 2000,
  17884. 1000,
  17885. 400,
  17886. 300,
  17887. 200,
  17888. 100,
  17889. 90,
  17890. 80,
  17891. 70,
  17892. 60,
  17893. 50,
  17894. 40,
  17895. 30,
  17896. 20,
  17897. 19,
  17898. 18,
  17899. 17,
  17900. 16,
  17901. 15,
  17902. 10,
  17903. 9,
  17904. 8,
  17905. 7,
  17906. 6,
  17907. 5,
  17908. 4,
  17909. 3,
  17910. 2,
  17911. 1],
  17912. values: [
  17913. 'י׳',
  17914. 'ט׳',
  17915. 'ח׳',
  17916. 'ז׳',
  17917. 'ו׳',
  17918. 'ה׳',
  17919. 'ד׳',
  17920. 'ג׳',
  17921. 'ב׳',
  17922. 'א׳',
  17923. 'ת',
  17924. 'ש',
  17925. 'ר',
  17926. 'ק',
  17927. 'צ',
  17928. 'פ',
  17929. 'ע',
  17930. 'ס',
  17931. 'נ',
  17932. 'מ',
  17933. 'ל',
  17934. 'כ',
  17935. 'יט',
  17936. 'יח',
  17937. 'יז',
  17938. 'טז',
  17939. 'טו',
  17940. 'י',
  17941. 'ט',
  17942. 'ח',
  17943. 'ז',
  17944. 'ו',
  17945. 'ה',
  17946. 'ד',
  17947. 'ג',
  17948. 'ב',
  17949. 'א'] };
  17950. var GEORGIAN = {
  17951. integers: [
  17952. 10000,
  17953. 9000,
  17954. 8000,
  17955. 7000,
  17956. 6000,
  17957. 5000,
  17958. 4000,
  17959. 3000,
  17960. 2000,
  17961. 1000,
  17962. 900,
  17963. 800,
  17964. 700,
  17965. 600,
  17966. 500,
  17967. 400,
  17968. 300,
  17969. 200,
  17970. 100,
  17971. 90,
  17972. 80,
  17973. 70,
  17974. 60,
  17975. 50,
  17976. 40,
  17977. 30,
  17978. 20,
  17979. 10,
  17980. 9,
  17981. 8,
  17982. 7,
  17983. 6,
  17984. 5,
  17985. 4,
  17986. 3,
  17987. 2,
  17988. 1],
  17989. values: [
  17990. 'ჵ',
  17991. 'ჰ',
  17992. 'ჯ',
  17993. 'ჴ',
  17994. 'ხ',
  17995. 'ჭ',
  17996. 'წ',
  17997. 'ძ',
  17998. 'ც',
  17999. 'ჩ',
  18000. 'შ',
  18001. 'ყ',
  18002. 'ღ',
  18003. 'ქ',
  18004. 'ფ',
  18005. 'ჳ',
  18006. 'ტ',
  18007. 'ს',
  18008. 'რ',
  18009. 'ჟ',
  18010. 'პ',
  18011. 'ო',
  18012. 'ჲ',
  18013. 'ნ',
  18014. 'მ',
  18015. 'ლ',
  18016. 'კ',
  18017. 'ი',
  18018. 'თ',
  18019. 'ჱ',
  18020. 'ზ',
  18021. 'ვ',
  18022. 'ე',
  18023. 'დ',
  18024. 'გ',
  18025. 'ბ',
  18026. 'ა'] };
  18027. var createAdditiveCounter = function createAdditiveCounter(value, min, max, symbols, fallback, suffix) {
  18028. if (value < min || value > max) {
  18029. return createCounterText(value, fallback, suffix.length > 0);
  18030. }
  18031. return symbols.integers.reduce(function (string, integer, index) {
  18032. while (value >= integer) {
  18033. value -= integer;
  18034. string += symbols.values[index];
  18035. }
  18036. return string;
  18037. }, '') + suffix;
  18038. };
  18039. var createCounterStyleWithSymbolResolver = function createCounterStyleWithSymbolResolver(value, codePointRangeLength, isNumeric, resolver) {
  18040. var string = '';
  18041. do {
  18042. if (!isNumeric) {
  18043. value--;
  18044. }
  18045. string = resolver(value) + string;
  18046. value /= codePointRangeLength;
  18047. } while (value * codePointRangeLength >= codePointRangeLength);
  18048. return string;
  18049. };
  18050. var createCounterStyleFromRange = function createCounterStyleFromRange(value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
  18051. var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
  18052. return (value < 0 ? '-' : '') + (
  18053. createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function (codePoint) {
  18054. return fromCodePoint(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
  18055. }) +
  18056. suffix);
  18057. };
  18058. var createCounterStyleFromSymbols = function createCounterStyleFromSymbols(value, symbols, suffix) {
  18059. if (suffix === void 0) {suffix = '. ';}
  18060. var codePointRangeLength = symbols.length;
  18061. return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function (codePoint) {return symbols[Math.floor(codePoint % codePointRangeLength)];}) + suffix;
  18062. };
  18063. var CJK_ZEROS = 1 << 0;
  18064. var CJK_TEN_COEFFICIENTS = 1 << 1;
  18065. var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
  18066. var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
  18067. var createCJKCounter = function createCJKCounter(value, numbers, multipliers, negativeSign, suffix, flags) {
  18068. if (value < -9999 || value > 9999) {
  18069. return createCounterText(value, LIST_STYLE_TYPE.CJK_DECIMAL, suffix.length > 0);
  18070. }
  18071. var tmp = Math.abs(value);
  18072. var string = suffix;
  18073. if (tmp === 0) {
  18074. return numbers[0] + string;
  18075. }
  18076. for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
  18077. var coefficient = tmp % 10;
  18078. if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== '') {
  18079. string = numbers[coefficient] + string;
  18080. } else
  18081. if (coefficient > 1 ||
  18082. coefficient === 1 && digit === 0 ||
  18083. coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS) ||
  18084. coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100 ||
  18085. coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS)) {
  18086. string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : '') + string;
  18087. } else
  18088. if (coefficient === 1 && digit > 0) {
  18089. string = multipliers[digit - 1] + string;
  18090. }
  18091. tmp = Math.floor(tmp / 10);
  18092. }
  18093. return (value < 0 ? negativeSign : '') + string;
  18094. };
  18095. var CHINESE_INFORMAL_MULTIPLIERS = '十百千萬';
  18096. var CHINESE_FORMAL_MULTIPLIERS = '拾佰仟萬';
  18097. var JAPANESE_NEGATIVE = 'マイナス';
  18098. var KOREAN_NEGATIVE = '마이너스';
  18099. var createCounterText = function createCounterText(value, type, appendSuffix) {
  18100. var defaultSuffix = appendSuffix ? '. ' : '';
  18101. var cjkSuffix = appendSuffix ? '、' : '';
  18102. var koreanSuffix = appendSuffix ? ', ' : '';
  18103. var spaceSuffix = appendSuffix ? ' ' : '';
  18104. switch (type) {
  18105. case LIST_STYLE_TYPE.DISC:
  18106. return '•' + spaceSuffix;
  18107. case LIST_STYLE_TYPE.CIRCLE:
  18108. return '◦' + spaceSuffix;
  18109. case LIST_STYLE_TYPE.SQUARE:
  18110. return '◾' + spaceSuffix;
  18111. case LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:
  18112. var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
  18113. return string.length < 4 ? "0" + string : string;
  18114. case LIST_STYLE_TYPE.CJK_DECIMAL:
  18115. return createCounterStyleFromSymbols(value, '〇一二三四五六七八九', cjkSuffix);
  18116. case LIST_STYLE_TYPE.LOWER_ROMAN:
  18117. return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
  18118. case LIST_STYLE_TYPE.UPPER_ROMAN:
  18119. return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  18120. case LIST_STYLE_TYPE.LOWER_GREEK:
  18121. return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
  18122. case LIST_STYLE_TYPE.LOWER_ALPHA:
  18123. return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
  18124. case LIST_STYLE_TYPE.UPPER_ALPHA:
  18125. return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
  18126. case LIST_STYLE_TYPE.ARABIC_INDIC:
  18127. return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
  18128. case LIST_STYLE_TYPE.ARMENIAN:
  18129. case LIST_STYLE_TYPE.UPPER_ARMENIAN:
  18130. return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  18131. case LIST_STYLE_TYPE.LOWER_ARMENIAN:
  18132. return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
  18133. case LIST_STYLE_TYPE.BENGALI:
  18134. return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
  18135. case LIST_STYLE_TYPE.CAMBODIAN:
  18136. case LIST_STYLE_TYPE.KHMER:
  18137. return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
  18138. case LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:
  18139. return createCounterStyleFromSymbols(value, '子丑寅卯辰巳午未申酉戌亥', cjkSuffix);
  18140. case LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:
  18141. return createCounterStyleFromSymbols(value, '甲乙丙丁戊己庚辛壬癸', cjkSuffix);
  18142. case LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:
  18143. case LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:
  18144. return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  18145. case LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:
  18146. return createCJKCounter(value, '零壹貳參肆伍陸柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '負', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  18147. case LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:
  18148. return createCJKCounter(value, '零一二三四五六七八九', CHINESE_INFORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  18149. case LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:
  18150. return createCJKCounter(value, '零壹贰叁肆伍陆柒捌玖', CHINESE_FORMAL_MULTIPLIERS, '负', cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  18151. case LIST_STYLE_TYPE.JAPANESE_INFORMAL:
  18152. return createCJKCounter(value, '〇一二三四五六七八九', '十百千万', JAPANESE_NEGATIVE, cjkSuffix, 0);
  18153. case LIST_STYLE_TYPE.JAPANESE_FORMAL:
  18154. return createCJKCounter(value, '零壱弐参四伍六七八九', '拾百千万', JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  18155. case LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:
  18156. return createCJKCounter(value, '영일이삼사오육칠팔구', '십백천만', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  18157. case LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:
  18158. return createCJKCounter(value, '零一二三四五六七八九', '十百千萬', KOREAN_NEGATIVE, koreanSuffix, 0);
  18159. case LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:
  18160. return createCJKCounter(value, '零壹貳參四五六七八九', '拾百千', KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  18161. case LIST_STYLE_TYPE.DEVANAGARI:
  18162. return createCounterStyleFromRange(value, 0x966, 0x96f, true, defaultSuffix);
  18163. case LIST_STYLE_TYPE.GEORGIAN:
  18164. return createAdditiveCounter(value, 1, 19999, GEORGIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  18165. case LIST_STYLE_TYPE.GUJARATI:
  18166. return createCounterStyleFromRange(value, 0xae6, 0xaef, true, defaultSuffix);
  18167. case LIST_STYLE_TYPE.GURMUKHI:
  18168. return createCounterStyleFromRange(value, 0xa66, 0xa6f, true, defaultSuffix);
  18169. case LIST_STYLE_TYPE.HEBREW:
  18170. return createAdditiveCounter(value, 1, 10999, HEBREW, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  18171. case LIST_STYLE_TYPE.HIRAGANA:
  18172. return createCounterStyleFromSymbols(value, 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん');
  18173. case LIST_STYLE_TYPE.HIRAGANA_IROHA:
  18174. return createCounterStyleFromSymbols(value, 'いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす');
  18175. case LIST_STYLE_TYPE.KANNADA:
  18176. return createCounterStyleFromRange(value, 0xce6, 0xcef, true, defaultSuffix);
  18177. case LIST_STYLE_TYPE.KATAKANA:
  18178. return createCounterStyleFromSymbols(value, 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン', cjkSuffix);
  18179. case LIST_STYLE_TYPE.KATAKANA_IROHA:
  18180. return createCounterStyleFromSymbols(value, 'イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス', cjkSuffix);
  18181. case LIST_STYLE_TYPE.LAO:
  18182. return createCounterStyleFromRange(value, 0xed0, 0xed9, true, defaultSuffix);
  18183. case LIST_STYLE_TYPE.MONGOLIAN:
  18184. return createCounterStyleFromRange(value, 0x1810, 0x1819, true, defaultSuffix);
  18185. case LIST_STYLE_TYPE.MYANMAR:
  18186. return createCounterStyleFromRange(value, 0x1040, 0x1049, true, defaultSuffix);
  18187. case LIST_STYLE_TYPE.ORIYA:
  18188. return createCounterStyleFromRange(value, 0xb66, 0xb6f, true, defaultSuffix);
  18189. case LIST_STYLE_TYPE.PERSIAN:
  18190. return createCounterStyleFromRange(value, 0x6f0, 0x6f9, true, defaultSuffix);
  18191. case LIST_STYLE_TYPE.TAMIL:
  18192. return createCounterStyleFromRange(value, 0xbe6, 0xbef, true, defaultSuffix);
  18193. case LIST_STYLE_TYPE.TELUGU:
  18194. return createCounterStyleFromRange(value, 0xc66, 0xc6f, true, defaultSuffix);
  18195. case LIST_STYLE_TYPE.THAI:
  18196. return createCounterStyleFromRange(value, 0xe50, 0xe59, true, defaultSuffix);
  18197. case LIST_STYLE_TYPE.TIBETAN:
  18198. return createCounterStyleFromRange(value, 0xf20, 0xf29, true, defaultSuffix);
  18199. case LIST_STYLE_TYPE.DECIMAL:
  18200. default:
  18201. return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);}
  18202. };
  18203. var IGNORE_ATTRIBUTE = 'data-html2canvas-ignore';
  18204. var DocumentCloner = /** @class */function () {
  18205. function DocumentCloner(element, options) {
  18206. this.options = options;
  18207. this.scrolledElements = [];
  18208. this.referenceElement = element;
  18209. this.counters = new CounterState();
  18210. this.quoteDepth = 0;
  18211. if (!element.ownerDocument) {
  18212. throw new Error('Cloned element does not have an owner document');
  18213. }
  18214. this.documentElement = this.cloneNode(element.ownerDocument.documentElement);
  18215. }
  18216. DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) {
  18217. var _this = this;
  18218. var iframe = createIFrameContainer(ownerDocument, windowSize);
  18219. if (!iframe.contentWindow) {
  18220. return Promise.reject("Unable to find iframe window");
  18221. }
  18222. var scrollX = ownerDocument.defaultView.pageXOffset;
  18223. var scrollY = ownerDocument.defaultView.pageYOffset;
  18224. var cloneWindow = iframe.contentWindow;
  18225. var documentClone = cloneWindow.document;
  18226. /* Chrome doesn't detect relative background-images assigned in inline <style> sheets when fetched through getComputedStyle
  18227. if window url is about:blank, we can assign the url to current by writing onto the document
  18228. */
  18229. var iframeLoad = iframeLoader(iframe).then(function () {return __awaiter(_this, void 0, void 0, function () {
  18230. var onclone;
  18231. return __generator(this, function (_a) {
  18232. switch (_a.label) {
  18233. case 0:
  18234. this.scrolledElements.forEach(restoreNodeScroll);
  18235. if (cloneWindow) {
  18236. cloneWindow.scrollTo(windowSize.left, windowSize.top);
  18237. if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (
  18238. cloneWindow.scrollY !== windowSize.top || cloneWindow.scrollX !== windowSize.left)) {
  18239. documentClone.documentElement.style.top = -windowSize.top + 'px';
  18240. documentClone.documentElement.style.left = -windowSize.left + 'px';
  18241. documentClone.documentElement.style.position = 'absolute';
  18242. }
  18243. }
  18244. onclone = this.options.onclone;
  18245. if (typeof this.clonedReferenceElement === 'undefined') {
  18246. return [2 /*return*/, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")];
  18247. }
  18248. if (!(documentClone.fonts && documentClone.fonts.ready)) return [3 /*break*/, 2];
  18249. return [4 /*yield*/, documentClone.fonts.ready];
  18250. case 1:
  18251. _a.sent();
  18252. _a.label = 2;
  18253. case 2:
  18254. if (typeof onclone === 'function') {
  18255. return [2 /*return*/, Promise.resolve().
  18256. then(function () {return onclone(documentClone);}).
  18257. then(function () {return iframe;})];
  18258. }
  18259. return [2 /*return*/, iframe];}
  18260. });
  18261. });});
  18262. documentClone.open();
  18263. documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
  18264. // Chrome scrolls the parent document for some reason after the write to the cloned window???
  18265. restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
  18266. documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement);
  18267. documentClone.close();
  18268. return iframeLoad;
  18269. };
  18270. DocumentCloner.prototype.createElementClone = function (node) {
  18271. if (isCanvasElement(node)) {
  18272. return this.createCanvasClone(node);
  18273. }
  18274. /*
  18275. if (isIFrameElement(node)) {
  18276. return this.createIFrameClone(node);
  18277. }
  18278. */
  18279. if (isStyleElement(node)) {
  18280. return this.createStyleClone(node);
  18281. }
  18282. var clone = node.cloneNode(false);
  18283. // @ts-ignore
  18284. if (isImageElement(clone) && clone.loading === 'lazy') {
  18285. // @ts-ignore
  18286. clone.loading = 'eager';
  18287. }
  18288. return clone;
  18289. };
  18290. DocumentCloner.prototype.createStyleClone = function (node) {
  18291. try {
  18292. var sheet = node.sheet;
  18293. if (sheet && sheet.cssRules) {
  18294. var css = [].slice.call(sheet.cssRules, 0).reduce(function (css, rule) {
  18295. if (rule && typeof rule.cssText === 'string') {
  18296. return css + rule.cssText;
  18297. }
  18298. return css;
  18299. }, '');
  18300. var style = node.cloneNode(false);
  18301. style.textContent = css;
  18302. return style;
  18303. }
  18304. }
  18305. catch (e) {
  18306. // accessing node.sheet.cssRules throws a DOMException
  18307. Logger.getInstance(this.options.id).error('Unable to access cssRules property', e);
  18308. if (e.name !== 'SecurityError') {
  18309. throw e;
  18310. }
  18311. }
  18312. return node.cloneNode(false);
  18313. };
  18314. DocumentCloner.prototype.createCanvasClone = function (canvas) {
  18315. if (this.options.inlineImages && canvas.ownerDocument) {
  18316. var img = canvas.ownerDocument.createElement('img');
  18317. try {
  18318. img.src = canvas.toDataURL();
  18319. return img;
  18320. }
  18321. catch (e) {
  18322. Logger.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted");
  18323. }
  18324. }
  18325. var clonedCanvas = canvas.cloneNode(false);
  18326. try {
  18327. clonedCanvas.width = canvas.width;
  18328. clonedCanvas.height = canvas.height;
  18329. var ctx = canvas.getContext('2d');
  18330. var clonedCtx = clonedCanvas.getContext('2d');
  18331. if (clonedCtx) {
  18332. if (ctx) {
  18333. clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
  18334. } else
  18335. {
  18336. clonedCtx.drawImage(canvas, 0, 0);
  18337. }
  18338. }
  18339. return clonedCanvas;
  18340. }
  18341. catch (e) {}
  18342. return clonedCanvas;
  18343. };
  18344. /*
  18345. createIFrameClone(iframe: HTMLIFrameElement) {
  18346. const tempIframe = <HTMLIFrameElement>iframe.cloneNode(false);
  18347. const iframeKey = generateIframeKey();
  18348. tempIframe.setAttribute('data-html2canvas-internal-iframe-key', iframeKey);
  18349. const {width, height} = parseBounds(iframe);
  18350. this.resourceLoader.cache[iframeKey] = getIframeDocumentElement(iframe, this.options)
  18351. .then(documentElement => {
  18352. return this.renderer(
  18353. documentElement,
  18354. {
  18355. allowTaint: this.options.allowTaint,
  18356. backgroundColor: '#ffffff',
  18357. canvas: null,
  18358. imageTimeout: this.options.imageTimeout,
  18359. logging: this.options.logging,
  18360. proxy: this.options.proxy,
  18361. removeContainer: this.options.removeContainer,
  18362. scale: this.options.scale,
  18363. foreignObjectRendering: this.options.foreignObjectRendering,
  18364. useCORS: this.options.useCORS,
  18365. target: new CanvasRenderer(),
  18366. width,
  18367. height,
  18368. x: 0,
  18369. y: 0,
  18370. windowWidth: documentElement.ownerDocument.defaultView.innerWidth,
  18371. windowHeight: documentElement.ownerDocument.defaultView.innerHeight,
  18372. scrollX: documentElement.ownerDocument.defaultView.pageXOffset,
  18373. scrollY: documentElement.ownerDocument.defaultView.pageYOffset
  18374. },
  18375. );
  18376. })
  18377. .then(
  18378. (canvas: HTMLCanvasElement) =>
  18379. new Promise((resolve, reject) => {
  18380. const iframeCanvas = document.createElement('img');
  18381. iframeCanvas.onload = () => resolve(canvas);
  18382. iframeCanvas.onerror = (event) => {
  18383. // Empty iframes may result in empty "data:," URLs, which are invalid from the <img>'s point of view
  18384. // and instead of `onload` cause `onerror` and unhandled rejection warnings
  18385. // https://github.com/niklasvh/html2canvas/issues/1502
  18386. iframeCanvas.src == 'data:,' ? resolve(canvas) : reject(event);
  18387. };
  18388. iframeCanvas.src = canvas.toDataURL();
  18389. if (tempIframe.parentNode && iframe.ownerDocument && iframe.ownerDocument.defaultView) {
  18390. tempIframe.parentNode.replaceChild(
  18391. copyCSSStyles(
  18392. iframe.ownerDocument.defaultView.getComputedStyle(iframe),
  18393. iframeCanvas
  18394. ),
  18395. tempIframe
  18396. );
  18397. }
  18398. })
  18399. );
  18400. return tempIframe;
  18401. }
  18402. */
  18403. DocumentCloner.prototype.cloneNode = function (node) {
  18404. if (isTextNode(node)) {
  18405. return document.createTextNode(node.data);
  18406. }
  18407. if (!node.ownerDocument) {
  18408. return node.cloneNode(false);
  18409. }
  18410. var window = node.ownerDocument.defaultView;
  18411. if (window && isElementNode(node) && (isHTMLElementNode(node) || isSVGElementNode(node))) {
  18412. var clone = this.createElementClone(node);
  18413. var style = window.getComputedStyle(node);
  18414. var styleBefore = window.getComputedStyle(node, ':before');
  18415. var styleAfter = window.getComputedStyle(node, ':after');
  18416. if (this.referenceElement === node && isHTMLElementNode(clone)) {
  18417. this.clonedReferenceElement = clone;
  18418. }
  18419. if (isBodyElement(clone)) {
  18420. createPseudoHideStyles(clone);
  18421. }
  18422. var counters = this.counters.parse(new CSSParsedCounterDeclaration(style));
  18423. var before = this.resolvePseudoContent(node, clone, styleBefore, PseudoElementType.BEFORE);
  18424. for (var child = node.firstChild; child; child = child.nextSibling) {
  18425. if (!isElementNode(child) ||
  18426. !isScriptElement(child) &&
  18427. !child.hasAttribute(IGNORE_ATTRIBUTE) && (
  18428. typeof this.options.ignoreElements !== 'function' || !this.options.ignoreElements(child))) {
  18429. if (!this.options.copyStyles || !isElementNode(child) || !isStyleElement(child)) {
  18430. clone.appendChild(this.cloneNode(child));
  18431. }
  18432. }
  18433. }
  18434. if (before) {
  18435. clone.insertBefore(before, clone.firstChild);
  18436. }
  18437. var after = this.resolvePseudoContent(node, clone, styleAfter, PseudoElementType.AFTER);
  18438. if (after) {
  18439. clone.appendChild(after);
  18440. }
  18441. this.counters.pop(counters);
  18442. if (style && (this.options.copyStyles || isSVGElementNode(node)) && !isIFrameElement(node)) {
  18443. copyCSSStyles(style, clone);
  18444. }
  18445. //this.inlineAllImages(clone);
  18446. if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
  18447. this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
  18448. }
  18449. if ((isTextareaElement(node) || isSelectElement(node)) && (
  18450. isTextareaElement(clone) || isSelectElement(clone))) {
  18451. clone.value = node.value;
  18452. }
  18453. return clone;
  18454. }
  18455. return node.cloneNode(false);
  18456. };
  18457. DocumentCloner.prototype.resolvePseudoContent = function (node, clone, style, pseudoElt) {
  18458. var _this = this;
  18459. if (!style) {
  18460. return;
  18461. }
  18462. var value = style.content;
  18463. var document = clone.ownerDocument;
  18464. if (!document || !value || value === 'none' || value === '-moz-alt-content' || style.display === 'none') {
  18465. return;
  18466. }
  18467. this.counters.parse(new CSSParsedCounterDeclaration(style));
  18468. var declaration = new CSSParsedPseudoDeclaration(style);
  18469. var anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
  18470. copyCSSStyles(style, anonymousReplacedElement);
  18471. declaration.content.forEach(function (token) {
  18472. if (token.type === TokenType.STRING_TOKEN) {
  18473. anonymousReplacedElement.appendChild(document.createTextNode(token.value));
  18474. } else
  18475. if (token.type === TokenType.URL_TOKEN) {
  18476. var img = document.createElement('img');
  18477. img.src = token.value;
  18478. img.style.opacity = '1';
  18479. anonymousReplacedElement.appendChild(img);
  18480. } else
  18481. if (token.type === TokenType.FUNCTION) {
  18482. if (token.name === 'attr') {
  18483. var attr = token.values.filter(isIdentToken);
  18484. if (attr.length) {
  18485. anonymousReplacedElement.appendChild(document.createTextNode(node.getAttribute(attr[0].value) || ''));
  18486. }
  18487. } else
  18488. if (token.name === 'counter') {
  18489. var _a = token.values.filter(nonFunctionArgSeparator),counter = _a[0],counterStyle = _a[1];
  18490. if (counter && isIdentToken(counter)) {
  18491. var counterState = _this.counters.getCounterValue(counter.value);
  18492. var counterType = counterStyle && isIdentToken(counterStyle) ?
  18493. listStyleType.parse(counterStyle.value) :
  18494. LIST_STYLE_TYPE.DECIMAL;
  18495. anonymousReplacedElement.appendChild(document.createTextNode(createCounterText(counterState, counterType, false)));
  18496. }
  18497. } else
  18498. if (token.name === 'counters') {
  18499. var _b = token.values.filter(nonFunctionArgSeparator),counter = _b[0],delim = _b[1],counterStyle = _b[2];
  18500. if (counter && isIdentToken(counter)) {
  18501. var counterStates = _this.counters.getCounterValues(counter.value);
  18502. var counterType_1 = counterStyle && isIdentToken(counterStyle) ?
  18503. listStyleType.parse(counterStyle.value) :
  18504. LIST_STYLE_TYPE.DECIMAL;
  18505. var separator = delim && delim.type === TokenType.STRING_TOKEN ? delim.value : '';
  18506. var text = counterStates.
  18507. map(function (value) {return createCounterText(value, counterType_1, false);}).
  18508. join(separator);
  18509. anonymousReplacedElement.appendChild(document.createTextNode(text));
  18510. }
  18511. }
  18512. } else
  18513. if (token.type === TokenType.IDENT_TOKEN) {
  18514. switch (token.value) {
  18515. case 'open-quote':
  18516. anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, _this.quoteDepth++, true)));
  18517. break;
  18518. case 'close-quote':
  18519. anonymousReplacedElement.appendChild(document.createTextNode(getQuote(declaration.quotes, --_this.quoteDepth, false)));
  18520. break;
  18521. default:
  18522. // safari doesn't parse string tokens correctly because of lack of quotes
  18523. anonymousReplacedElement.appendChild(document.createTextNode(token.value));}
  18524. }
  18525. });
  18526. anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  18527. var newClassName = pseudoElt === PseudoElementType.BEFORE ?
  18528. " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE :
  18529. " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  18530. if (isSVGElementNode(clone)) {
  18531. clone.className.baseValue += newClassName;
  18532. } else
  18533. {
  18534. clone.className += newClassName;
  18535. }
  18536. return anonymousReplacedElement;
  18537. };
  18538. DocumentCloner.destroy = function (container) {
  18539. if (container.parentNode) {
  18540. container.parentNode.removeChild(container);
  18541. return true;
  18542. }
  18543. return false;
  18544. };
  18545. return DocumentCloner;
  18546. }();
  18547. var PseudoElementType;
  18548. (function (PseudoElementType) {
  18549. PseudoElementType[PseudoElementType["BEFORE"] = 0] = "BEFORE";
  18550. PseudoElementType[PseudoElementType["AFTER"] = 1] = "AFTER";
  18551. })(PseudoElementType || (PseudoElementType = {}));
  18552. var createIFrameContainer = function createIFrameContainer(ownerDocument, bounds) {
  18553. var cloneIframeContainer = ownerDocument.createElement('iframe');
  18554. cloneIframeContainer.className = 'html2canvas-container';
  18555. cloneIframeContainer.style.visibility = 'hidden';
  18556. cloneIframeContainer.style.position = 'fixed';
  18557. cloneIframeContainer.style.left = '-10000px';
  18558. cloneIframeContainer.style.top = '0px';
  18559. cloneIframeContainer.style.border = '0';
  18560. cloneIframeContainer.width = bounds.width.toString();
  18561. cloneIframeContainer.height = bounds.height.toString();
  18562. cloneIframeContainer.scrolling = 'no'; // ios won't scroll without it
  18563. cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, 'true');
  18564. ownerDocument.body.appendChild(cloneIframeContainer);
  18565. return cloneIframeContainer;
  18566. };
  18567. var iframeLoader = function iframeLoader(iframe) {
  18568. return new Promise(function (resolve, reject) {
  18569. var cloneWindow = iframe.contentWindow;
  18570. if (!cloneWindow) {
  18571. return reject("No window assigned for iframe");
  18572. }
  18573. var documentClone = cloneWindow.document;
  18574. cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = function () {
  18575. cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
  18576. var interval = setInterval(function () {
  18577. if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
  18578. clearInterval(interval);
  18579. resolve(iframe);
  18580. }
  18581. }, 50);
  18582. };
  18583. });
  18584. };
  18585. var copyCSSStyles = function copyCSSStyles(style, target) {
  18586. // Edge does not provide value for cssText
  18587. for (var i = style.length - 1; i >= 0; i--) {
  18588. var property = style.item(i);
  18589. // Safari shows pseudoelements if content is set
  18590. if (property !== 'content') {
  18591. target.style.setProperty(property, style.getPropertyValue(property));
  18592. }
  18593. }
  18594. return target;
  18595. };
  18596. var serializeDoctype = function serializeDoctype(doctype) {
  18597. var str = '';
  18598. if (doctype) {
  18599. str += '<!DOCTYPE ';
  18600. if (doctype.name) {
  18601. str += doctype.name;
  18602. }
  18603. if (doctype.internalSubset) {
  18604. str += doctype.internalSubset;
  18605. }
  18606. if (doctype.publicId) {
  18607. str += "\"" + doctype.publicId + "\"";
  18608. }
  18609. if (doctype.systemId) {
  18610. str += "\"" + doctype.systemId + "\"";
  18611. }
  18612. str += '>';
  18613. }
  18614. return str;
  18615. };
  18616. var restoreOwnerScroll = function restoreOwnerScroll(ownerDocument, x, y) {
  18617. if (ownerDocument &&
  18618. ownerDocument.defaultView && (
  18619. x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
  18620. ownerDocument.defaultView.scrollTo(x, y);
  18621. }
  18622. };
  18623. var restoreNodeScroll = function restoreNodeScroll(_a) {
  18624. var element = _a[0],x = _a[1],y = _a[2];
  18625. element.scrollLeft = x;
  18626. element.scrollTop = y;
  18627. };
  18628. var PSEUDO_BEFORE = ':before';
  18629. var PSEUDO_AFTER = ':after';
  18630. var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = '___html2canvas___pseudoelement_before';
  18631. var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = '___html2canvas___pseudoelement_after';
  18632. var PSEUDO_HIDE_ELEMENT_STYLE = "{\n content: \"\" !important;\n display: none !important;\n}";
  18633. var createPseudoHideStyles = function createPseudoHideStyles(body) {
  18634. createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + PSEUDO_HIDE_ELEMENT_STYLE + "\n ." + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + PSEUDO_HIDE_ELEMENT_STYLE);
  18635. };
  18636. var createStyles = function createStyles(body, styles) {
  18637. var document = body.ownerDocument;
  18638. if (document) {
  18639. var style = document.createElement('style');
  18640. style.textContent = styles;
  18641. body.appendChild(style);
  18642. }
  18643. };
  18644. var PathType;
  18645. (function (PathType) {
  18646. PathType[PathType["VECTOR"] = 0] = "VECTOR";
  18647. PathType[PathType["BEZIER_CURVE"] = 1] = "BEZIER_CURVE";
  18648. })(PathType || (PathType = {}));
  18649. var equalPath = function equalPath(a, b) {
  18650. if (a.length === b.length) {
  18651. return a.some(function (v, i) {return v === b[i];});
  18652. }
  18653. return false;
  18654. };
  18655. var transformPath = function transformPath(path, deltaX, deltaY, deltaW, deltaH) {
  18656. return path.map(function (point, index) {
  18657. switch (index) {
  18658. case 0:
  18659. return point.add(deltaX, deltaY);
  18660. case 1:
  18661. return point.add(deltaX + deltaW, deltaY);
  18662. case 2:
  18663. return point.add(deltaX + deltaW, deltaY + deltaH);
  18664. case 3:
  18665. return point.add(deltaX, deltaY + deltaH);}
  18666. return point;
  18667. });
  18668. };
  18669. var Vector = /** @class */function () {
  18670. function Vector(x, y) {
  18671. this.type = PathType.VECTOR;
  18672. this.x = x;
  18673. this.y = y;
  18674. }
  18675. Vector.prototype.add = function (deltaX, deltaY) {
  18676. return new Vector(this.x + deltaX, this.y + deltaY);
  18677. };
  18678. return Vector;
  18679. }();
  18680. var lerp = function lerp(a, b, t) {
  18681. return new Vector(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
  18682. };
  18683. var BezierCurve = /** @class */function () {
  18684. function BezierCurve(start, startControl, endControl, end) {
  18685. this.type = PathType.BEZIER_CURVE;
  18686. this.start = start;
  18687. this.startControl = startControl;
  18688. this.endControl = endControl;
  18689. this.end = end;
  18690. }
  18691. BezierCurve.prototype.subdivide = function (t, firstHalf) {
  18692. var ab = lerp(this.start, this.startControl, t);
  18693. var bc = lerp(this.startControl, this.endControl, t);
  18694. var cd = lerp(this.endControl, this.end, t);
  18695. var abbc = lerp(ab, bc, t);
  18696. var bccd = lerp(bc, cd, t);
  18697. var dest = lerp(abbc, bccd, t);
  18698. return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
  18699. };
  18700. BezierCurve.prototype.add = function (deltaX, deltaY) {
  18701. return new BezierCurve(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
  18702. };
  18703. BezierCurve.prototype.reverse = function () {
  18704. return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
  18705. };
  18706. return BezierCurve;
  18707. }();
  18708. var isBezierCurve = function isBezierCurve(path) {return path.type === PathType.BEZIER_CURVE;};
  18709. var BoundCurves = /** @class */function () {
  18710. function BoundCurves(element) {
  18711. var styles = element.styles;
  18712. var bounds = element.bounds;
  18713. var _a = getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height),tlh = _a[0],tlv = _a[1];
  18714. var _b = getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height),trh = _b[0],trv = _b[1];
  18715. var _c = getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height),brh = _c[0],brv = _c[1];
  18716. var _d = getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height),blh = _d[0],blv = _d[1];
  18717. var factors = [];
  18718. factors.push((tlh + trh) / bounds.width);
  18719. factors.push((blh + brh) / bounds.width);
  18720. factors.push((tlv + blv) / bounds.height);
  18721. factors.push((trv + brv) / bounds.height);
  18722. var maxFactor = Math.max.apply(Math, factors);
  18723. if (maxFactor > 1) {
  18724. tlh /= maxFactor;
  18725. tlv /= maxFactor;
  18726. trh /= maxFactor;
  18727. trv /= maxFactor;
  18728. brh /= maxFactor;
  18729. brv /= maxFactor;
  18730. blh /= maxFactor;
  18731. blv /= maxFactor;
  18732. }
  18733. var topWidth = bounds.width - trh;
  18734. var rightHeight = bounds.height - brv;
  18735. var bottomWidth = bounds.width - brh;
  18736. var leftHeight = bounds.height - blv;
  18737. var borderTopWidth = styles.borderTopWidth;
  18738. var borderRightWidth = styles.borderRightWidth;
  18739. var borderBottomWidth = styles.borderBottomWidth;
  18740. var borderLeftWidth = styles.borderLeftWidth;
  18741. var paddingTop = getAbsoluteValue(styles.paddingTop, element.bounds.width);
  18742. var paddingRight = getAbsoluteValue(styles.paddingRight, element.bounds.width);
  18743. var paddingBottom = getAbsoluteValue(styles.paddingBottom, element.bounds.width);
  18744. var paddingLeft = getAbsoluteValue(styles.paddingLeft, element.bounds.width);
  18745. this.topLeftBorderBox =
  18746. tlh > 0 || tlv > 0 ?
  18747. getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) :
  18748. new Vector(bounds.left, bounds.top);
  18749. this.topRightBorderBox =
  18750. trh > 0 || trv > 0 ?
  18751. getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) :
  18752. new Vector(bounds.left + bounds.width, bounds.top);
  18753. this.bottomRightBorderBox =
  18754. brh > 0 || brv > 0 ?
  18755. getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) :
  18756. new Vector(bounds.left + bounds.width, bounds.top + bounds.height);
  18757. this.bottomLeftBorderBox =
  18758. blh > 0 || blv > 0 ?
  18759. getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) :
  18760. new Vector(bounds.left, bounds.top + bounds.height);
  18761. this.topLeftPaddingBox =
  18762. tlh > 0 || tlv > 0 ?
  18763. getCurvePoints(bounds.left + borderLeftWidth, bounds.top + borderTopWidth, Math.max(0, tlh - borderLeftWidth), Math.max(0, tlv - borderTopWidth), CORNER.TOP_LEFT) :
  18764. new Vector(bounds.left + borderLeftWidth, bounds.top + borderTopWidth);
  18765. this.topRightPaddingBox =
  18766. trh > 0 || trv > 0 ?
  18767. getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth), bounds.top + borderTopWidth, topWidth > bounds.width + borderLeftWidth ? 0 : trh - borderLeftWidth, trv - borderTopWidth, CORNER.TOP_RIGHT) :
  18768. new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + borderTopWidth);
  18769. this.bottomRightPaddingBox =
  18770. brh > 0 || brv > 0 ?
  18771. getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth), Math.max(0, brh - borderRightWidth), brv - borderBottomWidth, CORNER.BOTTOM_RIGHT) :
  18772. new Vector(bounds.left + bounds.width - borderRightWidth, bounds.top + bounds.height - borderBottomWidth);
  18773. this.bottomLeftPaddingBox =
  18774. blh > 0 || blv > 0 ?
  18775. getCurvePoints(bounds.left + borderLeftWidth, bounds.top + leftHeight, Math.max(0, blh - borderLeftWidth), blv - borderBottomWidth, CORNER.BOTTOM_LEFT) :
  18776. new Vector(bounds.left + borderLeftWidth, bounds.top + bounds.height - borderBottomWidth);
  18777. this.topLeftContentBox =
  18778. tlh > 0 || tlv > 0 ?
  18779. getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop, Math.max(0, tlh - (borderLeftWidth + paddingLeft)), Math.max(0, tlv - (borderTopWidth + paddingTop)), CORNER.TOP_LEFT) :
  18780. new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + borderTopWidth + paddingTop);
  18781. this.topRightContentBox =
  18782. trh > 0 || trv > 0 ?
  18783. getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth + paddingLeft), bounds.top + borderTopWidth + paddingTop, topWidth > bounds.width + borderLeftWidth + paddingLeft ? 0 : trh - borderLeftWidth + paddingLeft, trv - (borderTopWidth + paddingTop), CORNER.TOP_RIGHT) :
  18784. new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + borderTopWidth + paddingTop);
  18785. this.bottomRightContentBox =
  18786. brh > 0 || brv > 0 ?
  18787. getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth + paddingLeft)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth + paddingTop), Math.max(0, brh - (borderRightWidth + paddingRight)), brv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_RIGHT) :
  18788. new Vector(bounds.left + bounds.width - (borderRightWidth + paddingRight), bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
  18789. this.bottomLeftContentBox =
  18790. blh > 0 || blv > 0 ?
  18791. getCurvePoints(bounds.left + borderLeftWidth + paddingLeft, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth + paddingLeft)), blv - (borderBottomWidth + paddingBottom), CORNER.BOTTOM_LEFT) :
  18792. new Vector(bounds.left + borderLeftWidth + paddingLeft, bounds.top + bounds.height - (borderBottomWidth + paddingBottom));
  18793. }
  18794. return BoundCurves;
  18795. }();
  18796. var CORNER;
  18797. (function (CORNER) {
  18798. CORNER[CORNER["TOP_LEFT"] = 0] = "TOP_LEFT";
  18799. CORNER[CORNER["TOP_RIGHT"] = 1] = "TOP_RIGHT";
  18800. CORNER[CORNER["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT";
  18801. CORNER[CORNER["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT";
  18802. })(CORNER || (CORNER = {}));
  18803. var getCurvePoints = function getCurvePoints(x, y, r1, r2, position) {
  18804. var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
  18805. var ox = r1 * kappa; // control point offset horizontal
  18806. var oy = r2 * kappa; // control point offset vertical
  18807. var xm = x + r1; // x-middle
  18808. var ym = y + r2; // y-middle
  18809. switch (position) {
  18810. case CORNER.TOP_LEFT:
  18811. return new BezierCurve(new Vector(x, ym), new Vector(x, ym - oy), new Vector(xm - ox, y), new Vector(xm, y));
  18812. case CORNER.TOP_RIGHT:
  18813. return new BezierCurve(new Vector(x, y), new Vector(x + ox, y), new Vector(xm, ym - oy), new Vector(xm, ym));
  18814. case CORNER.BOTTOM_RIGHT:
  18815. return new BezierCurve(new Vector(xm, y), new Vector(xm, y + oy), new Vector(x + ox, ym), new Vector(x, ym));
  18816. case CORNER.BOTTOM_LEFT:
  18817. default:
  18818. return new BezierCurve(new Vector(xm, ym), new Vector(xm - ox, ym), new Vector(x, y + oy), new Vector(x, y));}
  18819. };
  18820. var calculateBorderBoxPath = function calculateBorderBoxPath(curves) {
  18821. return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox];
  18822. };
  18823. var calculateContentBoxPath = function calculateContentBoxPath(curves) {
  18824. return [
  18825. curves.topLeftContentBox,
  18826. curves.topRightContentBox,
  18827. curves.bottomRightContentBox,
  18828. curves.bottomLeftContentBox];
  18829. };
  18830. var calculatePaddingBoxPath = function calculatePaddingBoxPath(curves) {
  18831. return [
  18832. curves.topLeftPaddingBox,
  18833. curves.topRightPaddingBox,
  18834. curves.bottomRightPaddingBox,
  18835. curves.bottomLeftPaddingBox];
  18836. };
  18837. var TransformEffect = /** @class */function () {
  18838. function TransformEffect(offsetX, offsetY, matrix) {
  18839. this.type = 0 /* TRANSFORM */;
  18840. this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
  18841. this.offsetX = offsetX;
  18842. this.offsetY = offsetY;
  18843. this.matrix = matrix;
  18844. }
  18845. return TransformEffect;
  18846. }();
  18847. var ClipEffect = /** @class */function () {
  18848. function ClipEffect(path, target) {
  18849. this.type = 1 /* CLIP */;
  18850. this.target = target;
  18851. this.path = path;
  18852. }
  18853. return ClipEffect;
  18854. }();
  18855. var OpacityEffect = /** @class */function () {
  18856. function OpacityEffect(opacity) {
  18857. this.type = 2 /* OPACITY */;
  18858. this.target = 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */;
  18859. this.opacity = opacity;
  18860. }
  18861. return OpacityEffect;
  18862. }();
  18863. var isTransformEffect = function isTransformEffect(effect) {
  18864. return effect.type === 0 /* TRANSFORM */;
  18865. };
  18866. var isClipEffect = function isClipEffect(effect) {return effect.type === 1 /* CLIP */;};
  18867. var isOpacityEffect = function isOpacityEffect(effect) {return effect.type === 2 /* OPACITY */;};
  18868. var StackingContext = /** @class */function () {
  18869. function StackingContext(container) {
  18870. this.element = container;
  18871. this.inlineLevel = [];
  18872. this.nonInlineLevel = [];
  18873. this.negativeZIndex = [];
  18874. this.zeroOrAutoZIndexOrTransformedOrOpacity = [];
  18875. this.positiveZIndex = [];
  18876. this.nonPositionedFloats = [];
  18877. this.nonPositionedInlineLevel = [];
  18878. }
  18879. return StackingContext;
  18880. }();
  18881. var ElementPaint = /** @class */function () {
  18882. function ElementPaint(element, parentStack) {
  18883. this.container = element;
  18884. this.effects = parentStack.slice(0);
  18885. this.curves = new BoundCurves(element);
  18886. if (element.styles.opacity < 1) {
  18887. this.effects.push(new OpacityEffect(element.styles.opacity));
  18888. }
  18889. if (element.styles.transform !== null) {
  18890. var offsetX = element.bounds.left + element.styles.transformOrigin[0].number;
  18891. var offsetY = element.bounds.top + element.styles.transformOrigin[1].number;
  18892. var matrix = element.styles.transform;
  18893. this.effects.push(new TransformEffect(offsetX, offsetY, matrix));
  18894. }
  18895. if (element.styles.overflowX !== OVERFLOW.VISIBLE) {
  18896. var borderBox = calculateBorderBoxPath(this.curves);
  18897. var paddingBox = calculatePaddingBoxPath(this.curves);
  18898. if (equalPath(borderBox, paddingBox)) {
  18899. this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
  18900. } else
  18901. {
  18902. this.effects.push(new ClipEffect(borderBox, 2 /* BACKGROUND_BORDERS */));
  18903. this.effects.push(new ClipEffect(paddingBox, 4 /* CONTENT */));
  18904. }
  18905. }
  18906. }
  18907. ElementPaint.prototype.getParentEffects = function () {
  18908. var effects = this.effects.slice(0);
  18909. if (this.container.styles.overflowX !== OVERFLOW.VISIBLE) {
  18910. var borderBox = calculateBorderBoxPath(this.curves);
  18911. var paddingBox = calculatePaddingBoxPath(this.curves);
  18912. if (!equalPath(borderBox, paddingBox)) {
  18913. effects.push(new ClipEffect(paddingBox, 2 /* BACKGROUND_BORDERS */ | 4 /* CONTENT */));
  18914. }
  18915. }
  18916. return effects;
  18917. };
  18918. return ElementPaint;
  18919. }();
  18920. var parseStackTree = function parseStackTree(parent, stackingContext, realStackingContext, listItems) {
  18921. parent.container.elements.forEach(function (child) {
  18922. var treatAsRealStackingContext = contains(child.flags, 4 /* CREATES_REAL_STACKING_CONTEXT */);
  18923. var createsStackingContext = contains(child.flags, 2 /* CREATES_STACKING_CONTEXT */);
  18924. var paintContainer = new ElementPaint(child, parent.getParentEffects());
  18925. if (contains(child.styles.display, 2048 /* LIST_ITEM */)) {
  18926. listItems.push(paintContainer);
  18927. }
  18928. var listOwnerItems = contains(child.flags, 8 /* IS_LIST_OWNER */) ? [] : listItems;
  18929. if (treatAsRealStackingContext || createsStackingContext) {
  18930. var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
  18931. var stack = new StackingContext(paintContainer);
  18932. if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) {
  18933. var order_1 = child.styles.zIndex.order;
  18934. if (order_1 < 0) {
  18935. var index_1 = 0;
  18936. parentStack.negativeZIndex.some(function (current, i) {
  18937. if (order_1 > current.element.container.styles.zIndex.order) {
  18938. index_1 = i;
  18939. return false;
  18940. } else
  18941. if (index_1 > 0) {
  18942. return true;
  18943. }
  18944. return false;
  18945. });
  18946. parentStack.negativeZIndex.splice(index_1, 0, stack);
  18947. } else
  18948. if (order_1 > 0) {
  18949. var index_2 = 0;
  18950. parentStack.positiveZIndex.some(function (current, i) {
  18951. if (order_1 >= current.element.container.styles.zIndex.order) {
  18952. index_2 = i + 1;
  18953. return false;
  18954. } else
  18955. if (index_2 > 0) {
  18956. return true;
  18957. }
  18958. return false;
  18959. });
  18960. parentStack.positiveZIndex.splice(index_2, 0, stack);
  18961. } else
  18962. {
  18963. parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack);
  18964. }
  18965. } else
  18966. {
  18967. if (child.styles.isFloating()) {
  18968. parentStack.nonPositionedFloats.push(stack);
  18969. } else
  18970. {
  18971. parentStack.nonPositionedInlineLevel.push(stack);
  18972. }
  18973. }
  18974. parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems);
  18975. } else
  18976. {
  18977. if (child.styles.isInlineLevel()) {
  18978. stackingContext.inlineLevel.push(paintContainer);
  18979. } else
  18980. {
  18981. stackingContext.nonInlineLevel.push(paintContainer);
  18982. }
  18983. parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
  18984. }
  18985. if (contains(child.flags, 8 /* IS_LIST_OWNER */)) {
  18986. processListItems(child, listOwnerItems);
  18987. }
  18988. });
  18989. };
  18990. var processListItems = function processListItems(owner, elements) {
  18991. var numbering = owner instanceof OLElementContainer ? owner.start : 1;
  18992. var reversed = owner instanceof OLElementContainer ? owner.reversed : false;
  18993. for (var i = 0; i < elements.length; i++) {
  18994. var item = elements[i];
  18995. if (item.container instanceof LIElementContainer &&
  18996. typeof item.container.value === 'number' &&
  18997. item.container.value !== 0) {
  18998. numbering = item.container.value;
  18999. }
  19000. item.listValue = createCounterText(numbering, item.container.styles.listStyleType, true);
  19001. numbering += reversed ? -1 : 1;
  19002. }
  19003. };
  19004. var parseStackingContexts = function parseStackingContexts(container) {
  19005. var paintContainer = new ElementPaint(container, []);
  19006. var root = new StackingContext(paintContainer);
  19007. var listItems = [];
  19008. parseStackTree(paintContainer, root, root, listItems);
  19009. processListItems(paintContainer.container, listItems);
  19010. return root;
  19011. };
  19012. var parsePathForBorder = function parsePathForBorder(curves, borderSide) {
  19013. switch (borderSide) {
  19014. case 0:
  19015. return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
  19016. case 1:
  19017. return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
  19018. case 2:
  19019. return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
  19020. case 3:
  19021. default:
  19022. return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);}
  19023. };
  19024. var createPathFromCurves = function createPathFromCurves(outer1, inner1, outer2, inner2) {
  19025. var path = [];
  19026. if (isBezierCurve(outer1)) {
  19027. path.push(outer1.subdivide(0.5, false));
  19028. } else
  19029. {
  19030. path.push(outer1);
  19031. }
  19032. if (isBezierCurve(outer2)) {
  19033. path.push(outer2.subdivide(0.5, true));
  19034. } else
  19035. {
  19036. path.push(outer2);
  19037. }
  19038. if (isBezierCurve(inner2)) {
  19039. path.push(inner2.subdivide(0.5, true).reverse());
  19040. } else
  19041. {
  19042. path.push(inner2);
  19043. }
  19044. if (isBezierCurve(inner1)) {
  19045. path.push(inner1.subdivide(0.5, false).reverse());
  19046. } else
  19047. {
  19048. path.push(inner1);
  19049. }
  19050. return path;
  19051. };
  19052. var paddingBox = function paddingBox(element) {
  19053. var bounds = element.bounds;
  19054. var styles = element.styles;
  19055. return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
  19056. };
  19057. var contentBox = function contentBox(element) {
  19058. var styles = element.styles;
  19059. var bounds = element.bounds;
  19060. var paddingLeft = getAbsoluteValue(styles.paddingLeft, bounds.width);
  19061. var paddingRight = getAbsoluteValue(styles.paddingRight, bounds.width);
  19062. var paddingTop = getAbsoluteValue(styles.paddingTop, bounds.width);
  19063. var paddingBottom = getAbsoluteValue(styles.paddingBottom, bounds.width);
  19064. return bounds.add(paddingLeft + styles.borderLeftWidth, paddingTop + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft + paddingRight), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop + paddingBottom));
  19065. };
  19066. var calculateBackgroundPositioningArea = function calculateBackgroundPositioningArea(backgroundOrigin, element) {
  19067. if (backgroundOrigin === 0 /* BORDER_BOX */) {
  19068. return element.bounds;
  19069. }
  19070. if (backgroundOrigin === 2 /* CONTENT_BOX */) {
  19071. return contentBox(element);
  19072. }
  19073. return paddingBox(element);
  19074. };
  19075. var calculateBackgroundPaintingArea = function calculateBackgroundPaintingArea(backgroundClip, element) {
  19076. if (backgroundClip === BACKGROUND_CLIP.BORDER_BOX) {
  19077. return element.bounds;
  19078. }
  19079. if (backgroundClip === BACKGROUND_CLIP.CONTENT_BOX) {
  19080. return contentBox(element);
  19081. }
  19082. return paddingBox(element);
  19083. };
  19084. var calculateBackgroundRendering = function calculateBackgroundRendering(container, index, intrinsicSize) {
  19085. var backgroundPositioningArea = calculateBackgroundPositioningArea(getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container);
  19086. var backgroundPaintingArea = calculateBackgroundPaintingArea(getBackgroundValueForIndex(container.styles.backgroundClip, index), container);
  19087. var backgroundImageSize = calculateBackgroundSize(getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea);
  19088. var sizeWidth = backgroundImageSize[0],sizeHeight = backgroundImageSize[1];
  19089. var position = getAbsoluteValueForTuple(getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight);
  19090. var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
  19091. var offsetX = Math.round(backgroundPositioningArea.left + position[0]);
  19092. var offsetY = Math.round(backgroundPositioningArea.top + position[1]);
  19093. return [path, offsetX, offsetY, sizeWidth, sizeHeight];
  19094. };
  19095. var isAuto = function isAuto(token) {return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO;};
  19096. var hasIntrinsicValue = function hasIntrinsicValue(value) {return typeof value === 'number';};
  19097. var calculateBackgroundSize = function calculateBackgroundSize(size, _a, bounds) {
  19098. var intrinsicWidth = _a[0],intrinsicHeight = _a[1],intrinsicProportion = _a[2];
  19099. var first = size[0],second = size[1];
  19100. if (isLengthPercentage(first) && second && isLengthPercentage(second)) {
  19101. return [getAbsoluteValue(first, bounds.width), getAbsoluteValue(second, bounds.height)];
  19102. }
  19103. var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion);
  19104. if (isIdentToken(first) && (first.value === BACKGROUND_SIZE.CONTAIN || first.value === BACKGROUND_SIZE.COVER)) {
  19105. if (hasIntrinsicValue(intrinsicProportion)) {
  19106. var targetRatio = bounds.width / bounds.height;
  19107. return targetRatio < intrinsicProportion !== (first.value === BACKGROUND_SIZE.COVER) ?
  19108. [bounds.width, bounds.width / intrinsicProportion] :
  19109. [bounds.height * intrinsicProportion, bounds.height];
  19110. }
  19111. return [bounds.width, bounds.height];
  19112. }
  19113. var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth);
  19114. var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight);
  19115. var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight;
  19116. // If the background-size is auto or auto auto:
  19117. if (isAuto(first) && (!second || isAuto(second))) {
  19118. // If the image has both horizontal and vertical intrinsic dimensions, it's rendered at that size.
  19119. if (hasIntrinsicWidth && hasIntrinsicHeight) {
  19120. return [intrinsicWidth, intrinsicHeight];
  19121. }
  19122. // If the image has no intrinsic dimensions and has no intrinsic proportions,
  19123. // it's rendered at the size of the background positioning area.
  19124. if (!hasIntrinsicProportion && !hasIntrinsicDimensions) {
  19125. return [bounds.width, bounds.height];
  19126. }
  19127. // TODO If the image has no intrinsic dimensions but has intrinsic proportions, it's rendered as if contain had been specified instead.
  19128. // If the image has only one intrinsic dimension and has intrinsic proportions, it's rendered at the size corresponding to that one dimension.
  19129. // The other dimension is computed using the specified dimension and the intrinsic proportions.
  19130. if (hasIntrinsicDimensions && hasIntrinsicProportion) {
  19131. var width_1 = hasIntrinsicWidth ?
  19132. intrinsicWidth :
  19133. intrinsicHeight * intrinsicProportion;
  19134. var height_1 = hasIntrinsicHeight ?
  19135. intrinsicHeight :
  19136. intrinsicWidth / intrinsicProportion;
  19137. return [width_1, height_1];
  19138. }
  19139. // If the image has only one intrinsic dimension but has no intrinsic proportions,
  19140. // it's rendered using the specified dimension and the other dimension of the background positioning area.
  19141. var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width;
  19142. var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height;
  19143. return [width_2, height_2];
  19144. }
  19145. // If the image has intrinsic proportions, it's stretched to the specified dimension.
  19146. // The unspecified dimension is computed using the specified dimension and the intrinsic proportions.
  19147. if (hasIntrinsicProportion) {
  19148. var width_3 = 0;
  19149. var height_3 = 0;
  19150. if (isLengthPercentage(first)) {
  19151. width_3 = getAbsoluteValue(first, bounds.width);
  19152. } else
  19153. if (isLengthPercentage(second)) {
  19154. height_3 = getAbsoluteValue(second, bounds.height);
  19155. }
  19156. if (isAuto(first)) {
  19157. width_3 = height_3 * intrinsicProportion;
  19158. } else
  19159. if (!second || isAuto(second)) {
  19160. height_3 = width_3 / intrinsicProportion;
  19161. }
  19162. return [width_3, height_3];
  19163. }
  19164. // If the image has no intrinsic proportions, it's stretched to the specified dimension.
  19165. // The unspecified dimension is computed using the image's corresponding intrinsic dimension,
  19166. // if there is one. If there is no such intrinsic dimension,
  19167. // it becomes the corresponding dimension of the background positioning area.
  19168. var width = null;
  19169. var height = null;
  19170. if (isLengthPercentage(first)) {
  19171. width = getAbsoluteValue(first, bounds.width);
  19172. } else
  19173. if (second && isLengthPercentage(second)) {
  19174. height = getAbsoluteValue(second, bounds.height);
  19175. }
  19176. if (width !== null && (!second || isAuto(second))) {
  19177. height =
  19178. hasIntrinsicWidth && hasIntrinsicHeight ?
  19179. width / intrinsicWidth * intrinsicHeight :
  19180. bounds.height;
  19181. }
  19182. if (height !== null && isAuto(first)) {
  19183. width =
  19184. hasIntrinsicWidth && hasIntrinsicHeight ?
  19185. height / intrinsicHeight * intrinsicWidth :
  19186. bounds.width;
  19187. }
  19188. if (width !== null && height !== null) {
  19189. return [width, height];
  19190. }
  19191. throw new Error("Unable to calculate background-size for element");
  19192. };
  19193. var getBackgroundValueForIndex = function getBackgroundValueForIndex(values, index) {
  19194. var value = values[index];
  19195. if (typeof value === 'undefined') {
  19196. return values[0];
  19197. }
  19198. return value;
  19199. };
  19200. var calculateBackgroundRepeatPath = function calculateBackgroundRepeatPath(repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) {
  19201. var x = _a[0],y = _a[1];
  19202. var width = _b[0],height = _b[1];
  19203. switch (repeat) {
  19204. case BACKGROUND_REPEAT.REPEAT_X:
  19205. return [
  19206. new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
  19207. new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
  19208. new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
  19209. new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))];
  19210. case BACKGROUND_REPEAT.REPEAT_Y:
  19211. return [
  19212. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
  19213. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
  19214. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
  19215. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))];
  19216. case BACKGROUND_REPEAT.NO_REPEAT:
  19217. return [
  19218. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
  19219. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
  19220. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)),
  19221. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height))];
  19222. default:
  19223. return [
  19224. new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)),
  19225. new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)),
  19226. new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)),
  19227. new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top))];}
  19228. };
  19229. var SMALL_IMAGE = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
  19230. var SAMPLE_TEXT = 'Hidden Text';
  19231. var FontMetrics = /** @class */function () {
  19232. function FontMetrics(document) {
  19233. this._data = {};
  19234. this._document = document;
  19235. }
  19236. FontMetrics.prototype.parseMetrics = function (fontFamily, fontSize) {
  19237. var container = this._document.createElement('div');
  19238. var img = this._document.createElement('img');
  19239. var span = this._document.createElement('span');
  19240. var body = this._document.body;
  19241. container.style.visibility = 'hidden';
  19242. container.style.fontFamily = fontFamily;
  19243. container.style.fontSize = fontSize;
  19244. container.style.margin = '0';
  19245. container.style.padding = '0';
  19246. body.appendChild(container);
  19247. img.src = SMALL_IMAGE;
  19248. img.width = 1;
  19249. img.height = 1;
  19250. img.style.margin = '0';
  19251. img.style.padding = '0';
  19252. img.style.verticalAlign = 'baseline';
  19253. span.style.fontFamily = fontFamily;
  19254. span.style.fontSize = fontSize;
  19255. span.style.margin = '0';
  19256. span.style.padding = '0';
  19257. span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
  19258. container.appendChild(span);
  19259. container.appendChild(img);
  19260. var baseline = img.offsetTop - span.offsetTop + 2;
  19261. container.removeChild(span);
  19262. container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
  19263. container.style.lineHeight = 'normal';
  19264. img.style.verticalAlign = 'super';
  19265. var middle = img.offsetTop - container.offsetTop + 2;
  19266. body.removeChild(container);
  19267. return { baseline: baseline, middle: middle };
  19268. };
  19269. FontMetrics.prototype.getMetrics = function (fontFamily, fontSize) {
  19270. var key = fontFamily + " " + fontSize;
  19271. if (typeof this._data[key] === 'undefined') {
  19272. this._data[key] = this.parseMetrics(fontFamily, fontSize);
  19273. }
  19274. return this._data[key];
  19275. };
  19276. return FontMetrics;
  19277. }();
  19278. var MASK_OFFSET = 10000;
  19279. var CanvasRenderer = /** @class */function () {
  19280. function CanvasRenderer(options) {
  19281. this._activeEffects = [];
  19282. this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
  19283. this.ctx = this.canvas.getContext('2d');
  19284. this.options = options;
  19285. if (!options.canvas) {
  19286. this.canvas.width = Math.floor(options.width * options.scale);
  19287. this.canvas.height = Math.floor(options.height * options.scale);
  19288. this.canvas.style.width = options.width + "px";
  19289. this.canvas.style.height = options.height + "px";
  19290. }
  19291. this.fontMetrics = new FontMetrics(document);
  19292. this.ctx.scale(this.options.scale, this.options.scale);
  19293. this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY);
  19294. this.ctx.textBaseline = 'bottom';
  19295. this._activeEffects = [];
  19296. Logger.getInstance(options.id).debug("Canvas renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
  19297. }
  19298. CanvasRenderer.prototype.applyEffects = function (effects, target) {
  19299. var _this = this;
  19300. while (this._activeEffects.length) {
  19301. this.popEffect();
  19302. }
  19303. effects.filter(function (effect) {return contains(effect.target, target);}).forEach(function (effect) {return _this.applyEffect(effect);});
  19304. };
  19305. CanvasRenderer.prototype.applyEffect = function (effect) {
  19306. this.ctx.save();
  19307. if (isOpacityEffect(effect)) {
  19308. this.ctx.globalAlpha = effect.opacity;
  19309. }
  19310. if (isTransformEffect(effect)) {
  19311. this.ctx.translate(effect.offsetX, effect.offsetY);
  19312. this.ctx.transform(effect.matrix[0], effect.matrix[1], effect.matrix[2], effect.matrix[3], effect.matrix[4], effect.matrix[5]);
  19313. this.ctx.translate(-effect.offsetX, -effect.offsetY);
  19314. }
  19315. if (isClipEffect(effect)) {
  19316. this.path(effect.path);
  19317. this.ctx.clip();
  19318. }
  19319. this._activeEffects.push(effect);
  19320. };
  19321. CanvasRenderer.prototype.popEffect = function () {
  19322. this._activeEffects.pop();
  19323. this.ctx.restore();
  19324. };
  19325. CanvasRenderer.prototype.renderStack = function (stack) {
  19326. return __awaiter(this, void 0, void 0, function () {
  19327. var styles;
  19328. return __generator(this, function (_a) {
  19329. switch (_a.label) {
  19330. case 0:
  19331. styles = stack.element.container.styles;
  19332. if (!styles.isVisible()) return [3 /*break*/, 2];
  19333. return [4 /*yield*/, this.renderStackContent(stack)];
  19334. case 1:
  19335. _a.sent();
  19336. _a.label = 2;
  19337. case 2:return [2 /*return*/];}
  19338. });
  19339. });
  19340. };
  19341. CanvasRenderer.prototype.renderNode = function (paint) {
  19342. return __awaiter(this, void 0, void 0, function () {
  19343. return __generator(this, function (_a) {
  19344. switch (_a.label) {
  19345. case 0:
  19346. if (!paint.container.styles.isVisible()) return [3 /*break*/, 3];
  19347. return [4 /*yield*/, this.renderNodeBackgroundAndBorders(paint)];
  19348. case 1:
  19349. _a.sent();
  19350. return [4 /*yield*/, this.renderNodeContent(paint)];
  19351. case 2:
  19352. _a.sent();
  19353. _a.label = 3;
  19354. case 3:return [2 /*return*/];}
  19355. });
  19356. });
  19357. };
  19358. CanvasRenderer.prototype.renderTextWithLetterSpacing = function (text, letterSpacing) {
  19359. var _this = this;
  19360. if (letterSpacing === 0) {
  19361. this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
  19362. } else
  19363. {
  19364. var letters = toCodePoints(text.text).map(function (i) {return fromCodePoint(i);});
  19365. letters.reduce(function (left, letter) {
  19366. _this.ctx.fillText(letter, left, text.bounds.top + text.bounds.height);
  19367. return left + _this.ctx.measureText(letter).width;
  19368. }, text.bounds.left);
  19369. }
  19370. };
  19371. CanvasRenderer.prototype.createFontStyle = function (styles) {
  19372. var fontVariant = styles.fontVariant.
  19373. filter(function (variant) {return variant === 'normal' || variant === 'small-caps';}).
  19374. join('');
  19375. var fontFamily = styles.fontFamily.join(', ');
  19376. var fontSize = isDimensionToken(styles.fontSize) ?
  19377. "" + styles.fontSize.number + styles.fontSize.unit :
  19378. styles.fontSize.number + "px";
  19379. return [
  19380. [styles.fontStyle, fontVariant, styles.fontWeight, fontSize, fontFamily].join(' '),
  19381. fontFamily,
  19382. fontSize];
  19383. };
  19384. CanvasRenderer.prototype.renderTextNode = function (text, styles) {
  19385. return __awaiter(this, void 0, void 0, function () {
  19386. var _a, font, fontFamily, fontSize;
  19387. var _this = this;
  19388. return __generator(this, function (_b) {
  19389. _a = this.createFontStyle(styles), font = _a[0], fontFamily = _a[1], fontSize = _a[2];
  19390. this.ctx.font = font;
  19391. text.textBounds.forEach(function (text) {
  19392. _this.ctx.fillStyle = asString(styles.color);
  19393. _this.renderTextWithLetterSpacing(text, styles.letterSpacing);
  19394. var textShadows = styles.textShadow;
  19395. if (textShadows.length && text.text.trim().length) {
  19396. textShadows.
  19397. slice(0).
  19398. reverse().
  19399. forEach(function (textShadow) {
  19400. _this.ctx.shadowColor = asString(textShadow.color);
  19401. _this.ctx.shadowOffsetX = textShadow.offsetX.number * _this.options.scale;
  19402. _this.ctx.shadowOffsetY = textShadow.offsetY.number * _this.options.scale;
  19403. _this.ctx.shadowBlur = textShadow.blur.number;
  19404. _this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
  19405. });
  19406. _this.ctx.shadowColor = '';
  19407. _this.ctx.shadowOffsetX = 0;
  19408. _this.ctx.shadowOffsetY = 0;
  19409. _this.ctx.shadowBlur = 0;
  19410. }
  19411. if (styles.textDecorationLine.length) {
  19412. _this.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
  19413. styles.textDecorationLine.forEach(function (textDecorationLine) {
  19414. switch (textDecorationLine) {
  19415. case 1 /* UNDERLINE */:
  19416. // Draws a line at the baseline of the font
  19417. // TODO As some browsers display the line as more than 1px if the font-size is big,
  19418. // need to take that into account both in position and size
  19419. var baseline = _this.fontMetrics.getMetrics(fontFamily, fontSize).baseline;
  19420. _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1);
  19421. break;
  19422. case 2 /* OVERLINE */:
  19423. _this.ctx.fillRect(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1);
  19424. break;
  19425. case 3 /* LINE_THROUGH */:
  19426. // TODO try and find exact position for line-through
  19427. var middle = _this.fontMetrics.getMetrics(fontFamily, fontSize).middle;
  19428. _this.ctx.fillRect(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1);
  19429. break;}
  19430. });
  19431. }
  19432. });
  19433. return [2 /*return*/];
  19434. });
  19435. });
  19436. };
  19437. CanvasRenderer.prototype.renderReplacedElement = function (container, curves, image) {
  19438. if (image && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
  19439. var box = contentBox(container);
  19440. var path = calculatePaddingBoxPath(curves);
  19441. this.path(path);
  19442. this.ctx.save();
  19443. this.ctx.clip();
  19444. this.ctx.drawImage(image, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
  19445. this.ctx.restore();
  19446. }
  19447. };
  19448. CanvasRenderer.prototype.renderNodeContent = function (paint) {
  19449. return __awaiter(this, void 0, void 0, function () {
  19450. var container, curves, styles, _i, _a, child, image, e_1, image, e_2, iframeRenderer, canvas, size, bounds, x, textBounds, img, image, url, e_3, bounds;
  19451. return __generator(this, function (_b) {
  19452. switch (_b.label) {
  19453. case 0:
  19454. this.applyEffects(paint.effects, 4 /* CONTENT */);
  19455. container = paint.container;
  19456. curves = paint.curves;
  19457. styles = container.styles;
  19458. _i = 0, _a = container.textNodes;
  19459. _b.label = 1;
  19460. case 1:
  19461. if (!(_i < _a.length)) return [3 /*break*/, 4];
  19462. child = _a[_i];
  19463. return [4 /*yield*/, this.renderTextNode(child, styles)];
  19464. case 2:
  19465. _b.sent();
  19466. _b.label = 3;
  19467. case 3:
  19468. _i++;
  19469. return [3 /*break*/, 1];
  19470. case 4:
  19471. if (!(container instanceof ImageElementContainer)) return [3 /*break*/, 8];
  19472. _b.label = 5;
  19473. case 5:
  19474. _b.trys.push([5, 7,, 8]);
  19475. return [4 /*yield*/, this.options.cache.match(container.src)];
  19476. case 6:
  19477. image = _b.sent();
  19478. this.renderReplacedElement(container, curves, image);
  19479. return [3 /*break*/, 8];
  19480. case 7:
  19481. e_1 = _b.sent();
  19482. Logger.getInstance(this.options.id).error("Error loading image " + container.src);
  19483. return [3 /*break*/, 8];
  19484. case 8:
  19485. if (container instanceof CanvasElementContainer) {
  19486. this.renderReplacedElement(container, curves, container.canvas);
  19487. }
  19488. if (!(container instanceof SVGElementContainer)) return [3 /*break*/, 12];
  19489. _b.label = 9;
  19490. case 9:
  19491. _b.trys.push([9, 11,, 12]);
  19492. return [4 /*yield*/, this.options.cache.match(container.svg)];
  19493. case 10:
  19494. image = _b.sent();
  19495. this.renderReplacedElement(container, curves, image);
  19496. return [3 /*break*/, 12];
  19497. case 11:
  19498. e_2 = _b.sent();
  19499. Logger.getInstance(this.options.id).error("Error loading svg " + container.svg.substring(0, 255));
  19500. return [3 /*break*/, 12];
  19501. case 12:
  19502. if (!(container instanceof IFrameElementContainer && container.tree)) return [3 /*break*/, 14];
  19503. iframeRenderer = new CanvasRenderer({
  19504. id: this.options.id,
  19505. scale: this.options.scale,
  19506. backgroundColor: container.backgroundColor,
  19507. x: 0,
  19508. y: 0,
  19509. scrollX: 0,
  19510. scrollY: 0,
  19511. width: container.width,
  19512. height: container.height,
  19513. cache: this.options.cache,
  19514. windowWidth: container.width,
  19515. windowHeight: container.height });
  19516. return [4 /*yield*/, iframeRenderer.render(container.tree)];
  19517. case 13:
  19518. canvas = _b.sent();
  19519. if (container.width && container.height) {
  19520. this.ctx.drawImage(canvas, 0, 0, container.width, container.height, container.bounds.left, container.bounds.top, container.bounds.width, container.bounds.height);
  19521. }
  19522. _b.label = 14;
  19523. case 14:
  19524. if (container instanceof InputElementContainer) {
  19525. size = Math.min(container.bounds.width, container.bounds.height);
  19526. if (container.type === CHECKBOX) {
  19527. if (container.checked) {
  19528. this.ctx.save();
  19529. this.path([
  19530. new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79),
  19531. new Vector(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549),
  19532. new Vector(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071),
  19533. new Vector(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649),
  19534. new Vector(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23),
  19535. new Vector(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085),
  19536. new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)]);
  19537. this.ctx.fillStyle = asString(INPUT_COLOR);
  19538. this.ctx.fill();
  19539. this.ctx.restore();
  19540. }
  19541. } else
  19542. if (container.type === RADIO) {
  19543. if (container.checked) {
  19544. this.ctx.save();
  19545. this.ctx.beginPath();
  19546. this.ctx.arc(container.bounds.left + size / 2, container.bounds.top + size / 2, size / 4, 0, Math.PI * 2, true);
  19547. this.ctx.fillStyle = asString(INPUT_COLOR);
  19548. this.ctx.fill();
  19549. this.ctx.restore();
  19550. }
  19551. }
  19552. }
  19553. if (isTextInputElement(container) && container.value.length) {
  19554. this.ctx.font = this.createFontStyle(styles)[0];
  19555. this.ctx.fillStyle = asString(styles.color);
  19556. this.ctx.textBaseline = 'middle';
  19557. this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
  19558. bounds = contentBox(container);
  19559. x = 0;
  19560. switch (container.styles.textAlign) {
  19561. case TEXT_ALIGN.CENTER:
  19562. x += bounds.width / 2;
  19563. break;
  19564. case TEXT_ALIGN.RIGHT:
  19565. x += bounds.width;
  19566. break;}
  19567. textBounds = bounds.add(x, 0, 0, -bounds.height / 2 + 1);
  19568. this.ctx.save();
  19569. this.path([
  19570. new Vector(bounds.left, bounds.top),
  19571. new Vector(bounds.left + bounds.width, bounds.top),
  19572. new Vector(bounds.left + bounds.width, bounds.top + bounds.height),
  19573. new Vector(bounds.left, bounds.top + bounds.height)]);
  19574. this.ctx.clip();
  19575. this.renderTextWithLetterSpacing(new TextBounds(container.value, textBounds), styles.letterSpacing);
  19576. this.ctx.restore();
  19577. this.ctx.textBaseline = 'bottom';
  19578. this.ctx.textAlign = 'left';
  19579. }
  19580. if (!contains(container.styles.display, 2048 /* LIST_ITEM */)) return [3 /*break*/, 20];
  19581. if (!(container.styles.listStyleImage !== null)) return [3 /*break*/, 19];
  19582. img = container.styles.listStyleImage;
  19583. if (!(img.type === CSSImageType.URL)) return [3 /*break*/, 18];
  19584. image = void 0;
  19585. url = img.url;
  19586. _b.label = 15;
  19587. case 15:
  19588. _b.trys.push([15, 17,, 18]);
  19589. return [4 /*yield*/, this.options.cache.match(url)];
  19590. case 16:
  19591. image = _b.sent();
  19592. this.ctx.drawImage(image, container.bounds.left - (image.width + 10), container.bounds.top);
  19593. return [3 /*break*/, 18];
  19594. case 17:
  19595. e_3 = _b.sent();
  19596. Logger.getInstance(this.options.id).error("Error loading list-style-image " + url);
  19597. return [3 /*break*/, 18];
  19598. case 18:return [3 /*break*/, 20];
  19599. case 19:
  19600. if (paint.listValue && container.styles.listStyleType !== LIST_STYLE_TYPE.NONE) {
  19601. this.ctx.font = this.createFontStyle(styles)[0];
  19602. this.ctx.fillStyle = asString(styles.color);
  19603. this.ctx.textBaseline = 'middle';
  19604. this.ctx.textAlign = 'right';
  19605. bounds = new Bounds(container.bounds.left, container.bounds.top + getAbsoluteValue(container.styles.paddingTop, container.bounds.width), container.bounds.width, computeLineHeight(styles.lineHeight, styles.fontSize.number) / 2 + 1);
  19606. this.renderTextWithLetterSpacing(new TextBounds(paint.listValue, bounds), styles.letterSpacing);
  19607. this.ctx.textBaseline = 'bottom';
  19608. this.ctx.textAlign = 'left';
  19609. }
  19610. _b.label = 20;
  19611. case 20:return [2 /*return*/];}
  19612. });
  19613. });
  19614. };
  19615. CanvasRenderer.prototype.renderStackContent = function (stack) {
  19616. return __awaiter(this, void 0, void 0, function () {
  19617. var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child;
  19618. return __generator(this, function (_p) {
  19619. switch (_p.label) {
  19620. case 0:
  19621. // https://www.w3.org/TR/css-position-3/#painting-order
  19622. // 1. the background and borders of the element forming the stacking context.
  19623. return [4 /*yield*/, this.renderNodeBackgroundAndBorders(stack.element)];
  19624. case 1:
  19625. // https://www.w3.org/TR/css-position-3/#painting-order
  19626. // 1. the background and borders of the element forming the stacking context.
  19627. _p.sent();
  19628. _i = 0, _a = stack.negativeZIndex;
  19629. _p.label = 2;
  19630. case 2:
  19631. if (!(_i < _a.length)) return [3 /*break*/, 5];
  19632. child = _a[_i];
  19633. return [4 /*yield*/, this.renderStack(child)];
  19634. case 3:
  19635. _p.sent();
  19636. _p.label = 4;
  19637. case 4:
  19638. _i++;
  19639. return [3 /*break*/, 2];
  19640. case 5:
  19641. // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
  19642. return [4 /*yield*/, this.renderNodeContent(stack.element)];
  19643. case 6:
  19644. // 3. For all its in-flow, non-positioned, block-level descendants in tree order:
  19645. _p.sent();
  19646. _b = 0, _c = stack.nonInlineLevel;
  19647. _p.label = 7;
  19648. case 7:
  19649. if (!(_b < _c.length)) return [3 /*break*/, 10];
  19650. child = _c[_b];
  19651. return [4 /*yield*/, this.renderNode(child)];
  19652. case 8:
  19653. _p.sent();
  19654. _p.label = 9;
  19655. case 9:
  19656. _b++;
  19657. return [3 /*break*/, 7];
  19658. case 10:
  19659. _d = 0, _e = stack.nonPositionedFloats;
  19660. _p.label = 11;
  19661. case 11:
  19662. if (!(_d < _e.length)) return [3 /*break*/, 14];
  19663. child = _e[_d];
  19664. return [4 /*yield*/, this.renderStack(child)];
  19665. case 12:
  19666. _p.sent();
  19667. _p.label = 13;
  19668. case 13:
  19669. _d++;
  19670. return [3 /*break*/, 11];
  19671. case 14:
  19672. _f = 0, _g = stack.nonPositionedInlineLevel;
  19673. _p.label = 15;
  19674. case 15:
  19675. if (!(_f < _g.length)) return [3 /*break*/, 18];
  19676. child = _g[_f];
  19677. return [4 /*yield*/, this.renderStack(child)];
  19678. case 16:
  19679. _p.sent();
  19680. _p.label = 17;
  19681. case 17:
  19682. _f++;
  19683. return [3 /*break*/, 15];
  19684. case 18:
  19685. _h = 0, _j = stack.inlineLevel;
  19686. _p.label = 19;
  19687. case 19:
  19688. if (!(_h < _j.length)) return [3 /*break*/, 22];
  19689. child = _j[_h];
  19690. return [4 /*yield*/, this.renderNode(child)];
  19691. case 20:
  19692. _p.sent();
  19693. _p.label = 21;
  19694. case 21:
  19695. _h++;
  19696. return [3 /*break*/, 19];
  19697. case 22:
  19698. _k = 0, _l = stack.zeroOrAutoZIndexOrTransformedOrOpacity;
  19699. _p.label = 23;
  19700. case 23:
  19701. if (!(_k < _l.length)) return [3 /*break*/, 26];
  19702. child = _l[_k];
  19703. return [4 /*yield*/, this.renderStack(child)];
  19704. case 24:
  19705. _p.sent();
  19706. _p.label = 25;
  19707. case 25:
  19708. _k++;
  19709. return [3 /*break*/, 23];
  19710. case 26:
  19711. _m = 0, _o = stack.positiveZIndex;
  19712. _p.label = 27;
  19713. case 27:
  19714. if (!(_m < _o.length)) return [3 /*break*/, 30];
  19715. child = _o[_m];
  19716. return [4 /*yield*/, this.renderStack(child)];
  19717. case 28:
  19718. _p.sent();
  19719. _p.label = 29;
  19720. case 29:
  19721. _m++;
  19722. return [3 /*break*/, 27];
  19723. case 30:return [2 /*return*/];}
  19724. });
  19725. });
  19726. };
  19727. CanvasRenderer.prototype.mask = function (paths) {
  19728. this.ctx.beginPath();
  19729. this.ctx.moveTo(0, 0);
  19730. this.ctx.lineTo(this.canvas.width, 0);
  19731. this.ctx.lineTo(this.canvas.width, this.canvas.height);
  19732. this.ctx.lineTo(0, this.canvas.height);
  19733. this.ctx.lineTo(0, 0);
  19734. this.formatPath(paths.slice(0).reverse());
  19735. this.ctx.closePath();
  19736. };
  19737. CanvasRenderer.prototype.path = function (paths) {
  19738. this.ctx.beginPath();
  19739. this.formatPath(paths);
  19740. this.ctx.closePath();
  19741. };
  19742. CanvasRenderer.prototype.formatPath = function (paths) {
  19743. var _this = this;
  19744. paths.forEach(function (point, index) {
  19745. var start = isBezierCurve(point) ? point.start : point;
  19746. if (index === 0) {
  19747. _this.ctx.moveTo(start.x, start.y);
  19748. } else
  19749. {
  19750. _this.ctx.lineTo(start.x, start.y);
  19751. }
  19752. if (isBezierCurve(point)) {
  19753. _this.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
  19754. }
  19755. });
  19756. };
  19757. CanvasRenderer.prototype.renderRepeat = function (path, pattern, offsetX, offsetY) {
  19758. this.path(path);
  19759. this.ctx.fillStyle = pattern;
  19760. this.ctx.translate(offsetX, offsetY);
  19761. this.ctx.fill();
  19762. this.ctx.translate(-offsetX, -offsetY);
  19763. };
  19764. CanvasRenderer.prototype.resizeImage = function (image, width, height) {
  19765. if (image.width === width && image.height === height) {
  19766. return image;
  19767. }
  19768. var canvas = this.canvas.ownerDocument.createElement('canvas');
  19769. canvas.width = width;
  19770. canvas.height = height;
  19771. var ctx = canvas.getContext('2d');
  19772. ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, width, height);
  19773. return canvas;
  19774. };
  19775. CanvasRenderer.prototype.renderBackgroundImage = function (container) {
  19776. return __awaiter(this, void 0, void 0, function () {
  19777. var index, _loop_1, this_1, _i, _a, backgroundImage;
  19778. return __generator(this, function (_b) {
  19779. switch (_b.label) {
  19780. case 0:
  19781. index = container.styles.backgroundImage.length - 1;
  19782. _loop_1 = function _loop_1(backgroundImage) {
  19783. var image, url, e_4, _a, path, x, y, width, height, pattern, _b, path, x, y, width, height, _c, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _d, path, left, top_1, width, height, position, x, y, _e, rx, ry, radialGradient_1, midX, midY, f, invF;
  19784. return __generator(this, function (_f) {
  19785. switch (_f.label) {
  19786. case 0:
  19787. if (!(backgroundImage.type === CSSImageType.URL)) return [3 /*break*/, 5];
  19788. image = void 0;
  19789. url = backgroundImage.url;
  19790. _f.label = 1;
  19791. case 1:
  19792. _f.trys.push([1, 3,, 4]);
  19793. return [4 /*yield*/, this_1.options.cache.match(url)];
  19794. case 2:
  19795. image = _f.sent();
  19796. return [3 /*break*/, 4];
  19797. case 3:
  19798. e_4 = _f.sent();
  19799. Logger.getInstance(this_1.options.id).error("Error loading background-image " + url);
  19800. return [3 /*break*/, 4];
  19801. case 4:
  19802. if (image) {
  19803. _a = calculateBackgroundRendering(container, index, [
  19804. image.width,
  19805. image.height,
  19806. image.width / image.height]),
  19807. path = _a[0], x = _a[1], y = _a[2], width = _a[3], height = _a[4];
  19808. pattern = this_1.ctx.createPattern(this_1.resizeImage(image, width, height), 'repeat');
  19809. this_1.renderRepeat(path, pattern, x, y);
  19810. }
  19811. return [3 /*break*/, 6];
  19812. case 5:
  19813. if (isLinearGradient(backgroundImage)) {
  19814. _b = calculateBackgroundRendering(container, index, [null, null, null]), path = _b[0], x = _b[1], y = _b[2], width = _b[3], height = _b[4];
  19815. _c = calculateGradientDirection(backgroundImage.angle, width, height), lineLength = _c[0], x0 = _c[1], x1 = _c[2], y0 = _c[3], y1 = _c[4];
  19816. canvas = document.createElement('canvas');
  19817. canvas.width = width;
  19818. canvas.height = height;
  19819. ctx = canvas.getContext('2d');
  19820. gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
  19821. processColorStops(backgroundImage.stops, lineLength).forEach(function (colorStop) {
  19822. return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
  19823. });
  19824. ctx.fillStyle = gradient_1;
  19825. ctx.fillRect(0, 0, width, height);
  19826. if (width > 0 && height > 0) {
  19827. pattern = this_1.ctx.createPattern(canvas, 'repeat');
  19828. this_1.renderRepeat(path, pattern, x, y);
  19829. }
  19830. } else
  19831. if (isRadialGradient(backgroundImage)) {
  19832. _d = calculateBackgroundRendering(container, index, [
  19833. null,
  19834. null,
  19835. null]),
  19836. path = _d[0], left = _d[1], top_1 = _d[2], width = _d[3], height = _d[4];
  19837. position = backgroundImage.position.length === 0 ? [FIFTY_PERCENT] : backgroundImage.position;
  19838. x = getAbsoluteValue(position[0], width);
  19839. y = getAbsoluteValue(position[position.length - 1], height);
  19840. _e = calculateRadius(backgroundImage, x, y, width, height), rx = _e[0], ry = _e[1];
  19841. if (rx > 0 && rx > 0) {
  19842. radialGradient_1 = this_1.ctx.createRadialGradient(left + x, top_1 + y, 0, left + x, top_1 + y, rx);
  19843. processColorStops(backgroundImage.stops, rx * 2).forEach(function (colorStop) {
  19844. return radialGradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
  19845. });
  19846. this_1.path(path);
  19847. this_1.ctx.fillStyle = radialGradient_1;
  19848. if (rx !== ry) {
  19849. midX = container.bounds.left + 0.5 * container.bounds.width;
  19850. midY = container.bounds.top + 0.5 * container.bounds.height;
  19851. f = ry / rx;
  19852. invF = 1 / f;
  19853. this_1.ctx.save();
  19854. this_1.ctx.translate(midX, midY);
  19855. this_1.ctx.transform(1, 0, 0, f, 0, 0);
  19856. this_1.ctx.translate(-midX, -midY);
  19857. this_1.ctx.fillRect(left, invF * (top_1 - midY) + midY, width, height * invF);
  19858. this_1.ctx.restore();
  19859. } else
  19860. {
  19861. this_1.ctx.fill();
  19862. }
  19863. }
  19864. }
  19865. _f.label = 6;
  19866. case 6:
  19867. index--;
  19868. return [2 /*return*/];}
  19869. });
  19870. };
  19871. this_1 = this;
  19872. _i = 0, _a = container.styles.backgroundImage.slice(0).reverse();
  19873. _b.label = 1;
  19874. case 1:
  19875. if (!(_i < _a.length)) return [3 /*break*/, 4];
  19876. backgroundImage = _a[_i];
  19877. return [5 /*yield**/, _loop_1(backgroundImage)];
  19878. case 2:
  19879. _b.sent();
  19880. _b.label = 3;
  19881. case 3:
  19882. _i++;
  19883. return [3 /*break*/, 1];
  19884. case 4:return [2 /*return*/];}
  19885. });
  19886. });
  19887. };
  19888. CanvasRenderer.prototype.renderBorder = function (color, side, curvePoints) {
  19889. return __awaiter(this, void 0, void 0, function () {
  19890. return __generator(this, function (_a) {
  19891. this.path(parsePathForBorder(curvePoints, side));
  19892. this.ctx.fillStyle = asString(color);
  19893. this.ctx.fill();
  19894. return [2 /*return*/];
  19895. });
  19896. });
  19897. };
  19898. CanvasRenderer.prototype.renderNodeBackgroundAndBorders = function (paint) {
  19899. return __awaiter(this, void 0, void 0, function () {
  19900. var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border;
  19901. var _this = this;
  19902. return __generator(this, function (_a) {
  19903. switch (_a.label) {
  19904. case 0:
  19905. this.applyEffects(paint.effects, 2 /* BACKGROUND_BORDERS */);
  19906. styles = paint.container.styles;
  19907. hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
  19908. borders = [
  19909. { style: styles.borderTopStyle, color: styles.borderTopColor },
  19910. { style: styles.borderRightStyle, color: styles.borderRightColor },
  19911. { style: styles.borderBottomStyle, color: styles.borderBottomColor },
  19912. { style: styles.borderLeftStyle, color: styles.borderLeftColor }];
  19913. backgroundPaintingArea = calculateBackgroundCurvedPaintingArea(getBackgroundValueForIndex(styles.backgroundClip, 0), paint.curves);
  19914. if (!(hasBackground || styles.boxShadow.length)) return [3 /*break*/, 2];
  19915. this.ctx.save();
  19916. this.path(backgroundPaintingArea);
  19917. this.ctx.clip();
  19918. if (!isTransparent(styles.backgroundColor)) {
  19919. this.ctx.fillStyle = asString(styles.backgroundColor);
  19920. this.ctx.fill();
  19921. }
  19922. return [4 /*yield*/, this.renderBackgroundImage(paint.container)];
  19923. case 1:
  19924. _a.sent();
  19925. this.ctx.restore();
  19926. styles.boxShadow.
  19927. slice(0).
  19928. reverse().
  19929. forEach(function (shadow) {
  19930. _this.ctx.save();
  19931. var borderBoxArea = calculateBorderBoxPath(paint.curves);
  19932. var maskOffset = shadow.inset ? 0 : MASK_OFFSET;
  19933. var shadowPaintingArea = transformPath(borderBoxArea, -maskOffset + (shadow.inset ? 1 : -1) * shadow.spread.number, (shadow.inset ? 1 : -1) * shadow.spread.number, shadow.spread.number * (shadow.inset ? -2 : 2), shadow.spread.number * (shadow.inset ? -2 : 2));
  19934. if (shadow.inset) {
  19935. _this.path(borderBoxArea);
  19936. _this.ctx.clip();
  19937. _this.mask(shadowPaintingArea);
  19938. } else
  19939. {
  19940. _this.mask(borderBoxArea);
  19941. _this.ctx.clip();
  19942. _this.path(shadowPaintingArea);
  19943. }
  19944. _this.ctx.shadowOffsetX = shadow.offsetX.number + maskOffset;
  19945. _this.ctx.shadowOffsetY = shadow.offsetY.number;
  19946. _this.ctx.shadowColor = asString(shadow.color);
  19947. _this.ctx.shadowBlur = shadow.blur.number;
  19948. _this.ctx.fillStyle = shadow.inset ? asString(shadow.color) : 'rgba(0,0,0,1)';
  19949. _this.ctx.fill();
  19950. _this.ctx.restore();
  19951. });
  19952. _a.label = 2;
  19953. case 2:
  19954. side = 0;
  19955. _i = 0, borders_1 = borders;
  19956. _a.label = 3;
  19957. case 3:
  19958. if (!(_i < borders_1.length)) return [3 /*break*/, 7];
  19959. border = borders_1[_i];
  19960. if (!(border.style !== BORDER_STYLE.NONE && !isTransparent(border.color))) return [3 /*break*/, 5];
  19961. return [4 /*yield*/, this.renderBorder(border.color, side, paint.curves)];
  19962. case 4:
  19963. _a.sent();
  19964. _a.label = 5;
  19965. case 5:
  19966. side++;
  19967. _a.label = 6;
  19968. case 6:
  19969. _i++;
  19970. return [3 /*break*/, 3];
  19971. case 7:return [2 /*return*/];}
  19972. });
  19973. });
  19974. };
  19975. CanvasRenderer.prototype.render = function (element) {
  19976. return __awaiter(this, void 0, void 0, function () {
  19977. var stack;
  19978. return __generator(this, function (_a) {
  19979. switch (_a.label) {
  19980. case 0:
  19981. if (this.options.backgroundColor) {
  19982. this.ctx.fillStyle = asString(this.options.backgroundColor);
  19983. this.ctx.fillRect(this.options.x - this.options.scrollX, this.options.y - this.options.scrollY, this.options.width, this.options.height);
  19984. }
  19985. stack = parseStackingContexts(element);
  19986. return [4 /*yield*/, this.renderStack(stack)];
  19987. case 1:
  19988. _a.sent();
  19989. this.applyEffects([], 2 /* BACKGROUND_BORDERS */);
  19990. return [2 /*return*/, this.canvas];}
  19991. });
  19992. });
  19993. };
  19994. return CanvasRenderer;
  19995. }();
  19996. var isTextInputElement = function isTextInputElement(container) {
  19997. if (container instanceof TextareaElementContainer) {
  19998. return true;
  19999. } else
  20000. if (container instanceof SelectElementContainer) {
  20001. return true;
  20002. } else
  20003. if (container instanceof InputElementContainer && container.type !== RADIO && container.type !== CHECKBOX) {
  20004. return true;
  20005. }
  20006. return false;
  20007. };
  20008. var calculateBackgroundCurvedPaintingArea = function calculateBackgroundCurvedPaintingArea(clip, curves) {
  20009. switch (clip) {
  20010. case BACKGROUND_CLIP.BORDER_BOX:
  20011. return calculateBorderBoxPath(curves);
  20012. case BACKGROUND_CLIP.CONTENT_BOX:
  20013. return calculateContentBoxPath(curves);
  20014. case BACKGROUND_CLIP.PADDING_BOX:
  20015. default:
  20016. return calculatePaddingBoxPath(curves);}
  20017. };
  20018. var canvasTextAlign = function canvasTextAlign(textAlign) {
  20019. switch (textAlign) {
  20020. case TEXT_ALIGN.CENTER:
  20021. return 'center';
  20022. case TEXT_ALIGN.RIGHT:
  20023. return 'right';
  20024. case TEXT_ALIGN.LEFT:
  20025. default:
  20026. return 'left';}
  20027. };
  20028. var ForeignObjectRenderer = /** @class */function () {
  20029. function ForeignObjectRenderer(options) {
  20030. this.canvas = options.canvas ? options.canvas : document.createElement('canvas');
  20031. this.ctx = this.canvas.getContext('2d');
  20032. this.options = options;
  20033. this.canvas.width = Math.floor(options.width * options.scale);
  20034. this.canvas.height = Math.floor(options.height * options.scale);
  20035. this.canvas.style.width = options.width + "px";
  20036. this.canvas.style.height = options.height + "px";
  20037. this.ctx.scale(this.options.scale, this.options.scale);
  20038. this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY);
  20039. Logger.getInstance(options.id).debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
  20040. }
  20041. ForeignObjectRenderer.prototype.render = function (element) {
  20042. return __awaiter(this, void 0, void 0, function () {
  20043. var svg, img;
  20044. return __generator(this, function (_a) {
  20045. switch (_a.label) {
  20046. case 0:
  20047. svg = createForeignObjectSVG(Math.max(this.options.windowWidth, this.options.width) * this.options.scale, Math.max(this.options.windowHeight, this.options.height) * this.options.scale, this.options.scrollX * this.options.scale, this.options.scrollY * this.options.scale, element);
  20048. return [4 /*yield*/, loadSerializedSVG$1(svg)];
  20049. case 1:
  20050. img = _a.sent();
  20051. if (this.options.backgroundColor) {
  20052. this.ctx.fillStyle = asString(this.options.backgroundColor);
  20053. this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale);
  20054. }
  20055. this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale);
  20056. return [2 /*return*/, this.canvas];}
  20057. });
  20058. });
  20059. };
  20060. return ForeignObjectRenderer;
  20061. }();
  20062. var loadSerializedSVG$1 = function loadSerializedSVG$1(svg) {
  20063. return new Promise(function (resolve, reject) {
  20064. var img = new Image();
  20065. img.onload = function () {
  20066. resolve(img);
  20067. };
  20068. img.onerror = reject;
  20069. img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  20070. });
  20071. };
  20072. var _this = undefined;
  20073. var parseColor$1 = function parseColor$1(value) {return color.parse(Parser.create(value).parseComponentValue());};
  20074. var html2canvas = function html2canvas(element, options) {
  20075. if (options === void 0) {options = {};}
  20076. return renderElement(element, options);
  20077. };
  20078. if (typeof window !== 'undefined') {
  20079. CacheStorage.setContext(window);
  20080. }
  20081. var renderElement = function renderElement(element, opts) {return __awaiter(_this, void 0, void 0, function () {
  20082. var ownerDocument, defaultView, instanceName, _a, width, height, left, top, defaultResourceOptions, resourceOptions, defaultOptions, options, windowBounds, documentCloner, clonedElement, container, documentBackgroundColor, bodyBackgroundColor, bgColor, defaultBackgroundColor, backgroundColor, renderOptions, canvas, renderer, root, renderer;
  20083. return __generator(this, function (_b) {
  20084. switch (_b.label) {
  20085. case 0:
  20086. ownerDocument = element.ownerDocument;
  20087. if (!ownerDocument) {
  20088. throw new Error("Element is not attached to a Document");
  20089. }
  20090. defaultView = ownerDocument.defaultView;
  20091. if (!defaultView) {
  20092. throw new Error("Document is not attached to a Window");
  20093. }
  20094. instanceName = (Math.round(Math.random() * 1000) + Date.now()).toString(16);
  20095. _a = isBodyElement(element) || isHTMLElement(element) ? parseDocumentSize(ownerDocument) : parseBounds(element), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
  20096. defaultResourceOptions = {
  20097. allowTaint: false,
  20098. imageTimeout: 15000,
  20099. proxy: undefined,
  20100. useCORS: false };
  20101. resourceOptions = _assign({}, defaultResourceOptions, opts);
  20102. defaultOptions = {
  20103. backgroundColor: '#ffffff',
  20104. cache: opts.cache ? opts.cache : CacheStorage.create(instanceName, resourceOptions),
  20105. logging: true,
  20106. removeContainer: true,
  20107. foreignObjectRendering: false,
  20108. scale: defaultView.devicePixelRatio || 1,
  20109. windowWidth: defaultView.innerWidth,
  20110. windowHeight: defaultView.innerHeight,
  20111. scrollX: defaultView.pageXOffset,
  20112. scrollY: defaultView.pageYOffset,
  20113. x: left,
  20114. y: top,
  20115. width: Math.ceil(width),
  20116. height: Math.ceil(height),
  20117. id: instanceName };
  20118. options = _assign({}, defaultOptions, resourceOptions, opts);
  20119. windowBounds = new Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight);
  20120. Logger.create({ id: instanceName, enabled: options.logging });
  20121. Logger.getInstance(instanceName).debug("Starting document clone");
  20122. documentCloner = new DocumentCloner(element, {
  20123. id: instanceName,
  20124. onclone: options.onclone,
  20125. ignoreElements: options.ignoreElements,
  20126. inlineImages: options.foreignObjectRendering,
  20127. copyStyles: options.foreignObjectRendering });
  20128. clonedElement = documentCloner.clonedReferenceElement;
  20129. if (!clonedElement) {
  20130. return [2 /*return*/, Promise.reject("Unable to find element in cloned iframe")];
  20131. }
  20132. return [4 /*yield*/, documentCloner.toIFrame(ownerDocument, windowBounds)];
  20133. case 1:
  20134. container = _b.sent();
  20135. documentBackgroundColor = ownerDocument.documentElement ?
  20136. parseColor$1(getComputedStyle(ownerDocument.documentElement).backgroundColor) :
  20137. COLORS.TRANSPARENT;
  20138. bodyBackgroundColor = ownerDocument.body ?
  20139. parseColor$1(getComputedStyle(ownerDocument.body).backgroundColor) :
  20140. COLORS.TRANSPARENT;
  20141. bgColor = opts.backgroundColor;
  20142. defaultBackgroundColor = typeof bgColor === 'string' ? parseColor$1(bgColor) : bgColor === null ? COLORS.TRANSPARENT : 0xffffffff;
  20143. backgroundColor = element === ownerDocument.documentElement ?
  20144. isTransparent(documentBackgroundColor) ?
  20145. isTransparent(bodyBackgroundColor) ?
  20146. defaultBackgroundColor :
  20147. bodyBackgroundColor :
  20148. documentBackgroundColor :
  20149. defaultBackgroundColor;
  20150. renderOptions = {
  20151. id: instanceName,
  20152. cache: options.cache,
  20153. canvas: options.canvas,
  20154. backgroundColor: backgroundColor,
  20155. scale: options.scale,
  20156. x: options.x,
  20157. y: options.y,
  20158. scrollX: options.scrollX,
  20159. scrollY: options.scrollY,
  20160. width: options.width,
  20161. height: options.height,
  20162. windowWidth: options.windowWidth,
  20163. windowHeight: options.windowHeight };
  20164. if (!options.foreignObjectRendering) return [3 /*break*/, 3];
  20165. Logger.getInstance(instanceName).debug("Document cloned, using foreign object rendering");
  20166. renderer = new ForeignObjectRenderer(renderOptions);
  20167. return [4 /*yield*/, renderer.render(clonedElement)];
  20168. case 2:
  20169. canvas = _b.sent();
  20170. return [3 /*break*/, 5];
  20171. case 3:
  20172. Logger.getInstance(instanceName).debug("Document cloned, using computed rendering");
  20173. CacheStorage.attachInstance(options.cache);
  20174. Logger.getInstance(instanceName).debug("Starting DOM parsing");
  20175. root = parseTree(clonedElement);
  20176. CacheStorage.detachInstance();
  20177. if (backgroundColor === root.styles.backgroundColor) {
  20178. root.styles.backgroundColor = COLORS.TRANSPARENT;
  20179. }
  20180. Logger.getInstance(instanceName).debug("Starting renderer");
  20181. renderer = new CanvasRenderer(renderOptions);
  20182. return [4 /*yield*/, renderer.render(root)];
  20183. case 4:
  20184. canvas = _b.sent();
  20185. _b.label = 5;
  20186. case 5:
  20187. if (options.removeContainer === true) {
  20188. if (!DocumentCloner.destroy(container)) {
  20189. Logger.getInstance(instanceName).error("Cannot detach cloned iframe as it is not in the DOM anymore");
  20190. }
  20191. }
  20192. Logger.getInstance(instanceName).debug("Finished rendering");
  20193. Logger.destroy(instanceName);
  20194. CacheStorage.destroy(instanceName);
  20195. return [2 /*return*/, canvas];}
  20196. });
  20197. });};
  20198. return html2canvas;
  20199. });
  20200. /***/ }),
  20201. /***/ 94:
  20202. /*!****************************************************************************!*\
  20203. !*** /Users/mead/Code/vue/epidemic-h5/uParse-master/src/libs/html2json.js ***!
  20204. \****************************************************************************/
  20205. /*! no static exports found */
  20206. /***/ (function(module, exports, __webpack_require__) {
  20207. "use strict";
  20208. /* WEBPACK VAR INJECTION */(function(uni) {Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;
  20209. var _wxDiscode = _interopRequireDefault(__webpack_require__(/*! ./wxDiscode */ 95));
  20210. var _htmlparser = _interopRequireDefault(__webpack_require__(/*! ./htmlparser */ 96));function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
  20211. * html2Json 改造来自: https://github.com/Jxck/html2json
  20212. *
  20213. *
  20214. * author: Di (微信小程序开发工程师)
  20215. * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
  20216. * 垂直微信小程序开发交流社区
  20217. *
  20218. * github地址: https://github.com/icindy/wxParse
  20219. *
  20220. * for: 微信小程序富文本解析
  20221. * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
  20222. */function makeMap(str) {var obj = {};var items = str.split(',');for (var i = 0; i < items.length; i += 1) {obj[items[i]] = true;}return obj;} // Block Elements - HTML 5
  20223. var block = makeMap('br,code,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video'); // Inline Elements - HTML 5
  20224. var inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
  20225. // Elements that you can, intentionally, leave open
  20226. // (and which close themselves)
  20227. var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
  20228. function removeDOCTYPE(html) {
  20229. var isDocument = /<body.*>([^]*)<\/body>/.test(html);
  20230. return isDocument ? RegExp.$1 : html;
  20231. }
  20232. function trimHtml(html) {
  20233. return html.
  20234. replace(/<!--.*?-->/gi, '').
  20235. replace(/\/\*.*?\*\//gi, '').
  20236. replace(/[ ]+</gi, '<').
  20237. replace(/<script[^]*<\/script>/gi, '').
  20238. replace(/<style[^]*<\/style>/gi, '');
  20239. }
  20240. function getScreenInfo() {
  20241. var screen = {};
  20242. uni.getSystemInfo({
  20243. success: function success(res) {
  20244. screen.width = res.windowWidth;
  20245. screen.height = res.windowHeight;
  20246. } });
  20247. return screen;
  20248. }
  20249. function html2json(html, customHandler, imageProp, host) {
  20250. // 处理字符串
  20251. html = removeDOCTYPE(html);
  20252. html = trimHtml(html);
  20253. html = _wxDiscode.default.strDiscode(html);
  20254. // 生成node节点
  20255. var bufArray = [];
  20256. var results = {
  20257. nodes: [],
  20258. imageUrls: [] };
  20259. var screen = getScreenInfo();
  20260. function Node(tag) {
  20261. this.node = 'element';
  20262. this.tag = tag;
  20263. this.$screen = screen;
  20264. }
  20265. (0, _htmlparser.default)(html, {
  20266. start: function start(tag, attrs, unary) {
  20267. // node for this element
  20268. var node = new Node(tag);
  20269. if (bufArray.length !== 0) {
  20270. var parent = bufArray[0];
  20271. if (parent.nodes === undefined) {
  20272. parent.nodes = [];
  20273. }
  20274. }
  20275. if (block[tag]) {
  20276. node.tagType = 'block';
  20277. } else if (inline[tag]) {
  20278. node.tagType = 'inline';
  20279. } else if (closeSelf[tag]) {
  20280. node.tagType = 'closeSelf';
  20281. }
  20282. node.attr = attrs.reduce(function (pre, attr) {var
  20283. name = attr.name;var
  20284. value = attr.value;
  20285. if (name === 'class') {
  20286. node.classStr = value;
  20287. }
  20288. // has multi attibutes
  20289. // make it array of attribute
  20290. if (name === 'style') {
  20291. node.styleStr = value;
  20292. }
  20293. if (value.match(/ /)) {
  20294. value = value.split(' ');
  20295. }
  20296. // if attr already exists
  20297. // merge it
  20298. if (pre[name]) {
  20299. if (Array.isArray(pre[name])) {
  20300. // already array, push to last
  20301. pre[name].push(value);
  20302. } else {
  20303. // single value, make it array
  20304. pre[name] = [pre[name], value];
  20305. }
  20306. } else {
  20307. // not exist, put it
  20308. pre[name] = value;
  20309. }
  20310. return pre;
  20311. }, {});
  20312. // 优化样式相关属性
  20313. if (node.classStr) {
  20314. node.classStr += " ".concat(node.tag);
  20315. } else {
  20316. node.classStr = node.tag;
  20317. }
  20318. if (node.tagType === 'inline') {
  20319. node.classStr += ' inline';
  20320. }
  20321. // 对img添加额外数据
  20322. if (node.tag === 'img') {
  20323. var imgUrl = node.attr.src;
  20324. imgUrl = _wxDiscode.default.urlToHttpUrl(imgUrl, imageProp.domain);
  20325. Object.assign(node.attr, imageProp, {
  20326. src: imgUrl || '' });
  20327. if (imgUrl) {
  20328. results.imageUrls.push(imgUrl);
  20329. }
  20330. }
  20331. // 处理a标签属性
  20332. if (node.tag === 'a') {
  20333. node.attr.href = node.attr.href || '';
  20334. }
  20335. // 处理font标签样式属性
  20336. if (node.tag === 'font') {
  20337. var fontSize = [
  20338. 'x-small',
  20339. 'small',
  20340. 'medium',
  20341. 'large',
  20342. 'x-large',
  20343. 'xx-large',
  20344. '-webkit-xxx-large'];
  20345. var styleAttrs = {
  20346. color: 'color',
  20347. face: 'font-family',
  20348. size: 'font-size' };
  20349. if (!node.styleStr) node.styleStr = '';
  20350. Object.keys(styleAttrs).forEach(function (key) {
  20351. if (node.attr[key]) {
  20352. var value = key === 'size' ? fontSize[node.attr[key] - 1] : node.attr[key];
  20353. node.styleStr += "".concat(styleAttrs[key], ": ").concat(value, ";");
  20354. }
  20355. });
  20356. }
  20357. // 临时记录source资源
  20358. if (node.tag === 'source') {
  20359. results.source = node.attr.src;
  20360. }
  20361. if (customHandler.start) {
  20362. customHandler.start(node, results);
  20363. }
  20364. if (unary) {
  20365. // if this tag doesn't have end tag
  20366. // like <img src="hoge.png"/>
  20367. // add to parents
  20368. var _parent = bufArray[0] || results;
  20369. if (_parent.nodes === undefined) {
  20370. _parent.nodes = [];
  20371. }
  20372. _parent.nodes.push(node);
  20373. } else {
  20374. bufArray.unshift(node);
  20375. }
  20376. },
  20377. end: function end(tag) {
  20378. // merge into parent tag
  20379. var node = bufArray.shift();
  20380. if (node.tag !== tag) {
  20381. console.error('invalid state: mismatch end tag');
  20382. }
  20383. // 当有缓存source资源时于于video补上src资源
  20384. if (node.tag === 'video' && results.source) {
  20385. node.attr.src = results.source;
  20386. delete results.source;
  20387. }
  20388. if (customHandler.end) {
  20389. customHandler.end(node, results);
  20390. }
  20391. if (bufArray.length === 0) {
  20392. results.nodes.push(node);
  20393. } else {
  20394. var parent = bufArray[0];
  20395. if (!parent.nodes) {
  20396. parent.nodes = [];
  20397. }
  20398. parent.nodes.push(node);
  20399. }
  20400. },
  20401. chars: function chars(text) {
  20402. if (!text.trim()) return;
  20403. var node = {
  20404. node: 'text',
  20405. text: text };
  20406. if (customHandler.chars) {
  20407. customHandler.chars(node, results);
  20408. }
  20409. if (bufArray.length === 0) {
  20410. results.nodes.push(node);
  20411. } else {
  20412. var parent = bufArray[0];
  20413. if (parent.nodes === undefined) {
  20414. parent.nodes = [];
  20415. }
  20416. parent.nodes.push(node);
  20417. }
  20418. } });
  20419. return results;
  20420. }var _default =
  20421. html2json;exports.default = _default;
  20422. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
  20423. /***/ }),
  20424. /***/ 95:
  20425. /*!****************************************************************************!*\
  20426. !*** /Users/mead/Code/vue/epidemic-h5/uParse-master/src/libs/wxDiscode.js ***!
  20427. \****************************************************************************/
  20428. /*! no static exports found */
  20429. /***/ (function(module, exports, __webpack_require__) {
  20430. "use strict";
  20431. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; // HTML 支持的数学符号
  20432. function strNumDiscode(str) {
  20433. str = str.replace(/&forall;/g, '∀');
  20434. str = str.replace(/&part;/g, '∂');
  20435. str = str.replace(/&exist;/g, '∃');
  20436. str = str.replace(/&empty;/g, '∅');
  20437. str = str.replace(/&nabla;/g, '∇');
  20438. str = str.replace(/&isin;/g, '∈');
  20439. str = str.replace(/&notin;/g, '∉');
  20440. str = str.replace(/&ni;/g, '∋');
  20441. str = str.replace(/&prod;/g, '∏');
  20442. str = str.replace(/&sum;/g, '∑');
  20443. str = str.replace(/&minus;/g, '−');
  20444. str = str.replace(/&lowast;/g, '∗');
  20445. str = str.replace(/&radic;/g, '√');
  20446. str = str.replace(/&prop;/g, '∝');
  20447. str = str.replace(/&infin;/g, '∞');
  20448. str = str.replace(/&ang;/g, '∠');
  20449. str = str.replace(/&and;/g, '∧');
  20450. str = str.replace(/&or;/g, '∨');
  20451. str = str.replace(/&cap;/g, '∩');
  20452. str = str.replace(/&cup;/g, '∪');
  20453. str = str.replace(/&int;/g, '∫');
  20454. str = str.replace(/&there4;/g, '∴');
  20455. str = str.replace(/&sim;/g, '∼');
  20456. str = str.replace(/&cong;/g, '≅');
  20457. str = str.replace(/&asymp;/g, '≈');
  20458. str = str.replace(/&ne;/g, '≠');
  20459. str = str.replace(/&le;/g, '≤');
  20460. str = str.replace(/&ge;/g, '≥');
  20461. str = str.replace(/&sub;/g, '⊂');
  20462. str = str.replace(/&sup;/g, '⊃');
  20463. str = str.replace(/&nsub;/g, '⊄');
  20464. str = str.replace(/&sube;/g, '⊆');
  20465. str = str.replace(/&supe;/g, '⊇');
  20466. str = str.replace(/&oplus;/g, '⊕');
  20467. str = str.replace(/&otimes;/g, '⊗');
  20468. str = str.replace(/&perp;/g, '⊥');
  20469. str = str.replace(/&sdot;/g, '⋅');
  20470. return str;
  20471. }
  20472. // HTML 支持的希腊字母
  20473. function strGreeceDiscode(str) {
  20474. str = str.replace(/&Alpha;/g, 'Α');
  20475. str = str.replace(/&Beta;/g, 'Β');
  20476. str = str.replace(/&Gamma;/g, 'Γ');
  20477. str = str.replace(/&Delta;/g, 'Δ');
  20478. str = str.replace(/&Epsilon;/g, 'Ε');
  20479. str = str.replace(/&Zeta;/g, 'Ζ');
  20480. str = str.replace(/&Eta;/g, 'Η');
  20481. str = str.replace(/&Theta;/g, 'Θ');
  20482. str = str.replace(/&Iota;/g, 'Ι');
  20483. str = str.replace(/&Kappa;/g, 'Κ');
  20484. str = str.replace(/&Lambda;/g, 'Λ');
  20485. str = str.replace(/&Mu;/g, 'Μ');
  20486. str = str.replace(/&Nu;/g, 'Ν');
  20487. str = str.replace(/&Xi;/g, 'Ν');
  20488. str = str.replace(/&Omicron;/g, 'Ο');
  20489. str = str.replace(/&Pi;/g, 'Π');
  20490. str = str.replace(/&Rho;/g, 'Ρ');
  20491. str = str.replace(/&Sigma;/g, 'Σ');
  20492. str = str.replace(/&Tau;/g, 'Τ');
  20493. str = str.replace(/&Upsilon;/g, 'Υ');
  20494. str = str.replace(/&Phi;/g, 'Φ');
  20495. str = str.replace(/&Chi;/g, 'Χ');
  20496. str = str.replace(/&Psi;/g, 'Ψ');
  20497. str = str.replace(/&Omega;/g, 'Ω');
  20498. str = str.replace(/&alpha;/g, 'α');
  20499. str = str.replace(/&beta;/g, 'β');
  20500. str = str.replace(/&gamma;/g, 'γ');
  20501. str = str.replace(/&delta;/g, 'δ');
  20502. str = str.replace(/&epsilon;/g, 'ε');
  20503. str = str.replace(/&zeta;/g, 'ζ');
  20504. str = str.replace(/&eta;/g, 'η');
  20505. str = str.replace(/&theta;/g, 'θ');
  20506. str = str.replace(/&iota;/g, 'ι');
  20507. str = str.replace(/&kappa;/g, 'κ');
  20508. str = str.replace(/&lambda;/g, 'λ');
  20509. str = str.replace(/&mu;/g, 'μ');
  20510. str = str.replace(/&nu;/g, 'ν');
  20511. str = str.replace(/&xi;/g, 'ξ');
  20512. str = str.replace(/&omicron;/g, 'ο');
  20513. str = str.replace(/&pi;/g, 'π');
  20514. str = str.replace(/&rho;/g, 'ρ');
  20515. str = str.replace(/&sigmaf;/g, 'ς');
  20516. str = str.replace(/&sigma;/g, 'σ');
  20517. str = str.replace(/&tau;/g, 'τ');
  20518. str = str.replace(/&upsilon;/g, 'υ');
  20519. str = str.replace(/&phi;/g, 'φ');
  20520. str = str.replace(/&chi;/g, 'χ');
  20521. str = str.replace(/&psi;/g, 'ψ');
  20522. str = str.replace(/&omega;/g, 'ω');
  20523. str = str.replace(/&thetasym;/g, 'ϑ');
  20524. str = str.replace(/&upsih;/g, 'ϒ');
  20525. str = str.replace(/&piv;/g, 'ϖ');
  20526. str = str.replace(/&middot;/g, '·');
  20527. return str;
  20528. }
  20529. function strcharacterDiscode(str) {
  20530. // 加入常用解析
  20531. str = str.replace(/&nbsp;/g, ' ');
  20532. str = str.replace(/&ensp;/g, ' ');
  20533. str = str.replace(/&emsp;/g, ' ');
  20534. str = str.replace(/&quot;/g, "'");
  20535. str = str.replace(/&amp;/g, '&');
  20536. str = str.replace(/&lt;/g, '<');
  20537. str = str.replace(/&gt;/g, '>');
  20538. str = str.replace(/&#8226;/g, '•');
  20539. return str;
  20540. }
  20541. // HTML 支持的其他实体
  20542. function strOtherDiscode(str) {
  20543. str = str.replace(/&OElig;/g, 'Œ');
  20544. str = str.replace(/&oelig;/g, 'œ');
  20545. str = str.replace(/&Scaron;/g, 'Š');
  20546. str = str.replace(/&scaron;/g, 'š');
  20547. str = str.replace(/&Yuml;/g, 'Ÿ');
  20548. str = str.replace(/&fnof;/g, 'ƒ');
  20549. str = str.replace(/&circ;/g, 'ˆ');
  20550. str = str.replace(/&tilde;/g, '˜');
  20551. str = str.replace(/&ensp;/g, '');
  20552. str = str.replace(/&emsp;/g, '');
  20553. str = str.replace(/&thinsp;/g, '');
  20554. str = str.replace(/&zwnj;/g, '');
  20555. str = str.replace(/&zwj;/g, '');
  20556. str = str.replace(/&lrm;/g, '');
  20557. str = str.replace(/&rlm;/g, '');
  20558. str = str.replace(/&ndash;/g, '–');
  20559. str = str.replace(/&mdash;/g, '—');
  20560. str = str.replace(/&lsquo;/g, '‘');
  20561. str = str.replace(/&rsquo;/g, '’');
  20562. str = str.replace(/&sbquo;/g, '‚');
  20563. str = str.replace(/&ldquo;/g, '“');
  20564. str = str.replace(/&rdquo;/g, '”');
  20565. str = str.replace(/&bdquo;/g, '„');
  20566. str = str.replace(/&dagger;/g, '†');
  20567. str = str.replace(/&Dagger;/g, '‡');
  20568. str = str.replace(/&bull;/g, '•');
  20569. str = str.replace(/&hellip;/g, '…');
  20570. str = str.replace(/&permil;/g, '‰');
  20571. str = str.replace(/&prime;/g, '′');
  20572. str = str.replace(/&Prime;/g, '″');
  20573. str = str.replace(/&lsaquo;/g, '‹');
  20574. str = str.replace(/&rsaquo;/g, '›');
  20575. str = str.replace(/&oline;/g, '‾');
  20576. str = str.replace(/&euro;/g, '€');
  20577. str = str.replace(/&trade;/g, '™');
  20578. str = str.replace(/&larr;/g, '←');
  20579. str = str.replace(/&uarr;/g, '↑');
  20580. str = str.replace(/&rarr;/g, '→');
  20581. str = str.replace(/&darr;/g, '↓');
  20582. str = str.replace(/&harr;/g, '↔');
  20583. str = str.replace(/&crarr;/g, '↵');
  20584. str = str.replace(/&lceil;/g, '⌈');
  20585. str = str.replace(/&rceil;/g, '⌉');
  20586. str = str.replace(/&lfloor;/g, '⌊');
  20587. str = str.replace(/&rfloor;/g, '⌋');
  20588. str = str.replace(/&loz;/g, '◊');
  20589. str = str.replace(/&spades;/g, '♠');
  20590. str = str.replace(/&clubs;/g, '♣');
  20591. str = str.replace(/&hearts;/g, '♥');
  20592. str = str.replace(/&diams;/g, '♦');
  20593. str = str.replace(/&#39;/g, "'");
  20594. return str;
  20595. }
  20596. function strDiscode(str) {
  20597. str = strNumDiscode(str);
  20598. str = strGreeceDiscode(str);
  20599. str = strcharacterDiscode(str);
  20600. str = strOtherDiscode(str);
  20601. return str;
  20602. }
  20603. function urlToHttpUrl(url, domain) {
  20604. if (/^\/\//.test(url)) {
  20605. return "https:".concat(url);
  20606. } else if (/^\//.test(url)) {
  20607. return "https://".concat(domain).concat(url);
  20608. }
  20609. return url;
  20610. }var _default =
  20611. {
  20612. strDiscode: strDiscode,
  20613. urlToHttpUrl: urlToHttpUrl };exports.default = _default;
  20614. /***/ }),
  20615. /***/ 96:
  20616. /*!*****************************************************************************!*\
  20617. !*** /Users/mead/Code/vue/epidemic-h5/uParse-master/src/libs/htmlparser.js ***!
  20618. \*****************************************************************************/
  20619. /*! no static exports found */
  20620. /***/ (function(module, exports, __webpack_require__) {
  20621. "use strict";
  20622. Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0; /**
  20623. *
  20624. * htmlParser改造自: https://github.com/blowsie/Pure-JavaScript-HTML5-Parser
  20625. *
  20626. * author: Di (微信小程序开发工程师)
  20627. * organization: WeAppDev(微信小程序开发论坛)(http://weappdev.com)
  20628. * 垂直微信小程序开发交流社区
  20629. *
  20630. * github地址: https://github.com/icindy/wxParse
  20631. *
  20632. * for: 微信小程序富文本解析
  20633. * detail : http://weappdev.com/t/wxparse-alpha0-1-html-markdown/184
  20634. */
  20635. // Regular Expressions for parsing tags and attributes
  20636. var startTag = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z0-9_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/;
  20637. var endTag = /^<\/([-A-Za-z0-9_]+)[^>]*>/;
  20638. var attr = /([a-zA-Z0-9_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
  20639. function makeMap(str) {
  20640. var obj = {};
  20641. var items = str.split(',');
  20642. for (var i = 0; i < items.length; i += 1) {obj[items[i]] = true;}
  20643. return obj;
  20644. }
  20645. // Empty Elements - HTML 5
  20646. var empty = makeMap('area,base,basefont,br,col,frame,hr,img,input,link,meta,param,embed,command,keygen,source,track,wbr');
  20647. // Block Elements - HTML 5
  20648. var block = makeMap('address,code,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video');
  20649. // Inline Elements - HTML 5
  20650. var inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var');
  20651. // Elements that you can, intentionally, leave open
  20652. // (and which close themselves)
  20653. var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr');
  20654. // Attributes that have their values filled in disabled="disabled"
  20655. var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
  20656. function HTMLParser(html, handler) {
  20657. var index;
  20658. var chars;
  20659. var match;
  20660. var last = html;
  20661. var stack = [];
  20662. stack.last = function () {return stack[stack.length - 1];};
  20663. function parseEndTag(tag, tagName) {
  20664. // If no tag name is provided, clean shop
  20665. var pos;
  20666. if (!tagName) {
  20667. pos = 0;
  20668. } else {
  20669. // Find the closest opened tag of the same type
  20670. tagName = tagName.toLowerCase();
  20671. for (pos = stack.length - 1; pos >= 0; pos -= 1) {
  20672. if (stack[pos] === tagName) break;
  20673. }
  20674. }
  20675. if (pos >= 0) {
  20676. // Close all the open elements, up the stack
  20677. for (var i = stack.length - 1; i >= pos; i -= 1) {
  20678. if (handler.end) handler.end(stack[i]);
  20679. }
  20680. // Remove the open elements from the stack
  20681. stack.length = pos;
  20682. }
  20683. }
  20684. function parseStartTag(tag, tagName, rest, unary) {
  20685. tagName = tagName.toLowerCase();
  20686. if (block[tagName]) {
  20687. while (stack.last() && inline[stack.last()]) {
  20688. parseEndTag('', stack.last());
  20689. }
  20690. }
  20691. if (closeSelf[tagName] && stack.last() === tagName) {
  20692. parseEndTag('', tagName);
  20693. }
  20694. unary = empty[tagName] || !!unary;
  20695. if (!unary) stack.push(tagName);
  20696. if (handler.start) {
  20697. var attrs = [];
  20698. rest.replace(attr, function genAttr(matches, name) {
  20699. var value = arguments[2] || arguments[3] || arguments[4] || (fillAttrs[name] ? name : '');
  20700. attrs.push({
  20701. name: name,
  20702. value: value,
  20703. escaped: value.replace(/(^|[^\\])"/g, '$1\\"') // "
  20704. });
  20705. });
  20706. if (handler.start) {
  20707. handler.start(tagName, attrs, unary);
  20708. }
  20709. }
  20710. }
  20711. while (html) {
  20712. chars = true;
  20713. if (html.indexOf('</') === 0) {
  20714. match = html.match(endTag);
  20715. if (match) {
  20716. html = html.substring(match[0].length);
  20717. match[0].replace(endTag, parseEndTag);
  20718. chars = false;
  20719. }
  20720. // start tag
  20721. } else if (html.indexOf('<') === 0) {
  20722. match = html.match(startTag);
  20723. if (match) {
  20724. html = html.substring(match[0].length);
  20725. match[0].replace(startTag, parseStartTag);
  20726. chars = false;
  20727. }
  20728. }
  20729. if (chars) {
  20730. index = html.indexOf('<');
  20731. var text = '';
  20732. while (index === 0) {
  20733. text += '<';
  20734. html = html.substring(1);
  20735. index = html.indexOf('<');
  20736. }
  20737. text += index < 0 ? html : html.substring(0, index);
  20738. html = index < 0 ? '' : html.substring(index);
  20739. if (handler.chars) handler.chars(text);
  20740. }
  20741. if (html === last) throw new Error("Parse Error: ".concat(html));
  20742. last = html;
  20743. }
  20744. // Clean up any remaining tags
  20745. parseEndTag();
  20746. }var _default =
  20747. HTMLParser;exports.default = _default;
  20748. /***/ })
  20749. }]);
  20750. //# sourceMappingURL=../../.sourcemap/mp-weixin/common/vendor.js.map