html2canvas.js 293 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895
  1. // ../../../../project/banma/node_modules/html2canvas/dist/html2canvas.esm.js
  2. var extendStatics = function(d, b) {
  3. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  4. d2.__proto__ = b2;
  5. } || function(d2, b2) {
  6. for (var p in b2)
  7. if (b2.hasOwnProperty(p))
  8. d2[p] = b2[p];
  9. };
  10. return extendStatics(d, b);
  11. };
  12. function __extends(d, b) {
  13. extendStatics(d, b);
  14. function __() {
  15. this.constructor = d;
  16. }
  17. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  18. }
  19. var __assign = function() {
  20. __assign = Object.assign || function __assign2(t) {
  21. for (var s, i = 1, n = arguments.length; i < n; i++) {
  22. s = arguments[i];
  23. for (var p in s)
  24. if (Object.prototype.hasOwnProperty.call(s, p))
  25. t[p] = s[p];
  26. }
  27. return t;
  28. };
  29. return __assign.apply(this, arguments);
  30. };
  31. function __awaiter(thisArg, _arguments, P, generator) {
  32. return new (P || (P = Promise))(function(resolve, reject) {
  33. function fulfilled(value) {
  34. try {
  35. step(generator.next(value));
  36. } catch (e2) {
  37. reject(e2);
  38. }
  39. }
  40. function rejected(value) {
  41. try {
  42. step(generator["throw"](value));
  43. } catch (e2) {
  44. reject(e2);
  45. }
  46. }
  47. function step(result) {
  48. result.done ? resolve(result.value) : new P(function(resolve2) {
  49. resolve2(result.value);
  50. }).then(fulfilled, rejected);
  51. }
  52. step((generator = generator.apply(thisArg, _arguments || [])).next());
  53. });
  54. }
  55. function __generator(thisArg, body) {
  56. var _ = { label: 0, sent: function() {
  57. if (t[0] & 1)
  58. throw t[1];
  59. return t[1];
  60. }, trys: [], ops: [] }, f2, y, t, g;
  61. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  62. return this;
  63. }), g;
  64. function verb(n) {
  65. return function(v) {
  66. return step([n, v]);
  67. };
  68. }
  69. function step(op) {
  70. if (f2)
  71. throw new TypeError("Generator is already executing.");
  72. while (_)
  73. try {
  74. if (f2 = 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)
  75. return t;
  76. if (y = 0, t)
  77. op = [op[0] & 2, t.value];
  78. switch (op[0]) {
  79. case 0:
  80. case 1:
  81. t = op;
  82. break;
  83. case 4:
  84. _.label++;
  85. return { value: op[1], done: false };
  86. case 5:
  87. _.label++;
  88. y = op[1];
  89. op = [0];
  90. continue;
  91. case 7:
  92. op = _.ops.pop();
  93. _.trys.pop();
  94. continue;
  95. default:
  96. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  97. _ = 0;
  98. continue;
  99. }
  100. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  101. _.label = op[1];
  102. break;
  103. }
  104. if (op[0] === 6 && _.label < t[1]) {
  105. _.label = t[1];
  106. t = op;
  107. break;
  108. }
  109. if (t && _.label < t[2]) {
  110. _.label = t[2];
  111. _.ops.push(op);
  112. break;
  113. }
  114. if (t[2])
  115. _.ops.pop();
  116. _.trys.pop();
  117. continue;
  118. }
  119. op = body.call(thisArg, _);
  120. } catch (e2) {
  121. op = [6, e2];
  122. y = 0;
  123. } finally {
  124. f2 = t = 0;
  125. }
  126. if (op[0] & 5)
  127. throw op[1];
  128. return { value: op[0] ? op[1] : void 0, done: true };
  129. }
  130. }
  131. var Bounds = (
  132. /** @class */
  133. function() {
  134. function Bounds2(x, y, w, h) {
  135. this.left = x;
  136. this.top = y;
  137. this.width = w;
  138. this.height = h;
  139. }
  140. Bounds2.prototype.add = function(x, y, w, h) {
  141. return new Bounds2(this.left + x, this.top + y, this.width + w, this.height + h);
  142. };
  143. Bounds2.fromClientRect = function(clientRect) {
  144. return new Bounds2(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
  145. };
  146. return Bounds2;
  147. }()
  148. );
  149. var parseBounds = function(node) {
  150. return Bounds.fromClientRect(node.getBoundingClientRect());
  151. };
  152. var parseDocumentSize = function(document2) {
  153. var body = document2.body;
  154. var documentElement = document2.documentElement;
  155. if (!body || !documentElement) {
  156. throw new Error("Unable to get document size");
  157. }
  158. var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth));
  159. var height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
  160. return new Bounds(0, 0, width, height);
  161. };
  162. var toCodePoints = function(str) {
  163. var codePoints = [];
  164. var i = 0;
  165. var length = str.length;
  166. while (i < length) {
  167. var value = str.charCodeAt(i++);
  168. if (value >= 55296 && value <= 56319 && i < length) {
  169. var extra = str.charCodeAt(i++);
  170. if ((extra & 64512) === 56320) {
  171. codePoints.push(((value & 1023) << 10) + (extra & 1023) + 65536);
  172. } else {
  173. codePoints.push(value);
  174. i--;
  175. }
  176. } else {
  177. codePoints.push(value);
  178. }
  179. }
  180. return codePoints;
  181. };
  182. var fromCodePoint = function() {
  183. var codePoints = [];
  184. for (var _i = 0; _i < arguments.length; _i++) {
  185. codePoints[_i] = arguments[_i];
  186. }
  187. if (String.fromCodePoint) {
  188. return String.fromCodePoint.apply(String, codePoints);
  189. }
  190. var length = codePoints.length;
  191. if (!length) {
  192. return "";
  193. }
  194. var codeUnits = [];
  195. var index = -1;
  196. var result = "";
  197. while (++index < length) {
  198. var codePoint = codePoints[index];
  199. if (codePoint <= 65535) {
  200. codeUnits.push(codePoint);
  201. } else {
  202. codePoint -= 65536;
  203. codeUnits.push((codePoint >> 10) + 55296, codePoint % 1024 + 56320);
  204. }
  205. if (index + 1 === length || codeUnits.length > 16384) {
  206. result += String.fromCharCode.apply(String, codeUnits);
  207. codeUnits.length = 0;
  208. }
  209. }
  210. return result;
  211. };
  212. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  213. var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
  214. for (i = 0; i < chars.length; i++) {
  215. lookup[chars.charCodeAt(i)] = i;
  216. }
  217. var i;
  218. var decode = function(base642) {
  219. var bufferLength = base642.length * 0.75, len = base642.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
  220. if (base642[base642.length - 1] === "=") {
  221. bufferLength--;
  222. if (base642[base642.length - 2] === "=") {
  223. bufferLength--;
  224. }
  225. }
  226. var buffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined" && typeof Uint8Array.prototype.slice !== "undefined" ? new ArrayBuffer(bufferLength) : new Array(bufferLength);
  227. var bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
  228. for (i = 0; i < len; i += 4) {
  229. encoded1 = lookup[base642.charCodeAt(i)];
  230. encoded2 = lookup[base642.charCodeAt(i + 1)];
  231. encoded3 = lookup[base642.charCodeAt(i + 2)];
  232. encoded4 = lookup[base642.charCodeAt(i + 3)];
  233. bytes[p++] = encoded1 << 2 | encoded2 >> 4;
  234. bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
  235. bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
  236. }
  237. return buffer;
  238. };
  239. var polyUint16Array = function(buffer) {
  240. var length = buffer.length;
  241. var bytes = [];
  242. for (var i = 0; i < length; i += 2) {
  243. bytes.push(buffer[i + 1] << 8 | buffer[i]);
  244. }
  245. return bytes;
  246. };
  247. var polyUint32Array = function(buffer) {
  248. var length = buffer.length;
  249. var bytes = [];
  250. for (var i = 0; i < length; i += 4) {
  251. bytes.push(buffer[i + 3] << 24 | buffer[i + 2] << 16 | buffer[i + 1] << 8 | buffer[i]);
  252. }
  253. return bytes;
  254. };
  255. var UTRIE2_SHIFT_2 = 5;
  256. var UTRIE2_SHIFT_1 = 6 + 5;
  257. var UTRIE2_INDEX_SHIFT = 2;
  258. var UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2;
  259. var UTRIE2_LSCP_INDEX_2_OFFSET = 65536 >> UTRIE2_SHIFT_2;
  260. var UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2;
  261. var UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1;
  262. var UTRIE2_LSCP_INDEX_2_LENGTH = 1024 >> UTRIE2_SHIFT_2;
  263. var UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH;
  264. var UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH;
  265. var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 2048 >> 6;
  266. var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH;
  267. var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 65536 >> UTRIE2_SHIFT_1;
  268. var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2;
  269. var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1;
  270. var slice16 = function(view, start, end) {
  271. if (view.slice) {
  272. return view.slice(start, end);
  273. }
  274. return new Uint16Array(Array.prototype.slice.call(view, start, end));
  275. };
  276. var slice32 = function(view, start, end) {
  277. if (view.slice) {
  278. return view.slice(start, end);
  279. }
  280. return new Uint32Array(Array.prototype.slice.call(view, start, end));
  281. };
  282. var createTrieFromBase64 = function(base642) {
  283. var buffer = decode(base642);
  284. var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer);
  285. var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer);
  286. var headerLength = 24;
  287. var index = slice16(view16, headerLength / 2, view32[4] / 2);
  288. var data = view32[5] === 2 ? slice16(view16, (headerLength + view32[4]) / 2) : slice32(view32, Math.ceil((headerLength + view32[4]) / 4));
  289. return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
  290. };
  291. var Trie = (
  292. /** @class */
  293. function() {
  294. function Trie2(initialValue, errorValue, highStart, highValueIndex, index, data) {
  295. this.initialValue = initialValue;
  296. this.errorValue = errorValue;
  297. this.highStart = highStart;
  298. this.highValueIndex = highValueIndex;
  299. this.index = index;
  300. this.data = data;
  301. }
  302. Trie2.prototype.get = function(codePoint) {
  303. var ix;
  304. if (codePoint >= 0) {
  305. if (codePoint < 55296 || codePoint > 56319 && codePoint <= 65535) {
  306. ix = this.index[codePoint >> UTRIE2_SHIFT_2];
  307. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  308. return this.data[ix];
  309. }
  310. if (codePoint <= 65535) {
  311. ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 55296 >> UTRIE2_SHIFT_2)];
  312. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  313. return this.data[ix];
  314. }
  315. if (codePoint < this.highStart) {
  316. ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1);
  317. ix = this.index[ix];
  318. ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK;
  319. ix = this.index[ix];
  320. ix = (ix << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK);
  321. return this.data[ix];
  322. }
  323. if (codePoint <= 1114111) {
  324. return this.data[this.highValueIndex];
  325. }
  326. }
  327. return this.errorValue;
  328. };
  329. return Trie2;
  330. }()
  331. );
  332. var base64 = "KwAAAAAAAAAACA4AIDoAAPAfAAACAAAAAAAIABAAGABAAEgAUABYAF4AZgBeAGYAYABoAHAAeABeAGYAfACEAIAAiACQAJgAoACoAK0AtQC9AMUAXgBmAF4AZgBeAGYAzQDVAF4AZgDRANkA3gDmAOwA9AD8AAQBDAEUARoBIgGAAIgAJwEvATcBPwFFAU0BTAFUAVwBZAFsAXMBewGDATAAiwGTAZsBogGkAawBtAG8AcIBygHSAdoB4AHoAfAB+AH+AQYCDgIWAv4BHgImAi4CNgI+AkUCTQJTAlsCYwJrAnECeQKBAk0CiQKRApkCoQKoArACuALAAsQCzAIwANQC3ALkAjAA7AL0AvwCAQMJAxADGAMwACADJgMuAzYDPgOAAEYDSgNSA1IDUgNaA1oDYANiA2IDgACAAGoDgAByA3YDfgOAAIQDgACKA5IDmgOAAIAAogOqA4AAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAK8DtwOAAIAAvwPHA88D1wPfAyAD5wPsA/QD/AOAAIAABAQMBBIEgAAWBB4EJgQuBDMEIAM7BEEEXgBJBCADUQRZBGEEaQQwADAAcQQ+AXkEgQSJBJEEgACYBIAAoASoBK8EtwQwAL8ExQSAAIAAgACAAIAAgACgAM0EXgBeAF4AXgBeAF4AXgBeANUEXgDZBOEEXgDpBPEE+QQBBQkFEQUZBSEFKQUxBTUFPQVFBUwFVAVcBV4AYwVeAGsFcwV7BYMFiwWSBV4AmgWgBacFXgBeAF4AXgBeAKsFXgCyBbEFugW7BcIFwgXIBcIFwgXQBdQF3AXkBesF8wX7BQMGCwYTBhsGIwYrBjMGOwZeAD8GRwZNBl4AVAZbBl4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAGMGXgBqBnEGXgBeAF4AXgBeAF4AXgBeAF4AXgB5BoAG4wSGBo4GkwaAAIADHgR5AF4AXgBeAJsGgABGA4AAowarBrMGswagALsGwwbLBjAA0wbaBtoG3QbaBtoG2gbaBtoG2gblBusG8wb7BgMHCwcTBxsHCwcjBysHMAc1BzUHOgdCB9oGSgdSB1oHYAfaBloHaAfaBlIH2gbaBtoG2gbaBtoG2gbaBjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHbQdeAF4ANQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQd1B30HNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B4MH2gaKB68EgACAAIAAgACAAIAAgACAAI8HlwdeAJ8HpweAAIAArwe3B14AXgC/B8UHygcwANAH2AfgB4AA6AfwBz4B+AcACFwBCAgPCBcIogEYAR8IJwiAAC8INwg/CCADRwhPCFcIXwhnCEoDGgSAAIAAgABvCHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIfQh3CHgIeQh6CHsIfAh9CHcIeAh5CHoIewh8CH0Idwh4CHkIegh7CHwIhAiLCI4IMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAANQc1BzUHNQc1BzUHNQc1BzUHNQc1B54INQc1B6II2gaqCLIIugiAAIAAvgjGCIAAgACAAIAAgACAAIAAgACAAIAAywiHAYAA0wiAANkI3QjlCO0I9Aj8CIAAgACAAAIJCgkSCRoJIgknCTYHLwk3CZYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiWCJYIlgiAAIAAAAFAAXgBeAGAAcABeAHwAQACQAKAArQC9AJ4AXgBeAE0A3gBRAN4A7AD8AMwBGgEAAKcBNwEFAUwBXAF4QkhCmEKnArcCgAHHAsABz4LAAcABwAHAAd+C6ABoAG+C/4LAAcABwAHAAc+DF4MAAcAB54M3gweDV4Nng3eDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEeDqABVg6WDqABoQ6gAaABoAHXDvcONw/3DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DvcO9w73DncPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB7cPPwlGCU4JMACAAIAAgABWCV4JYQmAAGkJcAl4CXwJgAkwADAAMAAwAIgJgACLCZMJgACZCZ8JowmrCYAAswkwAF4AXgB8AIAAuwkABMMJyQmAAM4JgADVCTAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAqwYWBNkIMAAwADAAMADdCeAJ6AnuCR4E9gkwAP4JBQoNCjAAMACAABUK0wiAAB0KJAosCjQKgAAwADwKQwqAAEsKvQmdCVMKWwowADAAgACAALcEMACAAGMKgABrCjAAMAAwADAAMAAwADAAMAAwADAAMAAeBDAAMAAwADAAMAAwADAAMAAwADAAMAAwAIkEPQFzCnoKiQSCCooKkAqJBJgKoAqkCokEGAGsCrQKvArBCjAAMADJCtEKFQHZCuEK/gHpCvEKMAAwADAAMACAAIwE+QowAIAAPwEBCzAAMAAwADAAMACAAAkLEQswAIAAPwEZCyELgAAOCCkLMAAxCzkLMAAwADAAMAAwADAAXgBeAEELMAAwADAAMAAwADAAMAAwAEkLTQtVC4AAXAtkC4AAiQkwADAAMAAwADAAMAAwADAAbAtxC3kLgAuFC4sLMAAwAJMLlwufCzAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAApwswADAAMACAAIAAgACvC4AAgACAAIAAgACAALcLMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAvwuAAMcLgACAAIAAgACAAIAAyguAAIAAgACAAIAA0QswADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAANkLgACAAIAA4AswADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACJCR4E6AswADAAhwHwC4AA+AsADAgMEAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMACAAIAAGAwdDCUMMAAwAC0MNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQw1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHPQwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADUHNQc1BzUHNQc1BzUHNQc2BzAAMAA5DDUHNQc1BzUHNQc1BzUHNQc1BzUHNQdFDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAgACAAIAATQxSDFoMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAF4AXgBeAF4AXgBeAF4AYgxeAGoMXgBxDHkMfwxeAIUMXgBeAI0MMAAwADAAMAAwAF4AXgCVDJ0MMAAwADAAMABeAF4ApQxeAKsMswy7DF4Awgy9DMoMXgBeAF4AXgBeAF4AXgBeAF4AXgDRDNkMeQBqCeAM3Ax8AOYM7Az0DPgMXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgBeAF4AXgCgAAANoAAHDQ4NFg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAeDSYNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIAAgACAAIAAgACAAC4NMABeAF4ANg0wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAD4NRg1ODVYNXg1mDTAAbQ0wADAAMAAwADAAMAAwADAA2gbaBtoG2gbaBtoG2gbaBnUNeg3CBYANwgWFDdoGjA3aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gaUDZwNpA2oDdoG2gawDbcNvw3HDdoG2gbPDdYN3A3fDeYN2gbsDfMN2gbaBvoN/g3aBgYODg7aBl4AXgBeABYOXgBeACUG2gYeDl4AJA5eACwO2w3aBtoGMQ45DtoG2gbaBtoGQQ7aBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDjUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B1EO2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQdZDjUHNQc1BzUHNQc1B2EONQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHaA41BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B3AO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gY1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1BzUHNQc1B2EO2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gZJDtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBtoG2gbaBkkOeA6gAKAAoAAwADAAMAAwAKAAoACgAKAAoACgAKAAgA4wADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAD//wQABAAEAAQABAAEAAQABAAEAA0AAwABAAEAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAKABMAFwAeABsAGgAeABcAFgASAB4AGwAYAA8AGAAcAEsASwBLAEsASwBLAEsASwBLAEsAGAAYAB4AHgAeABMAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAFgAbABIAHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYADQARAB4ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkAFgAaABsAGwAbAB4AHQAdAB4ATwAXAB4ADQAeAB4AGgAbAE8ATwAOAFAAHQAdAB0ATwBPABcATwBPAE8AFgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwArAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAAQABAANAA0ASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAUAArACsAKwArACsAKwArACsABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAGgAaAFAAUABQAFAAUABMAB4AGwBQAB4AKwArACsABAAEAAQAKwBQAFAAUABQAFAAUAArACsAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUAArAFAAUAArACsABAArAAQABAAEAAQABAArACsAKwArAAQABAArACsABAAEAAQAKwArACsABAArACsAKwArACsAKwArAFAAUABQAFAAKwBQACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwAEAAQAUABQAFAABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUAArACsABABQAAQABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQAKwArAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeABsAKwArACsAKwArACsAKwBQAAQABAAEAAQABAAEACsABAAEAAQAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArAAQABAArACsABAAEAAQAKwArACsAKwArACsAKwArAAQABAArACsAKwArAFAAUAArAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwAeAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwAEAFAAKwBQAFAAUABQAFAAUAArACsAKwBQAFAAUAArAFAAUABQAFAAKwArACsAUABQACsAUAArAFAAUAArACsAKwBQAFAAKwArACsAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQAKwArACsABAAEAAQAKwAEAAQABAAEACsAKwBQACsAKwArACsAKwArAAQAKwArACsAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAB4AHgAeAB4AHgAeABsAHgArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArAFAAUABQACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAB4AUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABAArACsAKwArACsAKwArAAQABAArACsAKwArACsAKwArAFAAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwArAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAKwBcAFwAKwBcACsAKwBcACsAKwArACsAKwArAFwAXABcAFwAKwBcAFwAXABcAFwAXABcACsAXABcAFwAKwBcACsAXAArACsAXABcACsAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgArACoAKgBcACsAKwBcAFwAXABcAFwAKwBcACsAKgAqACoAKgAqACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAFwAXABcAFwAUAAOAA4ADgAOAB4ADgAOAAkADgAOAA0ACQATABMAEwATABMACQAeABMAHgAeAB4ABAAEAB4AHgAeAB4AHgAeAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUAANAAQAHgAEAB4ABAAWABEAFgARAAQABABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAAQABAAEAAQABAANAAQABABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsADQANAB4AHgAeAB4AHgAeAAQAHgAeAB4AHgAeAB4AKwAeAB4ADgAOAA0ADgAeAB4AHgAeAB4ACQAJACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgAeAB4AHgBcAFwAXABcAFwAXAAqACoAKgAqAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAKgAqACoAKgAqACoAKgBcAFwAXAAqACoAKgAqAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAXAAqAEsASwBLAEsASwBLAEsASwBLAEsAKgAqACoAKgAqACoAUABQAFAAUABQAFAAKwBQACsAKwArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQACsAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwAEAAQABAAeAA0AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAEQArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAADQANAA0AUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAA0ADQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQACsABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoADQANABUAXAANAB4ADQAbAFwAKgArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAB4AHgATABMADQANAA4AHgATABMAHgAEAAQABAAJACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAUABQAFAAUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwAeACsAKwArABMAEwBLAEsASwBLAEsASwBLAEsASwBLAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwBcAFwAXABcAFwAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcACsAKwArACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwAeAB4AXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsABABLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKgAqACoAKgAqACoAKgBcACoAKgAqACoAKgAqACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAUABQAFAAUABQAFAAUAArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4ADQANAA0ADQAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAHgAeAB4AHgBQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwANAA0ADQANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwBQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsABAAEAAQAHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAABABQAFAAUABQAAQABAAEAFAAUAAEAAQABAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAKwBQACsAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAKwArAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAKwAeAB4AHgAeAB4AHgAeAA4AHgArAA0ADQANAA0ADQANAA0ACQANAA0ADQAIAAQACwAEAAQADQAJAA0ADQAMAB0AHQAeABcAFwAWABcAFwAXABYAFwAdAB0AHgAeABQAFAAUAA0AAQABAAQABAAEAAQABAAJABoAGgAaABoAGgAaABoAGgAeABcAFwAdABUAFQAeAB4AHgAeAB4AHgAYABYAEQAVABUAFQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgANAB4ADQANAA0ADQAeAA0ADQANAAcAHgAeAB4AHgArAAQABAAEAAQABAAEAAQABAAEAAQAUABQACsAKwBPAFAAUABQAFAAUAAeAB4AHgAWABEATwBQAE8ATwBPAE8AUABQAFAAUABQAB4AHgAeABYAEQArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAaABsAGwAbABsAGgAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgBQABoAHgAdAB4AUAAeABoAHgAeAB4AHgAeAB4AHgAeAB4ATwAeAFAAGwAeAB4AUABQAFAAUABQAB4AHgAeAB0AHQAeAFAAHgBQAB4AUAAeAFAATwBQAFAAHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AUABQAFAAUABPAE8AUABQAFAAUABQAE8AUABQAE8AUABPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAE8ATwBPAE8ATwBPAE8ATwBPAE8AUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAATwAeAB4AKwArACsAKwAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB0AHQAeAB4AHgAdAB0AHgAeAB0AHgAeAB4AHQAeAB0AGwAbAB4AHQAeAB4AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB0AHgAdAB4AHQAdAB0AHQAdAB0AHgAdAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAdAB0AHQAdAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAlACUAHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBQAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAeAB4AHgAeAB0AHQAeAB4AHgAeAB0AHQAdAB4AHgAdAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB0AHQAeAB4AHQAeAB4AHgAeAB0AHQAeAB4AHgAeACUAJQAdAB0AJQAeACUAJQAlACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAHgAeAB4AHgAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHQAdAB0AHgAdACUAHQAdAB4AHQAdAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHQAdAB0AHQAlAB4AJQAlACUAHQAlACUAHQAdAB0AJQAlAB0AHQAlAB0AHQAlACUAJQAeAB0AHgAeAB4AHgAdAB0AJQAdAB0AHQAdAB0AHQAlACUAJQAlACUAHQAlACUAIAAlAB0AHQAlACUAJQAlACUAJQAlACUAHgAeAB4AJQAlACAAIAAgACAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeABcAFwAXABcAFwAXAB4AEwATACUAHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACUAJQBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwArACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAE8ATwBPAE8ATwBPAE8ATwAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeACsAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUAArACsAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQBQAFAAUABQACsAKwArACsAUABQAFAAUABQAFAAUABQAA0AUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAABAAEAAQAKwAEAAQAKwArACsAKwArAAQABAAEAAQAUABQAFAAUAArAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsABAAEAAQAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsADQANAA0ADQANAA0ADQANAB4AKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAUABQAFAAUABQAA0ADQANAA0ADQANABQAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwANAA0ADQANAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAeAAQABAAEAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLACsADQArAB4AKwArAAQABAAEAAQAUABQAB4AUAArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwAEAAQABAAEAAQABAAEAAQABAAOAA0ADQATABMAHgAeAB4ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0AUABQAFAAUAAEAAQAKwArAAQADQANAB4AUAArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXABcAA0ADQANACoASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUAArACsAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANACsADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEcARwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQACsAKwAeAAQABAANAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAEAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUAArACsAUAArACsAUABQACsAKwBQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AKwArAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAeAB4ADQANAA0ADQAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAArAAQABAArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAEAAQABAAEAAQABAAEACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAFgAWAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAKwBQACsAKwArACsAKwArAFAAKwArACsAKwBQACsAUAArAFAAKwBQAFAAUAArAFAAUAArAFAAKwArAFAAKwBQACsAUAArAFAAKwBQACsAUABQACsAUAArACsAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAUABQAFAAUAArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUAArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAlACUAJQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeACUAJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeACUAJQAlACUAJQAeACUAJQAlACUAJQAgACAAIAAlACUAIAAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIQAhACEAIQAhACUAJQAgACAAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAIAAlACUAJQAlACAAJQAgACAAIAAgACAAIAAgACAAIAAlACUAJQAgACUAJQAlACUAIAAgACAAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeACUAHgAlAB4AJQAlACUAJQAlACAAJQAlACUAJQAeACUAHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAIAAgACAAIAAgAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFwAXABcAFQAVABUAHgAeAB4AHgAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAIAAgACAAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAlACAAIAAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsA";
  333. var LETTER_NUMBER_MODIFIER = 50;
  334. var BK = 1;
  335. var CR = 2;
  336. var LF = 3;
  337. var CM = 4;
  338. var NL = 5;
  339. var WJ = 7;
  340. var ZW = 8;
  341. var GL = 9;
  342. var SP = 10;
  343. var ZWJ = 11;
  344. var B2 = 12;
  345. var BA = 13;
  346. var BB = 14;
  347. var HY = 15;
  348. var CB = 16;
  349. var CL = 17;
  350. var CP = 18;
  351. var EX = 19;
  352. var IN = 20;
  353. var NS = 21;
  354. var OP = 22;
  355. var QU = 23;
  356. var IS = 24;
  357. var NU = 25;
  358. var PO = 26;
  359. var PR = 27;
  360. var SY = 28;
  361. var AI = 29;
  362. var AL = 30;
  363. var CJ = 31;
  364. var EB = 32;
  365. var EM = 33;
  366. var H2 = 34;
  367. var H3 = 35;
  368. var HL = 36;
  369. var ID = 37;
  370. var JL = 38;
  371. var JV = 39;
  372. var JT = 40;
  373. var RI = 41;
  374. var SA = 42;
  375. var XX = 43;
  376. var BREAK_MANDATORY = "!";
  377. var BREAK_NOT_ALLOWED = "×";
  378. var BREAK_ALLOWED = "÷";
  379. var UnicodeTrie = createTrieFromBase64(base64);
  380. var ALPHABETICS = [AL, HL];
  381. var HARD_LINE_BREAKS = [BK, CR, LF, NL];
  382. var SPACE = [SP, ZW];
  383. var PREFIX_POSTFIX = [PR, PO];
  384. var LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE);
  385. var KOREAN_SYLLABLE_BLOCK = [JL, JV, JT, H2, H3];
  386. var HYPHEN = [HY, BA];
  387. var codePointsToCharacterClasses = function(codePoints, lineBreak2) {
  388. if (lineBreak2 === void 0) {
  389. lineBreak2 = "strict";
  390. }
  391. var types = [];
  392. var indicies = [];
  393. var categories = [];
  394. codePoints.forEach(function(codePoint, index) {
  395. var classType = UnicodeTrie.get(codePoint);
  396. if (classType > LETTER_NUMBER_MODIFIER) {
  397. categories.push(true);
  398. classType -= LETTER_NUMBER_MODIFIER;
  399. } else {
  400. categories.push(false);
  401. }
  402. if (["normal", "auto", "loose"].indexOf(lineBreak2) !== -1) {
  403. if ([8208, 8211, 12316, 12448].indexOf(codePoint) !== -1) {
  404. indicies.push(index);
  405. return types.push(CB);
  406. }
  407. }
  408. if (classType === CM || classType === ZWJ) {
  409. if (index === 0) {
  410. indicies.push(index);
  411. return types.push(AL);
  412. }
  413. var prev = types[index - 1];
  414. if (LINE_BREAKS.indexOf(prev) === -1) {
  415. indicies.push(indicies[index - 1]);
  416. return types.push(prev);
  417. }
  418. indicies.push(index);
  419. return types.push(AL);
  420. }
  421. indicies.push(index);
  422. if (classType === CJ) {
  423. return types.push(lineBreak2 === "strict" ? NS : ID);
  424. }
  425. if (classType === SA) {
  426. return types.push(AL);
  427. }
  428. if (classType === AI) {
  429. return types.push(AL);
  430. }
  431. if (classType === XX) {
  432. if (codePoint >= 131072 && codePoint <= 196605 || codePoint >= 196608 && codePoint <= 262141) {
  433. return types.push(ID);
  434. } else {
  435. return types.push(AL);
  436. }
  437. }
  438. types.push(classType);
  439. });
  440. return [indicies, types, categories];
  441. };
  442. var isAdjacentWithSpaceIgnored = function(a2, b, currentIndex, classTypes) {
  443. var current = classTypes[currentIndex];
  444. if (Array.isArray(a2) ? a2.indexOf(current) !== -1 : a2 === current) {
  445. var i = currentIndex;
  446. while (i <= classTypes.length) {
  447. i++;
  448. var next = classTypes[i];
  449. if (next === b) {
  450. return true;
  451. }
  452. if (next !== SP) {
  453. break;
  454. }
  455. }
  456. }
  457. if (current === SP) {
  458. var i = currentIndex;
  459. while (i > 0) {
  460. i--;
  461. var prev = classTypes[i];
  462. if (Array.isArray(a2) ? a2.indexOf(prev) !== -1 : a2 === prev) {
  463. var n = currentIndex;
  464. while (n <= classTypes.length) {
  465. n++;
  466. var next = classTypes[n];
  467. if (next === b) {
  468. return true;
  469. }
  470. if (next !== SP) {
  471. break;
  472. }
  473. }
  474. }
  475. if (prev !== SP) {
  476. break;
  477. }
  478. }
  479. }
  480. return false;
  481. };
  482. var previousNonSpaceClassType = function(currentIndex, classTypes) {
  483. var i = currentIndex;
  484. while (i >= 0) {
  485. var type = classTypes[i];
  486. if (type === SP) {
  487. i--;
  488. } else {
  489. return type;
  490. }
  491. }
  492. return 0;
  493. };
  494. var _lineBreakAtIndex = function(codePoints, classTypes, indicies, index, forbiddenBreaks) {
  495. if (indicies[index] === 0) {
  496. return BREAK_NOT_ALLOWED;
  497. }
  498. var currentIndex = index - 1;
  499. if (Array.isArray(forbiddenBreaks) && forbiddenBreaks[currentIndex] === true) {
  500. return BREAK_NOT_ALLOWED;
  501. }
  502. var beforeIndex = currentIndex - 1;
  503. var afterIndex = currentIndex + 1;
  504. var current = classTypes[currentIndex];
  505. var before = beforeIndex >= 0 ? classTypes[beforeIndex] : 0;
  506. var next = classTypes[afterIndex];
  507. if (current === CR && next === LF) {
  508. return BREAK_NOT_ALLOWED;
  509. }
  510. if (HARD_LINE_BREAKS.indexOf(current) !== -1) {
  511. return BREAK_MANDATORY;
  512. }
  513. if (HARD_LINE_BREAKS.indexOf(next) !== -1) {
  514. return BREAK_NOT_ALLOWED;
  515. }
  516. if (SPACE.indexOf(next) !== -1) {
  517. return BREAK_NOT_ALLOWED;
  518. }
  519. if (previousNonSpaceClassType(currentIndex, classTypes) === ZW) {
  520. return BREAK_ALLOWED;
  521. }
  522. if (UnicodeTrie.get(codePoints[currentIndex]) === ZWJ && (next === ID || next === EB || next === EM)) {
  523. return BREAK_NOT_ALLOWED;
  524. }
  525. if (current === WJ || next === WJ) {
  526. return BREAK_NOT_ALLOWED;
  527. }
  528. if (current === GL) {
  529. return BREAK_NOT_ALLOWED;
  530. }
  531. if ([SP, BA, HY].indexOf(current) === -1 && next === GL) {
  532. return BREAK_NOT_ALLOWED;
  533. }
  534. if ([CL, CP, EX, IS, SY].indexOf(next) !== -1) {
  535. return BREAK_NOT_ALLOWED;
  536. }
  537. if (previousNonSpaceClassType(currentIndex, classTypes) === OP) {
  538. return BREAK_NOT_ALLOWED;
  539. }
  540. if (isAdjacentWithSpaceIgnored(QU, OP, currentIndex, classTypes)) {
  541. return BREAK_NOT_ALLOWED;
  542. }
  543. if (isAdjacentWithSpaceIgnored([CL, CP], NS, currentIndex, classTypes)) {
  544. return BREAK_NOT_ALLOWED;
  545. }
  546. if (isAdjacentWithSpaceIgnored(B2, B2, currentIndex, classTypes)) {
  547. return BREAK_NOT_ALLOWED;
  548. }
  549. if (current === SP) {
  550. return BREAK_ALLOWED;
  551. }
  552. if (current === QU || next === QU) {
  553. return BREAK_NOT_ALLOWED;
  554. }
  555. if (next === CB || current === CB) {
  556. return BREAK_ALLOWED;
  557. }
  558. if ([BA, HY, NS].indexOf(next) !== -1 || current === BB) {
  559. return BREAK_NOT_ALLOWED;
  560. }
  561. if (before === HL && HYPHEN.indexOf(current) !== -1) {
  562. return BREAK_NOT_ALLOWED;
  563. }
  564. if (current === SY && next === HL) {
  565. return BREAK_NOT_ALLOWED;
  566. }
  567. if (next === IN && ALPHABETICS.concat(IN, EX, NU, ID, EB, EM).indexOf(current) !== -1) {
  568. return BREAK_NOT_ALLOWED;
  569. }
  570. if (ALPHABETICS.indexOf(next) !== -1 && current === NU || ALPHABETICS.indexOf(current) !== -1 && next === NU) {
  571. return BREAK_NOT_ALLOWED;
  572. }
  573. if (current === PR && [ID, EB, EM].indexOf(next) !== -1 || [ID, EB, EM].indexOf(current) !== -1 && next === PO) {
  574. return BREAK_NOT_ALLOWED;
  575. }
  576. if (ALPHABETICS.indexOf(current) !== -1 && PREFIX_POSTFIX.indexOf(next) !== -1 || PREFIX_POSTFIX.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
  577. return BREAK_NOT_ALLOWED;
  578. }
  579. if (
  580. // (PR | PO) × ( OP | HY )? NU
  581. [PR, PO].indexOf(current) !== -1 && (next === NU || [OP, HY].indexOf(next) !== -1 && classTypes[afterIndex + 1] === NU) || // ( OP | HY ) × NU
  582. [OP, HY].indexOf(current) !== -1 && next === NU || // NU × (NU | SY | IS)
  583. current === NU && [NU, SY, IS].indexOf(next) !== -1
  584. ) {
  585. return BREAK_NOT_ALLOWED;
  586. }
  587. if ([NU, SY, IS, CL, CP].indexOf(next) !== -1) {
  588. var prevIndex = currentIndex;
  589. while (prevIndex >= 0) {
  590. var type = classTypes[prevIndex];
  591. if (type === NU) {
  592. return BREAK_NOT_ALLOWED;
  593. } else if ([SY, IS].indexOf(type) !== -1) {
  594. prevIndex--;
  595. } else {
  596. break;
  597. }
  598. }
  599. }
  600. if ([PR, PO].indexOf(next) !== -1) {
  601. var prevIndex = [CL, CP].indexOf(current) !== -1 ? beforeIndex : currentIndex;
  602. while (prevIndex >= 0) {
  603. var type = classTypes[prevIndex];
  604. if (type === NU) {
  605. return BREAK_NOT_ALLOWED;
  606. } else if ([SY, IS].indexOf(type) !== -1) {
  607. prevIndex--;
  608. } else {
  609. break;
  610. }
  611. }
  612. }
  613. if (JL === current && [JL, JV, H2, H3].indexOf(next) !== -1 || [JV, H2].indexOf(current) !== -1 && [JV, JT].indexOf(next) !== -1 || [JT, H3].indexOf(current) !== -1 && next === JT) {
  614. return BREAK_NOT_ALLOWED;
  615. }
  616. if (KOREAN_SYLLABLE_BLOCK.indexOf(current) !== -1 && [IN, PO].indexOf(next) !== -1 || KOREAN_SYLLABLE_BLOCK.indexOf(next) !== -1 && current === PR) {
  617. return BREAK_NOT_ALLOWED;
  618. }
  619. if (ALPHABETICS.indexOf(current) !== -1 && ALPHABETICS.indexOf(next) !== -1) {
  620. return BREAK_NOT_ALLOWED;
  621. }
  622. if (current === IS && ALPHABETICS.indexOf(next) !== -1) {
  623. return BREAK_NOT_ALLOWED;
  624. }
  625. if (ALPHABETICS.concat(NU).indexOf(current) !== -1 && next === OP || ALPHABETICS.concat(NU).indexOf(next) !== -1 && current === CP) {
  626. return BREAK_NOT_ALLOWED;
  627. }
  628. if (current === RI && next === RI) {
  629. var i = indicies[currentIndex];
  630. var count = 1;
  631. while (i > 0) {
  632. i--;
  633. if (classTypes[i] === RI) {
  634. count++;
  635. } else {
  636. break;
  637. }
  638. }
  639. if (count % 2 !== 0) {
  640. return BREAK_NOT_ALLOWED;
  641. }
  642. }
  643. if (current === EB && next === EM) {
  644. return BREAK_NOT_ALLOWED;
  645. }
  646. return BREAK_ALLOWED;
  647. };
  648. var cssFormattedClasses = function(codePoints, options) {
  649. if (!options) {
  650. options = { lineBreak: "normal", wordBreak: "normal" };
  651. }
  652. var _a = codePointsToCharacterClasses(codePoints, options.lineBreak), indicies = _a[0], classTypes = _a[1], isLetterNumber = _a[2];
  653. if (options.wordBreak === "break-all" || options.wordBreak === "break-word") {
  654. classTypes = classTypes.map(function(type) {
  655. return [NU, AL, SA].indexOf(type) !== -1 ? ID : type;
  656. });
  657. }
  658. var forbiddenBreakpoints = options.wordBreak === "keep-all" ? isLetterNumber.map(function(letterNumber, i) {
  659. return letterNumber && codePoints[i] >= 19968 && codePoints[i] <= 40959;
  660. }) : void 0;
  661. return [indicies, classTypes, forbiddenBreakpoints];
  662. };
  663. var Break = (
  664. /** @class */
  665. function() {
  666. function Break2(codePoints, lineBreak2, start, end) {
  667. this.codePoints = codePoints;
  668. this.required = lineBreak2 === BREAK_MANDATORY;
  669. this.start = start;
  670. this.end = end;
  671. }
  672. Break2.prototype.slice = function() {
  673. return fromCodePoint.apply(void 0, this.codePoints.slice(this.start, this.end));
  674. };
  675. return Break2;
  676. }()
  677. );
  678. var LineBreaker = function(str, options) {
  679. var codePoints = toCodePoints(str);
  680. var _a = cssFormattedClasses(codePoints, options), indicies = _a[0], classTypes = _a[1], forbiddenBreakpoints = _a[2];
  681. var length = codePoints.length;
  682. var lastEnd = 0;
  683. var nextIndex = 0;
  684. return {
  685. next: function() {
  686. if (nextIndex >= length) {
  687. return { done: true, value: null };
  688. }
  689. var lineBreak2 = BREAK_NOT_ALLOWED;
  690. while (nextIndex < length && (lineBreak2 = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === BREAK_NOT_ALLOWED) {
  691. }
  692. if (lineBreak2 !== BREAK_NOT_ALLOWED || nextIndex === length) {
  693. var value = new Break(codePoints, lineBreak2, lastEnd, nextIndex);
  694. lastEnd = nextIndex;
  695. return { value, done: false };
  696. }
  697. return { done: true, value: null };
  698. }
  699. };
  700. };
  701. var TokenType;
  702. (function(TokenType2) {
  703. TokenType2[TokenType2["STRING_TOKEN"] = 0] = "STRING_TOKEN";
  704. TokenType2[TokenType2["BAD_STRING_TOKEN"] = 1] = "BAD_STRING_TOKEN";
  705. TokenType2[TokenType2["LEFT_PARENTHESIS_TOKEN"] = 2] = "LEFT_PARENTHESIS_TOKEN";
  706. TokenType2[TokenType2["RIGHT_PARENTHESIS_TOKEN"] = 3] = "RIGHT_PARENTHESIS_TOKEN";
  707. TokenType2[TokenType2["COMMA_TOKEN"] = 4] = "COMMA_TOKEN";
  708. TokenType2[TokenType2["HASH_TOKEN"] = 5] = "HASH_TOKEN";
  709. TokenType2[TokenType2["DELIM_TOKEN"] = 6] = "DELIM_TOKEN";
  710. TokenType2[TokenType2["AT_KEYWORD_TOKEN"] = 7] = "AT_KEYWORD_TOKEN";
  711. TokenType2[TokenType2["PREFIX_MATCH_TOKEN"] = 8] = "PREFIX_MATCH_TOKEN";
  712. TokenType2[TokenType2["DASH_MATCH_TOKEN"] = 9] = "DASH_MATCH_TOKEN";
  713. TokenType2[TokenType2["INCLUDE_MATCH_TOKEN"] = 10] = "INCLUDE_MATCH_TOKEN";
  714. TokenType2[TokenType2["LEFT_CURLY_BRACKET_TOKEN"] = 11] = "LEFT_CURLY_BRACKET_TOKEN";
  715. TokenType2[TokenType2["RIGHT_CURLY_BRACKET_TOKEN"] = 12] = "RIGHT_CURLY_BRACKET_TOKEN";
  716. TokenType2[TokenType2["SUFFIX_MATCH_TOKEN"] = 13] = "SUFFIX_MATCH_TOKEN";
  717. TokenType2[TokenType2["SUBSTRING_MATCH_TOKEN"] = 14] = "SUBSTRING_MATCH_TOKEN";
  718. TokenType2[TokenType2["DIMENSION_TOKEN"] = 15] = "DIMENSION_TOKEN";
  719. TokenType2[TokenType2["PERCENTAGE_TOKEN"] = 16] = "PERCENTAGE_TOKEN";
  720. TokenType2[TokenType2["NUMBER_TOKEN"] = 17] = "NUMBER_TOKEN";
  721. TokenType2[TokenType2["FUNCTION"] = 18] = "FUNCTION";
  722. TokenType2[TokenType2["FUNCTION_TOKEN"] = 19] = "FUNCTION_TOKEN";
  723. TokenType2[TokenType2["IDENT_TOKEN"] = 20] = "IDENT_TOKEN";
  724. TokenType2[TokenType2["COLUMN_TOKEN"] = 21] = "COLUMN_TOKEN";
  725. TokenType2[TokenType2["URL_TOKEN"] = 22] = "URL_TOKEN";
  726. TokenType2[TokenType2["BAD_URL_TOKEN"] = 23] = "BAD_URL_TOKEN";
  727. TokenType2[TokenType2["CDC_TOKEN"] = 24] = "CDC_TOKEN";
  728. TokenType2[TokenType2["CDO_TOKEN"] = 25] = "CDO_TOKEN";
  729. TokenType2[TokenType2["COLON_TOKEN"] = 26] = "COLON_TOKEN";
  730. TokenType2[TokenType2["SEMICOLON_TOKEN"] = 27] = "SEMICOLON_TOKEN";
  731. TokenType2[TokenType2["LEFT_SQUARE_BRACKET_TOKEN"] = 28] = "LEFT_SQUARE_BRACKET_TOKEN";
  732. TokenType2[TokenType2["RIGHT_SQUARE_BRACKET_TOKEN"] = 29] = "RIGHT_SQUARE_BRACKET_TOKEN";
  733. TokenType2[TokenType2["UNICODE_RANGE_TOKEN"] = 30] = "UNICODE_RANGE_TOKEN";
  734. TokenType2[TokenType2["WHITESPACE_TOKEN"] = 31] = "WHITESPACE_TOKEN";
  735. TokenType2[TokenType2["EOF_TOKEN"] = 32] = "EOF_TOKEN";
  736. })(TokenType || (TokenType = {}));
  737. var FLAG_UNRESTRICTED = 1 << 0;
  738. var FLAG_ID = 1 << 1;
  739. var FLAG_INTEGER = 1 << 2;
  740. var FLAG_NUMBER = 1 << 3;
  741. var LINE_FEED = 10;
  742. var SOLIDUS = 47;
  743. var REVERSE_SOLIDUS = 92;
  744. var CHARACTER_TABULATION = 9;
  745. var SPACE$1 = 32;
  746. var QUOTATION_MARK = 34;
  747. var EQUALS_SIGN = 61;
  748. var NUMBER_SIGN = 35;
  749. var DOLLAR_SIGN = 36;
  750. var PERCENTAGE_SIGN = 37;
  751. var APOSTROPHE = 39;
  752. var LEFT_PARENTHESIS = 40;
  753. var RIGHT_PARENTHESIS = 41;
  754. var LOW_LINE = 95;
  755. var HYPHEN_MINUS = 45;
  756. var EXCLAMATION_MARK = 33;
  757. var LESS_THAN_SIGN = 60;
  758. var GREATER_THAN_SIGN = 62;
  759. var COMMERCIAL_AT = 64;
  760. var LEFT_SQUARE_BRACKET = 91;
  761. var RIGHT_SQUARE_BRACKET = 93;
  762. var CIRCUMFLEX_ACCENT = 61;
  763. var LEFT_CURLY_BRACKET = 123;
  764. var QUESTION_MARK = 63;
  765. var RIGHT_CURLY_BRACKET = 125;
  766. var VERTICAL_LINE = 124;
  767. var TILDE = 126;
  768. var CONTROL = 128;
  769. var REPLACEMENT_CHARACTER = 65533;
  770. var ASTERISK = 42;
  771. var PLUS_SIGN = 43;
  772. var COMMA = 44;
  773. var COLON = 58;
  774. var SEMICOLON = 59;
  775. var FULL_STOP = 46;
  776. var NULL = 0;
  777. var BACKSPACE = 8;
  778. var LINE_TABULATION = 11;
  779. var SHIFT_OUT = 14;
  780. var INFORMATION_SEPARATOR_ONE = 31;
  781. var DELETE = 127;
  782. var EOF = -1;
  783. var ZERO = 48;
  784. var a = 97;
  785. var e = 101;
  786. var f = 102;
  787. var u = 117;
  788. var z = 122;
  789. var A = 65;
  790. var E = 69;
  791. var F = 70;
  792. var U = 85;
  793. var Z = 90;
  794. var isDigit = function(codePoint) {
  795. return codePoint >= ZERO && codePoint <= 57;
  796. };
  797. var isSurrogateCodePoint = function(codePoint) {
  798. return codePoint >= 55296 && codePoint <= 57343;
  799. };
  800. var isHex = function(codePoint) {
  801. return isDigit(codePoint) || codePoint >= A && codePoint <= F || codePoint >= a && codePoint <= f;
  802. };
  803. var isLowerCaseLetter = function(codePoint) {
  804. return codePoint >= a && codePoint <= z;
  805. };
  806. var isUpperCaseLetter = function(codePoint) {
  807. return codePoint >= A && codePoint <= Z;
  808. };
  809. var isLetter = function(codePoint) {
  810. return isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint);
  811. };
  812. var isNonASCIICodePoint = function(codePoint) {
  813. return codePoint >= CONTROL;
  814. };
  815. var isWhiteSpace = function(codePoint) {
  816. return codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE$1;
  817. };
  818. var isNameStartCodePoint = function(codePoint) {
  819. return isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
  820. };
  821. var isNameCodePoint = function(codePoint) {
  822. return isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
  823. };
  824. var isNonPrintableCodePoint = function(codePoint) {
  825. return codePoint >= NULL && codePoint <= BACKSPACE || codePoint === LINE_TABULATION || codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE || codePoint === DELETE;
  826. };
  827. var isValidEscape = function(c1, c2) {
  828. if (c1 !== REVERSE_SOLIDUS) {
  829. return false;
  830. }
  831. return c2 !== LINE_FEED;
  832. };
  833. var isIdentifierStart = function(c1, c2, c3) {
  834. if (c1 === HYPHEN_MINUS) {
  835. return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
  836. } else if (isNameStartCodePoint(c1)) {
  837. return true;
  838. } else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
  839. return true;
  840. }
  841. return false;
  842. };
  843. var isNumberStart = function(c1, c2, c3) {
  844. if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
  845. if (isDigit(c2)) {
  846. return true;
  847. }
  848. return c2 === FULL_STOP && isDigit(c3);
  849. }
  850. if (c1 === FULL_STOP) {
  851. return isDigit(c2);
  852. }
  853. return isDigit(c1);
  854. };
  855. var stringToNumber = function(codePoints) {
  856. var c = 0;
  857. var sign = 1;
  858. if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
  859. if (codePoints[c] === HYPHEN_MINUS) {
  860. sign = -1;
  861. }
  862. c++;
  863. }
  864. var integers = [];
  865. while (isDigit(codePoints[c])) {
  866. integers.push(codePoints[c++]);
  867. }
  868. var int = integers.length ? parseInt(fromCodePoint.apply(void 0, integers), 10) : 0;
  869. if (codePoints[c] === FULL_STOP) {
  870. c++;
  871. }
  872. var fraction = [];
  873. while (isDigit(codePoints[c])) {
  874. fraction.push(codePoints[c++]);
  875. }
  876. var fracd = fraction.length;
  877. var frac = fracd ? parseInt(fromCodePoint.apply(void 0, fraction), 10) : 0;
  878. if (codePoints[c] === E || codePoints[c] === e) {
  879. c++;
  880. }
  881. var expsign = 1;
  882. if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
  883. if (codePoints[c] === HYPHEN_MINUS) {
  884. expsign = -1;
  885. }
  886. c++;
  887. }
  888. var exponent = [];
  889. while (isDigit(codePoints[c])) {
  890. exponent.push(codePoints[c++]);
  891. }
  892. var exp = exponent.length ? parseInt(fromCodePoint.apply(void 0, exponent), 10) : 0;
  893. return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
  894. };
  895. var LEFT_PARENTHESIS_TOKEN = {
  896. type: TokenType.LEFT_PARENTHESIS_TOKEN
  897. };
  898. var RIGHT_PARENTHESIS_TOKEN = {
  899. type: TokenType.RIGHT_PARENTHESIS_TOKEN
  900. };
  901. var COMMA_TOKEN = { type: TokenType.COMMA_TOKEN };
  902. var SUFFIX_MATCH_TOKEN = { type: TokenType.SUFFIX_MATCH_TOKEN };
  903. var PREFIX_MATCH_TOKEN = { type: TokenType.PREFIX_MATCH_TOKEN };
  904. var COLUMN_TOKEN = { type: TokenType.COLUMN_TOKEN };
  905. var DASH_MATCH_TOKEN = { type: TokenType.DASH_MATCH_TOKEN };
  906. var INCLUDE_MATCH_TOKEN = { type: TokenType.INCLUDE_MATCH_TOKEN };
  907. var LEFT_CURLY_BRACKET_TOKEN = {
  908. type: TokenType.LEFT_CURLY_BRACKET_TOKEN
  909. };
  910. var RIGHT_CURLY_BRACKET_TOKEN = {
  911. type: TokenType.RIGHT_CURLY_BRACKET_TOKEN
  912. };
  913. var SUBSTRING_MATCH_TOKEN = { type: TokenType.SUBSTRING_MATCH_TOKEN };
  914. var BAD_URL_TOKEN = { type: TokenType.BAD_URL_TOKEN };
  915. var BAD_STRING_TOKEN = { type: TokenType.BAD_STRING_TOKEN };
  916. var CDO_TOKEN = { type: TokenType.CDO_TOKEN };
  917. var CDC_TOKEN = { type: TokenType.CDC_TOKEN };
  918. var COLON_TOKEN = { type: TokenType.COLON_TOKEN };
  919. var SEMICOLON_TOKEN = { type: TokenType.SEMICOLON_TOKEN };
  920. var LEFT_SQUARE_BRACKET_TOKEN = {
  921. type: TokenType.LEFT_SQUARE_BRACKET_TOKEN
  922. };
  923. var RIGHT_SQUARE_BRACKET_TOKEN = {
  924. type: TokenType.RIGHT_SQUARE_BRACKET_TOKEN
  925. };
  926. var WHITESPACE_TOKEN = { type: TokenType.WHITESPACE_TOKEN };
  927. var EOF_TOKEN = { type: TokenType.EOF_TOKEN };
  928. var Tokenizer = (
  929. /** @class */
  930. function() {
  931. function Tokenizer2() {
  932. this._value = [];
  933. }
  934. Tokenizer2.prototype.write = function(chunk) {
  935. this._value = this._value.concat(toCodePoints(chunk));
  936. };
  937. Tokenizer2.prototype.read = function() {
  938. var tokens = [];
  939. var token = this.consumeToken();
  940. while (token !== EOF_TOKEN) {
  941. tokens.push(token);
  942. token = this.consumeToken();
  943. }
  944. return tokens;
  945. };
  946. Tokenizer2.prototype.consumeToken = function() {
  947. var codePoint = this.consumeCodePoint();
  948. switch (codePoint) {
  949. case QUOTATION_MARK:
  950. return this.consumeStringToken(QUOTATION_MARK);
  951. case NUMBER_SIGN:
  952. var c1 = this.peekCodePoint(0);
  953. var c2 = this.peekCodePoint(1);
  954. var c3 = this.peekCodePoint(2);
  955. if (isNameCodePoint(c1) || isValidEscape(c2, c3)) {
  956. var flags = isIdentifierStart(c1, c2, c3) ? FLAG_ID : FLAG_UNRESTRICTED;
  957. var value = this.consumeName();
  958. return { type: TokenType.HASH_TOKEN, value, flags };
  959. }
  960. break;
  961. case DOLLAR_SIGN:
  962. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  963. this.consumeCodePoint();
  964. return SUFFIX_MATCH_TOKEN;
  965. }
  966. break;
  967. case APOSTROPHE:
  968. return this.consumeStringToken(APOSTROPHE);
  969. case LEFT_PARENTHESIS:
  970. return LEFT_PARENTHESIS_TOKEN;
  971. case RIGHT_PARENTHESIS:
  972. return RIGHT_PARENTHESIS_TOKEN;
  973. case ASTERISK:
  974. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  975. this.consumeCodePoint();
  976. return SUBSTRING_MATCH_TOKEN;
  977. }
  978. break;
  979. case PLUS_SIGN:
  980. if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
  981. this.reconsumeCodePoint(codePoint);
  982. return this.consumeNumericToken();
  983. }
  984. break;
  985. case COMMA:
  986. return COMMA_TOKEN;
  987. case HYPHEN_MINUS:
  988. var e1 = codePoint;
  989. var e2 = this.peekCodePoint(0);
  990. var e3 = this.peekCodePoint(1);
  991. if (isNumberStart(e1, e2, e3)) {
  992. this.reconsumeCodePoint(codePoint);
  993. return this.consumeNumericToken();
  994. }
  995. if (isIdentifierStart(e1, e2, e3)) {
  996. this.reconsumeCodePoint(codePoint);
  997. return this.consumeIdentLikeToken();
  998. }
  999. if (e2 === HYPHEN_MINUS && e3 === GREATER_THAN_SIGN) {
  1000. this.consumeCodePoint();
  1001. this.consumeCodePoint();
  1002. return CDC_TOKEN;
  1003. }
  1004. break;
  1005. case FULL_STOP:
  1006. if (isNumberStart(codePoint, this.peekCodePoint(0), this.peekCodePoint(1))) {
  1007. this.reconsumeCodePoint(codePoint);
  1008. return this.consumeNumericToken();
  1009. }
  1010. break;
  1011. case SOLIDUS:
  1012. if (this.peekCodePoint(0) === ASTERISK) {
  1013. this.consumeCodePoint();
  1014. while (true) {
  1015. var c = this.consumeCodePoint();
  1016. if (c === ASTERISK) {
  1017. c = this.consumeCodePoint();
  1018. if (c === SOLIDUS) {
  1019. return this.consumeToken();
  1020. }
  1021. }
  1022. if (c === EOF) {
  1023. return this.consumeToken();
  1024. }
  1025. }
  1026. }
  1027. break;
  1028. case COLON:
  1029. return COLON_TOKEN;
  1030. case SEMICOLON:
  1031. return SEMICOLON_TOKEN;
  1032. case LESS_THAN_SIGN:
  1033. if (this.peekCodePoint(0) === EXCLAMATION_MARK && this.peekCodePoint(1) === HYPHEN_MINUS && this.peekCodePoint(2) === HYPHEN_MINUS) {
  1034. this.consumeCodePoint();
  1035. this.consumeCodePoint();
  1036. return CDO_TOKEN;
  1037. }
  1038. break;
  1039. case COMMERCIAL_AT:
  1040. var a1 = this.peekCodePoint(0);
  1041. var a2 = this.peekCodePoint(1);
  1042. var a3 = this.peekCodePoint(2);
  1043. if (isIdentifierStart(a1, a2, a3)) {
  1044. var value = this.consumeName();
  1045. return { type: TokenType.AT_KEYWORD_TOKEN, value };
  1046. }
  1047. break;
  1048. case LEFT_SQUARE_BRACKET:
  1049. return LEFT_SQUARE_BRACKET_TOKEN;
  1050. case REVERSE_SOLIDUS:
  1051. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  1052. this.reconsumeCodePoint(codePoint);
  1053. return this.consumeIdentLikeToken();
  1054. }
  1055. break;
  1056. case RIGHT_SQUARE_BRACKET:
  1057. return RIGHT_SQUARE_BRACKET_TOKEN;
  1058. case CIRCUMFLEX_ACCENT:
  1059. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  1060. this.consumeCodePoint();
  1061. return PREFIX_MATCH_TOKEN;
  1062. }
  1063. break;
  1064. case LEFT_CURLY_BRACKET:
  1065. return LEFT_CURLY_BRACKET_TOKEN;
  1066. case RIGHT_CURLY_BRACKET:
  1067. return RIGHT_CURLY_BRACKET_TOKEN;
  1068. case u:
  1069. case U:
  1070. var u1 = this.peekCodePoint(0);
  1071. var u2 = this.peekCodePoint(1);
  1072. if (u1 === PLUS_SIGN && (isHex(u2) || u2 === QUESTION_MARK)) {
  1073. this.consumeCodePoint();
  1074. this.consumeUnicodeRangeToken();
  1075. }
  1076. this.reconsumeCodePoint(codePoint);
  1077. return this.consumeIdentLikeToken();
  1078. case VERTICAL_LINE:
  1079. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  1080. this.consumeCodePoint();
  1081. return DASH_MATCH_TOKEN;
  1082. }
  1083. if (this.peekCodePoint(0) === VERTICAL_LINE) {
  1084. this.consumeCodePoint();
  1085. return COLUMN_TOKEN;
  1086. }
  1087. break;
  1088. case TILDE:
  1089. if (this.peekCodePoint(0) === EQUALS_SIGN) {
  1090. this.consumeCodePoint();
  1091. return INCLUDE_MATCH_TOKEN;
  1092. }
  1093. break;
  1094. case EOF:
  1095. return EOF_TOKEN;
  1096. }
  1097. if (isWhiteSpace(codePoint)) {
  1098. this.consumeWhiteSpace();
  1099. return WHITESPACE_TOKEN;
  1100. }
  1101. if (isDigit(codePoint)) {
  1102. this.reconsumeCodePoint(codePoint);
  1103. return this.consumeNumericToken();
  1104. }
  1105. if (isNameStartCodePoint(codePoint)) {
  1106. this.reconsumeCodePoint(codePoint);
  1107. return this.consumeIdentLikeToken();
  1108. }
  1109. return { type: TokenType.DELIM_TOKEN, value: fromCodePoint(codePoint) };
  1110. };
  1111. Tokenizer2.prototype.consumeCodePoint = function() {
  1112. var value = this._value.shift();
  1113. return typeof value === "undefined" ? -1 : value;
  1114. };
  1115. Tokenizer2.prototype.reconsumeCodePoint = function(codePoint) {
  1116. this._value.unshift(codePoint);
  1117. };
  1118. Tokenizer2.prototype.peekCodePoint = function(delta) {
  1119. if (delta >= this._value.length) {
  1120. return -1;
  1121. }
  1122. return this._value[delta];
  1123. };
  1124. Tokenizer2.prototype.consumeUnicodeRangeToken = function() {
  1125. var digits = [];
  1126. var codePoint = this.consumeCodePoint();
  1127. while (isHex(codePoint) && digits.length < 6) {
  1128. digits.push(codePoint);
  1129. codePoint = this.consumeCodePoint();
  1130. }
  1131. var questionMarks = false;
  1132. while (codePoint === QUESTION_MARK && digits.length < 6) {
  1133. digits.push(codePoint);
  1134. codePoint = this.consumeCodePoint();
  1135. questionMarks = true;
  1136. }
  1137. if (questionMarks) {
  1138. var start_1 = parseInt(fromCodePoint.apply(void 0, digits.map(function(digit) {
  1139. return digit === QUESTION_MARK ? ZERO : digit;
  1140. })), 16);
  1141. var end = parseInt(fromCodePoint.apply(void 0, digits.map(function(digit) {
  1142. return digit === QUESTION_MARK ? F : digit;
  1143. })), 16);
  1144. return { type: TokenType.UNICODE_RANGE_TOKEN, start: start_1, end };
  1145. }
  1146. var start = parseInt(fromCodePoint.apply(void 0, digits), 16);
  1147. if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) {
  1148. this.consumeCodePoint();
  1149. codePoint = this.consumeCodePoint();
  1150. var endDigits = [];
  1151. while (isHex(codePoint) && endDigits.length < 6) {
  1152. endDigits.push(codePoint);
  1153. codePoint = this.consumeCodePoint();
  1154. }
  1155. var end = parseInt(fromCodePoint.apply(void 0, endDigits), 16);
  1156. return { type: TokenType.UNICODE_RANGE_TOKEN, start, end };
  1157. } else {
  1158. return { type: TokenType.UNICODE_RANGE_TOKEN, start, end: start };
  1159. }
  1160. };
  1161. Tokenizer2.prototype.consumeIdentLikeToken = function() {
  1162. var value = this.consumeName();
  1163. if (value.toLowerCase() === "url" && this.peekCodePoint(0) === LEFT_PARENTHESIS) {
  1164. this.consumeCodePoint();
  1165. return this.consumeUrlToken();
  1166. } else if (this.peekCodePoint(0) === LEFT_PARENTHESIS) {
  1167. this.consumeCodePoint();
  1168. return { type: TokenType.FUNCTION_TOKEN, value };
  1169. }
  1170. return { type: TokenType.IDENT_TOKEN, value };
  1171. };
  1172. Tokenizer2.prototype.consumeUrlToken = function() {
  1173. var value = [];
  1174. this.consumeWhiteSpace();
  1175. if (this.peekCodePoint(0) === EOF) {
  1176. return { type: TokenType.URL_TOKEN, value: "" };
  1177. }
  1178. var next = this.peekCodePoint(0);
  1179. if (next === APOSTROPHE || next === QUOTATION_MARK) {
  1180. var stringToken = this.consumeStringToken(this.consumeCodePoint());
  1181. if (stringToken.type === TokenType.STRING_TOKEN) {
  1182. this.consumeWhiteSpace();
  1183. if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
  1184. this.consumeCodePoint();
  1185. return { type: TokenType.URL_TOKEN, value: stringToken.value };
  1186. }
  1187. }
  1188. this.consumeBadUrlRemnants();
  1189. return BAD_URL_TOKEN;
  1190. }
  1191. while (true) {
  1192. var codePoint = this.consumeCodePoint();
  1193. if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
  1194. return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) };
  1195. } else if (isWhiteSpace(codePoint)) {
  1196. this.consumeWhiteSpace();
  1197. if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
  1198. this.consumeCodePoint();
  1199. return { type: TokenType.URL_TOKEN, value: fromCodePoint.apply(void 0, value) };
  1200. }
  1201. this.consumeBadUrlRemnants();
  1202. return BAD_URL_TOKEN;
  1203. } else if (codePoint === QUOTATION_MARK || codePoint === APOSTROPHE || codePoint === LEFT_PARENTHESIS || isNonPrintableCodePoint(codePoint)) {
  1204. this.consumeBadUrlRemnants();
  1205. return BAD_URL_TOKEN;
  1206. } else if (codePoint === REVERSE_SOLIDUS) {
  1207. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  1208. value.push(this.consumeEscapedCodePoint());
  1209. } else {
  1210. this.consumeBadUrlRemnants();
  1211. return BAD_URL_TOKEN;
  1212. }
  1213. } else {
  1214. value.push(codePoint);
  1215. }
  1216. }
  1217. };
  1218. Tokenizer2.prototype.consumeWhiteSpace = function() {
  1219. while (isWhiteSpace(this.peekCodePoint(0))) {
  1220. this.consumeCodePoint();
  1221. }
  1222. };
  1223. Tokenizer2.prototype.consumeBadUrlRemnants = function() {
  1224. while (true) {
  1225. var codePoint = this.consumeCodePoint();
  1226. if (codePoint === RIGHT_PARENTHESIS || codePoint === EOF) {
  1227. return;
  1228. }
  1229. if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  1230. this.consumeEscapedCodePoint();
  1231. }
  1232. }
  1233. };
  1234. Tokenizer2.prototype.consumeStringSlice = function(count) {
  1235. var SLICE_STACK_SIZE = 6e4;
  1236. var value = "";
  1237. while (count > 0) {
  1238. var amount = Math.min(SLICE_STACK_SIZE, count);
  1239. value += fromCodePoint.apply(void 0, this._value.splice(0, amount));
  1240. count -= amount;
  1241. }
  1242. this._value.shift();
  1243. return value;
  1244. };
  1245. Tokenizer2.prototype.consumeStringToken = function(endingCodePoint) {
  1246. var value = "";
  1247. var i = 0;
  1248. do {
  1249. var codePoint = this._value[i];
  1250. if (codePoint === EOF || codePoint === void 0 || codePoint === endingCodePoint) {
  1251. value += this.consumeStringSlice(i);
  1252. return { type: TokenType.STRING_TOKEN, value };
  1253. }
  1254. if (codePoint === LINE_FEED) {
  1255. this._value.splice(0, i);
  1256. return BAD_STRING_TOKEN;
  1257. }
  1258. if (codePoint === REVERSE_SOLIDUS) {
  1259. var next = this._value[i + 1];
  1260. if (next !== EOF && next !== void 0) {
  1261. if (next === LINE_FEED) {
  1262. value += this.consumeStringSlice(i);
  1263. i = -1;
  1264. this._value.shift();
  1265. } else if (isValidEscape(codePoint, next)) {
  1266. value += this.consumeStringSlice(i);
  1267. value += fromCodePoint(this.consumeEscapedCodePoint());
  1268. i = -1;
  1269. }
  1270. }
  1271. }
  1272. i++;
  1273. } while (true);
  1274. };
  1275. Tokenizer2.prototype.consumeNumber = function() {
  1276. var repr = [];
  1277. var type = FLAG_INTEGER;
  1278. var c1 = this.peekCodePoint(0);
  1279. if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
  1280. repr.push(this.consumeCodePoint());
  1281. }
  1282. while (isDigit(this.peekCodePoint(0))) {
  1283. repr.push(this.consumeCodePoint());
  1284. }
  1285. c1 = this.peekCodePoint(0);
  1286. var c2 = this.peekCodePoint(1);
  1287. if (c1 === FULL_STOP && isDigit(c2)) {
  1288. repr.push(this.consumeCodePoint(), this.consumeCodePoint());
  1289. type = FLAG_NUMBER;
  1290. while (isDigit(this.peekCodePoint(0))) {
  1291. repr.push(this.consumeCodePoint());
  1292. }
  1293. }
  1294. c1 = this.peekCodePoint(0);
  1295. c2 = this.peekCodePoint(1);
  1296. var c3 = this.peekCodePoint(2);
  1297. if ((c1 === E || c1 === e) && ((c2 === PLUS_SIGN || c2 === HYPHEN_MINUS) && isDigit(c3) || isDigit(c2))) {
  1298. repr.push(this.consumeCodePoint(), this.consumeCodePoint());
  1299. type = FLAG_NUMBER;
  1300. while (isDigit(this.peekCodePoint(0))) {
  1301. repr.push(this.consumeCodePoint());
  1302. }
  1303. }
  1304. return [stringToNumber(repr), type];
  1305. };
  1306. Tokenizer2.prototype.consumeNumericToken = function() {
  1307. var _a = this.consumeNumber(), number = _a[0], flags = _a[1];
  1308. var c1 = this.peekCodePoint(0);
  1309. var c2 = this.peekCodePoint(1);
  1310. var c3 = this.peekCodePoint(2);
  1311. if (isIdentifierStart(c1, c2, c3)) {
  1312. var unit = this.consumeName();
  1313. return { type: TokenType.DIMENSION_TOKEN, number, flags, unit };
  1314. }
  1315. if (c1 === PERCENTAGE_SIGN) {
  1316. this.consumeCodePoint();
  1317. return { type: TokenType.PERCENTAGE_TOKEN, number, flags };
  1318. }
  1319. return { type: TokenType.NUMBER_TOKEN, number, flags };
  1320. };
  1321. Tokenizer2.prototype.consumeEscapedCodePoint = function() {
  1322. var codePoint = this.consumeCodePoint();
  1323. if (isHex(codePoint)) {
  1324. var hex = fromCodePoint(codePoint);
  1325. while (isHex(this.peekCodePoint(0)) && hex.length < 6) {
  1326. hex += fromCodePoint(this.consumeCodePoint());
  1327. }
  1328. if (isWhiteSpace(this.peekCodePoint(0))) {
  1329. this.consumeCodePoint();
  1330. }
  1331. var hexCodePoint = parseInt(hex, 16);
  1332. if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 1114111) {
  1333. return REPLACEMENT_CHARACTER;
  1334. }
  1335. return hexCodePoint;
  1336. }
  1337. if (codePoint === EOF) {
  1338. return REPLACEMENT_CHARACTER;
  1339. }
  1340. return codePoint;
  1341. };
  1342. Tokenizer2.prototype.consumeName = function() {
  1343. var result = "";
  1344. while (true) {
  1345. var codePoint = this.consumeCodePoint();
  1346. if (isNameCodePoint(codePoint)) {
  1347. result += fromCodePoint(codePoint);
  1348. } else if (isValidEscape(codePoint, this.peekCodePoint(0))) {
  1349. result += fromCodePoint(this.consumeEscapedCodePoint());
  1350. } else {
  1351. this.reconsumeCodePoint(codePoint);
  1352. return result;
  1353. }
  1354. }
  1355. };
  1356. return Tokenizer2;
  1357. }()
  1358. );
  1359. var Parser = (
  1360. /** @class */
  1361. function() {
  1362. function Parser2(tokens) {
  1363. this._tokens = tokens;
  1364. }
  1365. Parser2.create = function(value) {
  1366. var tokenizer = new Tokenizer();
  1367. tokenizer.write(value);
  1368. return new Parser2(tokenizer.read());
  1369. };
  1370. Parser2.parseValue = function(value) {
  1371. return Parser2.create(value).parseComponentValue();
  1372. };
  1373. Parser2.parseValues = function(value) {
  1374. return Parser2.create(value).parseComponentValues();
  1375. };
  1376. Parser2.prototype.parseComponentValue = function() {
  1377. var token = this.consumeToken();
  1378. while (token.type === TokenType.WHITESPACE_TOKEN) {
  1379. token = this.consumeToken();
  1380. }
  1381. if (token.type === TokenType.EOF_TOKEN) {
  1382. throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
  1383. }
  1384. this.reconsumeToken(token);
  1385. var value = this.consumeComponentValue();
  1386. do {
  1387. token = this.consumeToken();
  1388. } while (token.type === TokenType.WHITESPACE_TOKEN);
  1389. if (token.type === TokenType.EOF_TOKEN) {
  1390. return value;
  1391. }
  1392. throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
  1393. };
  1394. Parser2.prototype.parseComponentValues = function() {
  1395. var values = [];
  1396. while (true) {
  1397. var value = this.consumeComponentValue();
  1398. if (value.type === TokenType.EOF_TOKEN) {
  1399. return values;
  1400. }
  1401. values.push(value);
  1402. values.push();
  1403. }
  1404. };
  1405. Parser2.prototype.consumeComponentValue = function() {
  1406. var token = this.consumeToken();
  1407. switch (token.type) {
  1408. case TokenType.LEFT_CURLY_BRACKET_TOKEN:
  1409. case TokenType.LEFT_SQUARE_BRACKET_TOKEN:
  1410. case TokenType.LEFT_PARENTHESIS_TOKEN:
  1411. return this.consumeSimpleBlock(token.type);
  1412. case TokenType.FUNCTION_TOKEN:
  1413. return this.consumeFunction(token);
  1414. }
  1415. return token;
  1416. };
  1417. Parser2.prototype.consumeSimpleBlock = function(type) {
  1418. var block = { type, values: [] };
  1419. var token = this.consumeToken();
  1420. while (true) {
  1421. if (token.type === TokenType.EOF_TOKEN || isEndingTokenFor(token, type)) {
  1422. return block;
  1423. }
  1424. this.reconsumeToken(token);
  1425. block.values.push(this.consumeComponentValue());
  1426. token = this.consumeToken();
  1427. }
  1428. };
  1429. Parser2.prototype.consumeFunction = function(functionToken) {
  1430. var cssFunction = {
  1431. name: functionToken.value,
  1432. values: [],
  1433. type: TokenType.FUNCTION
  1434. };
  1435. while (true) {
  1436. var token = this.consumeToken();
  1437. if (token.type === TokenType.EOF_TOKEN || token.type === TokenType.RIGHT_PARENTHESIS_TOKEN) {
  1438. return cssFunction;
  1439. }
  1440. this.reconsumeToken(token);
  1441. cssFunction.values.push(this.consumeComponentValue());
  1442. }
  1443. };
  1444. Parser2.prototype.consumeToken = function() {
  1445. var token = this._tokens.shift();
  1446. return typeof token === "undefined" ? EOF_TOKEN : token;
  1447. };
  1448. Parser2.prototype.reconsumeToken = function(token) {
  1449. this._tokens.unshift(token);
  1450. };
  1451. return Parser2;
  1452. }()
  1453. );
  1454. var isDimensionToken = function(token) {
  1455. return token.type === TokenType.DIMENSION_TOKEN;
  1456. };
  1457. var isNumberToken = function(token) {
  1458. return token.type === TokenType.NUMBER_TOKEN;
  1459. };
  1460. var isIdentToken = function(token) {
  1461. return token.type === TokenType.IDENT_TOKEN;
  1462. };
  1463. var isStringToken = function(token) {
  1464. return token.type === TokenType.STRING_TOKEN;
  1465. };
  1466. var isIdentWithValue = function(token, value) {
  1467. return isIdentToken(token) && token.value === value;
  1468. };
  1469. var nonWhiteSpace = function(token) {
  1470. return token.type !== TokenType.WHITESPACE_TOKEN;
  1471. };
  1472. var nonFunctionArgSeparator = function(token) {
  1473. return token.type !== TokenType.WHITESPACE_TOKEN && token.type !== TokenType.COMMA_TOKEN;
  1474. };
  1475. var parseFunctionArgs = function(tokens) {
  1476. var args = [];
  1477. var arg = [];
  1478. tokens.forEach(function(token) {
  1479. if (token.type === TokenType.COMMA_TOKEN) {
  1480. if (arg.length === 0) {
  1481. throw new Error("Error parsing function args, zero tokens for arg");
  1482. }
  1483. args.push(arg);
  1484. arg = [];
  1485. return;
  1486. }
  1487. if (token.type !== TokenType.WHITESPACE_TOKEN) {
  1488. arg.push(token);
  1489. }
  1490. });
  1491. if (arg.length) {
  1492. args.push(arg);
  1493. }
  1494. return args;
  1495. };
  1496. var isEndingTokenFor = function(token, type) {
  1497. if (type === TokenType.LEFT_CURLY_BRACKET_TOKEN && token.type === TokenType.RIGHT_CURLY_BRACKET_TOKEN) {
  1498. return true;
  1499. }
  1500. if (type === TokenType.LEFT_SQUARE_BRACKET_TOKEN && token.type === TokenType.RIGHT_SQUARE_BRACKET_TOKEN) {
  1501. return true;
  1502. }
  1503. return type === TokenType.LEFT_PARENTHESIS_TOKEN && token.type === TokenType.RIGHT_PARENTHESIS_TOKEN;
  1504. };
  1505. var isLength = function(token) {
  1506. return token.type === TokenType.NUMBER_TOKEN || token.type === TokenType.DIMENSION_TOKEN;
  1507. };
  1508. var isLengthPercentage = function(token) {
  1509. return token.type === TokenType.PERCENTAGE_TOKEN || isLength(token);
  1510. };
  1511. var parseLengthPercentageTuple = function(tokens) {
  1512. return tokens.length > 1 ? [tokens[0], tokens[1]] : [tokens[0]];
  1513. };
  1514. var ZERO_LENGTH = {
  1515. type: TokenType.NUMBER_TOKEN,
  1516. number: 0,
  1517. flags: FLAG_INTEGER
  1518. };
  1519. var FIFTY_PERCENT = {
  1520. type: TokenType.PERCENTAGE_TOKEN,
  1521. number: 50,
  1522. flags: FLAG_INTEGER
  1523. };
  1524. var HUNDRED_PERCENT = {
  1525. type: TokenType.PERCENTAGE_TOKEN,
  1526. number: 100,
  1527. flags: FLAG_INTEGER
  1528. };
  1529. var getAbsoluteValueForTuple = function(tuple, width, height) {
  1530. var x = tuple[0], y = tuple[1];
  1531. return [getAbsoluteValue(x, width), getAbsoluteValue(typeof y !== "undefined" ? y : x, height)];
  1532. };
  1533. var getAbsoluteValue = function(token, parent) {
  1534. if (token.type === TokenType.PERCENTAGE_TOKEN) {
  1535. return token.number / 100 * parent;
  1536. }
  1537. if (isDimensionToken(token)) {
  1538. switch (token.unit) {
  1539. case "rem":
  1540. case "em":
  1541. return 16 * token.number;
  1542. case "px":
  1543. default:
  1544. return token.number;
  1545. }
  1546. }
  1547. return token.number;
  1548. };
  1549. var DEG = "deg";
  1550. var GRAD = "grad";
  1551. var RAD = "rad";
  1552. var TURN = "turn";
  1553. var angle = {
  1554. name: "angle",
  1555. parse: function(value) {
  1556. if (value.type === TokenType.DIMENSION_TOKEN) {
  1557. switch (value.unit) {
  1558. case DEG:
  1559. return Math.PI * value.number / 180;
  1560. case GRAD:
  1561. return Math.PI / 200 * value.number;
  1562. case RAD:
  1563. return value.number;
  1564. case TURN:
  1565. return Math.PI * 2 * value.number;
  1566. }
  1567. }
  1568. throw new Error("Unsupported angle type");
  1569. }
  1570. };
  1571. var isAngle = function(value) {
  1572. if (value.type === TokenType.DIMENSION_TOKEN) {
  1573. if (value.unit === DEG || value.unit === GRAD || value.unit === RAD || value.unit === TURN) {
  1574. return true;
  1575. }
  1576. }
  1577. return false;
  1578. };
  1579. var parseNamedSide = function(tokens) {
  1580. var sideOrCorner = tokens.filter(isIdentToken).map(function(ident) {
  1581. return ident.value;
  1582. }).join(" ");
  1583. switch (sideOrCorner) {
  1584. case "to bottom right":
  1585. case "to right bottom":
  1586. case "left top":
  1587. case "top left":
  1588. return [ZERO_LENGTH, ZERO_LENGTH];
  1589. case "to top":
  1590. case "bottom":
  1591. return deg(0);
  1592. case "to bottom left":
  1593. case "to left bottom":
  1594. case "right top":
  1595. case "top right":
  1596. return [ZERO_LENGTH, HUNDRED_PERCENT];
  1597. case "to right":
  1598. case "left":
  1599. return deg(90);
  1600. case "to top left":
  1601. case "to left top":
  1602. case "right bottom":
  1603. case "bottom right":
  1604. return [HUNDRED_PERCENT, HUNDRED_PERCENT];
  1605. case "to bottom":
  1606. case "top":
  1607. return deg(180);
  1608. case "to top right":
  1609. case "to right top":
  1610. case "left bottom":
  1611. case "bottom left":
  1612. return [HUNDRED_PERCENT, ZERO_LENGTH];
  1613. case "to left":
  1614. case "right":
  1615. return deg(270);
  1616. }
  1617. return 0;
  1618. };
  1619. var deg = function(deg2) {
  1620. return Math.PI * deg2 / 180;
  1621. };
  1622. var color = {
  1623. name: "color",
  1624. parse: function(value) {
  1625. if (value.type === TokenType.FUNCTION) {
  1626. var colorFunction = SUPPORTED_COLOR_FUNCTIONS[value.name];
  1627. if (typeof colorFunction === "undefined") {
  1628. throw new Error('Attempting to parse an unsupported color function "' + value.name + '"');
  1629. }
  1630. return colorFunction(value.values);
  1631. }
  1632. if (value.type === TokenType.HASH_TOKEN) {
  1633. if (value.value.length === 3) {
  1634. var r = value.value.substring(0, 1);
  1635. var g = value.value.substring(1, 2);
  1636. var b = value.value.substring(2, 3);
  1637. return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), 1);
  1638. }
  1639. if (value.value.length === 4) {
  1640. var r = value.value.substring(0, 1);
  1641. var g = value.value.substring(1, 2);
  1642. var b = value.value.substring(2, 3);
  1643. var a2 = value.value.substring(3, 4);
  1644. return pack(parseInt(r + r, 16), parseInt(g + g, 16), parseInt(b + b, 16), parseInt(a2 + a2, 16) / 255);
  1645. }
  1646. if (value.value.length === 6) {
  1647. var r = value.value.substring(0, 2);
  1648. var g = value.value.substring(2, 4);
  1649. var b = value.value.substring(4, 6);
  1650. return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), 1);
  1651. }
  1652. if (value.value.length === 8) {
  1653. var r = value.value.substring(0, 2);
  1654. var g = value.value.substring(2, 4);
  1655. var b = value.value.substring(4, 6);
  1656. var a2 = value.value.substring(6, 8);
  1657. return pack(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a2, 16) / 255);
  1658. }
  1659. }
  1660. if (value.type === TokenType.IDENT_TOKEN) {
  1661. var namedColor = COLORS[value.value.toUpperCase()];
  1662. if (typeof namedColor !== "undefined") {
  1663. return namedColor;
  1664. }
  1665. }
  1666. return COLORS.TRANSPARENT;
  1667. }
  1668. };
  1669. var isTransparent = function(color2) {
  1670. return (255 & color2) === 0;
  1671. };
  1672. var asString = function(color2) {
  1673. var alpha = 255 & color2;
  1674. var blue = 255 & color2 >> 8;
  1675. var green = 255 & color2 >> 16;
  1676. var red = 255 & color2 >> 24;
  1677. return alpha < 255 ? "rgba(" + red + "," + green + "," + blue + "," + alpha / 255 + ")" : "rgb(" + red + "," + green + "," + blue + ")";
  1678. };
  1679. var pack = function(r, g, b, a2) {
  1680. return (r << 24 | g << 16 | b << 8 | Math.round(a2 * 255) << 0) >>> 0;
  1681. };
  1682. var getTokenColorValue = function(token, i) {
  1683. if (token.type === TokenType.NUMBER_TOKEN) {
  1684. return token.number;
  1685. }
  1686. if (token.type === TokenType.PERCENTAGE_TOKEN) {
  1687. var max = i === 3 ? 1 : 255;
  1688. return i === 3 ? token.number / 100 * max : Math.round(token.number / 100 * max);
  1689. }
  1690. return 0;
  1691. };
  1692. var rgb = function(args) {
  1693. var tokens = args.filter(nonFunctionArgSeparator);
  1694. if (tokens.length === 3) {
  1695. var _a = tokens.map(getTokenColorValue), r = _a[0], g = _a[1], b = _a[2];
  1696. return pack(r, g, b, 1);
  1697. }
  1698. if (tokens.length === 4) {
  1699. var _b = tokens.map(getTokenColorValue), r = _b[0], g = _b[1], b = _b[2], a2 = _b[3];
  1700. return pack(r, g, b, a2);
  1701. }
  1702. return 0;
  1703. };
  1704. function hue2rgb(t1, t2, hue) {
  1705. if (hue < 0) {
  1706. hue += 1;
  1707. }
  1708. if (hue >= 1) {
  1709. hue -= 1;
  1710. }
  1711. if (hue < 1 / 6) {
  1712. return (t2 - t1) * hue * 6 + t1;
  1713. } else if (hue < 1 / 2) {
  1714. return t2;
  1715. } else if (hue < 2 / 3) {
  1716. return (t2 - t1) * 6 * (2 / 3 - hue) + t1;
  1717. } else {
  1718. return t1;
  1719. }
  1720. }
  1721. var hsl = function(args) {
  1722. var tokens = args.filter(nonFunctionArgSeparator);
  1723. var hue = tokens[0], saturation = tokens[1], lightness = tokens[2], alpha = tokens[3];
  1724. var h = (hue.type === TokenType.NUMBER_TOKEN ? deg(hue.number) : angle.parse(hue)) / (Math.PI * 2);
  1725. var s = isLengthPercentage(saturation) ? saturation.number / 100 : 0;
  1726. var l = isLengthPercentage(lightness) ? lightness.number / 100 : 0;
  1727. var a2 = typeof alpha !== "undefined" && isLengthPercentage(alpha) ? getAbsoluteValue(alpha, 1) : 1;
  1728. if (s === 0) {
  1729. return pack(l * 255, l * 255, l * 255, 1);
  1730. }
  1731. var t2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;
  1732. var t1 = l * 2 - t2;
  1733. var r = hue2rgb(t1, t2, h + 1 / 3);
  1734. var g = hue2rgb(t1, t2, h);
  1735. var b = hue2rgb(t1, t2, h - 1 / 3);
  1736. return pack(r * 255, g * 255, b * 255, a2);
  1737. };
  1738. var SUPPORTED_COLOR_FUNCTIONS = {
  1739. hsl,
  1740. hsla: hsl,
  1741. rgb,
  1742. rgba: rgb
  1743. };
  1744. var COLORS = {
  1745. ALICEBLUE: 4042850303,
  1746. ANTIQUEWHITE: 4209760255,
  1747. AQUA: 16777215,
  1748. AQUAMARINE: 2147472639,
  1749. AZURE: 4043309055,
  1750. BEIGE: 4126530815,
  1751. BISQUE: 4293182719,
  1752. BLACK: 255,
  1753. BLANCHEDALMOND: 4293643775,
  1754. BLUE: 65535,
  1755. BLUEVIOLET: 2318131967,
  1756. BROWN: 2771004159,
  1757. BURLYWOOD: 3736635391,
  1758. CADETBLUE: 1604231423,
  1759. CHARTREUSE: 2147418367,
  1760. CHOCOLATE: 3530104575,
  1761. CORAL: 4286533887,
  1762. CORNFLOWERBLUE: 1687547391,
  1763. CORNSILK: 4294499583,
  1764. CRIMSON: 3692313855,
  1765. CYAN: 16777215,
  1766. DARKBLUE: 35839,
  1767. DARKCYAN: 9145343,
  1768. DARKGOLDENROD: 3095837695,
  1769. DARKGRAY: 2846468607,
  1770. DARKGREEN: 6553855,
  1771. DARKGREY: 2846468607,
  1772. DARKKHAKI: 3182914559,
  1773. DARKMAGENTA: 2332068863,
  1774. DARKOLIVEGREEN: 1433087999,
  1775. DARKORANGE: 4287365375,
  1776. DARKORCHID: 2570243327,
  1777. DARKRED: 2332033279,
  1778. DARKSALMON: 3918953215,
  1779. DARKSEAGREEN: 2411499519,
  1780. DARKSLATEBLUE: 1211993087,
  1781. DARKSLATEGRAY: 793726975,
  1782. DARKSLATEGREY: 793726975,
  1783. DARKTURQUOISE: 13554175,
  1784. DARKVIOLET: 2483082239,
  1785. DEEPPINK: 4279538687,
  1786. DEEPSKYBLUE: 12582911,
  1787. DIMGRAY: 1768516095,
  1788. DIMGREY: 1768516095,
  1789. DODGERBLUE: 512819199,
  1790. FIREBRICK: 2988581631,
  1791. FLORALWHITE: 4294635775,
  1792. FORESTGREEN: 579543807,
  1793. FUCHSIA: 4278255615,
  1794. GAINSBORO: 3705462015,
  1795. GHOSTWHITE: 4177068031,
  1796. GOLD: 4292280575,
  1797. GOLDENROD: 3668254975,
  1798. GRAY: 2155905279,
  1799. GREEN: 8388863,
  1800. GREENYELLOW: 2919182335,
  1801. GREY: 2155905279,
  1802. HONEYDEW: 4043305215,
  1803. HOTPINK: 4285117695,
  1804. INDIANRED: 3445382399,
  1805. INDIGO: 1258324735,
  1806. IVORY: 4294963455,
  1807. KHAKI: 4041641215,
  1808. LAVENDER: 3873897215,
  1809. LAVENDERBLUSH: 4293981695,
  1810. LAWNGREEN: 2096890111,
  1811. LEMONCHIFFON: 4294626815,
  1812. LIGHTBLUE: 2916673279,
  1813. LIGHTCORAL: 4034953471,
  1814. LIGHTCYAN: 3774873599,
  1815. LIGHTGOLDENRODYELLOW: 4210742015,
  1816. LIGHTGRAY: 3553874943,
  1817. LIGHTGREEN: 2431553791,
  1818. LIGHTGREY: 3553874943,
  1819. LIGHTPINK: 4290167295,
  1820. LIGHTSALMON: 4288707327,
  1821. LIGHTSEAGREEN: 548580095,
  1822. LIGHTSKYBLUE: 2278488831,
  1823. LIGHTSLATEGRAY: 2005441023,
  1824. LIGHTSLATEGREY: 2005441023,
  1825. LIGHTSTEELBLUE: 2965692159,
  1826. LIGHTYELLOW: 4294959359,
  1827. LIME: 16711935,
  1828. LIMEGREEN: 852308735,
  1829. LINEN: 4210091775,
  1830. MAGENTA: 4278255615,
  1831. MAROON: 2147483903,
  1832. MEDIUMAQUAMARINE: 1724754687,
  1833. MEDIUMBLUE: 52735,
  1834. MEDIUMORCHID: 3126187007,
  1835. MEDIUMPURPLE: 2473647103,
  1836. MEDIUMSEAGREEN: 1018393087,
  1837. MEDIUMSLATEBLUE: 2070474495,
  1838. MEDIUMSPRINGGREEN: 16423679,
  1839. MEDIUMTURQUOISE: 1221709055,
  1840. MEDIUMVIOLETRED: 3340076543,
  1841. MIDNIGHTBLUE: 421097727,
  1842. MINTCREAM: 4127193855,
  1843. MISTYROSE: 4293190143,
  1844. MOCCASIN: 4293178879,
  1845. NAVAJOWHITE: 4292783615,
  1846. NAVY: 33023,
  1847. OLDLACE: 4260751103,
  1848. OLIVE: 2155872511,
  1849. OLIVEDRAB: 1804477439,
  1850. ORANGE: 4289003775,
  1851. ORANGERED: 4282712319,
  1852. ORCHID: 3664828159,
  1853. PALEGOLDENROD: 4008225535,
  1854. PALEGREEN: 2566625535,
  1855. PALETURQUOISE: 2951671551,
  1856. PALEVIOLETRED: 3681588223,
  1857. PAPAYAWHIP: 4293907967,
  1858. PEACHPUFF: 4292524543,
  1859. PERU: 3448061951,
  1860. PINK: 4290825215,
  1861. PLUM: 3718307327,
  1862. POWDERBLUE: 2967529215,
  1863. PURPLE: 2147516671,
  1864. REBECCAPURPLE: 1714657791,
  1865. RED: 4278190335,
  1866. ROSYBROWN: 3163525119,
  1867. ROYALBLUE: 1097458175,
  1868. SADDLEBROWN: 2336560127,
  1869. SALMON: 4202722047,
  1870. SANDYBROWN: 4104413439,
  1871. SEAGREEN: 780883967,
  1872. SEASHELL: 4294307583,
  1873. SIENNA: 2689740287,
  1874. SILVER: 3233857791,
  1875. SKYBLUE: 2278484991,
  1876. SLATEBLUE: 1784335871,
  1877. SLATEGRAY: 1887473919,
  1878. SLATEGREY: 1887473919,
  1879. SNOW: 4294638335,
  1880. SPRINGGREEN: 16744447,
  1881. STEELBLUE: 1182971135,
  1882. TAN: 3535047935,
  1883. TEAL: 8421631,
  1884. THISTLE: 3636451583,
  1885. TOMATO: 4284696575,
  1886. TRANSPARENT: 0,
  1887. TURQUOISE: 1088475391,
  1888. VIOLET: 4001558271,
  1889. WHEAT: 4125012991,
  1890. WHITE: 4294967295,
  1891. WHITESMOKE: 4126537215,
  1892. YELLOW: 4294902015,
  1893. YELLOWGREEN: 2597139199
  1894. };
  1895. var PropertyDescriptorParsingType;
  1896. (function(PropertyDescriptorParsingType2) {
  1897. PropertyDescriptorParsingType2[PropertyDescriptorParsingType2["VALUE"] = 0] = "VALUE";
  1898. PropertyDescriptorParsingType2[PropertyDescriptorParsingType2["LIST"] = 1] = "LIST";
  1899. PropertyDescriptorParsingType2[PropertyDescriptorParsingType2["IDENT_VALUE"] = 2] = "IDENT_VALUE";
  1900. PropertyDescriptorParsingType2[PropertyDescriptorParsingType2["TYPE_VALUE"] = 3] = "TYPE_VALUE";
  1901. PropertyDescriptorParsingType2[PropertyDescriptorParsingType2["TOKEN_VALUE"] = 4] = "TOKEN_VALUE";
  1902. })(PropertyDescriptorParsingType || (PropertyDescriptorParsingType = {}));
  1903. var BACKGROUND_CLIP;
  1904. (function(BACKGROUND_CLIP2) {
  1905. BACKGROUND_CLIP2[BACKGROUND_CLIP2["BORDER_BOX"] = 0] = "BORDER_BOX";
  1906. BACKGROUND_CLIP2[BACKGROUND_CLIP2["PADDING_BOX"] = 1] = "PADDING_BOX";
  1907. BACKGROUND_CLIP2[BACKGROUND_CLIP2["CONTENT_BOX"] = 2] = "CONTENT_BOX";
  1908. })(BACKGROUND_CLIP || (BACKGROUND_CLIP = {}));
  1909. var backgroundClip = {
  1910. name: "background-clip",
  1911. initialValue: "border-box",
  1912. prefix: false,
  1913. type: PropertyDescriptorParsingType.LIST,
  1914. parse: function(tokens) {
  1915. return tokens.map(function(token) {
  1916. if (isIdentToken(token)) {
  1917. switch (token.value) {
  1918. case "padding-box":
  1919. return BACKGROUND_CLIP.PADDING_BOX;
  1920. case "content-box":
  1921. return BACKGROUND_CLIP.CONTENT_BOX;
  1922. }
  1923. }
  1924. return BACKGROUND_CLIP.BORDER_BOX;
  1925. });
  1926. }
  1927. };
  1928. var backgroundColor = {
  1929. name: "background-color",
  1930. initialValue: "transparent",
  1931. prefix: false,
  1932. type: PropertyDescriptorParsingType.TYPE_VALUE,
  1933. format: "color"
  1934. };
  1935. var parseColorStop = function(args) {
  1936. var color$12 = color.parse(args[0]);
  1937. var stop = args[1];
  1938. return stop && isLengthPercentage(stop) ? { color: color$12, stop } : { color: color$12, stop: null };
  1939. };
  1940. var processColorStops = function(stops, lineLength) {
  1941. var first = stops[0];
  1942. var last = stops[stops.length - 1];
  1943. if (first.stop === null) {
  1944. first.stop = ZERO_LENGTH;
  1945. }
  1946. if (last.stop === null) {
  1947. last.stop = HUNDRED_PERCENT;
  1948. }
  1949. var processStops = [];
  1950. var previous = 0;
  1951. for (var i = 0; i < stops.length; i++) {
  1952. var stop_1 = stops[i].stop;
  1953. if (stop_1 !== null) {
  1954. var absoluteValue = getAbsoluteValue(stop_1, lineLength);
  1955. if (absoluteValue > previous) {
  1956. processStops.push(absoluteValue);
  1957. } else {
  1958. processStops.push(previous);
  1959. }
  1960. previous = absoluteValue;
  1961. } else {
  1962. processStops.push(null);
  1963. }
  1964. }
  1965. var gapBegin = null;
  1966. for (var i = 0; i < processStops.length; i++) {
  1967. var stop_2 = processStops[i];
  1968. if (stop_2 === null) {
  1969. if (gapBegin === null) {
  1970. gapBegin = i;
  1971. }
  1972. } else if (gapBegin !== null) {
  1973. var gapLength = i - gapBegin;
  1974. var beforeGap = processStops[gapBegin - 1];
  1975. var gapValue = (stop_2 - beforeGap) / (gapLength + 1);
  1976. for (var g = 1; g <= gapLength; g++) {
  1977. processStops[gapBegin + g - 1] = gapValue * g;
  1978. }
  1979. gapBegin = null;
  1980. }
  1981. }
  1982. return stops.map(function(_a, i2) {
  1983. var color2 = _a.color;
  1984. return { color: color2, stop: Math.max(Math.min(1, processStops[i2] / lineLength), 0) };
  1985. });
  1986. };
  1987. var getAngleFromCorner = function(corner, width, height) {
  1988. var centerX = width / 2;
  1989. var centerY = height / 2;
  1990. var x = getAbsoluteValue(corner[0], width) - centerX;
  1991. var y = centerY - getAbsoluteValue(corner[1], height);
  1992. return (Math.atan2(y, x) + Math.PI * 2) % (Math.PI * 2);
  1993. };
  1994. var calculateGradientDirection = function(angle2, width, height) {
  1995. var radian = typeof angle2 === "number" ? angle2 : getAngleFromCorner(angle2, width, height);
  1996. var lineLength = Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian));
  1997. var halfWidth = width / 2;
  1998. var halfHeight = height / 2;
  1999. var halfLineLength = lineLength / 2;
  2000. var yDiff = Math.sin(radian - Math.PI / 2) * halfLineLength;
  2001. var xDiff = Math.cos(radian - Math.PI / 2) * halfLineLength;
  2002. return [lineLength, halfWidth - xDiff, halfWidth + xDiff, halfHeight - yDiff, halfHeight + yDiff];
  2003. };
  2004. var distance = function(a2, b) {
  2005. return Math.sqrt(a2 * a2 + b * b);
  2006. };
  2007. var findCorner = function(width, height, x, y, closest) {
  2008. var corners = [[0, 0], [0, height], [width, 0], [width, height]];
  2009. return corners.reduce(function(stat, corner) {
  2010. var cx = corner[0], cy = corner[1];
  2011. var d = distance(x - cx, y - cy);
  2012. if (closest ? d < stat.optimumDistance : d > stat.optimumDistance) {
  2013. return {
  2014. optimumCorner: corner,
  2015. optimumDistance: d
  2016. };
  2017. }
  2018. return stat;
  2019. }, {
  2020. optimumDistance: closest ? Infinity : -Infinity,
  2021. optimumCorner: null
  2022. }).optimumCorner;
  2023. };
  2024. var calculateRadius = function(gradient, x, y, width, height) {
  2025. var rx = 0;
  2026. var ry = 0;
  2027. switch (gradient.size) {
  2028. case CSSRadialExtent.CLOSEST_SIDE:
  2029. if (gradient.shape === CSSRadialShape.CIRCLE) {
  2030. rx = ry = Math.min(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
  2031. } else if (gradient.shape === CSSRadialShape.ELLIPSE) {
  2032. rx = Math.min(Math.abs(x), Math.abs(x - width));
  2033. ry = Math.min(Math.abs(y), Math.abs(y - height));
  2034. }
  2035. break;
  2036. case CSSRadialExtent.CLOSEST_CORNER:
  2037. if (gradient.shape === CSSRadialShape.CIRCLE) {
  2038. rx = ry = Math.min(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
  2039. } else if (gradient.shape === CSSRadialShape.ELLIPSE) {
  2040. var c = Math.min(Math.abs(y), Math.abs(y - height)) / Math.min(Math.abs(x), Math.abs(x - width));
  2041. var _a = findCorner(width, height, x, y, true), cx = _a[0], cy = _a[1];
  2042. rx = distance(cx - x, (cy - y) / c);
  2043. ry = c * rx;
  2044. }
  2045. break;
  2046. case CSSRadialExtent.FARTHEST_SIDE:
  2047. if (gradient.shape === CSSRadialShape.CIRCLE) {
  2048. rx = ry = Math.max(Math.abs(x), Math.abs(x - width), Math.abs(y), Math.abs(y - height));
  2049. } else if (gradient.shape === CSSRadialShape.ELLIPSE) {
  2050. rx = Math.max(Math.abs(x), Math.abs(x - width));
  2051. ry = Math.max(Math.abs(y), Math.abs(y - height));
  2052. }
  2053. break;
  2054. case CSSRadialExtent.FARTHEST_CORNER:
  2055. if (gradient.shape === CSSRadialShape.CIRCLE) {
  2056. rx = ry = Math.max(distance(x, y), distance(x, y - height), distance(x - width, y), distance(x - width, y - height));
  2057. } else if (gradient.shape === CSSRadialShape.ELLIPSE) {
  2058. var c = Math.max(Math.abs(y), Math.abs(y - height)) / Math.max(Math.abs(x), Math.abs(x - width));
  2059. var _b = findCorner(width, height, x, y, false), cx = _b[0], cy = _b[1];
  2060. rx = distance(cx - x, (cy - y) / c);
  2061. ry = c * rx;
  2062. }
  2063. break;
  2064. }
  2065. if (Array.isArray(gradient.size)) {
  2066. rx = getAbsoluteValue(gradient.size[0], width);
  2067. ry = gradient.size.length === 2 ? getAbsoluteValue(gradient.size[1], height) : rx;
  2068. }
  2069. return [rx, ry];
  2070. };
  2071. var linearGradient = function(tokens) {
  2072. var angle$1 = deg(180);
  2073. var stops = [];
  2074. parseFunctionArgs(tokens).forEach(function(arg, i) {
  2075. if (i === 0) {
  2076. var firstToken = arg[0];
  2077. if (firstToken.type === TokenType.IDENT_TOKEN && firstToken.value === "to") {
  2078. angle$1 = parseNamedSide(arg);
  2079. return;
  2080. } else if (isAngle(firstToken)) {
  2081. angle$1 = angle.parse(firstToken);
  2082. return;
  2083. }
  2084. }
  2085. var colorStop = parseColorStop(arg);
  2086. stops.push(colorStop);
  2087. });
  2088. return { angle: angle$1, stops, type: CSSImageType.LINEAR_GRADIENT };
  2089. };
  2090. var prefixLinearGradient = function(tokens) {
  2091. var angle$1 = deg(180);
  2092. var stops = [];
  2093. parseFunctionArgs(tokens).forEach(function(arg, i) {
  2094. if (i === 0) {
  2095. var firstToken = arg[0];
  2096. if (firstToken.type === TokenType.IDENT_TOKEN && ["top", "left", "right", "bottom"].indexOf(firstToken.value) !== -1) {
  2097. angle$1 = parseNamedSide(arg);
  2098. return;
  2099. } else if (isAngle(firstToken)) {
  2100. angle$1 = (angle.parse(firstToken) + deg(270)) % deg(360);
  2101. return;
  2102. }
  2103. }
  2104. var colorStop = parseColorStop(arg);
  2105. stops.push(colorStop);
  2106. });
  2107. return {
  2108. angle: angle$1,
  2109. stops,
  2110. type: CSSImageType.LINEAR_GRADIENT
  2111. };
  2112. };
  2113. var testRangeBounds = function(document2) {
  2114. var TEST_HEIGHT = 123;
  2115. if (document2.createRange) {
  2116. var range = document2.createRange();
  2117. if (range.getBoundingClientRect) {
  2118. var testElement = document2.createElement("boundtest");
  2119. testElement.style.height = TEST_HEIGHT + "px";
  2120. testElement.style.display = "block";
  2121. document2.body.appendChild(testElement);
  2122. range.selectNode(testElement);
  2123. var rangeBounds = range.getBoundingClientRect();
  2124. var rangeHeight = Math.round(rangeBounds.height);
  2125. document2.body.removeChild(testElement);
  2126. if (rangeHeight === TEST_HEIGHT) {
  2127. return true;
  2128. }
  2129. }
  2130. }
  2131. return false;
  2132. };
  2133. var testCORS = function() {
  2134. return typeof new Image().crossOrigin !== "undefined";
  2135. };
  2136. var testResponseType = function() {
  2137. return typeof new XMLHttpRequest().responseType === "string";
  2138. };
  2139. var testSVG = function(document2) {
  2140. var img = new Image();
  2141. var canvas = document2.createElement("canvas");
  2142. var ctx = canvas.getContext("2d");
  2143. if (!ctx) {
  2144. return false;
  2145. }
  2146. img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  2147. try {
  2148. ctx.drawImage(img, 0, 0);
  2149. canvas.toDataURL();
  2150. } catch (e2) {
  2151. return false;
  2152. }
  2153. return true;
  2154. };
  2155. var isGreenPixel = function(data) {
  2156. return data[0] === 0 && data[1] === 255 && data[2] === 0 && data[3] === 255;
  2157. };
  2158. var testForeignObject = function(document2) {
  2159. var canvas = document2.createElement("canvas");
  2160. var size = 100;
  2161. canvas.width = size;
  2162. canvas.height = size;
  2163. var ctx = canvas.getContext("2d");
  2164. if (!ctx) {
  2165. return Promise.reject(false);
  2166. }
  2167. ctx.fillStyle = "rgb(0, 255, 0)";
  2168. ctx.fillRect(0, 0, size, size);
  2169. var img = new Image();
  2170. var greenImageSrc = canvas.toDataURL();
  2171. img.src = greenImageSrc;
  2172. var svg = createForeignObjectSVG(size, size, 0, 0, img);
  2173. ctx.fillStyle = "red";
  2174. ctx.fillRect(0, 0, size, size);
  2175. return loadSerializedSVG(svg).then(function(img2) {
  2176. ctx.drawImage(img2, 0, 0);
  2177. var data = ctx.getImageData(0, 0, size, size).data;
  2178. ctx.fillStyle = "red";
  2179. ctx.fillRect(0, 0, size, size);
  2180. var node = document2.createElement("div");
  2181. node.style.backgroundImage = "url(" + greenImageSrc + ")";
  2182. node.style.height = size + "px";
  2183. return isGreenPixel(data) ? loadSerializedSVG(createForeignObjectSVG(size, size, 0, 0, node)) : Promise.reject(false);
  2184. }).then(function(img2) {
  2185. ctx.drawImage(img2, 0, 0);
  2186. return isGreenPixel(ctx.getImageData(0, 0, size, size).data);
  2187. }).catch(function() {
  2188. return false;
  2189. });
  2190. };
  2191. var createForeignObjectSVG = function(width, height, x, y, node) {
  2192. var xmlns = "http://www.w3.org/2000/svg";
  2193. var svg = document.createElementNS(xmlns, "svg");
  2194. var foreignObject = document.createElementNS(xmlns, "foreignObject");
  2195. svg.setAttributeNS(null, "width", width.toString());
  2196. svg.setAttributeNS(null, "height", height.toString());
  2197. foreignObject.setAttributeNS(null, "width", "100%");
  2198. foreignObject.setAttributeNS(null, "height", "100%");
  2199. foreignObject.setAttributeNS(null, "x", x.toString());
  2200. foreignObject.setAttributeNS(null, "y", y.toString());
  2201. foreignObject.setAttributeNS(null, "externalResourcesRequired", "true");
  2202. svg.appendChild(foreignObject);
  2203. foreignObject.appendChild(node);
  2204. return svg;
  2205. };
  2206. var loadSerializedSVG = function(svg) {
  2207. return new Promise(function(resolve, reject) {
  2208. var img = new Image();
  2209. img.onload = function() {
  2210. return resolve(img);
  2211. };
  2212. img.onerror = reject;
  2213. img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  2214. });
  2215. };
  2216. var FEATURES = {
  2217. get SUPPORT_RANGE_BOUNDS() {
  2218. var value = testRangeBounds(document);
  2219. Object.defineProperty(FEATURES, "SUPPORT_RANGE_BOUNDS", { value });
  2220. return value;
  2221. },
  2222. get SUPPORT_SVG_DRAWING() {
  2223. var value = testSVG(document);
  2224. Object.defineProperty(FEATURES, "SUPPORT_SVG_DRAWING", { value });
  2225. return value;
  2226. },
  2227. get SUPPORT_FOREIGNOBJECT_DRAWING() {
  2228. var value = typeof Array.from === "function" && typeof window.fetch === "function" ? testForeignObject(document) : Promise.resolve(false);
  2229. Object.defineProperty(FEATURES, "SUPPORT_FOREIGNOBJECT_DRAWING", { value });
  2230. return value;
  2231. },
  2232. get SUPPORT_CORS_IMAGES() {
  2233. var value = testCORS();
  2234. Object.defineProperty(FEATURES, "SUPPORT_CORS_IMAGES", { value });
  2235. return value;
  2236. },
  2237. get SUPPORT_RESPONSE_TYPE() {
  2238. var value = testResponseType();
  2239. Object.defineProperty(FEATURES, "SUPPORT_RESPONSE_TYPE", { value });
  2240. return value;
  2241. },
  2242. get SUPPORT_CORS_XHR() {
  2243. var value = "withCredentials" in new XMLHttpRequest();
  2244. Object.defineProperty(FEATURES, "SUPPORT_CORS_XHR", { value });
  2245. return value;
  2246. }
  2247. };
  2248. var Logger = (
  2249. /** @class */
  2250. function() {
  2251. function Logger2(id) {
  2252. this.id = id;
  2253. this.start = Date.now();
  2254. }
  2255. Logger2.prototype.debug = function() {
  2256. var args = [];
  2257. for (var _i = 0; _i < arguments.length; _i++) {
  2258. args[_i] = arguments[_i];
  2259. }
  2260. if (typeof window !== "undefined" && window.console && typeof console.debug === "function") {
  2261. console.debug.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  2262. } else {
  2263. this.info.apply(this, args);
  2264. }
  2265. };
  2266. Logger2.prototype.getTime = function() {
  2267. return Date.now() - this.start;
  2268. };
  2269. Logger2.create = function(id) {
  2270. Logger2.instances[id] = new Logger2(id);
  2271. };
  2272. Logger2.destroy = function(id) {
  2273. delete Logger2.instances[id];
  2274. };
  2275. Logger2.getInstance = function(id) {
  2276. var instance = Logger2.instances[id];
  2277. if (typeof instance === "undefined") {
  2278. throw new Error("No logger instance found with id " + id);
  2279. }
  2280. return instance;
  2281. };
  2282. Logger2.prototype.info = function() {
  2283. var args = [];
  2284. for (var _i = 0; _i < arguments.length; _i++) {
  2285. args[_i] = arguments[_i];
  2286. }
  2287. if (typeof window !== "undefined" && window.console && typeof console.info === "function") {
  2288. console.info.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  2289. }
  2290. };
  2291. Logger2.prototype.error = function() {
  2292. var args = [];
  2293. for (var _i = 0; _i < arguments.length; _i++) {
  2294. args[_i] = arguments[_i];
  2295. }
  2296. if (typeof window !== "undefined" && window.console && typeof console.error === "function") {
  2297. console.error.apply(console, [this.id, this.getTime() + "ms"].concat(args));
  2298. } else {
  2299. this.info.apply(this, args);
  2300. }
  2301. };
  2302. Logger2.instances = {};
  2303. return Logger2;
  2304. }()
  2305. );
  2306. var CacheStorage = (
  2307. /** @class */
  2308. function() {
  2309. function CacheStorage2() {
  2310. }
  2311. CacheStorage2.create = function(name, options) {
  2312. return CacheStorage2._caches[name] = new Cache(name, options);
  2313. };
  2314. CacheStorage2.destroy = function(name) {
  2315. delete CacheStorage2._caches[name];
  2316. };
  2317. CacheStorage2.open = function(name) {
  2318. var cache = CacheStorage2._caches[name];
  2319. if (typeof cache !== "undefined") {
  2320. return cache;
  2321. }
  2322. throw new Error('Cache with key "' + name + '" not found');
  2323. };
  2324. CacheStorage2.getOrigin = function(url) {
  2325. var link = CacheStorage2._link;
  2326. if (!link) {
  2327. return "about:blank";
  2328. }
  2329. link.href = url;
  2330. link.href = link.href;
  2331. return link.protocol + link.hostname + link.port;
  2332. };
  2333. CacheStorage2.isSameOrigin = function(src) {
  2334. return CacheStorage2.getOrigin(src) === CacheStorage2._origin;
  2335. };
  2336. CacheStorage2.setContext = function(window2) {
  2337. CacheStorage2._link = window2.document.createElement("a");
  2338. CacheStorage2._origin = CacheStorage2.getOrigin(window2.location.href);
  2339. };
  2340. CacheStorage2.getInstance = function() {
  2341. var current = CacheStorage2._current;
  2342. if (current === null) {
  2343. throw new Error("No cache instance attached");
  2344. }
  2345. return current;
  2346. };
  2347. CacheStorage2.attachInstance = function(cache) {
  2348. CacheStorage2._current = cache;
  2349. };
  2350. CacheStorage2.detachInstance = function() {
  2351. CacheStorage2._current = null;
  2352. };
  2353. CacheStorage2._caches = {};
  2354. CacheStorage2._origin = "about:blank";
  2355. CacheStorage2._current = null;
  2356. return CacheStorage2;
  2357. }()
  2358. );
  2359. var Cache = (
  2360. /** @class */
  2361. function() {
  2362. function Cache2(id, options) {
  2363. this.id = id;
  2364. this._options = options;
  2365. this._cache = {};
  2366. }
  2367. Cache2.prototype.addImage = function(src) {
  2368. var result = Promise.resolve();
  2369. if (this.has(src)) {
  2370. return result;
  2371. }
  2372. if (isBlobImage(src) || isRenderable(src)) {
  2373. this._cache[src] = this.loadImage(src);
  2374. return result;
  2375. }
  2376. return result;
  2377. };
  2378. Cache2.prototype.match = function(src) {
  2379. return this._cache[src];
  2380. };
  2381. Cache2.prototype.loadImage = function(key) {
  2382. return __awaiter(this, void 0, void 0, function() {
  2383. var isSameOrigin, useCORS, useProxy, src;
  2384. var _this2 = this;
  2385. return __generator(this, function(_a) {
  2386. switch (_a.label) {
  2387. case 0:
  2388. isSameOrigin = CacheStorage.isSameOrigin(key);
  2389. useCORS = !isInlineImage(key) && this._options.useCORS === true && FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
  2390. useProxy = !isInlineImage(key) && !isSameOrigin && typeof this._options.proxy === "string" && FEATURES.SUPPORT_CORS_XHR && !useCORS;
  2391. if (!isSameOrigin && this._options.allowTaint === false && !isInlineImage(key) && !useProxy && !useCORS) {
  2392. return [
  2393. 2
  2394. /*return*/
  2395. ];
  2396. }
  2397. src = key;
  2398. if (!useProxy)
  2399. return [3, 2];
  2400. return [4, this.proxy(src)];
  2401. case 1:
  2402. src = _a.sent();
  2403. _a.label = 2;
  2404. case 2:
  2405. Logger.getInstance(this.id).debug("Added image " + key.substring(0, 256));
  2406. return [4, new Promise(function(resolve, reject) {
  2407. var img = new Image();
  2408. img.onload = function() {
  2409. return resolve(img);
  2410. };
  2411. img.onerror = reject;
  2412. if (isInlineBase64Image(src) || useCORS) {
  2413. img.crossOrigin = "anonymous";
  2414. }
  2415. img.src = src;
  2416. if (img.complete === true) {
  2417. setTimeout(function() {
  2418. return resolve(img);
  2419. }, 500);
  2420. }
  2421. if (_this2._options.imageTimeout > 0) {
  2422. setTimeout(function() {
  2423. return reject("Timed out (" + _this2._options.imageTimeout + "ms) loading image");
  2424. }, _this2._options.imageTimeout);
  2425. }
  2426. })];
  2427. case 3:
  2428. return [2, _a.sent()];
  2429. }
  2430. });
  2431. });
  2432. };
  2433. Cache2.prototype.has = function(key) {
  2434. return typeof this._cache[key] !== "undefined";
  2435. };
  2436. Cache2.prototype.keys = function() {
  2437. return Promise.resolve(Object.keys(this._cache));
  2438. };
  2439. Cache2.prototype.proxy = function(src) {
  2440. var _this2 = this;
  2441. var proxy = this._options.proxy;
  2442. if (!proxy) {
  2443. throw new Error("No proxy defined");
  2444. }
  2445. var key = src.substring(0, 256);
  2446. return new Promise(function(resolve, reject) {
  2447. var responseType = FEATURES.SUPPORT_RESPONSE_TYPE ? "blob" : "text";
  2448. var xhr = new XMLHttpRequest();
  2449. xhr.onload = function() {
  2450. if (xhr.status === 200) {
  2451. if (responseType === "text") {
  2452. resolve(xhr.response);
  2453. } else {
  2454. var reader_1 = new FileReader();
  2455. reader_1.addEventListener("load", function() {
  2456. return resolve(reader_1.result);
  2457. }, false);
  2458. reader_1.addEventListener("error", function(e2) {
  2459. return reject(e2);
  2460. }, false);
  2461. reader_1.readAsDataURL(xhr.response);
  2462. }
  2463. } else {
  2464. reject("Failed to proxy resource " + key + " with status code " + xhr.status);
  2465. }
  2466. };
  2467. xhr.onerror = reject;
  2468. xhr.open("GET", proxy + "?url=" + encodeURIComponent(src) + "&responseType=" + responseType);
  2469. if (responseType !== "text" && xhr instanceof XMLHttpRequest) {
  2470. xhr.responseType = responseType;
  2471. }
  2472. if (_this2._options.imageTimeout) {
  2473. var timeout_1 = _this2._options.imageTimeout;
  2474. xhr.timeout = timeout_1;
  2475. xhr.ontimeout = function() {
  2476. return reject("Timed out (" + timeout_1 + "ms) proxying " + key);
  2477. };
  2478. }
  2479. xhr.send();
  2480. });
  2481. };
  2482. return Cache2;
  2483. }()
  2484. );
  2485. var INLINE_SVG = /^data:image\/svg\+xml/i;
  2486. var INLINE_BASE64 = /^data:image\/.*;base64,/i;
  2487. var INLINE_IMG = /^data:image\/.*/i;
  2488. var isRenderable = function(src) {
  2489. return FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);
  2490. };
  2491. var isInlineImage = function(src) {
  2492. return INLINE_IMG.test(src);
  2493. };
  2494. var isInlineBase64Image = function(src) {
  2495. return INLINE_BASE64.test(src);
  2496. };
  2497. var isBlobImage = function(src) {
  2498. return src.substr(0, 4) === "blob";
  2499. };
  2500. var isSVG = function(src) {
  2501. return src.substr(-3).toLowerCase() === "svg" || INLINE_SVG.test(src);
  2502. };
  2503. var webkitGradient = function(tokens) {
  2504. var angle2 = deg(180);
  2505. var stops = [];
  2506. var type = CSSImageType.LINEAR_GRADIENT;
  2507. var shape = CSSRadialShape.CIRCLE;
  2508. var size = CSSRadialExtent.FARTHEST_CORNER;
  2509. var position2 = [];
  2510. parseFunctionArgs(tokens).forEach(function(arg, i) {
  2511. var firstToken = arg[0];
  2512. if (i === 0) {
  2513. if (isIdentToken(firstToken) && firstToken.value === "linear") {
  2514. type = CSSImageType.LINEAR_GRADIENT;
  2515. return;
  2516. } else if (isIdentToken(firstToken) && firstToken.value === "radial") {
  2517. type = CSSImageType.RADIAL_GRADIENT;
  2518. return;
  2519. }
  2520. }
  2521. if (firstToken.type === TokenType.FUNCTION) {
  2522. if (firstToken.name === "from") {
  2523. var color$12 = color.parse(firstToken.values[0]);
  2524. stops.push({ stop: ZERO_LENGTH, color: color$12 });
  2525. } else if (firstToken.name === "to") {
  2526. var color$12 = color.parse(firstToken.values[0]);
  2527. stops.push({ stop: HUNDRED_PERCENT, color: color$12 });
  2528. } else if (firstToken.name === "color-stop") {
  2529. var values = firstToken.values.filter(nonFunctionArgSeparator);
  2530. if (values.length === 2) {
  2531. var color$12 = color.parse(values[1]);
  2532. var stop_1 = values[0];
  2533. if (isNumberToken(stop_1)) {
  2534. stops.push({
  2535. stop: { type: TokenType.PERCENTAGE_TOKEN, number: stop_1.number * 100, flags: stop_1.flags },
  2536. color: color$12
  2537. });
  2538. }
  2539. }
  2540. }
  2541. }
  2542. });
  2543. return type === CSSImageType.LINEAR_GRADIENT ? {
  2544. angle: (angle2 + deg(180)) % deg(360),
  2545. stops,
  2546. type
  2547. } : { size, shape, stops, position: position2, type };
  2548. };
  2549. var CLOSEST_SIDE = "closest-side";
  2550. var FARTHEST_SIDE = "farthest-side";
  2551. var CLOSEST_CORNER = "closest-corner";
  2552. var FARTHEST_CORNER = "farthest-corner";
  2553. var CIRCLE = "circle";
  2554. var ELLIPSE = "ellipse";
  2555. var COVER = "cover";
  2556. var CONTAIN = "contain";
  2557. var radialGradient = function(tokens) {
  2558. var shape = CSSRadialShape.CIRCLE;
  2559. var size = CSSRadialExtent.FARTHEST_CORNER;
  2560. var stops = [];
  2561. var position2 = [];
  2562. parseFunctionArgs(tokens).forEach(function(arg, i) {
  2563. var isColorStop = true;
  2564. if (i === 0) {
  2565. var isAtPosition_1 = false;
  2566. isColorStop = arg.reduce(function(acc, token) {
  2567. if (isAtPosition_1) {
  2568. if (isIdentToken(token)) {
  2569. switch (token.value) {
  2570. case "center":
  2571. position2.push(FIFTY_PERCENT);
  2572. return acc;
  2573. case "top":
  2574. case "left":
  2575. position2.push(ZERO_LENGTH);
  2576. return acc;
  2577. case "right":
  2578. case "bottom":
  2579. position2.push(HUNDRED_PERCENT);
  2580. return acc;
  2581. }
  2582. } else if (isLengthPercentage(token) || isLength(token)) {
  2583. position2.push(token);
  2584. }
  2585. } else if (isIdentToken(token)) {
  2586. switch (token.value) {
  2587. case CIRCLE:
  2588. shape = CSSRadialShape.CIRCLE;
  2589. return false;
  2590. case ELLIPSE:
  2591. shape = CSSRadialShape.ELLIPSE;
  2592. return false;
  2593. case "at":
  2594. isAtPosition_1 = true;
  2595. return false;
  2596. case CLOSEST_SIDE:
  2597. size = CSSRadialExtent.CLOSEST_SIDE;
  2598. return false;
  2599. case COVER:
  2600. case FARTHEST_SIDE:
  2601. size = CSSRadialExtent.FARTHEST_SIDE;
  2602. return false;
  2603. case CONTAIN:
  2604. case CLOSEST_CORNER:
  2605. size = CSSRadialExtent.CLOSEST_CORNER;
  2606. return false;
  2607. case FARTHEST_CORNER:
  2608. size = CSSRadialExtent.FARTHEST_CORNER;
  2609. return false;
  2610. }
  2611. } else if (isLength(token) || isLengthPercentage(token)) {
  2612. if (!Array.isArray(size)) {
  2613. size = [];
  2614. }
  2615. size.push(token);
  2616. return false;
  2617. }
  2618. return acc;
  2619. }, isColorStop);
  2620. }
  2621. if (isColorStop) {
  2622. var colorStop = parseColorStop(arg);
  2623. stops.push(colorStop);
  2624. }
  2625. });
  2626. return { size, shape, stops, position: position2, type: CSSImageType.RADIAL_GRADIENT };
  2627. };
  2628. var prefixRadialGradient = function(tokens) {
  2629. var shape = CSSRadialShape.CIRCLE;
  2630. var size = CSSRadialExtent.FARTHEST_CORNER;
  2631. var stops = [];
  2632. var position2 = [];
  2633. parseFunctionArgs(tokens).forEach(function(arg, i) {
  2634. var isColorStop = true;
  2635. if (i === 0) {
  2636. isColorStop = arg.reduce(function(acc, token) {
  2637. if (isIdentToken(token)) {
  2638. switch (token.value) {
  2639. case "center":
  2640. position2.push(FIFTY_PERCENT);
  2641. return false;
  2642. case "top":
  2643. case "left":
  2644. position2.push(ZERO_LENGTH);
  2645. return false;
  2646. case "right":
  2647. case "bottom":
  2648. position2.push(HUNDRED_PERCENT);
  2649. return false;
  2650. }
  2651. } else if (isLengthPercentage(token) || isLength(token)) {
  2652. position2.push(token);
  2653. return false;
  2654. }
  2655. return acc;
  2656. }, isColorStop);
  2657. } else if (i === 1) {
  2658. isColorStop = arg.reduce(function(acc, token) {
  2659. if (isIdentToken(token)) {
  2660. switch (token.value) {
  2661. case CIRCLE:
  2662. shape = CSSRadialShape.CIRCLE;
  2663. return false;
  2664. case ELLIPSE:
  2665. shape = CSSRadialShape.ELLIPSE;
  2666. return false;
  2667. case CONTAIN:
  2668. case CLOSEST_SIDE:
  2669. size = CSSRadialExtent.CLOSEST_SIDE;
  2670. return false;
  2671. case FARTHEST_SIDE:
  2672. size = CSSRadialExtent.FARTHEST_SIDE;
  2673. return false;
  2674. case CLOSEST_CORNER:
  2675. size = CSSRadialExtent.CLOSEST_CORNER;
  2676. return false;
  2677. case COVER:
  2678. case FARTHEST_CORNER:
  2679. size = CSSRadialExtent.FARTHEST_CORNER;
  2680. return false;
  2681. }
  2682. } else if (isLength(token) || isLengthPercentage(token)) {
  2683. if (!Array.isArray(size)) {
  2684. size = [];
  2685. }
  2686. size.push(token);
  2687. return false;
  2688. }
  2689. return acc;
  2690. }, isColorStop);
  2691. }
  2692. if (isColorStop) {
  2693. var colorStop = parseColorStop(arg);
  2694. stops.push(colorStop);
  2695. }
  2696. });
  2697. return { size, shape, stops, position: position2, type: CSSImageType.RADIAL_GRADIENT };
  2698. };
  2699. var CSSImageType;
  2700. (function(CSSImageType2) {
  2701. CSSImageType2[CSSImageType2["URL"] = 0] = "URL";
  2702. CSSImageType2[CSSImageType2["LINEAR_GRADIENT"] = 1] = "LINEAR_GRADIENT";
  2703. CSSImageType2[CSSImageType2["RADIAL_GRADIENT"] = 2] = "RADIAL_GRADIENT";
  2704. })(CSSImageType || (CSSImageType = {}));
  2705. var isLinearGradient = function(background) {
  2706. return background.type === CSSImageType.LINEAR_GRADIENT;
  2707. };
  2708. var isRadialGradient = function(background) {
  2709. return background.type === CSSImageType.RADIAL_GRADIENT;
  2710. };
  2711. var CSSRadialShape;
  2712. (function(CSSRadialShape2) {
  2713. CSSRadialShape2[CSSRadialShape2["CIRCLE"] = 0] = "CIRCLE";
  2714. CSSRadialShape2[CSSRadialShape2["ELLIPSE"] = 1] = "ELLIPSE";
  2715. })(CSSRadialShape || (CSSRadialShape = {}));
  2716. var CSSRadialExtent;
  2717. (function(CSSRadialExtent2) {
  2718. CSSRadialExtent2[CSSRadialExtent2["CLOSEST_SIDE"] = 0] = "CLOSEST_SIDE";
  2719. CSSRadialExtent2[CSSRadialExtent2["FARTHEST_SIDE"] = 1] = "FARTHEST_SIDE";
  2720. CSSRadialExtent2[CSSRadialExtent2["CLOSEST_CORNER"] = 2] = "CLOSEST_CORNER";
  2721. CSSRadialExtent2[CSSRadialExtent2["FARTHEST_CORNER"] = 3] = "FARTHEST_CORNER";
  2722. })(CSSRadialExtent || (CSSRadialExtent = {}));
  2723. var image = {
  2724. name: "image",
  2725. parse: function(value) {
  2726. if (value.type === TokenType.URL_TOKEN) {
  2727. var image_1 = { url: value.value, type: CSSImageType.URL };
  2728. CacheStorage.getInstance().addImage(value.value);
  2729. return image_1;
  2730. }
  2731. if (value.type === TokenType.FUNCTION) {
  2732. var imageFunction = SUPPORTED_IMAGE_FUNCTIONS[value.name];
  2733. if (typeof imageFunction === "undefined") {
  2734. throw new Error('Attempting to parse an unsupported image function "' + value.name + '"');
  2735. }
  2736. return imageFunction(value.values);
  2737. }
  2738. throw new Error("Unsupported image type");
  2739. }
  2740. };
  2741. function isSupportedImage(value) {
  2742. return value.type !== TokenType.FUNCTION || SUPPORTED_IMAGE_FUNCTIONS[value.name];
  2743. }
  2744. var SUPPORTED_IMAGE_FUNCTIONS = {
  2745. "linear-gradient": linearGradient,
  2746. "-moz-linear-gradient": prefixLinearGradient,
  2747. "-ms-linear-gradient": prefixLinearGradient,
  2748. "-o-linear-gradient": prefixLinearGradient,
  2749. "-webkit-linear-gradient": prefixLinearGradient,
  2750. "radial-gradient": radialGradient,
  2751. "-moz-radial-gradient": prefixRadialGradient,
  2752. "-ms-radial-gradient": prefixRadialGradient,
  2753. "-o-radial-gradient": prefixRadialGradient,
  2754. "-webkit-radial-gradient": prefixRadialGradient,
  2755. "-webkit-gradient": webkitGradient
  2756. };
  2757. var backgroundImage = {
  2758. name: "background-image",
  2759. initialValue: "none",
  2760. type: PropertyDescriptorParsingType.LIST,
  2761. prefix: false,
  2762. parse: function(tokens) {
  2763. if (tokens.length === 0) {
  2764. return [];
  2765. }
  2766. var first = tokens[0];
  2767. if (first.type === TokenType.IDENT_TOKEN && first.value === "none") {
  2768. return [];
  2769. }
  2770. return tokens.filter(function(value) {
  2771. return nonFunctionArgSeparator(value) && isSupportedImage(value);
  2772. }).map(image.parse);
  2773. }
  2774. };
  2775. var backgroundOrigin = {
  2776. name: "background-origin",
  2777. initialValue: "border-box",
  2778. prefix: false,
  2779. type: PropertyDescriptorParsingType.LIST,
  2780. parse: function(tokens) {
  2781. return tokens.map(function(token) {
  2782. if (isIdentToken(token)) {
  2783. switch (token.value) {
  2784. case "padding-box":
  2785. return 1;
  2786. case "content-box":
  2787. return 2;
  2788. }
  2789. }
  2790. return 0;
  2791. });
  2792. }
  2793. };
  2794. var backgroundPosition = {
  2795. name: "background-position",
  2796. initialValue: "0% 0%",
  2797. type: PropertyDescriptorParsingType.LIST,
  2798. prefix: false,
  2799. parse: function(tokens) {
  2800. return parseFunctionArgs(tokens).map(function(values) {
  2801. return values.filter(isLengthPercentage);
  2802. }).map(parseLengthPercentageTuple);
  2803. }
  2804. };
  2805. var BACKGROUND_REPEAT;
  2806. (function(BACKGROUND_REPEAT2) {
  2807. BACKGROUND_REPEAT2[BACKGROUND_REPEAT2["REPEAT"] = 0] = "REPEAT";
  2808. BACKGROUND_REPEAT2[BACKGROUND_REPEAT2["NO_REPEAT"] = 1] = "NO_REPEAT";
  2809. BACKGROUND_REPEAT2[BACKGROUND_REPEAT2["REPEAT_X"] = 2] = "REPEAT_X";
  2810. BACKGROUND_REPEAT2[BACKGROUND_REPEAT2["REPEAT_Y"] = 3] = "REPEAT_Y";
  2811. })(BACKGROUND_REPEAT || (BACKGROUND_REPEAT = {}));
  2812. var backgroundRepeat = {
  2813. name: "background-repeat",
  2814. initialValue: "repeat",
  2815. prefix: false,
  2816. type: PropertyDescriptorParsingType.LIST,
  2817. parse: function(tokens) {
  2818. return parseFunctionArgs(tokens).map(function(values) {
  2819. return values.filter(isIdentToken).map(function(token) {
  2820. return token.value;
  2821. }).join(" ");
  2822. }).map(parseBackgroundRepeat);
  2823. }
  2824. };
  2825. var parseBackgroundRepeat = function(value) {
  2826. switch (value) {
  2827. case "no-repeat":
  2828. return BACKGROUND_REPEAT.NO_REPEAT;
  2829. case "repeat-x":
  2830. case "repeat no-repeat":
  2831. return BACKGROUND_REPEAT.REPEAT_X;
  2832. case "repeat-y":
  2833. case "no-repeat repeat":
  2834. return BACKGROUND_REPEAT.REPEAT_Y;
  2835. case "repeat":
  2836. default:
  2837. return BACKGROUND_REPEAT.REPEAT;
  2838. }
  2839. };
  2840. var BACKGROUND_SIZE;
  2841. (function(BACKGROUND_SIZE2) {
  2842. BACKGROUND_SIZE2["AUTO"] = "auto";
  2843. BACKGROUND_SIZE2["CONTAIN"] = "contain";
  2844. BACKGROUND_SIZE2["COVER"] = "cover";
  2845. })(BACKGROUND_SIZE || (BACKGROUND_SIZE = {}));
  2846. var backgroundSize = {
  2847. name: "background-size",
  2848. initialValue: "0",
  2849. prefix: false,
  2850. type: PropertyDescriptorParsingType.LIST,
  2851. parse: function(tokens) {
  2852. return parseFunctionArgs(tokens).map(function(values) {
  2853. return values.filter(isBackgroundSizeInfoToken);
  2854. });
  2855. }
  2856. };
  2857. var isBackgroundSizeInfoToken = function(value) {
  2858. return isIdentToken(value) || isLengthPercentage(value);
  2859. };
  2860. var borderColorForSide = function(side) {
  2861. return {
  2862. name: "border-" + side + "-color",
  2863. initialValue: "transparent",
  2864. prefix: false,
  2865. type: PropertyDescriptorParsingType.TYPE_VALUE,
  2866. format: "color"
  2867. };
  2868. };
  2869. var borderTopColor = borderColorForSide("top");
  2870. var borderRightColor = borderColorForSide("right");
  2871. var borderBottomColor = borderColorForSide("bottom");
  2872. var borderLeftColor = borderColorForSide("left");
  2873. var borderRadiusForSide = function(side) {
  2874. return {
  2875. name: "border-radius-" + side,
  2876. initialValue: "0 0",
  2877. prefix: false,
  2878. type: PropertyDescriptorParsingType.LIST,
  2879. parse: function(tokens) {
  2880. return parseLengthPercentageTuple(tokens.filter(isLengthPercentage));
  2881. }
  2882. };
  2883. };
  2884. var borderTopLeftRadius = borderRadiusForSide("top-left");
  2885. var borderTopRightRadius = borderRadiusForSide("top-right");
  2886. var borderBottomRightRadius = borderRadiusForSide("bottom-right");
  2887. var borderBottomLeftRadius = borderRadiusForSide("bottom-left");
  2888. var BORDER_STYLE;
  2889. (function(BORDER_STYLE2) {
  2890. BORDER_STYLE2[BORDER_STYLE2["NONE"] = 0] = "NONE";
  2891. BORDER_STYLE2[BORDER_STYLE2["SOLID"] = 1] = "SOLID";
  2892. })(BORDER_STYLE || (BORDER_STYLE = {}));
  2893. var borderStyleForSide = function(side) {
  2894. return {
  2895. name: "border-" + side + "-style",
  2896. initialValue: "solid",
  2897. prefix: false,
  2898. type: PropertyDescriptorParsingType.IDENT_VALUE,
  2899. parse: function(style) {
  2900. switch (style) {
  2901. case "none":
  2902. return BORDER_STYLE.NONE;
  2903. }
  2904. return BORDER_STYLE.SOLID;
  2905. }
  2906. };
  2907. };
  2908. var borderTopStyle = borderStyleForSide("top");
  2909. var borderRightStyle = borderStyleForSide("right");
  2910. var borderBottomStyle = borderStyleForSide("bottom");
  2911. var borderLeftStyle = borderStyleForSide("left");
  2912. var borderWidthForSide = function(side) {
  2913. return {
  2914. name: "border-" + side + "-width",
  2915. initialValue: "0",
  2916. type: PropertyDescriptorParsingType.VALUE,
  2917. prefix: false,
  2918. parse: function(token) {
  2919. if (isDimensionToken(token)) {
  2920. return token.number;
  2921. }
  2922. return 0;
  2923. }
  2924. };
  2925. };
  2926. var borderTopWidth = borderWidthForSide("top");
  2927. var borderRightWidth = borderWidthForSide("right");
  2928. var borderBottomWidth = borderWidthForSide("bottom");
  2929. var borderLeftWidth = borderWidthForSide("left");
  2930. var color$1 = {
  2931. name: "color",
  2932. initialValue: "transparent",
  2933. prefix: false,
  2934. type: PropertyDescriptorParsingType.TYPE_VALUE,
  2935. format: "color"
  2936. };
  2937. var display = {
  2938. name: "display",
  2939. initialValue: "inline-block",
  2940. prefix: false,
  2941. type: PropertyDescriptorParsingType.LIST,
  2942. parse: function(tokens) {
  2943. return tokens.filter(isIdentToken).reduce(
  2944. function(bit, token) {
  2945. return bit | parseDisplayValue(token.value);
  2946. },
  2947. 0
  2948. /* NONE */
  2949. );
  2950. }
  2951. };
  2952. var parseDisplayValue = function(display2) {
  2953. switch (display2) {
  2954. case "block":
  2955. return 2;
  2956. case "inline":
  2957. return 4;
  2958. case "run-in":
  2959. return 8;
  2960. case "flow":
  2961. return 16;
  2962. case "flow-root":
  2963. return 32;
  2964. case "table":
  2965. return 64;
  2966. case "flex":
  2967. case "-webkit-flex":
  2968. return 128;
  2969. case "grid":
  2970. case "-ms-grid":
  2971. return 256;
  2972. case "ruby":
  2973. return 512;
  2974. case "subgrid":
  2975. return 1024;
  2976. case "list-item":
  2977. return 2048;
  2978. case "table-row-group":
  2979. return 4096;
  2980. case "table-header-group":
  2981. return 8192;
  2982. case "table-footer-group":
  2983. return 16384;
  2984. case "table-row":
  2985. return 32768;
  2986. case "table-cell":
  2987. return 65536;
  2988. case "table-column-group":
  2989. return 131072;
  2990. case "table-column":
  2991. return 262144;
  2992. case "table-caption":
  2993. return 524288;
  2994. case "ruby-base":
  2995. return 1048576;
  2996. case "ruby-text":
  2997. return 2097152;
  2998. case "ruby-base-container":
  2999. return 4194304;
  3000. case "ruby-text-container":
  3001. return 8388608;
  3002. case "contents":
  3003. return 16777216;
  3004. case "inline-block":
  3005. return 33554432;
  3006. case "inline-list-item":
  3007. return 67108864;
  3008. case "inline-table":
  3009. return 134217728;
  3010. case "inline-flex":
  3011. return 268435456;
  3012. case "inline-grid":
  3013. return 536870912;
  3014. }
  3015. return 0;
  3016. };
  3017. var FLOAT;
  3018. (function(FLOAT2) {
  3019. FLOAT2[FLOAT2["NONE"] = 0] = "NONE";
  3020. FLOAT2[FLOAT2["LEFT"] = 1] = "LEFT";
  3021. FLOAT2[FLOAT2["RIGHT"] = 2] = "RIGHT";
  3022. FLOAT2[FLOAT2["INLINE_START"] = 3] = "INLINE_START";
  3023. FLOAT2[FLOAT2["INLINE_END"] = 4] = "INLINE_END";
  3024. })(FLOAT || (FLOAT = {}));
  3025. var float = {
  3026. name: "float",
  3027. initialValue: "none",
  3028. prefix: false,
  3029. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3030. parse: function(float2) {
  3031. switch (float2) {
  3032. case "left":
  3033. return FLOAT.LEFT;
  3034. case "right":
  3035. return FLOAT.RIGHT;
  3036. case "inline-start":
  3037. return FLOAT.INLINE_START;
  3038. case "inline-end":
  3039. return FLOAT.INLINE_END;
  3040. }
  3041. return FLOAT.NONE;
  3042. }
  3043. };
  3044. var letterSpacing = {
  3045. name: "letter-spacing",
  3046. initialValue: "0",
  3047. prefix: false,
  3048. type: PropertyDescriptorParsingType.VALUE,
  3049. parse: function(token) {
  3050. if (token.type === TokenType.IDENT_TOKEN && token.value === "normal") {
  3051. return 0;
  3052. }
  3053. if (token.type === TokenType.NUMBER_TOKEN) {
  3054. return token.number;
  3055. }
  3056. if (token.type === TokenType.DIMENSION_TOKEN) {
  3057. return token.number;
  3058. }
  3059. return 0;
  3060. }
  3061. };
  3062. var LINE_BREAK;
  3063. (function(LINE_BREAK2) {
  3064. LINE_BREAK2["NORMAL"] = "normal";
  3065. LINE_BREAK2["STRICT"] = "strict";
  3066. })(LINE_BREAK || (LINE_BREAK = {}));
  3067. var lineBreak = {
  3068. name: "line-break",
  3069. initialValue: "normal",
  3070. prefix: false,
  3071. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3072. parse: function(lineBreak2) {
  3073. switch (lineBreak2) {
  3074. case "strict":
  3075. return LINE_BREAK.STRICT;
  3076. case "normal":
  3077. default:
  3078. return LINE_BREAK.NORMAL;
  3079. }
  3080. }
  3081. };
  3082. var lineHeight = {
  3083. name: "line-height",
  3084. initialValue: "normal",
  3085. prefix: false,
  3086. type: PropertyDescriptorParsingType.TOKEN_VALUE
  3087. };
  3088. var computeLineHeight = function(token, fontSize2) {
  3089. if (isIdentToken(token) && token.value === "normal") {
  3090. return 1.2 * fontSize2;
  3091. } else if (token.type === TokenType.NUMBER_TOKEN) {
  3092. return fontSize2 * token.number;
  3093. } else if (isLengthPercentage(token)) {
  3094. return getAbsoluteValue(token, fontSize2);
  3095. }
  3096. return fontSize2;
  3097. };
  3098. var listStyleImage = {
  3099. name: "list-style-image",
  3100. initialValue: "none",
  3101. type: PropertyDescriptorParsingType.VALUE,
  3102. prefix: false,
  3103. parse: function(token) {
  3104. if (token.type === TokenType.IDENT_TOKEN && token.value === "none") {
  3105. return null;
  3106. }
  3107. return image.parse(token);
  3108. }
  3109. };
  3110. var LIST_STYLE_POSITION;
  3111. (function(LIST_STYLE_POSITION2) {
  3112. LIST_STYLE_POSITION2[LIST_STYLE_POSITION2["INSIDE"] = 0] = "INSIDE";
  3113. LIST_STYLE_POSITION2[LIST_STYLE_POSITION2["OUTSIDE"] = 1] = "OUTSIDE";
  3114. })(LIST_STYLE_POSITION || (LIST_STYLE_POSITION = {}));
  3115. var listStylePosition = {
  3116. name: "list-style-position",
  3117. initialValue: "outside",
  3118. prefix: false,
  3119. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3120. parse: function(position2) {
  3121. switch (position2) {
  3122. case "inside":
  3123. return LIST_STYLE_POSITION.INSIDE;
  3124. case "outside":
  3125. default:
  3126. return LIST_STYLE_POSITION.OUTSIDE;
  3127. }
  3128. }
  3129. };
  3130. var LIST_STYLE_TYPE;
  3131. (function(LIST_STYLE_TYPE2) {
  3132. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["NONE"] = -1] = "NONE";
  3133. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DISC"] = 0] = "DISC";
  3134. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CIRCLE"] = 1] = "CIRCLE";
  3135. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["SQUARE"] = 2] = "SQUARE";
  3136. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DECIMAL"] = 3] = "DECIMAL";
  3137. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CJK_DECIMAL"] = 4] = "CJK_DECIMAL";
  3138. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DECIMAL_LEADING_ZERO"] = 5] = "DECIMAL_LEADING_ZERO";
  3139. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["LOWER_ROMAN"] = 6] = "LOWER_ROMAN";
  3140. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["UPPER_ROMAN"] = 7] = "UPPER_ROMAN";
  3141. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["LOWER_GREEK"] = 8] = "LOWER_GREEK";
  3142. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["LOWER_ALPHA"] = 9] = "LOWER_ALPHA";
  3143. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["UPPER_ALPHA"] = 10] = "UPPER_ALPHA";
  3144. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["ARABIC_INDIC"] = 11] = "ARABIC_INDIC";
  3145. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["ARMENIAN"] = 12] = "ARMENIAN";
  3146. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["BENGALI"] = 13] = "BENGALI";
  3147. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CAMBODIAN"] = 14] = "CAMBODIAN";
  3148. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CJK_EARTHLY_BRANCH"] = 15] = "CJK_EARTHLY_BRANCH";
  3149. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CJK_HEAVENLY_STEM"] = 16] = "CJK_HEAVENLY_STEM";
  3150. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["CJK_IDEOGRAPHIC"] = 17] = "CJK_IDEOGRAPHIC";
  3151. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DEVANAGARI"] = 18] = "DEVANAGARI";
  3152. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["ETHIOPIC_NUMERIC"] = 19] = "ETHIOPIC_NUMERIC";
  3153. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["GEORGIAN"] = 20] = "GEORGIAN";
  3154. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["GUJARATI"] = 21] = "GUJARATI";
  3155. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["GURMUKHI"] = 22] = "GURMUKHI";
  3156. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["HEBREW"] = 22] = "HEBREW";
  3157. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["HIRAGANA"] = 23] = "HIRAGANA";
  3158. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["HIRAGANA_IROHA"] = 24] = "HIRAGANA_IROHA";
  3159. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["JAPANESE_FORMAL"] = 25] = "JAPANESE_FORMAL";
  3160. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["JAPANESE_INFORMAL"] = 26] = "JAPANESE_INFORMAL";
  3161. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KANNADA"] = 27] = "KANNADA";
  3162. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KATAKANA"] = 28] = "KATAKANA";
  3163. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KATAKANA_IROHA"] = 29] = "KATAKANA_IROHA";
  3164. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KHMER"] = 30] = "KHMER";
  3165. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KOREAN_HANGUL_FORMAL"] = 31] = "KOREAN_HANGUL_FORMAL";
  3166. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KOREAN_HANJA_FORMAL"] = 32] = "KOREAN_HANJA_FORMAL";
  3167. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["KOREAN_HANJA_INFORMAL"] = 33] = "KOREAN_HANJA_INFORMAL";
  3168. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["LAO"] = 34] = "LAO";
  3169. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["LOWER_ARMENIAN"] = 35] = "LOWER_ARMENIAN";
  3170. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["MALAYALAM"] = 36] = "MALAYALAM";
  3171. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["MONGOLIAN"] = 37] = "MONGOLIAN";
  3172. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["MYANMAR"] = 38] = "MYANMAR";
  3173. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["ORIYA"] = 39] = "ORIYA";
  3174. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["PERSIAN"] = 40] = "PERSIAN";
  3175. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["SIMP_CHINESE_FORMAL"] = 41] = "SIMP_CHINESE_FORMAL";
  3176. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["SIMP_CHINESE_INFORMAL"] = 42] = "SIMP_CHINESE_INFORMAL";
  3177. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["TAMIL"] = 43] = "TAMIL";
  3178. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["TELUGU"] = 44] = "TELUGU";
  3179. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["THAI"] = 45] = "THAI";
  3180. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["TIBETAN"] = 46] = "TIBETAN";
  3181. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["TRAD_CHINESE_FORMAL"] = 47] = "TRAD_CHINESE_FORMAL";
  3182. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["TRAD_CHINESE_INFORMAL"] = 48] = "TRAD_CHINESE_INFORMAL";
  3183. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["UPPER_ARMENIAN"] = 49] = "UPPER_ARMENIAN";
  3184. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DISCLOSURE_OPEN"] = 50] = "DISCLOSURE_OPEN";
  3185. LIST_STYLE_TYPE2[LIST_STYLE_TYPE2["DISCLOSURE_CLOSED"] = 51] = "DISCLOSURE_CLOSED";
  3186. })(LIST_STYLE_TYPE || (LIST_STYLE_TYPE = {}));
  3187. var listStyleType = {
  3188. name: "list-style-type",
  3189. initialValue: "none",
  3190. prefix: false,
  3191. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3192. parse: function(type) {
  3193. switch (type) {
  3194. case "disc":
  3195. return LIST_STYLE_TYPE.DISC;
  3196. case "circle":
  3197. return LIST_STYLE_TYPE.CIRCLE;
  3198. case "square":
  3199. return LIST_STYLE_TYPE.SQUARE;
  3200. case "decimal":
  3201. return LIST_STYLE_TYPE.DECIMAL;
  3202. case "cjk-decimal":
  3203. return LIST_STYLE_TYPE.CJK_DECIMAL;
  3204. case "decimal-leading-zero":
  3205. return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;
  3206. case "lower-roman":
  3207. return LIST_STYLE_TYPE.LOWER_ROMAN;
  3208. case "upper-roman":
  3209. return LIST_STYLE_TYPE.UPPER_ROMAN;
  3210. case "lower-greek":
  3211. return LIST_STYLE_TYPE.LOWER_GREEK;
  3212. case "lower-alpha":
  3213. return LIST_STYLE_TYPE.LOWER_ALPHA;
  3214. case "upper-alpha":
  3215. return LIST_STYLE_TYPE.UPPER_ALPHA;
  3216. case "arabic-indic":
  3217. return LIST_STYLE_TYPE.ARABIC_INDIC;
  3218. case "armenian":
  3219. return LIST_STYLE_TYPE.ARMENIAN;
  3220. case "bengali":
  3221. return LIST_STYLE_TYPE.BENGALI;
  3222. case "cambodian":
  3223. return LIST_STYLE_TYPE.CAMBODIAN;
  3224. case "cjk-earthly-branch":
  3225. return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;
  3226. case "cjk-heavenly-stem":
  3227. return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;
  3228. case "cjk-ideographic":
  3229. return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;
  3230. case "devanagari":
  3231. return LIST_STYLE_TYPE.DEVANAGARI;
  3232. case "ethiopic-numeric":
  3233. return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;
  3234. case "georgian":
  3235. return LIST_STYLE_TYPE.GEORGIAN;
  3236. case "gujarati":
  3237. return LIST_STYLE_TYPE.GUJARATI;
  3238. case "gurmukhi":
  3239. return LIST_STYLE_TYPE.GURMUKHI;
  3240. case "hebrew":
  3241. return LIST_STYLE_TYPE.HEBREW;
  3242. case "hiragana":
  3243. return LIST_STYLE_TYPE.HIRAGANA;
  3244. case "hiragana-iroha":
  3245. return LIST_STYLE_TYPE.HIRAGANA_IROHA;
  3246. case "japanese-formal":
  3247. return LIST_STYLE_TYPE.JAPANESE_FORMAL;
  3248. case "japanese-informal":
  3249. return LIST_STYLE_TYPE.JAPANESE_INFORMAL;
  3250. case "kannada":
  3251. return LIST_STYLE_TYPE.KANNADA;
  3252. case "katakana":
  3253. return LIST_STYLE_TYPE.KATAKANA;
  3254. case "katakana-iroha":
  3255. return LIST_STYLE_TYPE.KATAKANA_IROHA;
  3256. case "khmer":
  3257. return LIST_STYLE_TYPE.KHMER;
  3258. case "korean-hangul-formal":
  3259. return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;
  3260. case "korean-hanja-formal":
  3261. return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;
  3262. case "korean-hanja-informal":
  3263. return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;
  3264. case "lao":
  3265. return LIST_STYLE_TYPE.LAO;
  3266. case "lower-armenian":
  3267. return LIST_STYLE_TYPE.LOWER_ARMENIAN;
  3268. case "malayalam":
  3269. return LIST_STYLE_TYPE.MALAYALAM;
  3270. case "mongolian":
  3271. return LIST_STYLE_TYPE.MONGOLIAN;
  3272. case "myanmar":
  3273. return LIST_STYLE_TYPE.MYANMAR;
  3274. case "oriya":
  3275. return LIST_STYLE_TYPE.ORIYA;
  3276. case "persian":
  3277. return LIST_STYLE_TYPE.PERSIAN;
  3278. case "simp-chinese-formal":
  3279. return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;
  3280. case "simp-chinese-informal":
  3281. return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;
  3282. case "tamil":
  3283. return LIST_STYLE_TYPE.TAMIL;
  3284. case "telugu":
  3285. return LIST_STYLE_TYPE.TELUGU;
  3286. case "thai":
  3287. return LIST_STYLE_TYPE.THAI;
  3288. case "tibetan":
  3289. return LIST_STYLE_TYPE.TIBETAN;
  3290. case "trad-chinese-formal":
  3291. return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;
  3292. case "trad-chinese-informal":
  3293. return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;
  3294. case "upper-armenian":
  3295. return LIST_STYLE_TYPE.UPPER_ARMENIAN;
  3296. case "disclosure-open":
  3297. return LIST_STYLE_TYPE.DISCLOSURE_OPEN;
  3298. case "disclosure-closed":
  3299. return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;
  3300. case "none":
  3301. default:
  3302. return LIST_STYLE_TYPE.NONE;
  3303. }
  3304. }
  3305. };
  3306. var marginForSide = function(side) {
  3307. return {
  3308. name: "margin-" + side,
  3309. initialValue: "0",
  3310. prefix: false,
  3311. type: PropertyDescriptorParsingType.TOKEN_VALUE
  3312. };
  3313. };
  3314. var marginTop = marginForSide("top");
  3315. var marginRight = marginForSide("right");
  3316. var marginBottom = marginForSide("bottom");
  3317. var marginLeft = marginForSide("left");
  3318. var OVERFLOW;
  3319. (function(OVERFLOW2) {
  3320. OVERFLOW2[OVERFLOW2["VISIBLE"] = 0] = "VISIBLE";
  3321. OVERFLOW2[OVERFLOW2["HIDDEN"] = 1] = "HIDDEN";
  3322. OVERFLOW2[OVERFLOW2["SCROLL"] = 2] = "SCROLL";
  3323. OVERFLOW2[OVERFLOW2["AUTO"] = 3] = "AUTO";
  3324. })(OVERFLOW || (OVERFLOW = {}));
  3325. var overflow = {
  3326. name: "overflow",
  3327. initialValue: "visible",
  3328. prefix: false,
  3329. type: PropertyDescriptorParsingType.LIST,
  3330. parse: function(tokens) {
  3331. return tokens.filter(isIdentToken).map(function(overflow2) {
  3332. switch (overflow2.value) {
  3333. case "hidden":
  3334. return OVERFLOW.HIDDEN;
  3335. case "scroll":
  3336. return OVERFLOW.SCROLL;
  3337. case "auto":
  3338. return OVERFLOW.AUTO;
  3339. case "visible":
  3340. default:
  3341. return OVERFLOW.VISIBLE;
  3342. }
  3343. });
  3344. }
  3345. };
  3346. var OVERFLOW_WRAP;
  3347. (function(OVERFLOW_WRAP2) {
  3348. OVERFLOW_WRAP2["NORMAL"] = "normal";
  3349. OVERFLOW_WRAP2["BREAK_WORD"] = "break-word";
  3350. })(OVERFLOW_WRAP || (OVERFLOW_WRAP = {}));
  3351. var overflowWrap = {
  3352. name: "overflow-wrap",
  3353. initialValue: "normal",
  3354. prefix: false,
  3355. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3356. parse: function(overflow2) {
  3357. switch (overflow2) {
  3358. case "break-word":
  3359. return OVERFLOW_WRAP.BREAK_WORD;
  3360. case "normal":
  3361. default:
  3362. return OVERFLOW_WRAP.NORMAL;
  3363. }
  3364. }
  3365. };
  3366. var paddingForSide = function(side) {
  3367. return {
  3368. name: "padding-" + side,
  3369. initialValue: "0",
  3370. prefix: false,
  3371. type: PropertyDescriptorParsingType.TYPE_VALUE,
  3372. format: "length-percentage"
  3373. };
  3374. };
  3375. var paddingTop = paddingForSide("top");
  3376. var paddingRight = paddingForSide("right");
  3377. var paddingBottom = paddingForSide("bottom");
  3378. var paddingLeft = paddingForSide("left");
  3379. var TEXT_ALIGN;
  3380. (function(TEXT_ALIGN2) {
  3381. TEXT_ALIGN2[TEXT_ALIGN2["LEFT"] = 0] = "LEFT";
  3382. TEXT_ALIGN2[TEXT_ALIGN2["CENTER"] = 1] = "CENTER";
  3383. TEXT_ALIGN2[TEXT_ALIGN2["RIGHT"] = 2] = "RIGHT";
  3384. })(TEXT_ALIGN || (TEXT_ALIGN = {}));
  3385. var textAlign = {
  3386. name: "text-align",
  3387. initialValue: "left",
  3388. prefix: false,
  3389. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3390. parse: function(textAlign2) {
  3391. switch (textAlign2) {
  3392. case "right":
  3393. return TEXT_ALIGN.RIGHT;
  3394. case "center":
  3395. case "justify":
  3396. return TEXT_ALIGN.CENTER;
  3397. case "left":
  3398. default:
  3399. return TEXT_ALIGN.LEFT;
  3400. }
  3401. }
  3402. };
  3403. var POSITION;
  3404. (function(POSITION2) {
  3405. POSITION2[POSITION2["STATIC"] = 0] = "STATIC";
  3406. POSITION2[POSITION2["RELATIVE"] = 1] = "RELATIVE";
  3407. POSITION2[POSITION2["ABSOLUTE"] = 2] = "ABSOLUTE";
  3408. POSITION2[POSITION2["FIXED"] = 3] = "FIXED";
  3409. POSITION2[POSITION2["STICKY"] = 4] = "STICKY";
  3410. })(POSITION || (POSITION = {}));
  3411. var position = {
  3412. name: "position",
  3413. initialValue: "static",
  3414. prefix: false,
  3415. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3416. parse: function(position2) {
  3417. switch (position2) {
  3418. case "relative":
  3419. return POSITION.RELATIVE;
  3420. case "absolute":
  3421. return POSITION.ABSOLUTE;
  3422. case "fixed":
  3423. return POSITION.FIXED;
  3424. case "sticky":
  3425. return POSITION.STICKY;
  3426. }
  3427. return POSITION.STATIC;
  3428. }
  3429. };
  3430. var textShadow = {
  3431. name: "text-shadow",
  3432. initialValue: "none",
  3433. type: PropertyDescriptorParsingType.LIST,
  3434. prefix: false,
  3435. parse: function(tokens) {
  3436. if (tokens.length === 1 && isIdentWithValue(tokens[0], "none")) {
  3437. return [];
  3438. }
  3439. return parseFunctionArgs(tokens).map(function(values) {
  3440. var shadow = {
  3441. color: COLORS.TRANSPARENT,
  3442. offsetX: ZERO_LENGTH,
  3443. offsetY: ZERO_LENGTH,
  3444. blur: ZERO_LENGTH
  3445. };
  3446. var c = 0;
  3447. for (var i = 0; i < values.length; i++) {
  3448. var token = values[i];
  3449. if (isLength(token)) {
  3450. if (c === 0) {
  3451. shadow.offsetX = token;
  3452. } else if (c === 1) {
  3453. shadow.offsetY = token;
  3454. } else {
  3455. shadow.blur = token;
  3456. }
  3457. c++;
  3458. } else {
  3459. shadow.color = color.parse(token);
  3460. }
  3461. }
  3462. return shadow;
  3463. });
  3464. }
  3465. };
  3466. var TEXT_TRANSFORM;
  3467. (function(TEXT_TRANSFORM2) {
  3468. TEXT_TRANSFORM2[TEXT_TRANSFORM2["NONE"] = 0] = "NONE";
  3469. TEXT_TRANSFORM2[TEXT_TRANSFORM2["LOWERCASE"] = 1] = "LOWERCASE";
  3470. TEXT_TRANSFORM2[TEXT_TRANSFORM2["UPPERCASE"] = 2] = "UPPERCASE";
  3471. TEXT_TRANSFORM2[TEXT_TRANSFORM2["CAPITALIZE"] = 3] = "CAPITALIZE";
  3472. })(TEXT_TRANSFORM || (TEXT_TRANSFORM = {}));
  3473. var textTransform = {
  3474. name: "text-transform",
  3475. initialValue: "none",
  3476. prefix: false,
  3477. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3478. parse: function(textTransform2) {
  3479. switch (textTransform2) {
  3480. case "uppercase":
  3481. return TEXT_TRANSFORM.UPPERCASE;
  3482. case "lowercase":
  3483. return TEXT_TRANSFORM.LOWERCASE;
  3484. case "capitalize":
  3485. return TEXT_TRANSFORM.CAPITALIZE;
  3486. }
  3487. return TEXT_TRANSFORM.NONE;
  3488. }
  3489. };
  3490. var transform = {
  3491. name: "transform",
  3492. initialValue: "none",
  3493. prefix: true,
  3494. type: PropertyDescriptorParsingType.VALUE,
  3495. parse: function(token) {
  3496. if (token.type === TokenType.IDENT_TOKEN && token.value === "none") {
  3497. return null;
  3498. }
  3499. if (token.type === TokenType.FUNCTION) {
  3500. var transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
  3501. if (typeof transformFunction === "undefined") {
  3502. throw new Error('Attempting to parse an unsupported transform function "' + token.name + '"');
  3503. }
  3504. return transformFunction(token.values);
  3505. }
  3506. return null;
  3507. }
  3508. };
  3509. var matrix = function(args) {
  3510. var values = args.filter(function(arg) {
  3511. return arg.type === TokenType.NUMBER_TOKEN;
  3512. }).map(function(arg) {
  3513. return arg.number;
  3514. });
  3515. return values.length === 6 ? values : null;
  3516. };
  3517. var matrix3d = function(args) {
  3518. var values = args.filter(function(arg) {
  3519. return arg.type === TokenType.NUMBER_TOKEN;
  3520. }).map(function(arg) {
  3521. return arg.number;
  3522. });
  3523. 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];
  3524. return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
  3525. };
  3526. var SUPPORTED_TRANSFORM_FUNCTIONS = {
  3527. matrix,
  3528. matrix3d
  3529. };
  3530. var DEFAULT_VALUE = {
  3531. type: TokenType.PERCENTAGE_TOKEN,
  3532. number: 50,
  3533. flags: FLAG_INTEGER
  3534. };
  3535. var DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
  3536. var transformOrigin = {
  3537. name: "transform-origin",
  3538. initialValue: "50% 50%",
  3539. prefix: true,
  3540. type: PropertyDescriptorParsingType.LIST,
  3541. parse: function(tokens) {
  3542. var origins = tokens.filter(isLengthPercentage);
  3543. if (origins.length !== 2) {
  3544. return DEFAULT;
  3545. }
  3546. return [origins[0], origins[1]];
  3547. }
  3548. };
  3549. var VISIBILITY;
  3550. (function(VISIBILITY2) {
  3551. VISIBILITY2[VISIBILITY2["VISIBLE"] = 0] = "VISIBLE";
  3552. VISIBILITY2[VISIBILITY2["HIDDEN"] = 1] = "HIDDEN";
  3553. VISIBILITY2[VISIBILITY2["COLLAPSE"] = 2] = "COLLAPSE";
  3554. })(VISIBILITY || (VISIBILITY = {}));
  3555. var visibility = {
  3556. name: "visible",
  3557. initialValue: "none",
  3558. prefix: false,
  3559. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3560. parse: function(visibility2) {
  3561. switch (visibility2) {
  3562. case "hidden":
  3563. return VISIBILITY.HIDDEN;
  3564. case "collapse":
  3565. return VISIBILITY.COLLAPSE;
  3566. case "visible":
  3567. default:
  3568. return VISIBILITY.VISIBLE;
  3569. }
  3570. }
  3571. };
  3572. var WORD_BREAK;
  3573. (function(WORD_BREAK2) {
  3574. WORD_BREAK2["NORMAL"] = "normal";
  3575. WORD_BREAK2["BREAK_ALL"] = "break-all";
  3576. WORD_BREAK2["KEEP_ALL"] = "keep-all";
  3577. })(WORD_BREAK || (WORD_BREAK = {}));
  3578. var wordBreak = {
  3579. name: "word-break",
  3580. initialValue: "normal",
  3581. prefix: false,
  3582. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3583. parse: function(wordBreak2) {
  3584. switch (wordBreak2) {
  3585. case "break-all":
  3586. return WORD_BREAK.BREAK_ALL;
  3587. case "keep-all":
  3588. return WORD_BREAK.KEEP_ALL;
  3589. case "normal":
  3590. default:
  3591. return WORD_BREAK.NORMAL;
  3592. }
  3593. }
  3594. };
  3595. var zIndex = {
  3596. name: "z-index",
  3597. initialValue: "auto",
  3598. prefix: false,
  3599. type: PropertyDescriptorParsingType.VALUE,
  3600. parse: function(token) {
  3601. if (token.type === TokenType.IDENT_TOKEN) {
  3602. return { auto: true, order: 0 };
  3603. }
  3604. if (isNumberToken(token)) {
  3605. return { auto: false, order: token.number };
  3606. }
  3607. throw new Error("Invalid z-index number parsed");
  3608. }
  3609. };
  3610. var opacity = {
  3611. name: "opacity",
  3612. initialValue: "1",
  3613. type: PropertyDescriptorParsingType.VALUE,
  3614. prefix: false,
  3615. parse: function(token) {
  3616. if (isNumberToken(token)) {
  3617. return token.number;
  3618. }
  3619. return 1;
  3620. }
  3621. };
  3622. var textDecorationColor = {
  3623. name: "text-decoration-color",
  3624. initialValue: "transparent",
  3625. prefix: false,
  3626. type: PropertyDescriptorParsingType.TYPE_VALUE,
  3627. format: "color"
  3628. };
  3629. var textDecorationLine = {
  3630. name: "text-decoration-line",
  3631. initialValue: "none",
  3632. prefix: false,
  3633. type: PropertyDescriptorParsingType.LIST,
  3634. parse: function(tokens) {
  3635. return tokens.filter(isIdentToken).map(function(token) {
  3636. switch (token.value) {
  3637. case "underline":
  3638. return 1;
  3639. case "overline":
  3640. return 2;
  3641. case "line-through":
  3642. return 3;
  3643. case "none":
  3644. return 4;
  3645. }
  3646. return 0;
  3647. }).filter(function(line) {
  3648. return line !== 0;
  3649. });
  3650. }
  3651. };
  3652. var fontFamily = {
  3653. name: "font-family",
  3654. initialValue: "",
  3655. prefix: false,
  3656. type: PropertyDescriptorParsingType.LIST,
  3657. parse: function(tokens) {
  3658. return tokens.filter(isStringToken$1).map(function(token) {
  3659. return token.value;
  3660. });
  3661. }
  3662. };
  3663. var isStringToken$1 = function(token) {
  3664. return token.type === TokenType.STRING_TOKEN || token.type === TokenType.IDENT_TOKEN;
  3665. };
  3666. var fontSize = {
  3667. name: "font-size",
  3668. initialValue: "0",
  3669. prefix: false,
  3670. type: PropertyDescriptorParsingType.TYPE_VALUE,
  3671. format: "length"
  3672. };
  3673. var fontWeight = {
  3674. name: "font-weight",
  3675. initialValue: "normal",
  3676. type: PropertyDescriptorParsingType.VALUE,
  3677. prefix: false,
  3678. parse: function(token) {
  3679. if (isNumberToken(token)) {
  3680. return token.number;
  3681. }
  3682. if (isIdentToken(token)) {
  3683. switch (token.value) {
  3684. case "bold":
  3685. return 700;
  3686. case "normal":
  3687. default:
  3688. return 400;
  3689. }
  3690. }
  3691. return 400;
  3692. }
  3693. };
  3694. var fontVariant = {
  3695. name: "font-variant",
  3696. initialValue: "none",
  3697. type: PropertyDescriptorParsingType.LIST,
  3698. prefix: false,
  3699. parse: function(tokens) {
  3700. return tokens.filter(isIdentToken).map(function(token) {
  3701. return token.value;
  3702. });
  3703. }
  3704. };
  3705. var FONT_STYLE;
  3706. (function(FONT_STYLE2) {
  3707. FONT_STYLE2["NORMAL"] = "normal";
  3708. FONT_STYLE2["ITALIC"] = "italic";
  3709. FONT_STYLE2["OBLIQUE"] = "oblique";
  3710. })(FONT_STYLE || (FONT_STYLE = {}));
  3711. var fontStyle = {
  3712. name: "font-style",
  3713. initialValue: "normal",
  3714. prefix: false,
  3715. type: PropertyDescriptorParsingType.IDENT_VALUE,
  3716. parse: function(overflow2) {
  3717. switch (overflow2) {
  3718. case "oblique":
  3719. return FONT_STYLE.OBLIQUE;
  3720. case "italic":
  3721. return FONT_STYLE.ITALIC;
  3722. case "normal":
  3723. default:
  3724. return FONT_STYLE.NORMAL;
  3725. }
  3726. }
  3727. };
  3728. var contains = function(bit, value) {
  3729. return (bit & value) !== 0;
  3730. };
  3731. var content = {
  3732. name: "content",
  3733. initialValue: "none",
  3734. type: PropertyDescriptorParsingType.LIST,
  3735. prefix: false,
  3736. parse: function(tokens) {
  3737. if (tokens.length === 0) {
  3738. return [];
  3739. }
  3740. var first = tokens[0];
  3741. if (first.type === TokenType.IDENT_TOKEN && first.value === "none") {
  3742. return [];
  3743. }
  3744. return tokens;
  3745. }
  3746. };
  3747. var counterIncrement = {
  3748. name: "counter-increment",
  3749. initialValue: "none",
  3750. prefix: true,
  3751. type: PropertyDescriptorParsingType.LIST,
  3752. parse: function(tokens) {
  3753. if (tokens.length === 0) {
  3754. return null;
  3755. }
  3756. var first = tokens[0];
  3757. if (first.type === TokenType.IDENT_TOKEN && first.value === "none") {
  3758. return null;
  3759. }
  3760. var increments = [];
  3761. var filtered = tokens.filter(nonWhiteSpace);
  3762. for (var i = 0; i < filtered.length; i++) {
  3763. var counter = filtered[i];
  3764. var next = filtered[i + 1];
  3765. if (counter.type === TokenType.IDENT_TOKEN) {
  3766. var increment = next && isNumberToken(next) ? next.number : 1;
  3767. increments.push({ counter: counter.value, increment });
  3768. }
  3769. }
  3770. return increments;
  3771. }
  3772. };
  3773. var counterReset = {
  3774. name: "counter-reset",
  3775. initialValue: "none",
  3776. prefix: true,
  3777. type: PropertyDescriptorParsingType.LIST,
  3778. parse: function(tokens) {
  3779. if (tokens.length === 0) {
  3780. return [];
  3781. }
  3782. var resets = [];
  3783. var filtered = tokens.filter(nonWhiteSpace);
  3784. for (var i = 0; i < filtered.length; i++) {
  3785. var counter = filtered[i];
  3786. var next = filtered[i + 1];
  3787. if (isIdentToken(counter) && counter.value !== "none") {
  3788. var reset = next && isNumberToken(next) ? next.number : 0;
  3789. resets.push({ counter: counter.value, reset });
  3790. }
  3791. }
  3792. return resets;
  3793. }
  3794. };
  3795. var quotes = {
  3796. name: "quotes",
  3797. initialValue: "none",
  3798. prefix: true,
  3799. type: PropertyDescriptorParsingType.LIST,
  3800. parse: function(tokens) {
  3801. if (tokens.length === 0) {
  3802. return null;
  3803. }
  3804. var first = tokens[0];
  3805. if (first.type === TokenType.IDENT_TOKEN && first.value === "none") {
  3806. return null;
  3807. }
  3808. var quotes2 = [];
  3809. var filtered = tokens.filter(isStringToken);
  3810. if (filtered.length % 2 !== 0) {
  3811. return null;
  3812. }
  3813. for (var i = 0; i < filtered.length; i += 2) {
  3814. var open_1 = filtered[i].value;
  3815. var close_1 = filtered[i + 1].value;
  3816. quotes2.push({ open: open_1, close: close_1 });
  3817. }
  3818. return quotes2;
  3819. }
  3820. };
  3821. var getQuote = function(quotes2, depth, open) {
  3822. if (!quotes2) {
  3823. return "";
  3824. }
  3825. var quote = quotes2[Math.min(depth, quotes2.length - 1)];
  3826. if (!quote) {
  3827. return "";
  3828. }
  3829. return open ? quote.open : quote.close;
  3830. };
  3831. var boxShadow = {
  3832. name: "box-shadow",
  3833. initialValue: "none",
  3834. type: PropertyDescriptorParsingType.LIST,
  3835. prefix: false,
  3836. parse: function(tokens) {
  3837. if (tokens.length === 1 && isIdentWithValue(tokens[0], "none")) {
  3838. return [];
  3839. }
  3840. return parseFunctionArgs(tokens).map(function(values) {
  3841. var shadow = {
  3842. color: 255,
  3843. offsetX: ZERO_LENGTH,
  3844. offsetY: ZERO_LENGTH,
  3845. blur: ZERO_LENGTH,
  3846. spread: ZERO_LENGTH,
  3847. inset: false
  3848. };
  3849. var c = 0;
  3850. for (var i = 0; i < values.length; i++) {
  3851. var token = values[i];
  3852. if (isIdentWithValue(token, "inset")) {
  3853. shadow.inset = true;
  3854. } else if (isLength(token)) {
  3855. if (c === 0) {
  3856. shadow.offsetX = token;
  3857. } else if (c === 1) {
  3858. shadow.offsetY = token;
  3859. } else if (c === 2) {
  3860. shadow.blur = token;
  3861. } else {
  3862. shadow.spread = token;
  3863. }
  3864. c++;
  3865. } else {
  3866. shadow.color = color.parse(token);
  3867. }
  3868. }
  3869. return shadow;
  3870. });
  3871. }
  3872. };
  3873. var CSSParsedDeclaration = (
  3874. /** @class */
  3875. function() {
  3876. function CSSParsedDeclaration2(declaration) {
  3877. this.backgroundClip = parse(backgroundClip, declaration.backgroundClip);
  3878. this.backgroundColor = parse(backgroundColor, declaration.backgroundColor);
  3879. this.backgroundImage = parse(backgroundImage, declaration.backgroundImage);
  3880. this.backgroundOrigin = parse(backgroundOrigin, declaration.backgroundOrigin);
  3881. this.backgroundPosition = parse(backgroundPosition, declaration.backgroundPosition);
  3882. this.backgroundRepeat = parse(backgroundRepeat, declaration.backgroundRepeat);
  3883. this.backgroundSize = parse(backgroundSize, declaration.backgroundSize);
  3884. this.borderTopColor = parse(borderTopColor, declaration.borderTopColor);
  3885. this.borderRightColor = parse(borderRightColor, declaration.borderRightColor);
  3886. this.borderBottomColor = parse(borderBottomColor, declaration.borderBottomColor);
  3887. this.borderLeftColor = parse(borderLeftColor, declaration.borderLeftColor);
  3888. this.borderTopLeftRadius = parse(borderTopLeftRadius, declaration.borderTopLeftRadius);
  3889. this.borderTopRightRadius = parse(borderTopRightRadius, declaration.borderTopRightRadius);
  3890. this.borderBottomRightRadius = parse(borderBottomRightRadius, declaration.borderBottomRightRadius);
  3891. this.borderBottomLeftRadius = parse(borderBottomLeftRadius, declaration.borderBottomLeftRadius);
  3892. this.borderTopStyle = parse(borderTopStyle, declaration.borderTopStyle);
  3893. this.borderRightStyle = parse(borderRightStyle, declaration.borderRightStyle);
  3894. this.borderBottomStyle = parse(borderBottomStyle, declaration.borderBottomStyle);
  3895. this.borderLeftStyle = parse(borderLeftStyle, declaration.borderLeftStyle);
  3896. this.borderTopWidth = parse(borderTopWidth, declaration.borderTopWidth);
  3897. this.borderRightWidth = parse(borderRightWidth, declaration.borderRightWidth);
  3898. this.borderBottomWidth = parse(borderBottomWidth, declaration.borderBottomWidth);
  3899. this.borderLeftWidth = parse(borderLeftWidth, declaration.borderLeftWidth);
  3900. this.boxShadow = parse(boxShadow, declaration.boxShadow);
  3901. this.color = parse(color$1, declaration.color);
  3902. this.display = parse(display, declaration.display);
  3903. this.float = parse(float, declaration.cssFloat);
  3904. this.fontFamily = parse(fontFamily, declaration.fontFamily);
  3905. this.fontSize = parse(fontSize, declaration.fontSize);
  3906. this.fontStyle = parse(fontStyle, declaration.fontStyle);
  3907. this.fontVariant = parse(fontVariant, declaration.fontVariant);
  3908. this.fontWeight = parse(fontWeight, declaration.fontWeight);
  3909. this.letterSpacing = parse(letterSpacing, declaration.letterSpacing);
  3910. this.lineBreak = parse(lineBreak, declaration.lineBreak);
  3911. this.lineHeight = parse(lineHeight, declaration.lineHeight);
  3912. this.listStyleImage = parse(listStyleImage, declaration.listStyleImage);
  3913. this.listStylePosition = parse(listStylePosition, declaration.listStylePosition);
  3914. this.listStyleType = parse(listStyleType, declaration.listStyleType);
  3915. this.marginTop = parse(marginTop, declaration.marginTop);
  3916. this.marginRight = parse(marginRight, declaration.marginRight);
  3917. this.marginBottom = parse(marginBottom, declaration.marginBottom);
  3918. this.marginLeft = parse(marginLeft, declaration.marginLeft);
  3919. this.opacity = parse(opacity, declaration.opacity);
  3920. var overflowTuple = parse(overflow, declaration.overflow);
  3921. this.overflowX = overflowTuple[0];
  3922. this.overflowY = overflowTuple[overflowTuple.length > 1 ? 1 : 0];
  3923. this.overflowWrap = parse(overflowWrap, declaration.overflowWrap);
  3924. this.paddingTop = parse(paddingTop, declaration.paddingTop);
  3925. this.paddingRight = parse(paddingRight, declaration.paddingRight);
  3926. this.paddingBottom = parse(paddingBottom, declaration.paddingBottom);
  3927. this.paddingLeft = parse(paddingLeft, declaration.paddingLeft);
  3928. this.position = parse(position, declaration.position);
  3929. this.textAlign = parse(textAlign, declaration.textAlign);
  3930. this.textDecorationColor = parse(textDecorationColor, declaration.textDecorationColor || declaration.color);
  3931. this.textDecorationLine = parse(textDecorationLine, declaration.textDecorationLine);
  3932. this.textShadow = parse(textShadow, declaration.textShadow);
  3933. this.textTransform = parse(textTransform, declaration.textTransform);
  3934. this.transform = parse(transform, declaration.transform);
  3935. this.transformOrigin = parse(transformOrigin, declaration.transformOrigin);
  3936. this.visibility = parse(visibility, declaration.visibility);
  3937. this.wordBreak = parse(wordBreak, declaration.wordBreak);
  3938. this.zIndex = parse(zIndex, declaration.zIndex);
  3939. }
  3940. CSSParsedDeclaration2.prototype.isVisible = function() {
  3941. return this.display > 0 && this.opacity > 0 && this.visibility === VISIBILITY.VISIBLE;
  3942. };
  3943. CSSParsedDeclaration2.prototype.isTransparent = function() {
  3944. return isTransparent(this.backgroundColor);
  3945. };
  3946. CSSParsedDeclaration2.prototype.isTransformed = function() {
  3947. return this.transform !== null;
  3948. };
  3949. CSSParsedDeclaration2.prototype.isPositioned = function() {
  3950. return this.position !== POSITION.STATIC;
  3951. };
  3952. CSSParsedDeclaration2.prototype.isPositionedWithZIndex = function() {
  3953. return this.isPositioned() && !this.zIndex.auto;
  3954. };
  3955. CSSParsedDeclaration2.prototype.isFloating = function() {
  3956. return this.float !== FLOAT.NONE;
  3957. };
  3958. CSSParsedDeclaration2.prototype.isInlineLevel = function() {
  3959. return contains(
  3960. this.display,
  3961. 4
  3962. /* INLINE */
  3963. ) || contains(
  3964. this.display,
  3965. 33554432
  3966. /* INLINE_BLOCK */
  3967. ) || contains(
  3968. this.display,
  3969. 268435456
  3970. /* INLINE_FLEX */
  3971. ) || contains(
  3972. this.display,
  3973. 536870912
  3974. /* INLINE_GRID */
  3975. ) || contains(
  3976. this.display,
  3977. 67108864
  3978. /* INLINE_LIST_ITEM */
  3979. ) || contains(
  3980. this.display,
  3981. 134217728
  3982. /* INLINE_TABLE */
  3983. );
  3984. };
  3985. return CSSParsedDeclaration2;
  3986. }()
  3987. );
  3988. var CSSParsedPseudoDeclaration = (
  3989. /** @class */
  3990. function() {
  3991. function CSSParsedPseudoDeclaration2(declaration) {
  3992. this.content = parse(content, declaration.content);
  3993. this.quotes = parse(quotes, declaration.quotes);
  3994. }
  3995. return CSSParsedPseudoDeclaration2;
  3996. }()
  3997. );
  3998. var CSSParsedCounterDeclaration = (
  3999. /** @class */
  4000. function() {
  4001. function CSSParsedCounterDeclaration2(declaration) {
  4002. this.counterIncrement = parse(counterIncrement, declaration.counterIncrement);
  4003. this.counterReset = parse(counterReset, declaration.counterReset);
  4004. }
  4005. return CSSParsedCounterDeclaration2;
  4006. }()
  4007. );
  4008. var parse = function(descriptor, style) {
  4009. var tokenizer = new Tokenizer();
  4010. var value = style !== null && typeof style !== "undefined" ? style.toString() : descriptor.initialValue;
  4011. tokenizer.write(value);
  4012. var parser = new Parser(tokenizer.read());
  4013. switch (descriptor.type) {
  4014. case PropertyDescriptorParsingType.IDENT_VALUE:
  4015. var token = parser.parseComponentValue();
  4016. return descriptor.parse(isIdentToken(token) ? token.value : descriptor.initialValue);
  4017. case PropertyDescriptorParsingType.VALUE:
  4018. return descriptor.parse(parser.parseComponentValue());
  4019. case PropertyDescriptorParsingType.LIST:
  4020. return descriptor.parse(parser.parseComponentValues());
  4021. case PropertyDescriptorParsingType.TOKEN_VALUE:
  4022. return parser.parseComponentValue();
  4023. case PropertyDescriptorParsingType.TYPE_VALUE:
  4024. switch (descriptor.format) {
  4025. case "angle":
  4026. return angle.parse(parser.parseComponentValue());
  4027. case "color":
  4028. return color.parse(parser.parseComponentValue());
  4029. case "image":
  4030. return image.parse(parser.parseComponentValue());
  4031. case "length":
  4032. var length_1 = parser.parseComponentValue();
  4033. return isLength(length_1) ? length_1 : ZERO_LENGTH;
  4034. case "length-percentage":
  4035. var value_1 = parser.parseComponentValue();
  4036. return isLengthPercentage(value_1) ? value_1 : ZERO_LENGTH;
  4037. }
  4038. }
  4039. throw new Error("Attempting to parse unsupported css format type " + descriptor.format);
  4040. };
  4041. var ElementContainer = (
  4042. /** @class */
  4043. function() {
  4044. function ElementContainer2(element) {
  4045. this.styles = new CSSParsedDeclaration(window.getComputedStyle(element, null));
  4046. this.textNodes = [];
  4047. this.elements = [];
  4048. if (this.styles.transform !== null && isHTMLElementNode(element)) {
  4049. element.style.transform = "none";
  4050. }
  4051. this.bounds = parseBounds(element);
  4052. this.flags = 0;
  4053. }
  4054. return ElementContainer2;
  4055. }()
  4056. );
  4057. var TextBounds = (
  4058. /** @class */
  4059. function() {
  4060. function TextBounds2(text, bounds) {
  4061. this.text = text;
  4062. this.bounds = bounds;
  4063. }
  4064. return TextBounds2;
  4065. }()
  4066. );
  4067. var parseTextBounds = function(value, styles, node) {
  4068. var textList = breakText(value, styles);
  4069. var textBounds = [];
  4070. var offset = 0;
  4071. textList.forEach(function(text) {
  4072. if (styles.textDecorationLine.length || text.trim().length > 0) {
  4073. if (FEATURES.SUPPORT_RANGE_BOUNDS) {
  4074. textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length)));
  4075. } else {
  4076. var replacementNode = node.splitText(text.length);
  4077. textBounds.push(new TextBounds(text, getWrapperBounds(node)));
  4078. node = replacementNode;
  4079. }
  4080. } else if (!FEATURES.SUPPORT_RANGE_BOUNDS) {
  4081. node = node.splitText(text.length);
  4082. }
  4083. offset += text.length;
  4084. });
  4085. return textBounds;
  4086. };
  4087. var getWrapperBounds = function(node) {
  4088. var ownerDocument = node.ownerDocument;
  4089. if (ownerDocument) {
  4090. var wrapper = ownerDocument.createElement("html2canvaswrapper");
  4091. wrapper.appendChild(node.cloneNode(true));
  4092. var parentNode = node.parentNode;
  4093. if (parentNode) {
  4094. parentNode.replaceChild(wrapper, node);
  4095. var bounds = parseBounds(wrapper);
  4096. if (wrapper.firstChild) {
  4097. parentNode.replaceChild(wrapper.firstChild, wrapper);
  4098. }
  4099. return bounds;
  4100. }
  4101. }
  4102. return new Bounds(0, 0, 0, 0);
  4103. };
  4104. var getRangeBounds = function(node, offset, length) {
  4105. var ownerDocument = node.ownerDocument;
  4106. if (!ownerDocument) {
  4107. throw new Error("Node has no owner document");
  4108. }
  4109. var range = ownerDocument.createRange();
  4110. range.setStart(node, offset);
  4111. range.setEnd(node, offset + length);
  4112. return Bounds.fromClientRect(range.getBoundingClientRect());
  4113. };
  4114. var breakText = function(value, styles) {
  4115. return styles.letterSpacing !== 0 ? toCodePoints(value).map(function(i) {
  4116. return fromCodePoint(i);
  4117. }) : breakWords(value, styles);
  4118. };
  4119. var breakWords = function(str, styles) {
  4120. var breaker = LineBreaker(str, {
  4121. lineBreak: styles.lineBreak,
  4122. wordBreak: styles.overflowWrap === OVERFLOW_WRAP.BREAK_WORD ? "break-word" : styles.wordBreak
  4123. });
  4124. var words = [];
  4125. var bk;
  4126. while (!(bk = breaker.next()).done) {
  4127. if (bk.value) {
  4128. words.push(bk.value.slice());
  4129. }
  4130. }
  4131. return words;
  4132. };
  4133. var TextContainer = (
  4134. /** @class */
  4135. function() {
  4136. function TextContainer2(node, styles) {
  4137. this.text = transform$1(node.data, styles.textTransform);
  4138. this.textBounds = parseTextBounds(this.text, styles, node);
  4139. }
  4140. return TextContainer2;
  4141. }()
  4142. );
  4143. var transform$1 = function(text, transform2) {
  4144. switch (transform2) {
  4145. case TEXT_TRANSFORM.LOWERCASE:
  4146. return text.toLowerCase();
  4147. case TEXT_TRANSFORM.CAPITALIZE:
  4148. return text.replace(CAPITALIZE, capitalize);
  4149. case TEXT_TRANSFORM.UPPERCASE:
  4150. return text.toUpperCase();
  4151. default:
  4152. return text;
  4153. }
  4154. };
  4155. var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g;
  4156. var capitalize = function(m, p1, p2) {
  4157. if (m.length > 0) {
  4158. return p1 + p2.toUpperCase();
  4159. }
  4160. return m;
  4161. };
  4162. var ImageElementContainer = (
  4163. /** @class */
  4164. function(_super) {
  4165. __extends(ImageElementContainer2, _super);
  4166. function ImageElementContainer2(img) {
  4167. var _this2 = _super.call(this, img) || this;
  4168. _this2.src = img.currentSrc || img.src;
  4169. _this2.intrinsicWidth = img.naturalWidth;
  4170. _this2.intrinsicHeight = img.naturalHeight;
  4171. CacheStorage.getInstance().addImage(_this2.src);
  4172. return _this2;
  4173. }
  4174. return ImageElementContainer2;
  4175. }(ElementContainer)
  4176. );
  4177. var CanvasElementContainer = (
  4178. /** @class */
  4179. function(_super) {
  4180. __extends(CanvasElementContainer2, _super);
  4181. function CanvasElementContainer2(canvas) {
  4182. var _this2 = _super.call(this, canvas) || this;
  4183. _this2.canvas = canvas;
  4184. _this2.intrinsicWidth = canvas.width;
  4185. _this2.intrinsicHeight = canvas.height;
  4186. return _this2;
  4187. }
  4188. return CanvasElementContainer2;
  4189. }(ElementContainer)
  4190. );
  4191. var SVGElementContainer = (
  4192. /** @class */
  4193. function(_super) {
  4194. __extends(SVGElementContainer2, _super);
  4195. function SVGElementContainer2(img) {
  4196. var _this2 = _super.call(this, img) || this;
  4197. var s = new XMLSerializer();
  4198. _this2.svg = "data:image/svg+xml," + encodeURIComponent(s.serializeToString(img));
  4199. _this2.intrinsicWidth = img.width.baseVal.value;
  4200. _this2.intrinsicHeight = img.height.baseVal.value;
  4201. CacheStorage.getInstance().addImage(_this2.svg);
  4202. return _this2;
  4203. }
  4204. return SVGElementContainer2;
  4205. }(ElementContainer)
  4206. );
  4207. var LIElementContainer = (
  4208. /** @class */
  4209. function(_super) {
  4210. __extends(LIElementContainer2, _super);
  4211. function LIElementContainer2(element) {
  4212. var _this2 = _super.call(this, element) || this;
  4213. _this2.value = element.value;
  4214. return _this2;
  4215. }
  4216. return LIElementContainer2;
  4217. }(ElementContainer)
  4218. );
  4219. var OLElementContainer = (
  4220. /** @class */
  4221. function(_super) {
  4222. __extends(OLElementContainer2, _super);
  4223. function OLElementContainer2(element) {
  4224. var _this2 = _super.call(this, element) || this;
  4225. _this2.start = element.start;
  4226. _this2.reversed = typeof element.reversed === "boolean" && element.reversed === true;
  4227. return _this2;
  4228. }
  4229. return OLElementContainer2;
  4230. }(ElementContainer)
  4231. );
  4232. var CHECKBOX_BORDER_RADIUS = [
  4233. {
  4234. type: TokenType.DIMENSION_TOKEN,
  4235. flags: 0,
  4236. unit: "px",
  4237. number: 3
  4238. }
  4239. ];
  4240. var RADIO_BORDER_RADIUS = [
  4241. {
  4242. type: TokenType.PERCENTAGE_TOKEN,
  4243. flags: 0,
  4244. number: 50
  4245. }
  4246. ];
  4247. var reformatInputBounds = function(bounds) {
  4248. if (bounds.width > bounds.height) {
  4249. return new Bounds(bounds.left + (bounds.width - bounds.height) / 2, bounds.top, bounds.height, bounds.height);
  4250. } else if (bounds.width < bounds.height) {
  4251. return new Bounds(bounds.left, bounds.top + (bounds.height - bounds.width) / 2, bounds.width, bounds.width);
  4252. }
  4253. return bounds;
  4254. };
  4255. var getInputValue = function(node) {
  4256. var value = node.type === PASSWORD ? new Array(node.value.length + 1).join("•") : node.value;
  4257. return value.length === 0 ? node.placeholder || "" : value;
  4258. };
  4259. var CHECKBOX = "checkbox";
  4260. var RADIO = "radio";
  4261. var PASSWORD = "password";
  4262. var INPUT_COLOR = 707406591;
  4263. var InputElementContainer = (
  4264. /** @class */
  4265. function(_super) {
  4266. __extends(InputElementContainer2, _super);
  4267. function InputElementContainer2(input) {
  4268. var _this2 = _super.call(this, input) || this;
  4269. _this2.type = input.type.toLowerCase();
  4270. _this2.checked = input.checked;
  4271. _this2.value = getInputValue(input);
  4272. if (_this2.type === CHECKBOX || _this2.type === RADIO) {
  4273. _this2.styles.backgroundColor = 3739148031;
  4274. _this2.styles.borderTopColor = _this2.styles.borderRightColor = _this2.styles.borderBottomColor = _this2.styles.borderLeftColor = 2779096575;
  4275. _this2.styles.borderTopWidth = _this2.styles.borderRightWidth = _this2.styles.borderBottomWidth = _this2.styles.borderLeftWidth = 1;
  4276. _this2.styles.borderTopStyle = _this2.styles.borderRightStyle = _this2.styles.borderBottomStyle = _this2.styles.borderLeftStyle = BORDER_STYLE.SOLID;
  4277. _this2.styles.backgroundClip = [BACKGROUND_CLIP.BORDER_BOX];
  4278. _this2.styles.backgroundOrigin = [
  4279. 0
  4280. /* BORDER_BOX */
  4281. ];
  4282. _this2.bounds = reformatInputBounds(_this2.bounds);
  4283. }
  4284. switch (_this2.type) {
  4285. case CHECKBOX:
  4286. _this2.styles.borderTopRightRadius = _this2.styles.borderTopLeftRadius = _this2.styles.borderBottomRightRadius = _this2.styles.borderBottomLeftRadius = CHECKBOX_BORDER_RADIUS;
  4287. break;
  4288. case RADIO:
  4289. _this2.styles.borderTopRightRadius = _this2.styles.borderTopLeftRadius = _this2.styles.borderBottomRightRadius = _this2.styles.borderBottomLeftRadius = RADIO_BORDER_RADIUS;
  4290. break;
  4291. }
  4292. return _this2;
  4293. }
  4294. return InputElementContainer2;
  4295. }(ElementContainer)
  4296. );
  4297. var SelectElementContainer = (
  4298. /** @class */
  4299. function(_super) {
  4300. __extends(SelectElementContainer2, _super);
  4301. function SelectElementContainer2(element) {
  4302. var _this2 = _super.call(this, element) || this;
  4303. var option = element.options[element.selectedIndex || 0];
  4304. _this2.value = option ? option.text || "" : "";
  4305. return _this2;
  4306. }
  4307. return SelectElementContainer2;
  4308. }(ElementContainer)
  4309. );
  4310. var TextareaElementContainer = (
  4311. /** @class */
  4312. function(_super) {
  4313. __extends(TextareaElementContainer2, _super);
  4314. function TextareaElementContainer2(element) {
  4315. var _this2 = _super.call(this, element) || this;
  4316. _this2.value = element.value;
  4317. return _this2;
  4318. }
  4319. return TextareaElementContainer2;
  4320. }(ElementContainer)
  4321. );
  4322. var parseColor = function(value) {
  4323. return color.parse(Parser.create(value).parseComponentValue());
  4324. };
  4325. var IFrameElementContainer = (
  4326. /** @class */
  4327. function(_super) {
  4328. __extends(IFrameElementContainer2, _super);
  4329. function IFrameElementContainer2(iframe) {
  4330. var _this2 = _super.call(this, iframe) || this;
  4331. _this2.src = iframe.src;
  4332. _this2.width = parseInt(iframe.width, 10) || 0;
  4333. _this2.height = parseInt(iframe.height, 10) || 0;
  4334. _this2.backgroundColor = _this2.styles.backgroundColor;
  4335. try {
  4336. if (iframe.contentWindow && iframe.contentWindow.document && iframe.contentWindow.document.documentElement) {
  4337. _this2.tree = parseTree(iframe.contentWindow.document.documentElement);
  4338. var documentBackgroundColor = iframe.contentWindow.document.documentElement ? parseColor(getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor) : COLORS.TRANSPARENT;
  4339. var bodyBackgroundColor = iframe.contentWindow.document.body ? parseColor(getComputedStyle(iframe.contentWindow.document.body).backgroundColor) : COLORS.TRANSPARENT;
  4340. _this2.backgroundColor = isTransparent(documentBackgroundColor) ? isTransparent(bodyBackgroundColor) ? _this2.styles.backgroundColor : bodyBackgroundColor : documentBackgroundColor;
  4341. }
  4342. } catch (e2) {
  4343. }
  4344. return _this2;
  4345. }
  4346. return IFrameElementContainer2;
  4347. }(ElementContainer)
  4348. );
  4349. var LIST_OWNERS = ["OL", "UL", "MENU"];
  4350. var parseNodeTree = function(node, parent, root) {
  4351. for (var childNode = node.firstChild, nextNode = void 0; childNode; childNode = nextNode) {
  4352. nextNode = childNode.nextSibling;
  4353. if (isTextNode(childNode) && childNode.data.trim().length > 0) {
  4354. parent.textNodes.push(new TextContainer(childNode, parent.styles));
  4355. } else if (isElementNode(childNode)) {
  4356. var container = createContainer(childNode);
  4357. if (container.styles.isVisible()) {
  4358. if (createsRealStackingContext(childNode, container, root)) {
  4359. container.flags |= 4;
  4360. } else if (createsStackingContext(container.styles)) {
  4361. container.flags |= 2;
  4362. }
  4363. if (LIST_OWNERS.indexOf(childNode.tagName) !== -1) {
  4364. container.flags |= 8;
  4365. }
  4366. parent.elements.push(container);
  4367. if (!isTextareaElement(childNode) && !isSVGElement(childNode) && !isSelectElement(childNode)) {
  4368. parseNodeTree(childNode, container, root);
  4369. }
  4370. }
  4371. }
  4372. }
  4373. };
  4374. var createContainer = function(element) {
  4375. if (isImageElement(element)) {
  4376. return new ImageElementContainer(element);
  4377. }
  4378. if (isCanvasElement(element)) {
  4379. return new CanvasElementContainer(element);
  4380. }
  4381. if (isSVGElement(element)) {
  4382. return new SVGElementContainer(element);
  4383. }
  4384. if (isLIElement(element)) {
  4385. return new LIElementContainer(element);
  4386. }
  4387. if (isOLElement(element)) {
  4388. return new OLElementContainer(element);
  4389. }
  4390. if (isInputElement(element)) {
  4391. return new InputElementContainer(element);
  4392. }
  4393. if (isSelectElement(element)) {
  4394. return new SelectElementContainer(element);
  4395. }
  4396. if (isTextareaElement(element)) {
  4397. return new TextareaElementContainer(element);
  4398. }
  4399. if (isIFrameElement(element)) {
  4400. return new IFrameElementContainer(element);
  4401. }
  4402. return new ElementContainer(element);
  4403. };
  4404. var parseTree = function(element) {
  4405. var container = createContainer(element);
  4406. container.flags |= 4;
  4407. parseNodeTree(element, container, container);
  4408. return container;
  4409. };
  4410. var createsRealStackingContext = function(node, container, root) {
  4411. return container.styles.isPositionedWithZIndex() || container.styles.opacity < 1 || container.styles.isTransformed() || isBodyElement(node) && root.styles.isTransparent();
  4412. };
  4413. var createsStackingContext = function(styles) {
  4414. return styles.isPositioned() || styles.isFloating();
  4415. };
  4416. var isTextNode = function(node) {
  4417. return node.nodeType === Node.TEXT_NODE;
  4418. };
  4419. var isElementNode = function(node) {
  4420. return node.nodeType === Node.ELEMENT_NODE;
  4421. };
  4422. var isHTMLElementNode = function(node) {
  4423. return typeof node.style !== "undefined";
  4424. };
  4425. var isLIElement = function(node) {
  4426. return node.tagName === "LI";
  4427. };
  4428. var isOLElement = function(node) {
  4429. return node.tagName === "OL";
  4430. };
  4431. var isInputElement = function(node) {
  4432. return node.tagName === "INPUT";
  4433. };
  4434. var isHTMLElement = function(node) {
  4435. return node.tagName === "HTML";
  4436. };
  4437. var isSVGElement = function(node) {
  4438. return node.tagName === "svg";
  4439. };
  4440. var isBodyElement = function(node) {
  4441. return node.tagName === "BODY";
  4442. };
  4443. var isCanvasElement = function(node) {
  4444. return node.tagName === "CANVAS";
  4445. };
  4446. var isImageElement = function(node) {
  4447. return node.tagName === "IMG";
  4448. };
  4449. var isIFrameElement = function(node) {
  4450. return node.tagName === "IFRAME";
  4451. };
  4452. var isStyleElement = function(node) {
  4453. return node.tagName === "STYLE";
  4454. };
  4455. var isScriptElement = function(node) {
  4456. return node.tagName === "SCRIPT";
  4457. };
  4458. var isTextareaElement = function(node) {
  4459. return node.tagName === "TEXTAREA";
  4460. };
  4461. var isSelectElement = function(node) {
  4462. return node.tagName === "SELECT";
  4463. };
  4464. var CounterState = (
  4465. /** @class */
  4466. function() {
  4467. function CounterState2() {
  4468. this.counters = {};
  4469. }
  4470. CounterState2.prototype.getCounterValue = function(name) {
  4471. var counter = this.counters[name];
  4472. if (counter && counter.length) {
  4473. return counter[counter.length - 1];
  4474. }
  4475. return 1;
  4476. };
  4477. CounterState2.prototype.getCounterValues = function(name) {
  4478. var counter = this.counters[name];
  4479. return counter ? counter : [];
  4480. };
  4481. CounterState2.prototype.pop = function(counters) {
  4482. var _this2 = this;
  4483. counters.forEach(function(counter) {
  4484. return _this2.counters[counter].pop();
  4485. });
  4486. };
  4487. CounterState2.prototype.parse = function(style) {
  4488. var _this2 = this;
  4489. var counterIncrement2 = style.counterIncrement;
  4490. var counterReset2 = style.counterReset;
  4491. if (counterIncrement2 !== null) {
  4492. counterIncrement2.forEach(function(entry) {
  4493. var counter = _this2.counters[entry.counter];
  4494. if (counter) {
  4495. counter[Math.max(0, counter.length - 1)] += entry.increment;
  4496. }
  4497. });
  4498. }
  4499. var counterNames = [];
  4500. counterReset2.forEach(function(entry) {
  4501. var counter = _this2.counters[entry.counter];
  4502. counterNames.push(entry.counter);
  4503. if (!counter) {
  4504. counter = _this2.counters[entry.counter] = [];
  4505. }
  4506. counter.push(entry.reset);
  4507. });
  4508. return counterNames;
  4509. };
  4510. return CounterState2;
  4511. }()
  4512. );
  4513. var ROMAN_UPPER = {
  4514. integers: [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
  4515. values: ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
  4516. };
  4517. var ARMENIAN = {
  4518. integers: [
  4519. 9e3,
  4520. 8e3,
  4521. 7e3,
  4522. 6e3,
  4523. 5e3,
  4524. 4e3,
  4525. 3e3,
  4526. 2e3,
  4527. 1e3,
  4528. 900,
  4529. 800,
  4530. 700,
  4531. 600,
  4532. 500,
  4533. 400,
  4534. 300,
  4535. 200,
  4536. 100,
  4537. 90,
  4538. 80,
  4539. 70,
  4540. 60,
  4541. 50,
  4542. 40,
  4543. 30,
  4544. 20,
  4545. 10,
  4546. 9,
  4547. 8,
  4548. 7,
  4549. 6,
  4550. 5,
  4551. 4,
  4552. 3,
  4553. 2,
  4554. 1
  4555. ],
  4556. values: [
  4557. "Ք",
  4558. "Փ",
  4559. "Ւ",
  4560. "Ց",
  4561. "Ր",
  4562. "Տ",
  4563. "Վ",
  4564. "Ս",
  4565. "Ռ",
  4566. "Ջ",
  4567. "Պ",
  4568. "Չ",
  4569. "Ո",
  4570. "Շ",
  4571. "Ն",
  4572. "Յ",
  4573. "Մ",
  4574. "Ճ",
  4575. "Ղ",
  4576. "Ձ",
  4577. "Հ",
  4578. "Կ",
  4579. "Ծ",
  4580. "Խ",
  4581. "Լ",
  4582. "Ի",
  4583. "Ժ",
  4584. "Թ",
  4585. "Ը",
  4586. "Է",
  4587. "Զ",
  4588. "Ե",
  4589. "Դ",
  4590. "Գ",
  4591. "Բ",
  4592. "Ա"
  4593. ]
  4594. };
  4595. var HEBREW = {
  4596. integers: [
  4597. 1e4,
  4598. 9e3,
  4599. 8e3,
  4600. 7e3,
  4601. 6e3,
  4602. 5e3,
  4603. 4e3,
  4604. 3e3,
  4605. 2e3,
  4606. 1e3,
  4607. 400,
  4608. 300,
  4609. 200,
  4610. 100,
  4611. 90,
  4612. 80,
  4613. 70,
  4614. 60,
  4615. 50,
  4616. 40,
  4617. 30,
  4618. 20,
  4619. 19,
  4620. 18,
  4621. 17,
  4622. 16,
  4623. 15,
  4624. 10,
  4625. 9,
  4626. 8,
  4627. 7,
  4628. 6,
  4629. 5,
  4630. 4,
  4631. 3,
  4632. 2,
  4633. 1
  4634. ],
  4635. values: [
  4636. "י׳",
  4637. "ט׳",
  4638. "ח׳",
  4639. "ז׳",
  4640. "ו׳",
  4641. "ה׳",
  4642. "ד׳",
  4643. "ג׳",
  4644. "ב׳",
  4645. "א׳",
  4646. "ת",
  4647. "ש",
  4648. "ר",
  4649. "ק",
  4650. "צ",
  4651. "פ",
  4652. "ע",
  4653. "ס",
  4654. "נ",
  4655. "מ",
  4656. "ל",
  4657. "כ",
  4658. "יט",
  4659. "יח",
  4660. "יז",
  4661. "טז",
  4662. "טו",
  4663. "י",
  4664. "ט",
  4665. "ח",
  4666. "ז",
  4667. "ו",
  4668. "ה",
  4669. "ד",
  4670. "ג",
  4671. "ב",
  4672. "א"
  4673. ]
  4674. };
  4675. var GEORGIAN = {
  4676. integers: [
  4677. 1e4,
  4678. 9e3,
  4679. 8e3,
  4680. 7e3,
  4681. 6e3,
  4682. 5e3,
  4683. 4e3,
  4684. 3e3,
  4685. 2e3,
  4686. 1e3,
  4687. 900,
  4688. 800,
  4689. 700,
  4690. 600,
  4691. 500,
  4692. 400,
  4693. 300,
  4694. 200,
  4695. 100,
  4696. 90,
  4697. 80,
  4698. 70,
  4699. 60,
  4700. 50,
  4701. 40,
  4702. 30,
  4703. 20,
  4704. 10,
  4705. 9,
  4706. 8,
  4707. 7,
  4708. 6,
  4709. 5,
  4710. 4,
  4711. 3,
  4712. 2,
  4713. 1
  4714. ],
  4715. values: [
  4716. "ჵ",
  4717. "ჰ",
  4718. "ჯ",
  4719. "ჴ",
  4720. "ხ",
  4721. "ჭ",
  4722. "წ",
  4723. "ძ",
  4724. "ც",
  4725. "ჩ",
  4726. "შ",
  4727. "ყ",
  4728. "ღ",
  4729. "ქ",
  4730. "ფ",
  4731. "ჳ",
  4732. "ტ",
  4733. "ს",
  4734. "რ",
  4735. "ჟ",
  4736. "პ",
  4737. "ო",
  4738. "ჲ",
  4739. "ნ",
  4740. "მ",
  4741. "ლ",
  4742. "კ",
  4743. "ი",
  4744. "თ",
  4745. "ჱ",
  4746. "ზ",
  4747. "ვ",
  4748. "ე",
  4749. "დ",
  4750. "გ",
  4751. "ბ",
  4752. "ა"
  4753. ]
  4754. };
  4755. var createAdditiveCounter = function(value, min, max, symbols, fallback, suffix) {
  4756. if (value < min || value > max) {
  4757. return createCounterText(value, fallback, suffix.length > 0);
  4758. }
  4759. return symbols.integers.reduce(function(string, integer, index) {
  4760. while (value >= integer) {
  4761. value -= integer;
  4762. string += symbols.values[index];
  4763. }
  4764. return string;
  4765. }, "") + suffix;
  4766. };
  4767. var createCounterStyleWithSymbolResolver = function(value, codePointRangeLength, isNumeric, resolver) {
  4768. var string = "";
  4769. do {
  4770. if (!isNumeric) {
  4771. value--;
  4772. }
  4773. string = resolver(value) + string;
  4774. value /= codePointRangeLength;
  4775. } while (value * codePointRangeLength >= codePointRangeLength);
  4776. return string;
  4777. };
  4778. var createCounterStyleFromRange = function(value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
  4779. var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
  4780. return (value < 0 ? "-" : "") + (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function(codePoint) {
  4781. return fromCodePoint(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
  4782. }) + suffix);
  4783. };
  4784. var createCounterStyleFromSymbols = function(value, symbols, suffix) {
  4785. if (suffix === void 0) {
  4786. suffix = ". ";
  4787. }
  4788. var codePointRangeLength = symbols.length;
  4789. return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, false, function(codePoint) {
  4790. return symbols[Math.floor(codePoint % codePointRangeLength)];
  4791. }) + suffix;
  4792. };
  4793. var CJK_ZEROS = 1 << 0;
  4794. var CJK_TEN_COEFFICIENTS = 1 << 1;
  4795. var CJK_TEN_HIGH_COEFFICIENTS = 1 << 2;
  4796. var CJK_HUNDRED_COEFFICIENTS = 1 << 3;
  4797. var createCJKCounter = function(value, numbers, multipliers, negativeSign, suffix, flags) {
  4798. if (value < -9999 || value > 9999) {
  4799. return createCounterText(value, LIST_STYLE_TYPE.CJK_DECIMAL, suffix.length > 0);
  4800. }
  4801. var tmp = Math.abs(value);
  4802. var string = suffix;
  4803. if (tmp === 0) {
  4804. return numbers[0] + string;
  4805. }
  4806. for (var digit = 0; tmp > 0 && digit <= 4; digit++) {
  4807. var coefficient = tmp % 10;
  4808. if (coefficient === 0 && contains(flags, CJK_ZEROS) && string !== "") {
  4809. string = numbers[coefficient] + string;
  4810. } else if (coefficient > 1 || coefficient === 1 && digit === 0 || coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_COEFFICIENTS) || coefficient === 1 && digit === 1 && contains(flags, CJK_TEN_HIGH_COEFFICIENTS) && value > 100 || coefficient === 1 && digit > 1 && contains(flags, CJK_HUNDRED_COEFFICIENTS)) {
  4811. string = numbers[coefficient] + (digit > 0 ? multipliers[digit - 1] : "") + string;
  4812. } else if (coefficient === 1 && digit > 0) {
  4813. string = multipliers[digit - 1] + string;
  4814. }
  4815. tmp = Math.floor(tmp / 10);
  4816. }
  4817. return (value < 0 ? negativeSign : "") + string;
  4818. };
  4819. var CHINESE_INFORMAL_MULTIPLIERS = "十百千萬";
  4820. var CHINESE_FORMAL_MULTIPLIERS = "拾佰仟萬";
  4821. var JAPANESE_NEGATIVE = "マイナス";
  4822. var KOREAN_NEGATIVE = "마이너스";
  4823. var createCounterText = function(value, type, appendSuffix) {
  4824. var defaultSuffix = appendSuffix ? ". " : "";
  4825. var cjkSuffix = appendSuffix ? "、" : "";
  4826. var koreanSuffix = appendSuffix ? ", " : "";
  4827. var spaceSuffix = appendSuffix ? " " : "";
  4828. switch (type) {
  4829. case LIST_STYLE_TYPE.DISC:
  4830. return "•" + spaceSuffix;
  4831. case LIST_STYLE_TYPE.CIRCLE:
  4832. return "◦" + spaceSuffix;
  4833. case LIST_STYLE_TYPE.SQUARE:
  4834. return "◾" + spaceSuffix;
  4835. case LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:
  4836. var string = createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
  4837. return string.length < 4 ? "0" + string : string;
  4838. case LIST_STYLE_TYPE.CJK_DECIMAL:
  4839. return createCounterStyleFromSymbols(value, "〇一二三四五六七八九", cjkSuffix);
  4840. case LIST_STYLE_TYPE.LOWER_ROMAN:
  4841. return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
  4842. case LIST_STYLE_TYPE.UPPER_ROMAN:
  4843. return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  4844. case LIST_STYLE_TYPE.LOWER_GREEK:
  4845. return createCounterStyleFromRange(value, 945, 969, false, defaultSuffix);
  4846. case LIST_STYLE_TYPE.LOWER_ALPHA:
  4847. return createCounterStyleFromRange(value, 97, 122, false, defaultSuffix);
  4848. case LIST_STYLE_TYPE.UPPER_ALPHA:
  4849. return createCounterStyleFromRange(value, 65, 90, false, defaultSuffix);
  4850. case LIST_STYLE_TYPE.ARABIC_INDIC:
  4851. return createCounterStyleFromRange(value, 1632, 1641, true, defaultSuffix);
  4852. case LIST_STYLE_TYPE.ARMENIAN:
  4853. case LIST_STYLE_TYPE.UPPER_ARMENIAN:
  4854. return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  4855. case LIST_STYLE_TYPE.LOWER_ARMENIAN:
  4856. return createAdditiveCounter(value, 1, 9999, ARMENIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();
  4857. case LIST_STYLE_TYPE.BENGALI:
  4858. return createCounterStyleFromRange(value, 2534, 2543, true, defaultSuffix);
  4859. case LIST_STYLE_TYPE.CAMBODIAN:
  4860. case LIST_STYLE_TYPE.KHMER:
  4861. return createCounterStyleFromRange(value, 6112, 6121, true, defaultSuffix);
  4862. case LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:
  4863. return createCounterStyleFromSymbols(value, "子丑寅卯辰巳午未申酉戌亥", cjkSuffix);
  4864. case LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:
  4865. return createCounterStyleFromSymbols(value, "甲乙丙丁戊己庚辛壬癸", cjkSuffix);
  4866. case LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:
  4867. case LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:
  4868. return createCJKCounter(value, "零一二三四五六七八九", CHINESE_INFORMAL_MULTIPLIERS, "負", cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  4869. case LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:
  4870. return createCJKCounter(value, "零壹貳參肆伍陸柒捌玖", CHINESE_FORMAL_MULTIPLIERS, "負", cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  4871. case LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:
  4872. return createCJKCounter(value, "零一二三四五六七八九", CHINESE_INFORMAL_MULTIPLIERS, "负", cjkSuffix, CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  4873. case LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:
  4874. return createCJKCounter(value, "零壹贰叁肆伍陆柒捌玖", CHINESE_FORMAL_MULTIPLIERS, "负", cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS | CJK_HUNDRED_COEFFICIENTS);
  4875. case LIST_STYLE_TYPE.JAPANESE_INFORMAL:
  4876. return createCJKCounter(value, "〇一二三四五六七八九", "十百千万", JAPANESE_NEGATIVE, cjkSuffix, 0);
  4877. case LIST_STYLE_TYPE.JAPANESE_FORMAL:
  4878. return createCJKCounter(value, "零壱弐参四伍六七八九", "拾百千万", JAPANESE_NEGATIVE, cjkSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  4879. case LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:
  4880. return createCJKCounter(value, "영일이삼사오육칠팔구", "십백천만", KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  4881. case LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:
  4882. return createCJKCounter(value, "零一二三四五六七八九", "十百千萬", KOREAN_NEGATIVE, koreanSuffix, 0);
  4883. case LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:
  4884. return createCJKCounter(value, "零壹貳參四五六七八九", "拾百千", KOREAN_NEGATIVE, koreanSuffix, CJK_ZEROS | CJK_TEN_COEFFICIENTS | CJK_TEN_HIGH_COEFFICIENTS);
  4885. case LIST_STYLE_TYPE.DEVANAGARI:
  4886. return createCounterStyleFromRange(value, 2406, 2415, true, defaultSuffix);
  4887. case LIST_STYLE_TYPE.GEORGIAN:
  4888. return createAdditiveCounter(value, 1, 19999, GEORGIAN, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  4889. case LIST_STYLE_TYPE.GUJARATI:
  4890. return createCounterStyleFromRange(value, 2790, 2799, true, defaultSuffix);
  4891. case LIST_STYLE_TYPE.GURMUKHI:
  4892. return createCounterStyleFromRange(value, 2662, 2671, true, defaultSuffix);
  4893. case LIST_STYLE_TYPE.HEBREW:
  4894. return createAdditiveCounter(value, 1, 10999, HEBREW, LIST_STYLE_TYPE.DECIMAL, defaultSuffix);
  4895. case LIST_STYLE_TYPE.HIRAGANA:
  4896. return createCounterStyleFromSymbols(value, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");
  4897. case LIST_STYLE_TYPE.HIRAGANA_IROHA:
  4898. return createCounterStyleFromSymbols(value, "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");
  4899. case LIST_STYLE_TYPE.KANNADA:
  4900. return createCounterStyleFromRange(value, 3302, 3311, true, defaultSuffix);
  4901. case LIST_STYLE_TYPE.KATAKANA:
  4902. return createCounterStyleFromSymbols(value, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン", cjkSuffix);
  4903. case LIST_STYLE_TYPE.KATAKANA_IROHA:
  4904. return createCounterStyleFromSymbols(value, "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス", cjkSuffix);
  4905. case LIST_STYLE_TYPE.LAO:
  4906. return createCounterStyleFromRange(value, 3792, 3801, true, defaultSuffix);
  4907. case LIST_STYLE_TYPE.MONGOLIAN:
  4908. return createCounterStyleFromRange(value, 6160, 6169, true, defaultSuffix);
  4909. case LIST_STYLE_TYPE.MYANMAR:
  4910. return createCounterStyleFromRange(value, 4160, 4169, true, defaultSuffix);
  4911. case LIST_STYLE_TYPE.ORIYA:
  4912. return createCounterStyleFromRange(value, 2918, 2927, true, defaultSuffix);
  4913. case LIST_STYLE_TYPE.PERSIAN:
  4914. return createCounterStyleFromRange(value, 1776, 1785, true, defaultSuffix);
  4915. case LIST_STYLE_TYPE.TAMIL:
  4916. return createCounterStyleFromRange(value, 3046, 3055, true, defaultSuffix);
  4917. case LIST_STYLE_TYPE.TELUGU:
  4918. return createCounterStyleFromRange(value, 3174, 3183, true, defaultSuffix);
  4919. case LIST_STYLE_TYPE.THAI:
  4920. return createCounterStyleFromRange(value, 3664, 3673, true, defaultSuffix);
  4921. case LIST_STYLE_TYPE.TIBETAN:
  4922. return createCounterStyleFromRange(value, 3872, 3881, true, defaultSuffix);
  4923. case LIST_STYLE_TYPE.DECIMAL:
  4924. default:
  4925. return createCounterStyleFromRange(value, 48, 57, true, defaultSuffix);
  4926. }
  4927. };
  4928. var IGNORE_ATTRIBUTE = "data-html2canvas-ignore";
  4929. var DocumentCloner = (
  4930. /** @class */
  4931. function() {
  4932. function DocumentCloner2(element, options) {
  4933. this.options = options;
  4934. this.scrolledElements = [];
  4935. this.referenceElement = element;
  4936. this.counters = new CounterState();
  4937. this.quoteDepth = 0;
  4938. if (!element.ownerDocument) {
  4939. throw new Error("Cloned element does not have an owner document");
  4940. }
  4941. this.documentElement = this.cloneNode(element.ownerDocument.documentElement);
  4942. }
  4943. DocumentCloner2.prototype.toIFrame = function(ownerDocument, windowSize) {
  4944. var _this2 = this;
  4945. var iframe = createIFrameContainer(ownerDocument, windowSize);
  4946. if (!iframe.contentWindow) {
  4947. return Promise.reject("Unable to find iframe window");
  4948. }
  4949. var scrollX = ownerDocument.defaultView.pageXOffset;
  4950. var scrollY = ownerDocument.defaultView.pageYOffset;
  4951. var cloneWindow = iframe.contentWindow;
  4952. var documentClone = cloneWindow.document;
  4953. var iframeLoad = iframeLoader(iframe).then(function() {
  4954. _this2.scrolledElements.forEach(restoreNodeScroll);
  4955. if (cloneWindow) {
  4956. cloneWindow.scrollTo(windowSize.left, windowSize.top);
  4957. if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (cloneWindow.scrollY !== windowSize.top || cloneWindow.scrollX !== windowSize.left)) {
  4958. documentClone.documentElement.style.top = -windowSize.top + "px";
  4959. documentClone.documentElement.style.left = -windowSize.left + "px";
  4960. documentClone.documentElement.style.position = "absolute";
  4961. }
  4962. }
  4963. var onclone = _this2.options.onclone;
  4964. if (typeof _this2.clonedReferenceElement === "undefined") {
  4965. return Promise.reject("Error finding the " + _this2.referenceElement.nodeName + " in the cloned document");
  4966. }
  4967. if (typeof onclone === "function") {
  4968. return Promise.resolve().then(function() {
  4969. return onclone(documentClone);
  4970. }).then(function() {
  4971. return iframe;
  4972. });
  4973. }
  4974. return iframe;
  4975. });
  4976. documentClone.open();
  4977. documentClone.write(serializeDoctype(document.doctype) + "<html></html>");
  4978. restoreOwnerScroll(this.referenceElement.ownerDocument, scrollX, scrollY);
  4979. documentClone.replaceChild(documentClone.adoptNode(this.documentElement), documentClone.documentElement);
  4980. documentClone.close();
  4981. return iframeLoad;
  4982. };
  4983. DocumentCloner2.prototype.createElementClone = function(node) {
  4984. if (isCanvasElement(node)) {
  4985. return this.createCanvasClone(node);
  4986. }
  4987. if (isStyleElement(node)) {
  4988. return this.createStyleClone(node);
  4989. }
  4990. return node.cloneNode(false);
  4991. };
  4992. DocumentCloner2.prototype.createStyleClone = function(node) {
  4993. try {
  4994. var sheet = node.sheet;
  4995. if (sheet && sheet.cssRules) {
  4996. var css = [].slice.call(sheet.cssRules, 0).reduce(function(css2, rule) {
  4997. if (rule && typeof rule.cssText === "string") {
  4998. return css2 + rule.cssText;
  4999. }
  5000. return css2;
  5001. }, "");
  5002. var style = node.cloneNode(false);
  5003. style.textContent = css;
  5004. return style;
  5005. }
  5006. } catch (e2) {
  5007. Logger.getInstance(this.options.id).error("Unable to access cssRules property", e2);
  5008. if (e2.name !== "SecurityError") {
  5009. throw e2;
  5010. }
  5011. }
  5012. return node.cloneNode(false);
  5013. };
  5014. DocumentCloner2.prototype.createCanvasClone = function(canvas) {
  5015. if (this.options.inlineImages && canvas.ownerDocument) {
  5016. var img = canvas.ownerDocument.createElement("img");
  5017. try {
  5018. img.src = canvas.toDataURL();
  5019. return img;
  5020. } catch (e2) {
  5021. Logger.getInstance(this.options.id).info("Unable to clone canvas contents, canvas is tainted");
  5022. }
  5023. }
  5024. var clonedCanvas = canvas.cloneNode(false);
  5025. try {
  5026. clonedCanvas.width = canvas.width;
  5027. clonedCanvas.height = canvas.height;
  5028. var ctx = canvas.getContext("2d");
  5029. var clonedCtx = clonedCanvas.getContext("2d");
  5030. if (clonedCtx) {
  5031. if (ctx) {
  5032. clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);
  5033. } else {
  5034. clonedCtx.drawImage(canvas, 0, 0);
  5035. }
  5036. }
  5037. return clonedCanvas;
  5038. } catch (e2) {
  5039. }
  5040. return clonedCanvas;
  5041. };
  5042. DocumentCloner2.prototype.cloneNode = function(node) {
  5043. if (isTextNode(node)) {
  5044. return document.createTextNode(node.data);
  5045. }
  5046. if (!node.ownerDocument) {
  5047. return node.cloneNode(false);
  5048. }
  5049. var window2 = node.ownerDocument.defaultView;
  5050. if (isHTMLElementNode(node) && window2) {
  5051. var clone = this.createElementClone(node);
  5052. var style = window2.getComputedStyle(node);
  5053. var styleBefore = window2.getComputedStyle(node, ":before");
  5054. var styleAfter = window2.getComputedStyle(node, ":after");
  5055. if (this.referenceElement === node) {
  5056. this.clonedReferenceElement = clone;
  5057. }
  5058. if (isBodyElement(clone)) {
  5059. createPseudoHideStyles(clone);
  5060. }
  5061. var counters = this.counters.parse(new CSSParsedCounterDeclaration(style));
  5062. var before_1 = this.resolvePseudoContent(node, clone, styleBefore, PseudoElementType.BEFORE);
  5063. for (var child = node.firstChild; child; child = child.nextSibling) {
  5064. if (!isElementNode(child) || !isScriptElement(child) && !child.hasAttribute(IGNORE_ATTRIBUTE) && (typeof this.options.ignoreElements !== "function" || !this.options.ignoreElements(child))) {
  5065. if (!this.options.copyStyles || !isElementNode(child) || !isStyleElement(child)) {
  5066. clone.appendChild(this.cloneNode(child));
  5067. }
  5068. }
  5069. }
  5070. if (before_1) {
  5071. clone.insertBefore(before_1, clone.firstChild);
  5072. }
  5073. var after_1 = this.resolvePseudoContent(node, clone, styleAfter, PseudoElementType.AFTER);
  5074. if (after_1) {
  5075. clone.appendChild(after_1);
  5076. }
  5077. this.counters.pop(counters);
  5078. if (style && this.options.copyStyles && !isIFrameElement(node)) {
  5079. copyCSSStyles(style, clone);
  5080. }
  5081. if (node.scrollTop !== 0 || node.scrollLeft !== 0) {
  5082. this.scrolledElements.push([clone, node.scrollLeft, node.scrollTop]);
  5083. }
  5084. if ((isTextareaElement(node) || isSelectElement(node)) && (isTextareaElement(clone) || isSelectElement(clone))) {
  5085. clone.value = node.value;
  5086. }
  5087. return clone;
  5088. }
  5089. return node.cloneNode(false);
  5090. };
  5091. DocumentCloner2.prototype.resolvePseudoContent = function(node, clone, style, pseudoElt) {
  5092. var _this2 = this;
  5093. if (!style) {
  5094. return;
  5095. }
  5096. var value = style.content;
  5097. var document2 = clone.ownerDocument;
  5098. if (!document2 || !value || value === "none" || value === "-moz-alt-content" || style.display === "none") {
  5099. return;
  5100. }
  5101. this.counters.parse(new CSSParsedCounterDeclaration(style));
  5102. var declaration = new CSSParsedPseudoDeclaration(style);
  5103. var anonymousReplacedElement = document2.createElement("html2canvaspseudoelement");
  5104. copyCSSStyles(style, anonymousReplacedElement);
  5105. declaration.content.forEach(function(token) {
  5106. if (token.type === TokenType.STRING_TOKEN) {
  5107. anonymousReplacedElement.appendChild(document2.createTextNode(token.value));
  5108. } else if (token.type === TokenType.URL_TOKEN) {
  5109. var img = document2.createElement("img");
  5110. img.src = token.value;
  5111. img.style.opacity = "1";
  5112. anonymousReplacedElement.appendChild(img);
  5113. } else if (token.type === TokenType.FUNCTION) {
  5114. if (token.name === "attr") {
  5115. var attr = token.values.filter(isIdentToken);
  5116. if (attr.length) {
  5117. anonymousReplacedElement.appendChild(document2.createTextNode(node.getAttribute(attr[0].value) || ""));
  5118. }
  5119. } else if (token.name === "counter") {
  5120. var _a = token.values.filter(nonFunctionArgSeparator), counter = _a[0], counterStyle = _a[1];
  5121. if (counter && isIdentToken(counter)) {
  5122. var counterState = _this2.counters.getCounterValue(counter.value);
  5123. var counterType = counterStyle && isIdentToken(counterStyle) ? listStyleType.parse(counterStyle.value) : LIST_STYLE_TYPE.DECIMAL;
  5124. anonymousReplacedElement.appendChild(document2.createTextNode(createCounterText(counterState, counterType, false)));
  5125. }
  5126. } else if (token.name === "counters") {
  5127. var _b = token.values.filter(nonFunctionArgSeparator), counter = _b[0], delim = _b[1], counterStyle = _b[2];
  5128. if (counter && isIdentToken(counter)) {
  5129. var counterStates = _this2.counters.getCounterValues(counter.value);
  5130. var counterType_1 = counterStyle && isIdentToken(counterStyle) ? listStyleType.parse(counterStyle.value) : LIST_STYLE_TYPE.DECIMAL;
  5131. var separator = delim && delim.type === TokenType.STRING_TOKEN ? delim.value : "";
  5132. var text = counterStates.map(function(value2) {
  5133. return createCounterText(value2, counterType_1, false);
  5134. }).join(separator);
  5135. anonymousReplacedElement.appendChild(document2.createTextNode(text));
  5136. }
  5137. }
  5138. } else if (token.type === TokenType.IDENT_TOKEN) {
  5139. switch (token.value) {
  5140. case "open-quote":
  5141. anonymousReplacedElement.appendChild(document2.createTextNode(getQuote(declaration.quotes, _this2.quoteDepth++, true)));
  5142. break;
  5143. case "close-quote":
  5144. anonymousReplacedElement.appendChild(document2.createTextNode(getQuote(declaration.quotes, --_this2.quoteDepth, false)));
  5145. break;
  5146. default:
  5147. }
  5148. }
  5149. });
  5150. anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  5151. clone.className += pseudoElt === PseudoElementType.BEFORE ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER;
  5152. return anonymousReplacedElement;
  5153. };
  5154. return DocumentCloner2;
  5155. }()
  5156. );
  5157. var PseudoElementType;
  5158. (function(PseudoElementType2) {
  5159. PseudoElementType2[PseudoElementType2["BEFORE"] = 0] = "BEFORE";
  5160. PseudoElementType2[PseudoElementType2["AFTER"] = 1] = "AFTER";
  5161. })(PseudoElementType || (PseudoElementType = {}));
  5162. var createIFrameContainer = function(ownerDocument, bounds) {
  5163. var cloneIframeContainer = ownerDocument.createElement("iframe");
  5164. cloneIframeContainer.className = "html2canvas-container";
  5165. cloneIframeContainer.style.visibility = "hidden";
  5166. cloneIframeContainer.style.position = "fixed";
  5167. cloneIframeContainer.style.left = "-10000px";
  5168. cloneIframeContainer.style.top = "0px";
  5169. cloneIframeContainer.style.border = "0";
  5170. cloneIframeContainer.width = bounds.width.toString();
  5171. cloneIframeContainer.height = bounds.height.toString();
  5172. cloneIframeContainer.scrolling = "no";
  5173. cloneIframeContainer.setAttribute(IGNORE_ATTRIBUTE, "true");
  5174. ownerDocument.body.appendChild(cloneIframeContainer);
  5175. return cloneIframeContainer;
  5176. };
  5177. var iframeLoader = function(iframe) {
  5178. return new Promise(function(resolve, reject) {
  5179. var cloneWindow = iframe.contentWindow;
  5180. if (!cloneWindow) {
  5181. return reject("No window assigned for iframe");
  5182. }
  5183. var documentClone = cloneWindow.document;
  5184. cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = function() {
  5185. cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
  5186. var interval = setInterval(function() {
  5187. if (documentClone.body.childNodes.length > 0 && documentClone.readyState === "complete") {
  5188. clearInterval(interval);
  5189. resolve(iframe);
  5190. }
  5191. }, 50);
  5192. };
  5193. });
  5194. };
  5195. var copyCSSStyles = function(style, target) {
  5196. for (var i = style.length - 1; i >= 0; i--) {
  5197. var property = style.item(i);
  5198. if (property !== "content") {
  5199. target.style.setProperty(property, style.getPropertyValue(property));
  5200. }
  5201. }
  5202. return target;
  5203. };
  5204. var serializeDoctype = function(doctype) {
  5205. var str = "";
  5206. if (doctype) {
  5207. str += "<!DOCTYPE ";
  5208. if (doctype.name) {
  5209. str += doctype.name;
  5210. }
  5211. if (doctype.internalSubset) {
  5212. str += doctype.internalSubset;
  5213. }
  5214. if (doctype.publicId) {
  5215. str += '"' + doctype.publicId + '"';
  5216. }
  5217. if (doctype.systemId) {
  5218. str += '"' + doctype.systemId + '"';
  5219. }
  5220. str += ">";
  5221. }
  5222. return str;
  5223. };
  5224. var restoreOwnerScroll = function(ownerDocument, x, y) {
  5225. if (ownerDocument && ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) {
  5226. ownerDocument.defaultView.scrollTo(x, y);
  5227. }
  5228. };
  5229. var restoreNodeScroll = function(_a) {
  5230. var element = _a[0], x = _a[1], y = _a[2];
  5231. element.scrollLeft = x;
  5232. element.scrollTop = y;
  5233. };
  5234. var PSEUDO_BEFORE = ":before";
  5235. var PSEUDO_AFTER = ":after";
  5236. var PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before";
  5237. var PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after";
  5238. var PSEUDO_HIDE_ELEMENT_STYLE = '{\n content: "" !important;\n display: none !important;\n}';
  5239. var createPseudoHideStyles = function(body) {
  5240. 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);
  5241. };
  5242. var createStyles = function(body, styles) {
  5243. var document2 = body.ownerDocument;
  5244. if (document2) {
  5245. var style = document2.createElement("style");
  5246. style.textContent = styles;
  5247. body.appendChild(style);
  5248. }
  5249. };
  5250. var PathType;
  5251. (function(PathType2) {
  5252. PathType2[PathType2["VECTOR"] = 0] = "VECTOR";
  5253. PathType2[PathType2["BEZIER_CURVE"] = 1] = "BEZIER_CURVE";
  5254. })(PathType || (PathType = {}));
  5255. var equalPath = function(a2, b) {
  5256. if (a2.length === b.length) {
  5257. return a2.some(function(v, i) {
  5258. return v === b[i];
  5259. });
  5260. }
  5261. return false;
  5262. };
  5263. var transformPath = function(path, deltaX, deltaY, deltaW, deltaH) {
  5264. return path.map(function(point, index) {
  5265. switch (index) {
  5266. case 0:
  5267. return point.add(deltaX, deltaY);
  5268. case 1:
  5269. return point.add(deltaX + deltaW, deltaY);
  5270. case 2:
  5271. return point.add(deltaX + deltaW, deltaY + deltaH);
  5272. case 3:
  5273. return point.add(deltaX, deltaY + deltaH);
  5274. }
  5275. return point;
  5276. });
  5277. };
  5278. var Vector = (
  5279. /** @class */
  5280. function() {
  5281. function Vector2(x, y) {
  5282. this.type = PathType.VECTOR;
  5283. this.x = x;
  5284. this.y = y;
  5285. }
  5286. Vector2.prototype.add = function(deltaX, deltaY) {
  5287. return new Vector2(this.x + deltaX, this.y + deltaY);
  5288. };
  5289. return Vector2;
  5290. }()
  5291. );
  5292. var lerp = function(a2, b, t) {
  5293. return new Vector(a2.x + (b.x - a2.x) * t, a2.y + (b.y - a2.y) * t);
  5294. };
  5295. var BezierCurve = (
  5296. /** @class */
  5297. function() {
  5298. function BezierCurve2(start, startControl, endControl, end) {
  5299. this.type = PathType.BEZIER_CURVE;
  5300. this.start = start;
  5301. this.startControl = startControl;
  5302. this.endControl = endControl;
  5303. this.end = end;
  5304. }
  5305. BezierCurve2.prototype.subdivide = function(t, firstHalf) {
  5306. var ab = lerp(this.start, this.startControl, t);
  5307. var bc = lerp(this.startControl, this.endControl, t);
  5308. var cd = lerp(this.endControl, this.end, t);
  5309. var abbc = lerp(ab, bc, t);
  5310. var bccd = lerp(bc, cd, t);
  5311. var dest = lerp(abbc, bccd, t);
  5312. return firstHalf ? new BezierCurve2(this.start, ab, abbc, dest) : new BezierCurve2(dest, bccd, cd, this.end);
  5313. };
  5314. BezierCurve2.prototype.add = function(deltaX, deltaY) {
  5315. return new BezierCurve2(this.start.add(deltaX, deltaY), this.startControl.add(deltaX, deltaY), this.endControl.add(deltaX, deltaY), this.end.add(deltaX, deltaY));
  5316. };
  5317. BezierCurve2.prototype.reverse = function() {
  5318. return new BezierCurve2(this.end, this.endControl, this.startControl, this.start);
  5319. };
  5320. return BezierCurve2;
  5321. }()
  5322. );
  5323. var isBezierCurve = function(path) {
  5324. return path.type === PathType.BEZIER_CURVE;
  5325. };
  5326. var BoundCurves = (
  5327. /** @class */
  5328. function() {
  5329. function BoundCurves2(element) {
  5330. var styles = element.styles;
  5331. var bounds = element.bounds;
  5332. var _a = getAbsoluteValueForTuple(styles.borderTopLeftRadius, bounds.width, bounds.height), tlh = _a[0], tlv = _a[1];
  5333. var _b = getAbsoluteValueForTuple(styles.borderTopRightRadius, bounds.width, bounds.height), trh = _b[0], trv = _b[1];
  5334. var _c = getAbsoluteValueForTuple(styles.borderBottomRightRadius, bounds.width, bounds.height), brh = _c[0], brv = _c[1];
  5335. var _d = getAbsoluteValueForTuple(styles.borderBottomLeftRadius, bounds.width, bounds.height), blh = _d[0], blv = _d[1];
  5336. var factors = [];
  5337. factors.push((tlh + trh) / bounds.width);
  5338. factors.push((blh + brh) / bounds.width);
  5339. factors.push((tlv + blv) / bounds.height);
  5340. factors.push((trv + brv) / bounds.height);
  5341. var maxFactor = Math.max.apply(Math, factors);
  5342. if (maxFactor > 1) {
  5343. tlh /= maxFactor;
  5344. tlv /= maxFactor;
  5345. trh /= maxFactor;
  5346. trv /= maxFactor;
  5347. brh /= maxFactor;
  5348. brv /= maxFactor;
  5349. blh /= maxFactor;
  5350. blv /= maxFactor;
  5351. }
  5352. var topWidth = bounds.width - trh;
  5353. var rightHeight = bounds.height - brv;
  5354. var bottomWidth = bounds.width - brh;
  5355. var leftHeight = bounds.height - blv;
  5356. var borderTopWidth2 = styles.borderTopWidth;
  5357. var borderRightWidth2 = styles.borderRightWidth;
  5358. var borderBottomWidth2 = styles.borderBottomWidth;
  5359. var borderLeftWidth2 = styles.borderLeftWidth;
  5360. var paddingTop2 = getAbsoluteValue(styles.paddingTop, element.bounds.width);
  5361. var paddingRight2 = getAbsoluteValue(styles.paddingRight, element.bounds.width);
  5362. var paddingBottom2 = getAbsoluteValue(styles.paddingBottom, element.bounds.width);
  5363. var paddingLeft2 = getAbsoluteValue(styles.paddingLeft, element.bounds.width);
  5364. this.topLeftBorderBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) : new Vector(bounds.left, bounds.top);
  5365. this.topRightBorderBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width, bounds.top);
  5366. this.bottomRightBorderBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width, bounds.top + bounds.height);
  5367. this.bottomLeftBorderBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) : new Vector(bounds.left, bounds.top + bounds.height);
  5368. this.topLeftPaddingBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth2, bounds.top + borderTopWidth2, Math.max(0, tlh - borderLeftWidth2), Math.max(0, tlv - borderTopWidth2), CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth2, bounds.top + borderTopWidth2);
  5369. this.topRightPaddingBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth2), bounds.top + borderTopWidth2, topWidth > bounds.width + borderLeftWidth2 ? 0 : trh - borderLeftWidth2, trv - borderTopWidth2, CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth2, bounds.top + borderTopWidth2);
  5370. this.bottomRightPaddingBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borderLeftWidth2), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth2), Math.max(0, brh - borderRightWidth2), brv - borderBottomWidth2, CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - borderRightWidth2, bounds.top + bounds.height - borderBottomWidth2);
  5371. this.bottomLeftPaddingBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth2, bounds.top + leftHeight, Math.max(0, blh - borderLeftWidth2), blv - borderBottomWidth2, CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth2, bounds.top + bounds.height - borderBottomWidth2);
  5372. this.topLeftContentBox = tlh > 0 || tlv > 0 ? getCurvePoints(bounds.left + borderLeftWidth2 + paddingLeft2, bounds.top + borderTopWidth2 + paddingTop2, Math.max(0, tlh - (borderLeftWidth2 + paddingLeft2)), Math.max(0, tlv - (borderTopWidth2 + paddingTop2)), CORNER.TOP_LEFT) : new Vector(bounds.left + borderLeftWidth2 + paddingLeft2, bounds.top + borderTopWidth2 + paddingTop2);
  5373. this.topRightContentBox = trh > 0 || trv > 0 ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borderLeftWidth2 + paddingLeft2), bounds.top + borderTopWidth2 + paddingTop2, topWidth > bounds.width + borderLeftWidth2 + paddingLeft2 ? 0 : trh - borderLeftWidth2 + paddingLeft2, trv - (borderTopWidth2 + paddingTop2), CORNER.TOP_RIGHT) : new Vector(bounds.left + bounds.width - (borderRightWidth2 + paddingRight2), bounds.top + borderTopWidth2 + paddingTop2);
  5374. this.bottomRightContentBox = brh > 0 || brv > 0 ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - (borderLeftWidth2 + paddingLeft2)), bounds.top + Math.min(rightHeight, bounds.height + borderTopWidth2 + paddingTop2), Math.max(0, brh - (borderRightWidth2 + paddingRight2)), brv - (borderBottomWidth2 + paddingBottom2), CORNER.BOTTOM_RIGHT) : new Vector(bounds.left + bounds.width - (borderRightWidth2 + paddingRight2), bounds.top + bounds.height - (borderBottomWidth2 + paddingBottom2));
  5375. this.bottomLeftContentBox = blh > 0 || blv > 0 ? getCurvePoints(bounds.left + borderLeftWidth2 + paddingLeft2, bounds.top + leftHeight, Math.max(0, blh - (borderLeftWidth2 + paddingLeft2)), blv - (borderBottomWidth2 + paddingBottom2), CORNER.BOTTOM_LEFT) : new Vector(bounds.left + borderLeftWidth2 + paddingLeft2, bounds.top + bounds.height - (borderBottomWidth2 + paddingBottom2));
  5376. }
  5377. return BoundCurves2;
  5378. }()
  5379. );
  5380. var CORNER;
  5381. (function(CORNER2) {
  5382. CORNER2[CORNER2["TOP_LEFT"] = 0] = "TOP_LEFT";
  5383. CORNER2[CORNER2["TOP_RIGHT"] = 1] = "TOP_RIGHT";
  5384. CORNER2[CORNER2["BOTTOM_RIGHT"] = 2] = "BOTTOM_RIGHT";
  5385. CORNER2[CORNER2["BOTTOM_LEFT"] = 3] = "BOTTOM_LEFT";
  5386. })(CORNER || (CORNER = {}));
  5387. var getCurvePoints = function(x, y, r1, r2, position2) {
  5388. var kappa = 4 * ((Math.sqrt(2) - 1) / 3);
  5389. var ox = r1 * kappa;
  5390. var oy = r2 * kappa;
  5391. var xm = x + r1;
  5392. var ym = y + r2;
  5393. switch (position2) {
  5394. case CORNER.TOP_LEFT:
  5395. return new BezierCurve(new Vector(x, ym), new Vector(x, ym - oy), new Vector(xm - ox, y), new Vector(xm, y));
  5396. case CORNER.TOP_RIGHT:
  5397. return new BezierCurve(new Vector(x, y), new Vector(x + ox, y), new Vector(xm, ym - oy), new Vector(xm, ym));
  5398. case CORNER.BOTTOM_RIGHT:
  5399. return new BezierCurve(new Vector(xm, y), new Vector(xm, y + oy), new Vector(x + ox, ym), new Vector(x, ym));
  5400. case CORNER.BOTTOM_LEFT:
  5401. default:
  5402. return new BezierCurve(new Vector(xm, ym), new Vector(xm - ox, ym), new Vector(x, y + oy), new Vector(x, y));
  5403. }
  5404. };
  5405. var calculateBorderBoxPath = function(curves) {
  5406. return [curves.topLeftBorderBox, curves.topRightBorderBox, curves.bottomRightBorderBox, curves.bottomLeftBorderBox];
  5407. };
  5408. var calculateContentBoxPath = function(curves) {
  5409. return [
  5410. curves.topLeftContentBox,
  5411. curves.topRightContentBox,
  5412. curves.bottomRightContentBox,
  5413. curves.bottomLeftContentBox
  5414. ];
  5415. };
  5416. var calculatePaddingBoxPath = function(curves) {
  5417. return [
  5418. curves.topLeftPaddingBox,
  5419. curves.topRightPaddingBox,
  5420. curves.bottomRightPaddingBox,
  5421. curves.bottomLeftPaddingBox
  5422. ];
  5423. };
  5424. var TransformEffect = (
  5425. /** @class */
  5426. function() {
  5427. function TransformEffect2(offsetX, offsetY, matrix2) {
  5428. this.type = 0;
  5429. this.offsetX = offsetX;
  5430. this.offsetY = offsetY;
  5431. this.matrix = matrix2;
  5432. this.target = 2 | 4;
  5433. }
  5434. return TransformEffect2;
  5435. }()
  5436. );
  5437. var ClipEffect = (
  5438. /** @class */
  5439. function() {
  5440. function ClipEffect2(path, target) {
  5441. this.type = 1;
  5442. this.target = target;
  5443. this.path = path;
  5444. }
  5445. return ClipEffect2;
  5446. }()
  5447. );
  5448. var isTransformEffect = function(effect) {
  5449. return effect.type === 0;
  5450. };
  5451. var isClipEffect = function(effect) {
  5452. return effect.type === 1;
  5453. };
  5454. var StackingContext = (
  5455. /** @class */
  5456. function() {
  5457. function StackingContext2(container) {
  5458. this.element = container;
  5459. this.inlineLevel = [];
  5460. this.nonInlineLevel = [];
  5461. this.negativeZIndex = [];
  5462. this.zeroOrAutoZIndexOrTransformedOrOpacity = [];
  5463. this.positiveZIndex = [];
  5464. this.nonPositionedFloats = [];
  5465. this.nonPositionedInlineLevel = [];
  5466. }
  5467. return StackingContext2;
  5468. }()
  5469. );
  5470. var ElementPaint = (
  5471. /** @class */
  5472. function() {
  5473. function ElementPaint2(element, parentStack) {
  5474. this.container = element;
  5475. this.effects = parentStack.slice(0);
  5476. this.curves = new BoundCurves(element);
  5477. if (element.styles.transform !== null) {
  5478. var offsetX = element.bounds.left + element.styles.transformOrigin[0].number;
  5479. var offsetY = element.bounds.top + element.styles.transformOrigin[1].number;
  5480. var matrix2 = element.styles.transform;
  5481. this.effects.push(new TransformEffect(offsetX, offsetY, matrix2));
  5482. }
  5483. if (element.styles.overflowX !== OVERFLOW.VISIBLE) {
  5484. var borderBox = calculateBorderBoxPath(this.curves);
  5485. var paddingBox2 = calculatePaddingBoxPath(this.curves);
  5486. if (equalPath(borderBox, paddingBox2)) {
  5487. this.effects.push(new ClipEffect(
  5488. borderBox,
  5489. 2 | 4
  5490. /* CONTENT */
  5491. ));
  5492. } else {
  5493. this.effects.push(new ClipEffect(
  5494. borderBox,
  5495. 2
  5496. /* BACKGROUND_BORDERS */
  5497. ));
  5498. this.effects.push(new ClipEffect(
  5499. paddingBox2,
  5500. 4
  5501. /* CONTENT */
  5502. ));
  5503. }
  5504. }
  5505. }
  5506. ElementPaint2.prototype.getParentEffects = function() {
  5507. var effects = this.effects.slice(0);
  5508. if (this.container.styles.overflowX !== OVERFLOW.VISIBLE) {
  5509. var borderBox = calculateBorderBoxPath(this.curves);
  5510. var paddingBox2 = calculatePaddingBoxPath(this.curves);
  5511. if (!equalPath(borderBox, paddingBox2)) {
  5512. effects.push(new ClipEffect(
  5513. paddingBox2,
  5514. 2 | 4
  5515. /* CONTENT */
  5516. ));
  5517. }
  5518. }
  5519. return effects;
  5520. };
  5521. return ElementPaint2;
  5522. }()
  5523. );
  5524. var parseStackTree = function(parent, stackingContext, realStackingContext, listItems) {
  5525. parent.container.elements.forEach(function(child) {
  5526. var treatAsRealStackingContext = contains(
  5527. child.flags,
  5528. 4
  5529. /* CREATES_REAL_STACKING_CONTEXT */
  5530. );
  5531. var createsStackingContext2 = contains(
  5532. child.flags,
  5533. 2
  5534. /* CREATES_STACKING_CONTEXT */
  5535. );
  5536. var paintContainer = new ElementPaint(child, parent.getParentEffects());
  5537. if (contains(
  5538. child.styles.display,
  5539. 2048
  5540. /* LIST_ITEM */
  5541. )) {
  5542. listItems.push(paintContainer);
  5543. }
  5544. var listOwnerItems = contains(
  5545. child.flags,
  5546. 8
  5547. /* IS_LIST_OWNER */
  5548. ) ? [] : listItems;
  5549. if (treatAsRealStackingContext || createsStackingContext2) {
  5550. var parentStack = treatAsRealStackingContext || child.styles.isPositioned() ? realStackingContext : stackingContext;
  5551. var stack = new StackingContext(paintContainer);
  5552. if (child.styles.isPositioned() || child.styles.opacity < 1 || child.styles.isTransformed()) {
  5553. var order_1 = child.styles.zIndex.order;
  5554. if (order_1 < 0) {
  5555. var index_1 = 0;
  5556. parentStack.negativeZIndex.some(function(current, i) {
  5557. if (order_1 > current.element.container.styles.zIndex.order) {
  5558. index_1 = i;
  5559. return false;
  5560. } else if (index_1 > 0) {
  5561. return true;
  5562. }
  5563. return false;
  5564. });
  5565. parentStack.negativeZIndex.splice(index_1, 0, stack);
  5566. } else if (order_1 > 0) {
  5567. var index_2 = 0;
  5568. parentStack.positiveZIndex.some(function(current, i) {
  5569. if (order_1 > current.element.container.styles.zIndex.order) {
  5570. index_2 = i + 1;
  5571. return false;
  5572. } else if (index_2 > 0) {
  5573. return true;
  5574. }
  5575. return false;
  5576. });
  5577. parentStack.positiveZIndex.splice(index_2, 0, stack);
  5578. } else {
  5579. parentStack.zeroOrAutoZIndexOrTransformedOrOpacity.push(stack);
  5580. }
  5581. } else {
  5582. if (child.styles.isFloating()) {
  5583. parentStack.nonPositionedFloats.push(stack);
  5584. } else {
  5585. parentStack.nonPositionedInlineLevel.push(stack);
  5586. }
  5587. }
  5588. parseStackTree(paintContainer, stack, treatAsRealStackingContext ? stack : realStackingContext, listOwnerItems);
  5589. } else {
  5590. if (child.styles.isInlineLevel()) {
  5591. stackingContext.inlineLevel.push(paintContainer);
  5592. } else {
  5593. stackingContext.nonInlineLevel.push(paintContainer);
  5594. }
  5595. parseStackTree(paintContainer, stackingContext, realStackingContext, listOwnerItems);
  5596. }
  5597. if (contains(
  5598. child.flags,
  5599. 8
  5600. /* IS_LIST_OWNER */
  5601. )) {
  5602. processListItems(child, listOwnerItems);
  5603. }
  5604. });
  5605. };
  5606. var processListItems = function(owner, elements) {
  5607. var numbering = owner instanceof OLElementContainer ? owner.start : 1;
  5608. var reversed = owner instanceof OLElementContainer ? owner.reversed : false;
  5609. for (var i = 0; i < elements.length; i++) {
  5610. var item = elements[i];
  5611. if (item.container instanceof LIElementContainer && typeof item.container.value === "number" && item.container.value !== 0) {
  5612. numbering = item.container.value;
  5613. }
  5614. item.listValue = createCounterText(numbering, item.container.styles.listStyleType, true);
  5615. numbering += reversed ? -1 : 1;
  5616. }
  5617. };
  5618. var parseStackingContexts = function(container) {
  5619. var paintContainer = new ElementPaint(container, []);
  5620. var root = new StackingContext(paintContainer);
  5621. var listItems = [];
  5622. parseStackTree(paintContainer, root, root, listItems);
  5623. processListItems(paintContainer.container, listItems);
  5624. return root;
  5625. };
  5626. var parsePathForBorder = function(curves, borderSide) {
  5627. switch (borderSide) {
  5628. case 0:
  5629. return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
  5630. case 1:
  5631. return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
  5632. case 2:
  5633. return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
  5634. case 3:
  5635. default:
  5636. return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);
  5637. }
  5638. };
  5639. var createPathFromCurves = function(outer1, inner1, outer2, inner2) {
  5640. var path = [];
  5641. if (isBezierCurve(outer1)) {
  5642. path.push(outer1.subdivide(0.5, false));
  5643. } else {
  5644. path.push(outer1);
  5645. }
  5646. if (isBezierCurve(outer2)) {
  5647. path.push(outer2.subdivide(0.5, true));
  5648. } else {
  5649. path.push(outer2);
  5650. }
  5651. if (isBezierCurve(inner2)) {
  5652. path.push(inner2.subdivide(0.5, true).reverse());
  5653. } else {
  5654. path.push(inner2);
  5655. }
  5656. if (isBezierCurve(inner1)) {
  5657. path.push(inner1.subdivide(0.5, false).reverse());
  5658. } else {
  5659. path.push(inner1);
  5660. }
  5661. return path;
  5662. };
  5663. var paddingBox = function(element) {
  5664. var bounds = element.bounds;
  5665. var styles = element.styles;
  5666. return bounds.add(styles.borderLeftWidth, styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth), -(styles.borderTopWidth + styles.borderBottomWidth));
  5667. };
  5668. var contentBox = function(element) {
  5669. var styles = element.styles;
  5670. var bounds = element.bounds;
  5671. var paddingLeft2 = getAbsoluteValue(styles.paddingLeft, bounds.width);
  5672. var paddingRight2 = getAbsoluteValue(styles.paddingRight, bounds.width);
  5673. var paddingTop2 = getAbsoluteValue(styles.paddingTop, bounds.width);
  5674. var paddingBottom2 = getAbsoluteValue(styles.paddingBottom, bounds.width);
  5675. return bounds.add(paddingLeft2 + styles.borderLeftWidth, paddingTop2 + styles.borderTopWidth, -(styles.borderRightWidth + styles.borderLeftWidth + paddingLeft2 + paddingRight2), -(styles.borderTopWidth + styles.borderBottomWidth + paddingTop2 + paddingBottom2));
  5676. };
  5677. var calculateBackgroundPositioningArea = function(backgroundOrigin2, element) {
  5678. if (backgroundOrigin2 === 0) {
  5679. return element.bounds;
  5680. }
  5681. if (backgroundOrigin2 === 2) {
  5682. return contentBox(element);
  5683. }
  5684. return paddingBox(element);
  5685. };
  5686. var calculateBackgroundPaintingArea = function(backgroundClip2, element) {
  5687. if (backgroundClip2 === BACKGROUND_CLIP.BORDER_BOX) {
  5688. return element.bounds;
  5689. }
  5690. if (backgroundClip2 === BACKGROUND_CLIP.CONTENT_BOX) {
  5691. return contentBox(element);
  5692. }
  5693. return paddingBox(element);
  5694. };
  5695. var calculateBackgroundRendering = function(container, index, intrinsicSize) {
  5696. var backgroundPositioningArea = calculateBackgroundPositioningArea(getBackgroundValueForIndex(container.styles.backgroundOrigin, index), container);
  5697. var backgroundPaintingArea = calculateBackgroundPaintingArea(getBackgroundValueForIndex(container.styles.backgroundClip, index), container);
  5698. var backgroundImageSize = calculateBackgroundSize(getBackgroundValueForIndex(container.styles.backgroundSize, index), intrinsicSize, backgroundPositioningArea);
  5699. var sizeWidth = backgroundImageSize[0], sizeHeight = backgroundImageSize[1];
  5700. var position2 = getAbsoluteValueForTuple(getBackgroundValueForIndex(container.styles.backgroundPosition, index), backgroundPositioningArea.width - sizeWidth, backgroundPositioningArea.height - sizeHeight);
  5701. var path = calculateBackgroundRepeatPath(getBackgroundValueForIndex(container.styles.backgroundRepeat, index), position2, backgroundImageSize, backgroundPositioningArea, backgroundPaintingArea);
  5702. var offsetX = Math.round(backgroundPositioningArea.left + position2[0]);
  5703. var offsetY = Math.round(backgroundPositioningArea.top + position2[1]);
  5704. return [path, offsetX, offsetY, sizeWidth, sizeHeight];
  5705. };
  5706. var isAuto = function(token) {
  5707. return isIdentToken(token) && token.value === BACKGROUND_SIZE.AUTO;
  5708. };
  5709. var hasIntrinsicValue = function(value) {
  5710. return typeof value === "number";
  5711. };
  5712. var calculateBackgroundSize = function(size, _a, bounds) {
  5713. var intrinsicWidth = _a[0], intrinsicHeight = _a[1], intrinsicProportion = _a[2];
  5714. var first = size[0], second = size[1];
  5715. if (isLengthPercentage(first) && second && isLengthPercentage(second)) {
  5716. return [getAbsoluteValue(first, bounds.width), getAbsoluteValue(second, bounds.height)];
  5717. }
  5718. var hasIntrinsicProportion = hasIntrinsicValue(intrinsicProportion);
  5719. if (isIdentToken(first) && (first.value === BACKGROUND_SIZE.CONTAIN || first.value === BACKGROUND_SIZE.COVER)) {
  5720. if (hasIntrinsicValue(intrinsicProportion)) {
  5721. var targetRatio = bounds.width / bounds.height;
  5722. return targetRatio < intrinsicProportion !== (first.value === BACKGROUND_SIZE.COVER) ? [bounds.width, bounds.width / intrinsicProportion] : [bounds.height * intrinsicProportion, bounds.height];
  5723. }
  5724. return [bounds.width, bounds.height];
  5725. }
  5726. var hasIntrinsicWidth = hasIntrinsicValue(intrinsicWidth);
  5727. var hasIntrinsicHeight = hasIntrinsicValue(intrinsicHeight);
  5728. var hasIntrinsicDimensions = hasIntrinsicWidth || hasIntrinsicHeight;
  5729. if (isAuto(first) && (!second || isAuto(second))) {
  5730. if (hasIntrinsicWidth && hasIntrinsicHeight) {
  5731. return [intrinsicWidth, intrinsicHeight];
  5732. }
  5733. if (!hasIntrinsicProportion && !hasIntrinsicDimensions) {
  5734. return [bounds.width, bounds.height];
  5735. }
  5736. if (hasIntrinsicDimensions && hasIntrinsicProportion) {
  5737. var width_1 = hasIntrinsicWidth ? intrinsicWidth : intrinsicHeight * intrinsicProportion;
  5738. var height_1 = hasIntrinsicHeight ? intrinsicHeight : intrinsicWidth / intrinsicProportion;
  5739. return [width_1, height_1];
  5740. }
  5741. var width_2 = hasIntrinsicWidth ? intrinsicWidth : bounds.width;
  5742. var height_2 = hasIntrinsicHeight ? intrinsicHeight : bounds.height;
  5743. return [width_2, height_2];
  5744. }
  5745. if (hasIntrinsicProportion) {
  5746. var width_3 = 0;
  5747. var height_3 = 0;
  5748. if (isLengthPercentage(first)) {
  5749. width_3 = getAbsoluteValue(first, bounds.width);
  5750. } else if (isLengthPercentage(second)) {
  5751. height_3 = getAbsoluteValue(second, bounds.height);
  5752. }
  5753. if (isAuto(first)) {
  5754. width_3 = height_3 * intrinsicProportion;
  5755. } else if (!second || isAuto(second)) {
  5756. height_3 = width_3 / intrinsicProportion;
  5757. }
  5758. return [width_3, height_3];
  5759. }
  5760. var width = null;
  5761. var height = null;
  5762. if (isLengthPercentage(first)) {
  5763. width = getAbsoluteValue(first, bounds.width);
  5764. } else if (second && isLengthPercentage(second)) {
  5765. height = getAbsoluteValue(second, bounds.height);
  5766. }
  5767. if (width !== null && (!second || isAuto(second))) {
  5768. height = hasIntrinsicWidth && hasIntrinsicHeight ? width / intrinsicWidth * intrinsicHeight : bounds.height;
  5769. }
  5770. if (height !== null && isAuto(first)) {
  5771. width = hasIntrinsicWidth && hasIntrinsicHeight ? height / intrinsicHeight * intrinsicWidth : bounds.width;
  5772. }
  5773. if (width !== null && height !== null) {
  5774. return [width, height];
  5775. }
  5776. throw new Error("Unable to calculate background-size for element");
  5777. };
  5778. var getBackgroundValueForIndex = function(values, index) {
  5779. var value = values[index];
  5780. if (typeof value === "undefined") {
  5781. return values[0];
  5782. }
  5783. return value;
  5784. };
  5785. var calculateBackgroundRepeatPath = function(repeat, _a, _b, backgroundPositioningArea, backgroundPaintingArea) {
  5786. var x = _a[0], y = _a[1];
  5787. var width = _b[0], height = _b[1];
  5788. switch (repeat) {
  5789. case BACKGROUND_REPEAT.REPEAT_X:
  5790. return [
  5791. new Vector(Math.round(backgroundPositioningArea.left), Math.round(backgroundPositioningArea.top + y)),
  5792. new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(backgroundPositioningArea.top + y)),
  5793. new Vector(Math.round(backgroundPositioningArea.left + backgroundPositioningArea.width), Math.round(height + backgroundPositioningArea.top + y)),
  5794. new Vector(Math.round(backgroundPositioningArea.left), Math.round(height + backgroundPositioningArea.top + y))
  5795. ];
  5796. case BACKGROUND_REPEAT.REPEAT_Y:
  5797. return [
  5798. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top)),
  5799. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top)),
  5800. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top)),
  5801. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.height + backgroundPositioningArea.top))
  5802. ];
  5803. case BACKGROUND_REPEAT.NO_REPEAT:
  5804. return [
  5805. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y)),
  5806. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y)),
  5807. new Vector(Math.round(backgroundPositioningArea.left + x + width), Math.round(backgroundPositioningArea.top + y + height)),
  5808. new Vector(Math.round(backgroundPositioningArea.left + x), Math.round(backgroundPositioningArea.top + y + height))
  5809. ];
  5810. default:
  5811. return [
  5812. new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.top)),
  5813. new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.top)),
  5814. new Vector(Math.round(backgroundPaintingArea.left + backgroundPaintingArea.width), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top)),
  5815. new Vector(Math.round(backgroundPaintingArea.left), Math.round(backgroundPaintingArea.height + backgroundPaintingArea.top))
  5816. ];
  5817. }
  5818. };
  5819. var SMALL_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
  5820. var SAMPLE_TEXT = "Hidden Text";
  5821. var FontMetrics = (
  5822. /** @class */
  5823. function() {
  5824. function FontMetrics2(document2) {
  5825. this._data = {};
  5826. this._document = document2;
  5827. }
  5828. FontMetrics2.prototype.parseMetrics = function(fontFamily2, fontSize2) {
  5829. var container = this._document.createElement("div");
  5830. var img = this._document.createElement("img");
  5831. var span = this._document.createElement("span");
  5832. var body = this._document.body;
  5833. container.style.visibility = "hidden";
  5834. container.style.fontFamily = fontFamily2;
  5835. container.style.fontSize = fontSize2;
  5836. container.style.margin = "0";
  5837. container.style.padding = "0";
  5838. body.appendChild(container);
  5839. img.src = SMALL_IMAGE;
  5840. img.width = 1;
  5841. img.height = 1;
  5842. img.style.margin = "0";
  5843. img.style.padding = "0";
  5844. img.style.verticalAlign = "baseline";
  5845. span.style.fontFamily = fontFamily2;
  5846. span.style.fontSize = fontSize2;
  5847. span.style.margin = "0";
  5848. span.style.padding = "0";
  5849. span.appendChild(this._document.createTextNode(SAMPLE_TEXT));
  5850. container.appendChild(span);
  5851. container.appendChild(img);
  5852. var baseline = img.offsetTop - span.offsetTop + 2;
  5853. container.removeChild(span);
  5854. container.appendChild(this._document.createTextNode(SAMPLE_TEXT));
  5855. container.style.lineHeight = "normal";
  5856. img.style.verticalAlign = "super";
  5857. var middle = img.offsetTop - container.offsetTop + 2;
  5858. body.removeChild(container);
  5859. return { baseline, middle };
  5860. };
  5861. FontMetrics2.prototype.getMetrics = function(fontFamily2, fontSize2) {
  5862. var key = fontFamily2 + " " + fontSize2;
  5863. if (typeof this._data[key] === "undefined") {
  5864. this._data[key] = this.parseMetrics(fontFamily2, fontSize2);
  5865. }
  5866. return this._data[key];
  5867. };
  5868. return FontMetrics2;
  5869. }()
  5870. );
  5871. var MASK_OFFSET = 1e4;
  5872. var CanvasRenderer = (
  5873. /** @class */
  5874. function() {
  5875. function CanvasRenderer2(options) {
  5876. this._activeEffects = [];
  5877. this.canvas = options.canvas ? options.canvas : document.createElement("canvas");
  5878. this.ctx = this.canvas.getContext("2d");
  5879. this.options = options;
  5880. this.canvas.width = Math.floor(options.width * options.scale);
  5881. this.canvas.height = Math.floor(options.height * options.scale);
  5882. this.canvas.style.width = options.width + "px";
  5883. this.canvas.style.height = options.height + "px";
  5884. this.fontMetrics = new FontMetrics(document);
  5885. this.ctx.scale(this.options.scale, this.options.scale);
  5886. this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY);
  5887. this.ctx.textBaseline = "bottom";
  5888. this._activeEffects = [];
  5889. Logger.getInstance(options.id).debug("Canvas renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
  5890. }
  5891. CanvasRenderer2.prototype.applyEffects = function(effects, target) {
  5892. var _this2 = this;
  5893. while (this._activeEffects.length) {
  5894. this.popEffect();
  5895. }
  5896. effects.filter(function(effect) {
  5897. return contains(effect.target, target);
  5898. }).forEach(function(effect) {
  5899. return _this2.applyEffect(effect);
  5900. });
  5901. };
  5902. CanvasRenderer2.prototype.applyEffect = function(effect) {
  5903. this.ctx.save();
  5904. if (isTransformEffect(effect)) {
  5905. this.ctx.translate(effect.offsetX, effect.offsetY);
  5906. this.ctx.transform(effect.matrix[0], effect.matrix[1], effect.matrix[2], effect.matrix[3], effect.matrix[4], effect.matrix[5]);
  5907. this.ctx.translate(-effect.offsetX, -effect.offsetY);
  5908. }
  5909. if (isClipEffect(effect)) {
  5910. this.path(effect.path);
  5911. this.ctx.clip();
  5912. }
  5913. this._activeEffects.push(effect);
  5914. };
  5915. CanvasRenderer2.prototype.popEffect = function() {
  5916. this._activeEffects.pop();
  5917. this.ctx.restore();
  5918. };
  5919. CanvasRenderer2.prototype.renderStack = function(stack) {
  5920. return __awaiter(this, void 0, void 0, function() {
  5921. var styles;
  5922. return __generator(this, function(_a) {
  5923. switch (_a.label) {
  5924. case 0:
  5925. styles = stack.element.container.styles;
  5926. if (!styles.isVisible())
  5927. return [3, 2];
  5928. this.ctx.globalAlpha = styles.opacity;
  5929. return [4, this.renderStackContent(stack)];
  5930. case 1:
  5931. _a.sent();
  5932. _a.label = 2;
  5933. case 2:
  5934. return [
  5935. 2
  5936. /*return*/
  5937. ];
  5938. }
  5939. });
  5940. });
  5941. };
  5942. CanvasRenderer2.prototype.renderNode = function(paint) {
  5943. return __awaiter(this, void 0, void 0, function() {
  5944. return __generator(this, function(_a) {
  5945. switch (_a.label) {
  5946. case 0:
  5947. if (!paint.container.styles.isVisible())
  5948. return [3, 3];
  5949. return [4, this.renderNodeBackgroundAndBorders(paint)];
  5950. case 1:
  5951. _a.sent();
  5952. return [4, this.renderNodeContent(paint)];
  5953. case 2:
  5954. _a.sent();
  5955. _a.label = 3;
  5956. case 3:
  5957. return [
  5958. 2
  5959. /*return*/
  5960. ];
  5961. }
  5962. });
  5963. });
  5964. };
  5965. CanvasRenderer2.prototype.renderTextWithLetterSpacing = function(text, letterSpacing2) {
  5966. var _this2 = this;
  5967. if (letterSpacing2 === 0) {
  5968. this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
  5969. } else {
  5970. var letters = toCodePoints(text.text).map(function(i) {
  5971. return fromCodePoint(i);
  5972. });
  5973. letters.reduce(function(left, letter) {
  5974. _this2.ctx.fillText(letter, left, text.bounds.top + text.bounds.height);
  5975. return left + _this2.ctx.measureText(letter).width;
  5976. }, text.bounds.left);
  5977. }
  5978. };
  5979. CanvasRenderer2.prototype.createFontStyle = function(styles) {
  5980. var fontVariant2 = styles.fontVariant.filter(function(variant) {
  5981. return variant === "normal" || variant === "small-caps";
  5982. }).join("");
  5983. var fontFamily2 = styles.fontFamily.join(", ");
  5984. var fontSize2 = isDimensionToken(styles.fontSize) ? "" + styles.fontSize.number + styles.fontSize.unit : styles.fontSize.number + "px";
  5985. return [
  5986. [styles.fontStyle, fontVariant2, styles.fontWeight, fontSize2, fontFamily2].join(" "),
  5987. fontFamily2,
  5988. fontSize2
  5989. ];
  5990. };
  5991. CanvasRenderer2.prototype.renderTextNode = function(text, styles) {
  5992. return __awaiter(this, void 0, void 0, function() {
  5993. var _a, font, fontFamily2, fontSize2;
  5994. var _this2 = this;
  5995. return __generator(this, function(_b) {
  5996. _a = this.createFontStyle(styles), font = _a[0], fontFamily2 = _a[1], fontSize2 = _a[2];
  5997. this.ctx.font = font;
  5998. text.textBounds.forEach(function(text2) {
  5999. _this2.ctx.fillStyle = asString(styles.color);
  6000. _this2.renderTextWithLetterSpacing(text2, styles.letterSpacing);
  6001. var textShadows = styles.textShadow;
  6002. if (textShadows.length && text2.text.trim().length) {
  6003. textShadows.slice(0).reverse().forEach(function(textShadow2) {
  6004. _this2.ctx.shadowColor = asString(textShadow2.color);
  6005. _this2.ctx.shadowOffsetX = textShadow2.offsetX.number * _this2.options.scale;
  6006. _this2.ctx.shadowOffsetY = textShadow2.offsetY.number * _this2.options.scale;
  6007. _this2.ctx.shadowBlur = textShadow2.blur.number;
  6008. _this2.ctx.fillText(text2.text, text2.bounds.left, text2.bounds.top + text2.bounds.height);
  6009. });
  6010. _this2.ctx.shadowColor = "";
  6011. _this2.ctx.shadowOffsetX = 0;
  6012. _this2.ctx.shadowOffsetY = 0;
  6013. _this2.ctx.shadowBlur = 0;
  6014. }
  6015. if (styles.textDecorationLine.length) {
  6016. _this2.ctx.fillStyle = asString(styles.textDecorationColor || styles.color);
  6017. styles.textDecorationLine.forEach(function(textDecorationLine2) {
  6018. switch (textDecorationLine2) {
  6019. case 1:
  6020. var baseline = _this2.fontMetrics.getMetrics(fontFamily2, fontSize2).baseline;
  6021. _this2.ctx.fillRect(text2.bounds.left, Math.round(text2.bounds.top + baseline), text2.bounds.width, 1);
  6022. break;
  6023. case 2:
  6024. _this2.ctx.fillRect(text2.bounds.left, Math.round(text2.bounds.top), text2.bounds.width, 1);
  6025. break;
  6026. case 3:
  6027. var middle = _this2.fontMetrics.getMetrics(fontFamily2, fontSize2).middle;
  6028. _this2.ctx.fillRect(text2.bounds.left, Math.ceil(text2.bounds.top + middle), text2.bounds.width, 1);
  6029. break;
  6030. }
  6031. });
  6032. }
  6033. });
  6034. return [
  6035. 2
  6036. /*return*/
  6037. ];
  6038. });
  6039. });
  6040. };
  6041. CanvasRenderer2.prototype.renderReplacedElement = function(container, curves, image2) {
  6042. if (image2 && container.intrinsicWidth > 0 && container.intrinsicHeight > 0) {
  6043. var box = contentBox(container);
  6044. var path = calculatePaddingBoxPath(curves);
  6045. this.path(path);
  6046. this.ctx.save();
  6047. this.ctx.clip();
  6048. this.ctx.drawImage(image2, 0, 0, container.intrinsicWidth, container.intrinsicHeight, box.left, box.top, box.width, box.height);
  6049. this.ctx.restore();
  6050. }
  6051. };
  6052. CanvasRenderer2.prototype.renderNodeContent = function(paint) {
  6053. return __awaiter(this, void 0, void 0, function() {
  6054. var container, curves, styles, _i, _a, child, image2, e_1, image2, e_2, iframeRenderer, canvas, size, bounds, x, textBounds, img, image2, url, e_3, bounds;
  6055. return __generator(this, function(_b) {
  6056. switch (_b.label) {
  6057. case 0:
  6058. this.applyEffects(
  6059. paint.effects,
  6060. 4
  6061. /* CONTENT */
  6062. );
  6063. container = paint.container;
  6064. curves = paint.curves;
  6065. styles = container.styles;
  6066. _i = 0, _a = container.textNodes;
  6067. _b.label = 1;
  6068. case 1:
  6069. if (!(_i < _a.length))
  6070. return [3, 4];
  6071. child = _a[_i];
  6072. return [4, this.renderTextNode(child, styles)];
  6073. case 2:
  6074. _b.sent();
  6075. _b.label = 3;
  6076. case 3:
  6077. _i++;
  6078. return [3, 1];
  6079. case 4:
  6080. if (!(container instanceof ImageElementContainer))
  6081. return [3, 8];
  6082. _b.label = 5;
  6083. case 5:
  6084. _b.trys.push([5, 7, , 8]);
  6085. return [4, this.options.cache.match(container.src)];
  6086. case 6:
  6087. image2 = _b.sent();
  6088. this.renderReplacedElement(container, curves, image2);
  6089. return [3, 8];
  6090. case 7:
  6091. e_1 = _b.sent();
  6092. Logger.getInstance(this.options.id).error("Error loading image " + container.src);
  6093. return [3, 8];
  6094. case 8:
  6095. if (container instanceof CanvasElementContainer) {
  6096. this.renderReplacedElement(container, curves, container.canvas);
  6097. }
  6098. if (!(container instanceof SVGElementContainer))
  6099. return [3, 12];
  6100. _b.label = 9;
  6101. case 9:
  6102. _b.trys.push([9, 11, , 12]);
  6103. return [4, this.options.cache.match(container.svg)];
  6104. case 10:
  6105. image2 = _b.sent();
  6106. this.renderReplacedElement(container, curves, image2);
  6107. return [3, 12];
  6108. case 11:
  6109. e_2 = _b.sent();
  6110. Logger.getInstance(this.options.id).error("Error loading svg " + container.svg.substring(0, 255));
  6111. return [3, 12];
  6112. case 12:
  6113. if (!(container instanceof IFrameElementContainer && container.tree))
  6114. return [3, 14];
  6115. iframeRenderer = new CanvasRenderer2({
  6116. id: this.options.id,
  6117. scale: this.options.scale,
  6118. backgroundColor: container.backgroundColor,
  6119. x: 0,
  6120. y: 0,
  6121. scrollX: 0,
  6122. scrollY: 0,
  6123. width: container.width,
  6124. height: container.height,
  6125. cache: this.options.cache,
  6126. windowWidth: container.width,
  6127. windowHeight: container.height
  6128. });
  6129. return [4, iframeRenderer.render(container.tree)];
  6130. case 13:
  6131. canvas = _b.sent();
  6132. if (container.width && container.height) {
  6133. this.ctx.drawImage(canvas, 0, 0, container.width, container.height, container.bounds.left, container.bounds.top, container.bounds.width, container.bounds.height);
  6134. }
  6135. _b.label = 14;
  6136. case 14:
  6137. if (container instanceof InputElementContainer) {
  6138. size = Math.min(container.bounds.width, container.bounds.height);
  6139. if (container.type === CHECKBOX) {
  6140. if (container.checked) {
  6141. this.ctx.save();
  6142. this.path([
  6143. new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79),
  6144. new Vector(container.bounds.left + size * 0.16, container.bounds.top + size * 0.5549),
  6145. new Vector(container.bounds.left + size * 0.27347, container.bounds.top + size * 0.44071),
  6146. new Vector(container.bounds.left + size * 0.39694, container.bounds.top + size * 0.5649),
  6147. new Vector(container.bounds.left + size * 0.72983, container.bounds.top + size * 0.23),
  6148. new Vector(container.bounds.left + size * 0.84, container.bounds.top + size * 0.34085),
  6149. new Vector(container.bounds.left + size * 0.39363, container.bounds.top + size * 0.79)
  6150. ]);
  6151. this.ctx.fillStyle = asString(INPUT_COLOR);
  6152. this.ctx.fill();
  6153. this.ctx.restore();
  6154. }
  6155. } else if (container.type === RADIO) {
  6156. if (container.checked) {
  6157. this.ctx.save();
  6158. this.ctx.beginPath();
  6159. this.ctx.arc(container.bounds.left + size / 2, container.bounds.top + size / 2, size / 4, 0, Math.PI * 2, true);
  6160. this.ctx.fillStyle = asString(INPUT_COLOR);
  6161. this.ctx.fill();
  6162. this.ctx.restore();
  6163. }
  6164. }
  6165. }
  6166. if (isTextInputElement(container) && container.value.length) {
  6167. this.ctx.font = this.createFontStyle(styles)[0];
  6168. this.ctx.fillStyle = asString(styles.color);
  6169. this.ctx.textBaseline = "middle";
  6170. this.ctx.textAlign = canvasTextAlign(container.styles.textAlign);
  6171. bounds = contentBox(container);
  6172. x = 0;
  6173. switch (container.styles.textAlign) {
  6174. case TEXT_ALIGN.CENTER:
  6175. x += bounds.width / 2;
  6176. break;
  6177. case TEXT_ALIGN.RIGHT:
  6178. x += bounds.width;
  6179. break;
  6180. }
  6181. textBounds = bounds.add(x, 0, 0, -bounds.height / 2 + 1);
  6182. this.ctx.save();
  6183. this.path([
  6184. new Vector(bounds.left, bounds.top),
  6185. new Vector(bounds.left + bounds.width, bounds.top),
  6186. new Vector(bounds.left + bounds.width, bounds.top + bounds.height),
  6187. new Vector(bounds.left, bounds.top + bounds.height)
  6188. ]);
  6189. this.ctx.clip();
  6190. this.renderTextWithLetterSpacing(new TextBounds(container.value, textBounds), styles.letterSpacing);
  6191. this.ctx.restore();
  6192. this.ctx.textBaseline = "bottom";
  6193. this.ctx.textAlign = "left";
  6194. }
  6195. if (!contains(
  6196. container.styles.display,
  6197. 2048
  6198. /* LIST_ITEM */
  6199. ))
  6200. return [3, 20];
  6201. if (!(container.styles.listStyleImage !== null))
  6202. return [3, 19];
  6203. img = container.styles.listStyleImage;
  6204. if (!(img.type === CSSImageType.URL))
  6205. return [3, 18];
  6206. image2 = void 0;
  6207. url = img.url;
  6208. _b.label = 15;
  6209. case 15:
  6210. _b.trys.push([15, 17, , 18]);
  6211. return [4, this.options.cache.match(url)];
  6212. case 16:
  6213. image2 = _b.sent();
  6214. this.ctx.drawImage(image2, container.bounds.left - (image2.width + 10), container.bounds.top);
  6215. return [3, 18];
  6216. case 17:
  6217. e_3 = _b.sent();
  6218. Logger.getInstance(this.options.id).error("Error loading list-style-image " + url);
  6219. return [3, 18];
  6220. case 18:
  6221. return [3, 20];
  6222. case 19:
  6223. if (paint.listValue && container.styles.listStyleType !== LIST_STYLE_TYPE.NONE) {
  6224. this.ctx.font = this.createFontStyle(styles)[0];
  6225. this.ctx.fillStyle = asString(styles.color);
  6226. this.ctx.textBaseline = "middle";
  6227. this.ctx.textAlign = "right";
  6228. 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);
  6229. this.renderTextWithLetterSpacing(new TextBounds(paint.listValue, bounds), styles.letterSpacing);
  6230. this.ctx.textBaseline = "bottom";
  6231. this.ctx.textAlign = "left";
  6232. }
  6233. _b.label = 20;
  6234. case 20:
  6235. return [
  6236. 2
  6237. /*return*/
  6238. ];
  6239. }
  6240. });
  6241. });
  6242. };
  6243. CanvasRenderer2.prototype.renderStackContent = function(stack) {
  6244. return __awaiter(this, void 0, void 0, function() {
  6245. var _i, _a, child, _b, _c, child, _d, _e, child, _f, _g, child, _h, _j, child, _k, _l, child, _m, _o, child;
  6246. return __generator(this, function(_p) {
  6247. switch (_p.label) {
  6248. case 0:
  6249. return [4, this.renderNodeBackgroundAndBorders(stack.element)];
  6250. case 1:
  6251. _p.sent();
  6252. _i = 0, _a = stack.negativeZIndex;
  6253. _p.label = 2;
  6254. case 2:
  6255. if (!(_i < _a.length))
  6256. return [3, 5];
  6257. child = _a[_i];
  6258. return [4, this.renderStack(child)];
  6259. case 3:
  6260. _p.sent();
  6261. _p.label = 4;
  6262. case 4:
  6263. _i++;
  6264. return [3, 2];
  6265. case 5:
  6266. return [4, this.renderNodeContent(stack.element)];
  6267. case 6:
  6268. _p.sent();
  6269. _b = 0, _c = stack.nonInlineLevel;
  6270. _p.label = 7;
  6271. case 7:
  6272. if (!(_b < _c.length))
  6273. return [3, 10];
  6274. child = _c[_b];
  6275. return [4, this.renderNode(child)];
  6276. case 8:
  6277. _p.sent();
  6278. _p.label = 9;
  6279. case 9:
  6280. _b++;
  6281. return [3, 7];
  6282. case 10:
  6283. _d = 0, _e = stack.nonPositionedFloats;
  6284. _p.label = 11;
  6285. case 11:
  6286. if (!(_d < _e.length))
  6287. return [3, 14];
  6288. child = _e[_d];
  6289. return [4, this.renderStack(child)];
  6290. case 12:
  6291. _p.sent();
  6292. _p.label = 13;
  6293. case 13:
  6294. _d++;
  6295. return [3, 11];
  6296. case 14:
  6297. _f = 0, _g = stack.nonPositionedInlineLevel;
  6298. _p.label = 15;
  6299. case 15:
  6300. if (!(_f < _g.length))
  6301. return [3, 18];
  6302. child = _g[_f];
  6303. return [4, this.renderStack(child)];
  6304. case 16:
  6305. _p.sent();
  6306. _p.label = 17;
  6307. case 17:
  6308. _f++;
  6309. return [3, 15];
  6310. case 18:
  6311. _h = 0, _j = stack.inlineLevel;
  6312. _p.label = 19;
  6313. case 19:
  6314. if (!(_h < _j.length))
  6315. return [3, 22];
  6316. child = _j[_h];
  6317. return [4, this.renderNode(child)];
  6318. case 20:
  6319. _p.sent();
  6320. _p.label = 21;
  6321. case 21:
  6322. _h++;
  6323. return [3, 19];
  6324. case 22:
  6325. _k = 0, _l = stack.zeroOrAutoZIndexOrTransformedOrOpacity;
  6326. _p.label = 23;
  6327. case 23:
  6328. if (!(_k < _l.length))
  6329. return [3, 26];
  6330. child = _l[_k];
  6331. return [4, this.renderStack(child)];
  6332. case 24:
  6333. _p.sent();
  6334. _p.label = 25;
  6335. case 25:
  6336. _k++;
  6337. return [3, 23];
  6338. case 26:
  6339. _m = 0, _o = stack.positiveZIndex;
  6340. _p.label = 27;
  6341. case 27:
  6342. if (!(_m < _o.length))
  6343. return [3, 30];
  6344. child = _o[_m];
  6345. return [4, this.renderStack(child)];
  6346. case 28:
  6347. _p.sent();
  6348. _p.label = 29;
  6349. case 29:
  6350. _m++;
  6351. return [3, 27];
  6352. case 30:
  6353. return [
  6354. 2
  6355. /*return*/
  6356. ];
  6357. }
  6358. });
  6359. });
  6360. };
  6361. CanvasRenderer2.prototype.mask = function(paths) {
  6362. this.ctx.beginPath();
  6363. this.ctx.moveTo(0, 0);
  6364. this.ctx.lineTo(this.canvas.width, 0);
  6365. this.ctx.lineTo(this.canvas.width, this.canvas.height);
  6366. this.ctx.lineTo(0, this.canvas.height);
  6367. this.ctx.lineTo(0, 0);
  6368. this.formatPath(paths.slice(0).reverse());
  6369. this.ctx.closePath();
  6370. };
  6371. CanvasRenderer2.prototype.path = function(paths) {
  6372. this.ctx.beginPath();
  6373. this.formatPath(paths);
  6374. this.ctx.closePath();
  6375. };
  6376. CanvasRenderer2.prototype.formatPath = function(paths) {
  6377. var _this2 = this;
  6378. paths.forEach(function(point, index) {
  6379. var start = isBezierCurve(point) ? point.start : point;
  6380. if (index === 0) {
  6381. _this2.ctx.moveTo(start.x, start.y);
  6382. } else {
  6383. _this2.ctx.lineTo(start.x, start.y);
  6384. }
  6385. if (isBezierCurve(point)) {
  6386. _this2.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
  6387. }
  6388. });
  6389. };
  6390. CanvasRenderer2.prototype.renderRepeat = function(path, pattern, offsetX, offsetY) {
  6391. this.path(path);
  6392. this.ctx.fillStyle = pattern;
  6393. this.ctx.translate(offsetX, offsetY);
  6394. this.ctx.fill();
  6395. this.ctx.translate(-offsetX, -offsetY);
  6396. };
  6397. CanvasRenderer2.prototype.resizeImage = function(image2, width, height) {
  6398. if (image2.width === width && image2.height === height) {
  6399. return image2;
  6400. }
  6401. var canvas = this.canvas.ownerDocument.createElement("canvas");
  6402. canvas.width = width;
  6403. canvas.height = height;
  6404. var ctx = canvas.getContext("2d");
  6405. ctx.drawImage(image2, 0, 0, image2.width, image2.height, 0, 0, width, height);
  6406. return canvas;
  6407. };
  6408. CanvasRenderer2.prototype.renderBackgroundImage = function(container) {
  6409. return __awaiter(this, void 0, void 0, function() {
  6410. var index, _loop_1, this_1, _i, _a, backgroundImage2;
  6411. return __generator(this, function(_b) {
  6412. switch (_b.label) {
  6413. case 0:
  6414. index = container.styles.backgroundImage.length - 1;
  6415. _loop_1 = function(backgroundImage3) {
  6416. var image2, url, e_4, _a2, path, x, y, width, height, pattern, _b2, path, x, y, width, height, _c, lineLength, x0, x1, y0, y1, canvas, ctx, gradient_1, pattern, _d, path, left, top_1, width, height, position2, x, y, _e, rx, ry, radialGradient_1, midX, midY, f2, invF;
  6417. return __generator(this, function(_f) {
  6418. switch (_f.label) {
  6419. case 0:
  6420. if (!(backgroundImage3.type === CSSImageType.URL))
  6421. return [3, 5];
  6422. image2 = void 0;
  6423. url = backgroundImage3.url;
  6424. _f.label = 1;
  6425. case 1:
  6426. _f.trys.push([1, 3, , 4]);
  6427. return [4, this_1.options.cache.match(url)];
  6428. case 2:
  6429. image2 = _f.sent();
  6430. return [3, 4];
  6431. case 3:
  6432. e_4 = _f.sent();
  6433. Logger.getInstance(this_1.options.id).error("Error loading background-image " + url);
  6434. return [3, 4];
  6435. case 4:
  6436. if (image2) {
  6437. _a2 = calculateBackgroundRendering(container, index, [
  6438. image2.width,
  6439. image2.height,
  6440. image2.width / image2.height
  6441. ]), path = _a2[0], x = _a2[1], y = _a2[2], width = _a2[3], height = _a2[4];
  6442. pattern = this_1.ctx.createPattern(this_1.resizeImage(image2, width, height), "repeat");
  6443. this_1.renderRepeat(path, pattern, x, y);
  6444. }
  6445. return [3, 6];
  6446. case 5:
  6447. if (isLinearGradient(backgroundImage3)) {
  6448. _b2 = calculateBackgroundRendering(container, index, [null, null, null]), path = _b2[0], x = _b2[1], y = _b2[2], width = _b2[3], height = _b2[4];
  6449. _c = calculateGradientDirection(backgroundImage3.angle, width, height), lineLength = _c[0], x0 = _c[1], x1 = _c[2], y0 = _c[3], y1 = _c[4];
  6450. canvas = document.createElement("canvas");
  6451. canvas.width = width;
  6452. canvas.height = height;
  6453. ctx = canvas.getContext("2d");
  6454. gradient_1 = ctx.createLinearGradient(x0, y0, x1, y1);
  6455. processColorStops(backgroundImage3.stops, lineLength).forEach(function(colorStop) {
  6456. return gradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
  6457. });
  6458. ctx.fillStyle = gradient_1;
  6459. ctx.fillRect(0, 0, width, height);
  6460. if (width > 0 && height > 0) {
  6461. pattern = this_1.ctx.createPattern(canvas, "repeat");
  6462. this_1.renderRepeat(path, pattern, x, y);
  6463. }
  6464. } else if (isRadialGradient(backgroundImage3)) {
  6465. _d = calculateBackgroundRendering(container, index, [
  6466. null,
  6467. null,
  6468. null
  6469. ]), path = _d[0], left = _d[1], top_1 = _d[2], width = _d[3], height = _d[4];
  6470. position2 = backgroundImage3.position.length === 0 ? [FIFTY_PERCENT] : backgroundImage3.position;
  6471. x = getAbsoluteValue(position2[0], width);
  6472. y = getAbsoluteValue(position2[position2.length - 1], height);
  6473. _e = calculateRadius(backgroundImage3, x, y, width, height), rx = _e[0], ry = _e[1];
  6474. if (rx > 0 && rx > 0) {
  6475. radialGradient_1 = this_1.ctx.createRadialGradient(left + x, top_1 + y, 0, left + x, top_1 + y, rx);
  6476. processColorStops(backgroundImage3.stops, rx * 2).forEach(function(colorStop) {
  6477. return radialGradient_1.addColorStop(colorStop.stop, asString(colorStop.color));
  6478. });
  6479. this_1.path(path);
  6480. this_1.ctx.fillStyle = radialGradient_1;
  6481. if (rx !== ry) {
  6482. midX = container.bounds.left + 0.5 * container.bounds.width;
  6483. midY = container.bounds.top + 0.5 * container.bounds.height;
  6484. f2 = ry / rx;
  6485. invF = 1 / f2;
  6486. this_1.ctx.save();
  6487. this_1.ctx.translate(midX, midY);
  6488. this_1.ctx.transform(1, 0, 0, f2, 0, 0);
  6489. this_1.ctx.translate(-midX, -midY);
  6490. this_1.ctx.fillRect(left, invF * (top_1 - midY) + midY, width, height * invF);
  6491. this_1.ctx.restore();
  6492. } else {
  6493. this_1.ctx.fill();
  6494. }
  6495. }
  6496. }
  6497. _f.label = 6;
  6498. case 6:
  6499. index--;
  6500. return [
  6501. 2
  6502. /*return*/
  6503. ];
  6504. }
  6505. });
  6506. };
  6507. this_1 = this;
  6508. _i = 0, _a = container.styles.backgroundImage.slice(0).reverse();
  6509. _b.label = 1;
  6510. case 1:
  6511. if (!(_i < _a.length))
  6512. return [3, 4];
  6513. backgroundImage2 = _a[_i];
  6514. return [5, _loop_1(backgroundImage2)];
  6515. case 2:
  6516. _b.sent();
  6517. _b.label = 3;
  6518. case 3:
  6519. _i++;
  6520. return [3, 1];
  6521. case 4:
  6522. return [
  6523. 2
  6524. /*return*/
  6525. ];
  6526. }
  6527. });
  6528. });
  6529. };
  6530. CanvasRenderer2.prototype.renderBorder = function(color2, side, curvePoints) {
  6531. return __awaiter(this, void 0, void 0, function() {
  6532. return __generator(this, function(_a) {
  6533. this.path(parsePathForBorder(curvePoints, side));
  6534. this.ctx.fillStyle = asString(color2);
  6535. this.ctx.fill();
  6536. return [
  6537. 2
  6538. /*return*/
  6539. ];
  6540. });
  6541. });
  6542. };
  6543. CanvasRenderer2.prototype.renderNodeBackgroundAndBorders = function(paint) {
  6544. return __awaiter(this, void 0, void 0, function() {
  6545. var styles, hasBackground, borders, backgroundPaintingArea, side, _i, borders_1, border;
  6546. var _this2 = this;
  6547. return __generator(this, function(_a) {
  6548. switch (_a.label) {
  6549. case 0:
  6550. this.applyEffects(
  6551. paint.effects,
  6552. 2
  6553. /* BACKGROUND_BORDERS */
  6554. );
  6555. styles = paint.container.styles;
  6556. hasBackground = !isTransparent(styles.backgroundColor) || styles.backgroundImage.length;
  6557. borders = [
  6558. { style: styles.borderTopStyle, color: styles.borderTopColor },
  6559. { style: styles.borderRightStyle, color: styles.borderRightColor },
  6560. { style: styles.borderBottomStyle, color: styles.borderBottomColor },
  6561. { style: styles.borderLeftStyle, color: styles.borderLeftColor }
  6562. ];
  6563. backgroundPaintingArea = calculateBackgroundCurvedPaintingArea(getBackgroundValueForIndex(styles.backgroundClip, 0), paint.curves);
  6564. if (!(hasBackground || styles.boxShadow.length))
  6565. return [3, 2];
  6566. this.ctx.save();
  6567. this.path(backgroundPaintingArea);
  6568. this.ctx.clip();
  6569. if (!isTransparent(styles.backgroundColor)) {
  6570. this.ctx.fillStyle = asString(styles.backgroundColor);
  6571. this.ctx.fill();
  6572. }
  6573. return [4, this.renderBackgroundImage(paint.container)];
  6574. case 1:
  6575. _a.sent();
  6576. this.ctx.restore();
  6577. styles.boxShadow.slice(0).reverse().forEach(function(shadow) {
  6578. _this2.ctx.save();
  6579. var borderBoxArea = calculateBorderBoxPath(paint.curves);
  6580. var maskOffset = shadow.inset ? 0 : MASK_OFFSET;
  6581. 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));
  6582. if (shadow.inset) {
  6583. _this2.path(borderBoxArea);
  6584. _this2.ctx.clip();
  6585. _this2.mask(shadowPaintingArea);
  6586. } else {
  6587. _this2.mask(borderBoxArea);
  6588. _this2.ctx.clip();
  6589. _this2.path(shadowPaintingArea);
  6590. }
  6591. _this2.ctx.shadowOffsetX = shadow.offsetX.number + maskOffset;
  6592. _this2.ctx.shadowOffsetY = shadow.offsetY.number;
  6593. _this2.ctx.shadowColor = asString(shadow.color);
  6594. _this2.ctx.shadowBlur = shadow.blur.number;
  6595. _this2.ctx.fillStyle = shadow.inset ? asString(shadow.color) : "rgba(0,0,0,1)";
  6596. _this2.ctx.fill();
  6597. _this2.ctx.restore();
  6598. });
  6599. _a.label = 2;
  6600. case 2:
  6601. side = 0;
  6602. _i = 0, borders_1 = borders;
  6603. _a.label = 3;
  6604. case 3:
  6605. if (!(_i < borders_1.length))
  6606. return [3, 7];
  6607. border = borders_1[_i];
  6608. if (!(border.style !== BORDER_STYLE.NONE && !isTransparent(border.color)))
  6609. return [3, 5];
  6610. return [4, this.renderBorder(border.color, side, paint.curves)];
  6611. case 4:
  6612. _a.sent();
  6613. _a.label = 5;
  6614. case 5:
  6615. side++;
  6616. _a.label = 6;
  6617. case 6:
  6618. _i++;
  6619. return [3, 3];
  6620. case 7:
  6621. return [
  6622. 2
  6623. /*return*/
  6624. ];
  6625. }
  6626. });
  6627. });
  6628. };
  6629. CanvasRenderer2.prototype.render = function(element) {
  6630. return __awaiter(this, void 0, void 0, function() {
  6631. var stack;
  6632. return __generator(this, function(_a) {
  6633. switch (_a.label) {
  6634. case 0:
  6635. if (this.options.backgroundColor) {
  6636. this.ctx.fillStyle = asString(this.options.backgroundColor);
  6637. this.ctx.fillRect(this.options.x - this.options.scrollX, this.options.y - this.options.scrollY, this.options.width, this.options.height);
  6638. }
  6639. stack = parseStackingContexts(element);
  6640. return [4, this.renderStack(stack)];
  6641. case 1:
  6642. _a.sent();
  6643. this.applyEffects(
  6644. [],
  6645. 2
  6646. /* BACKGROUND_BORDERS */
  6647. );
  6648. return [2, this.canvas];
  6649. }
  6650. });
  6651. });
  6652. };
  6653. return CanvasRenderer2;
  6654. }()
  6655. );
  6656. var isTextInputElement = function(container) {
  6657. if (container instanceof TextareaElementContainer) {
  6658. return true;
  6659. } else if (container instanceof SelectElementContainer) {
  6660. return true;
  6661. } else if (container instanceof InputElementContainer && container.type !== RADIO && container.type !== CHECKBOX) {
  6662. return true;
  6663. }
  6664. return false;
  6665. };
  6666. var calculateBackgroundCurvedPaintingArea = function(clip, curves) {
  6667. switch (clip) {
  6668. case BACKGROUND_CLIP.BORDER_BOX:
  6669. return calculateBorderBoxPath(curves);
  6670. case BACKGROUND_CLIP.CONTENT_BOX:
  6671. return calculateContentBoxPath(curves);
  6672. case BACKGROUND_CLIP.PADDING_BOX:
  6673. default:
  6674. return calculatePaddingBoxPath(curves);
  6675. }
  6676. };
  6677. var canvasTextAlign = function(textAlign2) {
  6678. switch (textAlign2) {
  6679. case TEXT_ALIGN.CENTER:
  6680. return "center";
  6681. case TEXT_ALIGN.RIGHT:
  6682. return "right";
  6683. case TEXT_ALIGN.LEFT:
  6684. default:
  6685. return "left";
  6686. }
  6687. };
  6688. var ForeignObjectRenderer = (
  6689. /** @class */
  6690. function() {
  6691. function ForeignObjectRenderer2(options) {
  6692. this.canvas = options.canvas ? options.canvas : document.createElement("canvas");
  6693. this.ctx = this.canvas.getContext("2d");
  6694. this.options = options;
  6695. this.canvas.width = Math.floor(options.width * options.scale);
  6696. this.canvas.height = Math.floor(options.height * options.scale);
  6697. this.canvas.style.width = options.width + "px";
  6698. this.canvas.style.height = options.height + "px";
  6699. this.ctx.scale(this.options.scale, this.options.scale);
  6700. this.ctx.translate(-options.x + options.scrollX, -options.y + options.scrollY);
  6701. Logger.getInstance(options.id).debug("EXPERIMENTAL ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
  6702. }
  6703. ForeignObjectRenderer2.prototype.render = function(element) {
  6704. return __awaiter(this, void 0, void 0, function() {
  6705. var svg, img;
  6706. return __generator(this, function(_a) {
  6707. switch (_a.label) {
  6708. case 0:
  6709. 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);
  6710. return [4, loadSerializedSVG$1(svg)];
  6711. case 1:
  6712. img = _a.sent();
  6713. if (this.options.backgroundColor) {
  6714. this.ctx.fillStyle = asString(this.options.backgroundColor);
  6715. this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale);
  6716. }
  6717. this.ctx.drawImage(img, -this.options.x * this.options.scale, -this.options.y * this.options.scale);
  6718. return [2, this.canvas];
  6719. }
  6720. });
  6721. });
  6722. };
  6723. return ForeignObjectRenderer2;
  6724. }()
  6725. );
  6726. var loadSerializedSVG$1 = function(svg) {
  6727. return new Promise(function(resolve, reject) {
  6728. var img = new Image();
  6729. img.onload = function() {
  6730. resolve(img);
  6731. };
  6732. img.onerror = reject;
  6733. img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
  6734. });
  6735. };
  6736. var _this = void 0;
  6737. var parseColor$1 = function(value) {
  6738. return color.parse(Parser.create(value).parseComponentValue());
  6739. };
  6740. var html2canvas = function(element, options) {
  6741. if (options === void 0) {
  6742. options = {};
  6743. }
  6744. return renderElement(element, options);
  6745. };
  6746. CacheStorage.setContext(window);
  6747. var renderElement = function(element, opts) {
  6748. return __awaiter(_this, void 0, void 0, function() {
  6749. var ownerDocument, defaultView, instanceName, _a, width, height, left, top, defaultResourceOptions, resourceOptions, defaultOptions, options, windowBounds, documentCloner, clonedElement, container, documentBackgroundColor, bodyBackgroundColor, bgColor, defaultBackgroundColor, backgroundColor2, renderOptions, canvas, renderer, root, renderer;
  6750. return __generator(this, function(_b) {
  6751. switch (_b.label) {
  6752. case 0:
  6753. ownerDocument = element.ownerDocument;
  6754. if (!ownerDocument) {
  6755. throw new Error("Element is not attached to a Document");
  6756. }
  6757. defaultView = ownerDocument.defaultView;
  6758. if (!defaultView) {
  6759. throw new Error("Document is not attached to a Window");
  6760. }
  6761. instanceName = (Math.round(Math.random() * 1e3) + Date.now()).toString(16);
  6762. _a = isBodyElement(element) || isHTMLElement(element) ? parseDocumentSize(ownerDocument) : parseBounds(element), width = _a.width, height = _a.height, left = _a.left, top = _a.top;
  6763. defaultResourceOptions = {
  6764. allowTaint: false,
  6765. imageTimeout: 15e3,
  6766. proxy: void 0,
  6767. useCORS: false
  6768. };
  6769. resourceOptions = __assign({}, defaultResourceOptions, opts);
  6770. defaultOptions = {
  6771. backgroundColor: "#ffffff",
  6772. cache: opts.cache ? opts.cache : CacheStorage.create(instanceName, resourceOptions),
  6773. logging: true,
  6774. removeContainer: true,
  6775. foreignObjectRendering: false,
  6776. scale: defaultView.devicePixelRatio || 1,
  6777. windowWidth: defaultView.innerWidth,
  6778. windowHeight: defaultView.innerHeight,
  6779. scrollX: defaultView.pageXOffset,
  6780. scrollY: defaultView.pageYOffset,
  6781. x: left,
  6782. y: top,
  6783. width: Math.ceil(width),
  6784. height: Math.ceil(height),
  6785. id: instanceName
  6786. };
  6787. options = __assign({}, defaultOptions, resourceOptions, opts);
  6788. windowBounds = new Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight);
  6789. Logger.create(instanceName);
  6790. Logger.getInstance(instanceName).debug("Starting document clone");
  6791. documentCloner = new DocumentCloner(element, {
  6792. id: instanceName,
  6793. onclone: options.onclone,
  6794. ignoreElements: options.ignoreElements,
  6795. inlineImages: options.foreignObjectRendering,
  6796. copyStyles: options.foreignObjectRendering
  6797. });
  6798. clonedElement = documentCloner.clonedReferenceElement;
  6799. if (!clonedElement) {
  6800. return [2, Promise.reject("Unable to find element in cloned iframe")];
  6801. }
  6802. return [4, documentCloner.toIFrame(ownerDocument, windowBounds)];
  6803. case 1:
  6804. container = _b.sent();
  6805. documentBackgroundColor = ownerDocument.documentElement ? parseColor$1(getComputedStyle(ownerDocument.documentElement).backgroundColor) : COLORS.TRANSPARENT;
  6806. bodyBackgroundColor = ownerDocument.body ? parseColor$1(getComputedStyle(ownerDocument.body).backgroundColor) : COLORS.TRANSPARENT;
  6807. bgColor = opts.backgroundColor;
  6808. defaultBackgroundColor = typeof bgColor === "string" ? parseColor$1(bgColor) : bgColor === null ? COLORS.TRANSPARENT : 4294967295;
  6809. backgroundColor2 = element === ownerDocument.documentElement ? isTransparent(documentBackgroundColor) ? isTransparent(bodyBackgroundColor) ? defaultBackgroundColor : bodyBackgroundColor : documentBackgroundColor : defaultBackgroundColor;
  6810. renderOptions = {
  6811. id: instanceName,
  6812. cache: options.cache,
  6813. backgroundColor: backgroundColor2,
  6814. scale: options.scale,
  6815. x: options.x,
  6816. y: options.y,
  6817. scrollX: options.scrollX,
  6818. scrollY: options.scrollY,
  6819. width: options.width,
  6820. height: options.height,
  6821. windowWidth: options.windowWidth,
  6822. windowHeight: options.windowHeight
  6823. };
  6824. if (!options.foreignObjectRendering)
  6825. return [3, 3];
  6826. Logger.getInstance(instanceName).debug("Document cloned, using foreign object rendering");
  6827. renderer = new ForeignObjectRenderer(renderOptions);
  6828. return [4, renderer.render(clonedElement)];
  6829. case 2:
  6830. canvas = _b.sent();
  6831. return [3, 5];
  6832. case 3:
  6833. Logger.getInstance(instanceName).debug("Document cloned, using computed rendering");
  6834. CacheStorage.attachInstance(options.cache);
  6835. Logger.getInstance(instanceName).debug("Starting DOM parsing");
  6836. root = parseTree(clonedElement);
  6837. CacheStorage.detachInstance();
  6838. if (backgroundColor2 === root.styles.backgroundColor) {
  6839. root.styles.backgroundColor = COLORS.TRANSPARENT;
  6840. }
  6841. Logger.getInstance(instanceName).debug("Starting renderer");
  6842. renderer = new CanvasRenderer(renderOptions);
  6843. return [4, renderer.render(root)];
  6844. case 4:
  6845. canvas = _b.sent();
  6846. _b.label = 5;
  6847. case 5:
  6848. if (options.removeContainer === true) {
  6849. if (!cleanContainer(container)) {
  6850. Logger.getInstance(instanceName).error("Cannot detach cloned iframe as it is not in the DOM anymore");
  6851. }
  6852. }
  6853. Logger.getInstance(instanceName).debug("Finished rendering");
  6854. Logger.destroy(instanceName);
  6855. CacheStorage.destroy(instanceName);
  6856. return [2, canvas];
  6857. }
  6858. });
  6859. });
  6860. };
  6861. var cleanContainer = function(container) {
  6862. if (container.parentNode) {
  6863. container.parentNode.removeChild(container);
  6864. return true;
  6865. }
  6866. return false;
  6867. };
  6868. var html2canvas_esm_default = html2canvas;
  6869. export {
  6870. html2canvas_esm_default as default
  6871. };
  6872. /*! Bundled license information:
  6873. html2canvas/dist/html2canvas.esm.js:
  6874. (*!
  6875. * html2canvas 1.0.0-rc.4 <https://html2canvas.hertzen.com>
  6876. * Copyright (c) 2019 Niklas von Hertzen <https://hertzen.com>
  6877. * Released under MIT License
  6878. *)
  6879. (*! *****************************************************************************
  6880. Copyright (c) Microsoft Corporation. All rights reserved.
  6881. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  6882. this file except in compliance with the License. You may obtain a copy of the
  6883. License at http://www.apache.org/licenses/LICENSE-2.0
  6884. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  6885. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  6886. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  6887. MERCHANTABLITY OR NON-INFRINGEMENT.
  6888. See the Apache Version 2.0 License for specific language governing permissions
  6889. and limitations under the License.
  6890. ***************************************************************************** *)
  6891. */
  6892. //# sourceMappingURL=html2canvas.js.map