123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445 |
- /**
- * @license Angular v5.2.11
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core')) :
- typeof define === 'function' && define.amd ? define('@angular/platform-browser', ['exports', '@angular/common', '@angular/core'], factory) :
- (factory((global.ng = global.ng || {}, global.ng.platformBrowser = {}),global.ng.common,global.ng.core));
- }(this, (function (exports,_angular_common,_angular_core) { 'use strict';
-
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
-
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
-
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
- ***************************************************************************** */
- /* global Reflect, Promise */
-
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
-
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
-
- var __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
-
- /**
- * @license Angular v5.2.11
- * (c) 2010-2018 Google, Inc. https://angular.io/
- * License: MIT
- */
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _DOM = /** @type {?} */ ((null));
- /**
- * @return {?}
- */
- function getDOM() {
- return _DOM;
- }
- /**
- * @param {?} adapter
- * @return {?}
- */
-
- /**
- * @param {?} adapter
- * @return {?}
- */
- function setRootDomAdapter(adapter) {
- if (!_DOM) {
- _DOM = adapter;
- }
- }
- /**
- * Provides DOM operations in an environment-agnostic way.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- * @abstract
- */
- var DomAdapter = /** @class */ (function () {
- function DomAdapter() {
- this.resourceLoaderType = /** @type {?} */ ((null));
- }
- Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
- /**
- * Maps attribute names to their corresponding property names for cases
- * where attribute name doesn't match property name.
- */
- get: /**
- * Maps attribute names to their corresponding property names for cases
- * where attribute name doesn't match property name.
- * @return {?}
- */
- function () { return this._attrToPropMap; },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) { this._attrToPropMap = value; },
- enumerable: true,
- configurable: true
- });
- return DomAdapter;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Provides DOM operations in any browser environment.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- * @abstract
- */
- var GenericBrowserDomAdapter = /** @class */ (function (_super) {
- __extends(GenericBrowserDomAdapter, _super);
- function GenericBrowserDomAdapter() {
- var _this = _super.call(this) || this;
- _this._animationPrefix = null;
- _this._transitionEnd = null;
- try {
- var /** @type {?} */ element_1 = _this.createElement('div', document);
- if (_this.getStyle(element_1, 'animationName') != null) {
- _this._animationPrefix = '';
- }
- else {
- var /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
- for (var /** @type {?} */ i = 0; i < domPrefixes.length; i++) {
- if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
- _this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
- break;
- }
- }
- }
- var /** @type {?} */ transEndEventNames_1 = {
- WebkitTransition: 'webkitTransitionEnd',
- MozTransition: 'transitionend',
- OTransition: 'oTransitionEnd otransitionend',
- transition: 'transitionend'
- };
- Object.keys(transEndEventNames_1).forEach(function (key) {
- if (_this.getStyle(element_1, key) != null) {
- _this._transitionEnd = transEndEventNames_1[key];
- }
- });
- }
- catch (/** @type {?} */ e) {
- _this._animationPrefix = null;
- _this._transitionEnd = null;
- }
- return _this;
- }
- /**
- * @param {?} el
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getDistributedNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).getDistributedNodes(); };
- /**
- * @param {?} el
- * @param {?} baseUrl
- * @param {?} href
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.resolveAndSetHref = /**
- * @param {?} el
- * @param {?} baseUrl
- * @param {?} href
- * @return {?}
- */
- function (el, baseUrl, href) {
- el.href = href == null ? baseUrl : baseUrl + '/../' + href;
- };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsDOMEvents = /**
- * @return {?}
- */
- function () { return true; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = /**
- * @return {?}
- */
- function () {
- return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function';
- };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getAnimationPrefix = /**
- * @return {?}
- */
- function () { return this._animationPrefix ? this._animationPrefix : ''; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.getTransitionEnd = /**
- * @return {?}
- */
- function () { return this._transitionEnd ? this._transitionEnd : ''; };
- /**
- * @return {?}
- */
- GenericBrowserDomAdapter.prototype.supportsAnimation = /**
- * @return {?}
- */
- function () {
- return this._animationPrefix != null && this._transitionEnd != null;
- };
- return GenericBrowserDomAdapter;
- }(DomAdapter));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var _attrToPropMap = {
- 'class': 'className',
- 'innerHtml': 'innerHTML',
- 'readonly': 'readOnly',
- 'tabindex': 'tabIndex',
- };
- var DOM_KEY_LOCATION_NUMPAD = 3;
- // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
- var _keyMap = {
- // The following values are here for cross-browser compatibility and to match the W3C standard
- // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
- '\b': 'Backspace',
- '\t': 'Tab',
- '\x7F': 'Delete',
- '\x1B': 'Escape',
- 'Del': 'Delete',
- 'Esc': 'Escape',
- 'Left': 'ArrowLeft',
- 'Right': 'ArrowRight',
- 'Up': 'ArrowUp',
- 'Down': 'ArrowDown',
- 'Menu': 'ContextMenu',
- 'Scroll': 'ScrollLock',
- 'Win': 'OS'
- };
- // There is a bug in Chrome for numeric keypad keys:
- // https://code.google.com/p/chromium/issues/detail?id=155654
- // 1, 2, 3 ... are reported as A, B, C ...
- var _chromeNumKeyPadMap = {
- 'A': '1',
- 'B': '2',
- 'C': '3',
- 'D': '4',
- 'E': '5',
- 'F': '6',
- 'G': '7',
- 'H': '8',
- 'I': '9',
- 'J': '*',
- 'K': '+',
- 'M': '-',
- 'N': '.',
- 'O': '/',
- '\x60': '0',
- '\x90': 'NumLock'
- };
- var nodeContains;
- if (_angular_core.ɵglobal['Node']) {
- nodeContains = _angular_core.ɵglobal['Node'].prototype.contains || function (node) {
- return !!(this.compareDocumentPosition(node) & 16);
- };
- }
- /**
- * A `DomAdapter` powered by full browser DOM APIs.
- *
- * \@security Tread carefully! Interacting with the DOM directly is dangerous and
- * can introduce XSS risks.
- */
- var BrowserDomAdapter = /** @class */ (function (_super) {
- __extends(BrowserDomAdapter, _super);
- function BrowserDomAdapter() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @param {?} templateHtml
- * @return {?}
- */
- BrowserDomAdapter.prototype.parse = /**
- * @param {?} templateHtml
- * @return {?}
- */
- function (templateHtml) { throw new Error('parse not implemented'); };
- /**
- * @return {?}
- */
- BrowserDomAdapter.makeCurrent = /**
- * @return {?}
- */
- function () { setRootDomAdapter(new BrowserDomAdapter()); };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasProperty = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) { return name in element; };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setProperty = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (el, name, value) { (/** @type {?} */ (el))[name] = value; };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getProperty = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { return (/** @type {?} */ (el))[name]; };
- /**
- * @param {?} el
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- BrowserDomAdapter.prototype.invoke = /**
- * @param {?} el
- * @param {?} methodName
- * @param {?} args
- * @return {?}
- */
- function (el, methodName, args) {
- (_a = (/** @type {?} */ (el)))[methodName].apply(_a, args);
- var _a;
- };
- // TODO(tbosch): move this into a separate environment class once we have it
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.logError = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- if (console.error) {
- console.error(error);
- }
- else {
- console.log(error);
- }
- }
- };
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.log = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- window.console.log && window.console.log(error);
- }
- };
- /**
- * @param {?} error
- * @return {?}
- */
- BrowserDomAdapter.prototype.logGroup = /**
- * @param {?} error
- * @return {?}
- */
- function (error) {
- if (window.console) {
- window.console.group && window.console.group(error);
- }
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.logGroupEnd = /**
- * @return {?}
- */
- function () {
- if (window.console) {
- window.console.groupEnd && window.console.groupEnd();
- }
- };
- Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
- get: /**
- * @return {?}
- */
- function () { return _attrToPropMap; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} nodeA
- * @param {?} nodeB
- * @return {?}
- */
- BrowserDomAdapter.prototype.contains = /**
- * @param {?} nodeA
- * @param {?} nodeB
- * @return {?}
- */
- function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
- /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.querySelector = /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- function (el, selector) { return el.querySelector(selector); };
- /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.querySelectorAll = /**
- * @param {?} el
- * @param {?} selector
- * @return {?}
- */
- function (el, selector) { return el.querySelectorAll(selector); };
- /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- BrowserDomAdapter.prototype.on = /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- function (el, evt, listener) { el.addEventListener(evt, listener, false); };
- /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- BrowserDomAdapter.prototype.onAndCancel = /**
- * @param {?} el
- * @param {?} evt
- * @param {?} listener
- * @return {?}
- */
- function (el, evt, listener) {
- el.addEventListener(evt, listener, false);
- // Needed to follow Dart's subscription semantic, until fix of
- // https://code.google.com/p/dart/issues/detail?id=17406
- return function () { el.removeEventListener(evt, listener, false); };
- };
- /**
- * @param {?} el
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.dispatchEvent = /**
- * @param {?} el
- * @param {?} evt
- * @return {?}
- */
- function (el, evt) { el.dispatchEvent(evt); };
- /**
- * @param {?} eventType
- * @return {?}
- */
- BrowserDomAdapter.prototype.createMouseEvent = /**
- * @param {?} eventType
- * @return {?}
- */
- function (eventType) {
- var /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent');
- evt.initEvent(eventType, true, true);
- return evt;
- };
- /**
- * @param {?} eventType
- * @return {?}
- */
- BrowserDomAdapter.prototype.createEvent = /**
- * @param {?} eventType
- * @return {?}
- */
- function (eventType) {
- var /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event');
- evt.initEvent(eventType, true, true);
- return evt;
- };
- /**
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.preventDefault = /**
- * @param {?} evt
- * @return {?}
- */
- function (evt) {
- evt.preventDefault();
- evt.returnValue = false;
- };
- /**
- * @param {?} evt
- * @return {?}
- */
- BrowserDomAdapter.prototype.isPrevented = /**
- * @param {?} evt
- * @return {?}
- */
- function (evt) {
- return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getInnerHTML = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.innerHTML; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getTemplateContent = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getOuterHTML = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.outerHTML; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.nodeName = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeName; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.nodeValue = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeValue; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.type = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.type; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.content = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (this.hasProperty(node, 'content')) {
- return (/** @type {?} */ (node)).content;
- }
- else {
- return node;
- }
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.firstChild = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.firstChild; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.nextSibling = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.nextSibling; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.parentElement = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.parentNode; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.childNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.childNodes; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.childNodesAsList = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var /** @type {?} */ childNodes = el.childNodes;
- var /** @type {?} */ res = new Array(childNodes.length);
- for (var /** @type {?} */ i = 0; i < childNodes.length; i++) {
- res[i] = childNodes[i];
- }
- return res;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.clearNodes = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- while (el.firstChild) {
- el.removeChild(el.firstChild);
- }
- };
- /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.appendChild = /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- function (el, node) { el.appendChild(node); };
- /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeChild = /**
- * @param {?} el
- * @param {?} node
- * @return {?}
- */
- function (el, node) { el.removeChild(node); };
- /**
- * @param {?} el
- * @param {?} newChild
- * @param {?} oldChild
- * @return {?}
- */
- BrowserDomAdapter.prototype.replaceChild = /**
- * @param {?} el
- * @param {?} newChild
- * @param {?} oldChild
- * @return {?}
- */
- function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.remove = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- if (node.parentNode) {
- node.parentNode.removeChild(node);
- }
- return node;
- };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- function (parent, ref, node) { parent.insertBefore(node, ref); };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} nodes
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertAllBefore = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} nodes
- * @return {?}
- */
- function (parent, ref, nodes) {
- nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
- };
- /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.insertAfter = /**
- * @param {?} parent
- * @param {?} ref
- * @param {?} node
- * @return {?}
- */
- function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setInnerHTML = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.innerHTML = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getText = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.textContent; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setText = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.textContent = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getValue = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.value; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setValue = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.value = value; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getChecked = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return el.checked; };
- /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setChecked = /**
- * @param {?} el
- * @param {?} value
- * @return {?}
- */
- function (el, value) { el.checked = value; };
- /**
- * @param {?} text
- * @return {?}
- */
- BrowserDomAdapter.prototype.createComment = /**
- * @param {?} text
- * @return {?}
- */
- function (text) { return this.getDefaultDocument().createComment(text); };
- /**
- * @param {?} html
- * @return {?}
- */
- BrowserDomAdapter.prototype.createTemplate = /**
- * @param {?} html
- * @return {?}
- */
- function (html) {
- var /** @type {?} */ t = this.getDefaultDocument().createElement('template');
- t.innerHTML = html;
- return t;
- };
- /**
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createElement = /**
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- function (tagName, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createElement(tagName);
- };
- /**
- * @param {?} ns
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createElementNS = /**
- * @param {?} ns
- * @param {?} tagName
- * @param {?=} doc
- * @return {?}
- */
- function (ns, tagName, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createElementNS(ns, tagName);
- };
- /**
- * @param {?} text
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createTextNode = /**
- * @param {?} text
- * @param {?=} doc
- * @return {?}
- */
- function (text, doc) {
- doc = doc || this.getDefaultDocument();
- return doc.createTextNode(text);
- };
- /**
- * @param {?} attrName
- * @param {?} attrValue
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createScriptTag = /**
- * @param {?} attrName
- * @param {?} attrValue
- * @param {?=} doc
- * @return {?}
- */
- function (attrName, attrValue, doc) {
- doc = doc || this.getDefaultDocument();
- var /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT'));
- el.setAttribute(attrName, attrValue);
- return el;
- };
- /**
- * @param {?} css
- * @param {?=} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.createStyleElement = /**
- * @param {?} css
- * @param {?=} doc
- * @return {?}
- */
- function (css, doc) {
- doc = doc || this.getDefaultDocument();
- var /** @type {?} */ style = /** @type {?} */ (doc.createElement('style'));
- this.appendChild(style, this.createTextNode(css, doc));
- return style;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.createShadowRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).createShadowRoot(); };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getShadowRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).shadowRoot; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHost = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return (/** @type {?} */ (el)).host; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.clone = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.cloneNode(true); };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getElementsByClassName = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return element.getElementsByClassName(name);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getElementsByTagName = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return element.getElementsByTagName(name);
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.classList = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return Array.prototype.slice.call(element.classList, 0); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.addClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) { element.classList.add(className); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) { element.classList.remove(className); };
- /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasClass = /**
- * @param {?} element
- * @param {?} className
- * @return {?}
- */
- function (element, className) {
- return element.classList.contains(className);
- };
- /**
- * @param {?} element
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- BrowserDomAdapter.prototype.setStyle = /**
- * @param {?} element
- * @param {?} styleName
- * @param {?} styleValue
- * @return {?}
- */
- function (element, styleName, styleValue) {
- element.style[styleName] = styleValue;
- };
- /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeStyle = /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- function (element, stylename) {
- // IE requires '' instead of null
- // see https://github.com/angular/angular/issues/7916
- element.style[stylename] = '';
- };
- /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- BrowserDomAdapter.prototype.getStyle = /**
- * @param {?} element
- * @param {?} stylename
- * @return {?}
- */
- function (element, stylename) { return element.style[stylename]; };
- /**
- * @param {?} element
- * @param {?} styleName
- * @param {?=} styleValue
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasStyle = /**
- * @param {?} element
- * @param {?} styleName
- * @param {?=} styleValue
- * @return {?}
- */
- function (element, styleName, styleValue) {
- var /** @type {?} */ value = this.getStyle(element, styleName) || '';
- return styleValue ? value == styleValue : value.length > 0;
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.tagName = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return element.tagName; };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.attributeMap = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var /** @type {?} */ res = new Map();
- var /** @type {?} */ elAttrs = element.attributes;
- for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) {
- var /** @type {?} */ attrib = elAttrs.item(i);
- res.set(attrib.name, attrib.value);
- }
- return res;
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) {
- return element.hasAttribute(attribute);
- };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} attribute
- * @return {?}
- */
- function (element, ns, attribute) {
- return element.hasAttributeNS(ns, attribute);
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.getAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) {
- return element.getAttribute(attribute);
- };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- function (element, ns, name) {
- return element.getAttributeNS(ns, name);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setAttribute = /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, name, value) { element.setAttribute(name, value); };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, ns, name, value) {
- element.setAttributeNS(ns, name, value);
- };
- /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeAttribute = /**
- * @param {?} element
- * @param {?} attribute
- * @return {?}
- */
- function (element, attribute) { element.removeAttribute(attribute); };
- /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.removeAttributeNS = /**
- * @param {?} element
- * @param {?} ns
- * @param {?} name
- * @return {?}
- */
- function (element, ns, name) {
- element.removeAttributeNS(ns, name);
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.templateAwareRoot = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.createHtmlDocument = /**
- * @return {?}
- */
- function () {
- return document.implementation.createHTMLDocument('fakeTitle');
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getDefaultDocument = /**
- * @return {?}
- */
- function () { return document; };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getBoundingClientRect = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- try {
- return el.getBoundingClientRect();
- }
- catch (/** @type {?} */ e) {
- return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
- }
- };
- /**
- * @param {?} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.getTitle = /**
- * @param {?} doc
- * @return {?}
- */
- function (doc) { return doc.title; };
- /**
- * @param {?} doc
- * @param {?} newTitle
- * @return {?}
- */
- BrowserDomAdapter.prototype.setTitle = /**
- * @param {?} doc
- * @param {?} newTitle
- * @return {?}
- */
- function (doc, newTitle) { doc.title = newTitle || ''; };
- /**
- * @param {?} n
- * @param {?} selector
- * @return {?}
- */
- BrowserDomAdapter.prototype.elementMatches = /**
- * @param {?} n
- * @param {?} selector
- * @return {?}
- */
- function (n, selector) {
- if (this.isElementNode(n)) {
- return n.matches && n.matches(selector) ||
- n.msMatchesSelector && n.msMatchesSelector(selector) ||
- n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
- }
- return false;
- };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.isTemplateElement = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
- };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isTextNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.TEXT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isCommentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.COMMENT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isElementNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nodeType === Node.ELEMENT_NODE; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.hasShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- return node.shadowRoot != null && node instanceof HTMLElement;
- };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.isShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node instanceof DocumentFragment; };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.importIntoDoc = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return document.importNode(this.templateAwareRoot(node), true); };
- /**
- * @param {?} node
- * @return {?}
- */
- BrowserDomAdapter.prototype.adoptNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return document.adoptNode(node); };
- /**
- * @param {?} el
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHref = /**
- * @param {?} el
- * @return {?}
- */
- function (el) { return /** @type {?} */ ((el.getAttribute('href'))); };
- /**
- * @param {?} event
- * @return {?}
- */
- BrowserDomAdapter.prototype.getEventKey = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var /** @type {?} */ key = event.key;
- if (key == null) {
- key = event.keyIdentifier;
- // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
- // Safari cf
- // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
- if (key == null) {
- return 'Unidentified';
- }
- if (key.startsWith('U+')) {
- key = String.fromCharCode(parseInt(key.substring(2), 16));
- if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
- // There is a bug in Chrome for numeric keypad keys:
- // https://code.google.com/p/chromium/issues/detail?id=155654
- // 1, 2, 3 ... are reported as A, B, C ...
- key = (/** @type {?} */ (_chromeNumKeyPadMap))[key];
- }
- }
- }
- return _keyMap[key] || key;
- };
- /**
- * @param {?} doc
- * @param {?} target
- * @return {?}
- */
- BrowserDomAdapter.prototype.getGlobalEventTarget = /**
- * @param {?} doc
- * @param {?} target
- * @return {?}
- */
- function (doc, target) {
- if (target === 'window') {
- return window;
- }
- if (target === 'document') {
- return doc;
- }
- if (target === 'body') {
- return doc.body;
- }
- return null;
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getHistory = /**
- * @return {?}
- */
- function () { return window.history; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getLocation = /**
- * @return {?}
- */
- function () { return window.location; };
- /**
- * @param {?} doc
- * @return {?}
- */
- BrowserDomAdapter.prototype.getBaseHref = /**
- * @param {?} doc
- * @return {?}
- */
- function (doc) {
- var /** @type {?} */ href = getBaseElementHref();
- return href == null ? null : relativePath(href);
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.resetBaseElement = /**
- * @return {?}
- */
- function () { baseElement = null; };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.getUserAgent = /**
- * @return {?}
- */
- function () { return window.navigator.userAgent; };
- /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setData = /**
- * @param {?} element
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (element, name, value) {
- this.setAttribute(element, 'data-' + name, value);
- };
- /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getData = /**
- * @param {?} element
- * @param {?} name
- * @return {?}
- */
- function (element, name) {
- return this.getAttribute(element, 'data-' + name);
- };
- /**
- * @param {?} element
- * @return {?}
- */
- BrowserDomAdapter.prototype.getComputedStyle = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { return getComputedStyle(element); };
- // TODO(tbosch): move this into a separate environment class once we have it
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.supportsWebAnimation = /**
- * @return {?}
- */
- function () {
- return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function';
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.performanceNow = /**
- * @return {?}
- */
- function () {
- // performance.now() is not available in all browsers, see
- // http://caniuse.com/#search=performance.now
- return window.performance && window.performance.now ? window.performance.now() :
- new Date().getTime();
- };
- /**
- * @return {?}
- */
- BrowserDomAdapter.prototype.supportsCookies = /**
- * @return {?}
- */
- function () { return true; };
- /**
- * @param {?} name
- * @return {?}
- */
- BrowserDomAdapter.prototype.getCookie = /**
- * @param {?} name
- * @return {?}
- */
- function (name) { return _angular_common.ɵparseCookieValue(document.cookie, name); };
- /**
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- BrowserDomAdapter.prototype.setCookie = /**
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (name, value) {
- // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
- // not clear other cookies.
- document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
- };
- return BrowserDomAdapter;
- }(GenericBrowserDomAdapter));
- var baseElement = null;
- /**
- * @return {?}
- */
- function getBaseElementHref() {
- if (!baseElement) {
- baseElement = /** @type {?} */ ((document.querySelector('base')));
- if (!baseElement) {
- return null;
- }
- }
- return baseElement.getAttribute('href');
- }
- // based on urlUtils.js in AngularJS 1
- var urlParsingNode;
- /**
- * @param {?} url
- * @return {?}
- */
- function relativePath(url) {
- if (!urlParsingNode) {
- urlParsingNode = document.createElement('a');
- }
- urlParsingNode.setAttribute('href', url);
- return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
- '/' + urlParsingNode.pathname;
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A DI Token representing the main rendering context. In a browser this is the DOM Document.
- *
- * Note: Document might not be available in the Application Context when Application and Rendering
- * Contexts are not the same (e.g. when running the application into a Web Worker).
- *
- * @deprecated import from `\@angular/common` instead.
- */
- var DOCUMENT$1 = _angular_common.DOCUMENT;
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @return {?}
- */
- function supportsState() {
- return !!window.history.pushState;
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
- * This class should not be used directly by an application developer. Instead, use
- * {\@link Location}.
- */
- var BrowserPlatformLocation = /** @class */ (function (_super) {
- __extends(BrowserPlatformLocation, _super);
- function BrowserPlatformLocation(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- _this._init();
- return _this;
- }
- // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
- /** @internal */
- /**
- * \@internal
- * @return {?}
- */
- BrowserPlatformLocation.prototype._init = /**
- * \@internal
- * @return {?}
- */
- function () {
- (/** @type {?} */ (this)).location = getDOM().getLocation();
- this._history = getDOM().getHistory();
- };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.getBaseHrefFromDOM = /**
- * @return {?}
- */
- function () { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); };
- /**
- * @param {?} fn
- * @return {?}
- */
- BrowserPlatformLocation.prototype.onPopState = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BrowserPlatformLocation.prototype.onHashChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
- };
- Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
- get: /**
- * @return {?}
- */
- function () { return this.location.pathname; },
- set: /**
- * @param {?} newPath
- * @return {?}
- */
- function (newPath) { this.location.pathname = newPath; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
- get: /**
- * @return {?}
- */
- function () { return this.location.search; },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
- get: /**
- * @return {?}
- */
- function () { return this.location.hash; },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- BrowserPlatformLocation.prototype.pushState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- function (state, title, url) {
- if (supportsState()) {
- this._history.pushState(state, title, url);
- }
- else {
- this.location.hash = url;
- }
- };
- /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- BrowserPlatformLocation.prototype.replaceState = /**
- * @param {?} state
- * @param {?} title
- * @param {?} url
- * @return {?}
- */
- function (state, title, url) {
- if (supportsState()) {
- this._history.replaceState(state, title, url);
- }
- else {
- this.location.hash = url;
- }
- };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.forward = /**
- * @return {?}
- */
- function () { this._history.forward(); };
- /**
- * @return {?}
- */
- BrowserPlatformLocation.prototype.back = /**
- * @return {?}
- */
- function () { this._history.back(); };
- BrowserPlatformLocation.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- BrowserPlatformLocation.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return BrowserPlatformLocation;
- }(_angular_common.PlatformLocation));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A service that can be used to get and add meta tags.
- *
- * \@experimental
- */
- var Meta = /** @class */ (function () {
- function Meta(_doc) {
- this._doc = _doc;
- this._dom = getDOM();
- }
- /**
- * @param {?} tag
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype.addTag = /**
- * @param {?} tag
- * @param {?=} forceCreation
- * @return {?}
- */
- function (tag, forceCreation) {
- if (forceCreation === void 0) { forceCreation = false; }
- if (!tag)
- return null;
- return this._getOrCreateElement(tag, forceCreation);
- };
- /**
- * @param {?} tags
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype.addTags = /**
- * @param {?} tags
- * @param {?=} forceCreation
- * @return {?}
- */
- function (tags, forceCreation) {
- var _this = this;
- if (forceCreation === void 0) { forceCreation = false; }
- if (!tags)
- return [];
- return tags.reduce(function (result, tag) {
- if (tag) {
- result.push(_this._getOrCreateElement(tag, forceCreation));
- }
- return result;
- }, []);
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.getTag = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) {
- if (!attrSelector)
- return null;
- return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.getTags = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) {
- if (!attrSelector)
- return [];
- var /** @type {?} */ list = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
- return list ? [].slice.call(list) : [];
- };
- /**
- * @param {?} tag
- * @param {?=} selector
- * @return {?}
- */
- Meta.prototype.updateTag = /**
- * @param {?} tag
- * @param {?=} selector
- * @return {?}
- */
- function (tag, selector) {
- if (!tag)
- return null;
- selector = selector || this._parseSelector(tag);
- var /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector)));
- if (meta) {
- return this._setMetaElementAttributes(tag, meta);
- }
- return this._getOrCreateElement(tag, true);
- };
- /**
- * @param {?} attrSelector
- * @return {?}
- */
- Meta.prototype.removeTag = /**
- * @param {?} attrSelector
- * @return {?}
- */
- function (attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); };
- /**
- * @param {?} meta
- * @return {?}
- */
- Meta.prototype.removeTagElement = /**
- * @param {?} meta
- * @return {?}
- */
- function (meta) {
- if (meta) {
- this._dom.remove(meta);
- }
- };
- /**
- * @param {?} meta
- * @param {?=} forceCreation
- * @return {?}
- */
- Meta.prototype._getOrCreateElement = /**
- * @param {?} meta
- * @param {?=} forceCreation
- * @return {?}
- */
- function (meta, forceCreation) {
- if (forceCreation === void 0) { forceCreation = false; }
- if (!forceCreation) {
- var /** @type {?} */ selector = this._parseSelector(meta);
- var /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector)));
- // It's allowed to have multiple elements with the same name so it's not enough to
- // just check that element with the same name already present on the page. We also need to
- // check if element has tag attributes
- if (elem && this._containsAttributes(meta, elem))
- return elem;
- }
- var /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta'));
- this._setMetaElementAttributes(meta, element);
- var /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0];
- this._dom.appendChild(head, element);
- return element;
- };
- /**
- * @param {?} tag
- * @param {?} el
- * @return {?}
- */
- Meta.prototype._setMetaElementAttributes = /**
- * @param {?} tag
- * @param {?} el
- * @return {?}
- */
- function (tag, el) {
- var _this = this;
- Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
- return el;
- };
- /**
- * @param {?} tag
- * @return {?}
- */
- Meta.prototype._parseSelector = /**
- * @param {?} tag
- * @return {?}
- */
- function (tag) {
- var /** @type {?} */ attr = tag.name ? 'name' : 'property';
- return attr + "=\"" + tag[attr] + "\"";
- };
- /**
- * @param {?} tag
- * @param {?} elem
- * @return {?}
- */
- Meta.prototype._containsAttributes = /**
- * @param {?} tag
- * @param {?} elem
- * @return {?}
- */
- function (tag, elem) {
- var _this = this;
- return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
- };
- Meta.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- Meta.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return Meta;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * An id that identifies a particular application being bootstrapped, that should
- * match across the client/server boundary.
- */
- var TRANSITION_ID = new _angular_core.InjectionToken('TRANSITION_ID');
- /**
- * @param {?} transitionId
- * @param {?} document
- * @param {?} injector
- * @return {?}
- */
- function appInitializerFactory(transitionId, document, injector) {
- return function () {
- // Wait for all application initializers to be completed before removing the styles set by
- // the server.
- injector.get(_angular_core.ApplicationInitStatus).donePromise.then(function () {
- var /** @type {?} */ dom = getDOM();
- var /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
- styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
- .forEach(function (el) { return dom.remove(el); });
- });
- };
- }
- var SERVER_TRANSITION_PROVIDERS = [
- {
- provide: _angular_core.APP_INITIALIZER,
- useFactory: appInitializerFactory,
- deps: [TRANSITION_ID, DOCUMENT$1, _angular_core.Injector],
- multi: true
- },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var BrowserGetTestability = /** @class */ (function () {
- function BrowserGetTestability() {
- }
- /**
- * @return {?}
- */
- BrowserGetTestability.init = /**
- * @return {?}
- */
- function () { _angular_core.setTestabilityGetter(new BrowserGetTestability()); };
- /**
- * @param {?} registry
- * @return {?}
- */
- BrowserGetTestability.prototype.addToWindow = /**
- * @param {?} registry
- * @return {?}
- */
- function (registry) {
- _angular_core.ɵglobal['getAngularTestability'] = function (elem, findInAncestors) {
- if (findInAncestors === void 0) { findInAncestors = true; }
- var /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors);
- if (testability == null) {
- throw new Error('Could not find testability for element.');
- }
- return testability;
- };
- _angular_core.ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
- _angular_core.ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
- var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) {
- var /** @type {?} */ testabilities = _angular_core.ɵglobal['getAllAngularTestabilities']();
- var /** @type {?} */ count = testabilities.length;
- var /** @type {?} */ didWork = false;
- var /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) {
- didWork = didWork || didWork_;
- count--;
- if (count == 0) {
- callback(didWork);
- }
- };
- testabilities.forEach(function (testability /** TODO #9100 */) {
- testability.whenStable(decrement);
- });
- };
- if (!_angular_core.ɵglobal['frameworkStabilizers']) {
- _angular_core.ɵglobal['frameworkStabilizers'] = [];
- }
- _angular_core.ɵglobal['frameworkStabilizers'].push(whenAllStable);
- };
- /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- BrowserGetTestability.prototype.findTestabilityInTree = /**
- * @param {?} registry
- * @param {?} elem
- * @param {?} findInAncestors
- * @return {?}
- */
- function (registry, elem, findInAncestors) {
- if (elem == null) {
- return null;
- }
- var /** @type {?} */ t = registry.getTestability(elem);
- if (t != null) {
- return t;
- }
- else if (!findInAncestors) {
- return null;
- }
- if (getDOM().isShadowRoot(elem)) {
- return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
- }
- return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
- };
- return BrowserGetTestability;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A service that can be used to get and set the title of a current HTML document.
- *
- * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
- * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
- * (representing the `<title>` tag). Instead, this service can be used to set and get the current
- * title value.
- *
- * \@experimental
- */
- var Title = /** @class */ (function () {
- function Title(_doc) {
- this._doc = _doc;
- }
- /**
- * Get the title of the current HTML document.
- */
- /**
- * Get the title of the current HTML document.
- * @return {?}
- */
- Title.prototype.getTitle = /**
- * Get the title of the current HTML document.
- * @return {?}
- */
- function () { return getDOM().getTitle(this._doc); };
- /**
- * Set the title of the current HTML document.
- * @param newTitle
- */
- /**
- * Set the title of the current HTML document.
- * @param {?} newTitle
- * @return {?}
- */
- Title.prototype.setTitle = /**
- * Set the title of the current HTML document.
- * @param {?} newTitle
- * @return {?}
- */
- function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
- Title.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- Title.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return Title;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} input
- * @return {?}
- */
-
- /**
- * @param {?} input
- * @return {?}
- */
-
- /**
- * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
- * `name` is `'probe'`.
- * @param {?} name Name under which it will be exported. Keep in mind this will be a property of the
- * global `ng` object.
- * @param {?} value The value to export.
- * @return {?}
- */
- function exportNgVar(name, value) {
- if (typeof COMPILED === 'undefined' || !COMPILED) {
- // Note: we can't export `ng` when using closure enhanced optimization as:
- // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
- // - we can't declare a closure extern as the namespace `ng` is already used within Google
- // for typings for angularJS (via `goog.provide('ng....')`).
- var /** @type {?} */ ng = _angular_core.ɵglobal['ng'] = (/** @type {?} */ (_angular_core.ɵglobal['ng'])) || {};
- ng[name] = value;
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var CORE_TOKENS = {
- 'ApplicationRef': _angular_core.ApplicationRef,
- 'NgZone': _angular_core.NgZone,
- };
- var INSPECT_GLOBAL_NAME = 'probe';
- var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
- /**
- * Returns a {\@link DebugElement} for the given native DOM element, or
- * null if the given native element does not have an Angular view associated
- * with it.
- * @param {?} element
- * @return {?}
- */
- function inspectNativeElement(element) {
- return _angular_core.getDebugNode(element);
- }
- /**
- * @param {?} coreTokens
- * @return {?}
- */
- function _createNgProbe(coreTokens) {
- exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
- exportNgVar(CORE_TOKENS_GLOBAL_NAME, __assign({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
- return function () { return inspectNativeElement; };
- }
- /**
- * @param {?} tokens
- * @return {?}
- */
- function _ngProbeTokensToMap(tokens) {
- return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
- }
- /**
- * Providers which support debugging Angular applications (e.g. via `ng.probe`).
- */
- var ELEMENT_PROBE_PROVIDERS = [
- {
- provide: _angular_core.APP_INITIALIZER,
- useFactory: _createNgProbe,
- deps: [
- [_angular_core.NgProbeToken, new _angular_core.Optional()],
- ],
- multi: true,
- },
- ];
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var EVENT_MANAGER_PLUGINS = new _angular_core.InjectionToken('EventManagerPlugins');
- /**
- * \@stable
- */
- var EventManager = /** @class */ (function () {
- function EventManager(plugins, _zone) {
- var _this = this;
- this._zone = _zone;
- this._eventNameToPlugin = new Map();
- plugins.forEach(function (p) { return p.manager = _this; });
- this._plugins = plugins.slice().reverse();
- }
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManager.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ plugin = this._findPluginFor(eventName);
- return plugin.addEventListener(element, eventName, handler);
- };
- /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManager.prototype.addGlobalEventListener = /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (target, eventName, handler) {
- var /** @type {?} */ plugin = this._findPluginFor(eventName);
- return plugin.addGlobalEventListener(target, eventName, handler);
- };
- /**
- * @return {?}
- */
- EventManager.prototype.getZone = /**
- * @return {?}
- */
- function () { return this._zone; };
- /** @internal */
- /**
- * \@internal
- * @param {?} eventName
- * @return {?}
- */
- EventManager.prototype._findPluginFor = /**
- * \@internal
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- var /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName);
- if (plugin) {
- return plugin;
- }
- var /** @type {?} */ plugins = this._plugins;
- for (var /** @type {?} */ i = 0; i < plugins.length; i++) {
- var /** @type {?} */ plugin_1 = plugins[i];
- if (plugin_1.supports(eventName)) {
- this._eventNameToPlugin.set(eventName, plugin_1);
- return plugin_1;
- }
- }
- throw new Error("No event manager plugin found for event " + eventName);
- };
- EventManager.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- EventManager.ctorParameters = function () { return [
- { type: Array, decorators: [{ type: _angular_core.Inject, args: [EVENT_MANAGER_PLUGINS,] },] },
- { type: _angular_core.NgZone, },
- ]; };
- return EventManager;
- }());
- /**
- * @abstract
- */
- var EventManagerPlugin = /** @class */ (function () {
- function EventManagerPlugin(_doc) {
- this._doc = _doc;
- }
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- EventManagerPlugin.prototype.addGlobalEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element);
- if (!target) {
- throw new Error("Unsupported event target " + target + " for event " + eventName);
- }
- return this.addEventListener(target, eventName, handler);
- };
- return EventManagerPlugin;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var SharedStylesHost = /** @class */ (function () {
- function SharedStylesHost() {
- /**
- * \@internal
- */
- this._stylesSet = new Set();
- }
- /**
- * @param {?} styles
- * @return {?}
- */
- SharedStylesHost.prototype.addStyles = /**
- * @param {?} styles
- * @return {?}
- */
- function (styles) {
- var _this = this;
- var /** @type {?} */ additions = new Set();
- styles.forEach(function (style) {
- if (!_this._stylesSet.has(style)) {
- _this._stylesSet.add(style);
- additions.add(style);
- }
- });
- this.onStylesAdded(additions);
- };
- /**
- * @param {?} additions
- * @return {?}
- */
- SharedStylesHost.prototype.onStylesAdded = /**
- * @param {?} additions
- * @return {?}
- */
- function (additions) { };
- /**
- * @return {?}
- */
- SharedStylesHost.prototype.getAllStyles = /**
- * @return {?}
- */
- function () { return Array.from(this._stylesSet); };
- SharedStylesHost.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- SharedStylesHost.ctorParameters = function () { return []; };
- return SharedStylesHost;
- }());
- var DomSharedStylesHost = /** @class */ (function (_super) {
- __extends(DomSharedStylesHost, _super);
- function DomSharedStylesHost(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- _this._hostNodes = new Set();
- _this._styleNodes = new Set();
- _this._hostNodes.add(_doc.head);
- return _this;
- }
- /**
- * @param {?} styles
- * @param {?} host
- * @return {?}
- */
- DomSharedStylesHost.prototype._addStylesToHost = /**
- * @param {?} styles
- * @param {?} host
- * @return {?}
- */
- function (styles, host) {
- var _this = this;
- styles.forEach(function (style) {
- var /** @type {?} */ styleEl = _this._doc.createElement('style');
- styleEl.textContent = style;
- _this._styleNodes.add(host.appendChild(styleEl));
- });
- };
- /**
- * @param {?} hostNode
- * @return {?}
- */
- DomSharedStylesHost.prototype.addHost = /**
- * @param {?} hostNode
- * @return {?}
- */
- function (hostNode) {
- this._addStylesToHost(this._stylesSet, hostNode);
- this._hostNodes.add(hostNode);
- };
- /**
- * @param {?} hostNode
- * @return {?}
- */
- DomSharedStylesHost.prototype.removeHost = /**
- * @param {?} hostNode
- * @return {?}
- */
- function (hostNode) { this._hostNodes.delete(hostNode); };
- /**
- * @param {?} additions
- * @return {?}
- */
- DomSharedStylesHost.prototype.onStylesAdded = /**
- * @param {?} additions
- * @return {?}
- */
- function (additions) {
- var _this = this;
- this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
- };
- /**
- * @return {?}
- */
- DomSharedStylesHost.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
- DomSharedStylesHost.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- DomSharedStylesHost.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return DomSharedStylesHost;
- }(SharedStylesHost));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var NAMESPACE_URIS = {
- 'svg': 'http://www.w3.org/2000/svg',
- 'xhtml': 'http://www.w3.org/1999/xhtml',
- 'xlink': 'http://www.w3.org/1999/xlink',
- 'xml': 'http://www.w3.org/XML/1998/namespace',
- 'xmlns': 'http://www.w3.org/2000/xmlns/',
- };
- var COMPONENT_REGEX = /%COMP%/g;
- var COMPONENT_VARIABLE = '%COMP%';
- var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
- var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
- /**
- * @param {?} componentShortId
- * @return {?}
- */
- function shimContentAttribute(componentShortId) {
- return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
- }
- /**
- * @param {?} componentShortId
- * @return {?}
- */
- function shimHostAttribute(componentShortId) {
- return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
- }
- /**
- * @param {?} compId
- * @param {?} styles
- * @param {?} target
- * @return {?}
- */
- function flattenStyles(compId, styles, target) {
- for (var /** @type {?} */ i = 0; i < styles.length; i++) {
- var /** @type {?} */ style = styles[i];
- if (Array.isArray(style)) {
- flattenStyles(compId, style, target);
- }
- else {
- style = style.replace(COMPONENT_REGEX, compId);
- target.push(style);
- }
- }
- return target;
- }
- /**
- * @param {?} eventHandler
- * @return {?}
- */
- function decoratePreventDefault(eventHandler) {
- return function (event) {
- var /** @type {?} */ allowDefaultBehavior = eventHandler(event);
- if (allowDefaultBehavior === false) {
- // TODO(tbosch): move preventDefault into event plugins...
- event.preventDefault();
- event.returnValue = false;
- }
- };
- }
- var DomRendererFactory2 = /** @class */ (function () {
- function DomRendererFactory2(eventManager, sharedStylesHost) {
- this.eventManager = eventManager;
- this.sharedStylesHost = sharedStylesHost;
- this.rendererByCompId = new Map();
- this.defaultRenderer = new DefaultDomRenderer2(eventManager);
- }
- /**
- * @param {?} element
- * @param {?} type
- * @return {?}
- */
- DomRendererFactory2.prototype.createRenderer = /**
- * @param {?} element
- * @param {?} type
- * @return {?}
- */
- function (element, type) {
- if (!element || !type) {
- return this.defaultRenderer;
- }
- switch (type.encapsulation) {
- case _angular_core.ViewEncapsulation.Emulated: {
- var /** @type {?} */ renderer = this.rendererByCompId.get(type.id);
- if (!renderer) {
- renderer =
- new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
- this.rendererByCompId.set(type.id, renderer);
- }
- (/** @type {?} */ (renderer)).applyToHost(element);
- return renderer;
- }
- case _angular_core.ViewEncapsulation.Native:
- return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
- default: {
- if (!this.rendererByCompId.has(type.id)) {
- var /** @type {?} */ styles = flattenStyles(type.id, type.styles, []);
- this.sharedStylesHost.addStyles(styles);
- this.rendererByCompId.set(type.id, this.defaultRenderer);
- }
- return this.defaultRenderer;
- }
- }
- };
- /**
- * @return {?}
- */
- DomRendererFactory2.prototype.begin = /**
- * @return {?}
- */
- function () { };
- /**
- * @return {?}
- */
- DomRendererFactory2.prototype.end = /**
- * @return {?}
- */
- function () { };
- DomRendererFactory2.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- DomRendererFactory2.ctorParameters = function () { return [
- { type: EventManager, },
- { type: DomSharedStylesHost, },
- ]; };
- return DomRendererFactory2;
- }());
- var DefaultDomRenderer2 = /** @class */ (function () {
- function DefaultDomRenderer2(eventManager) {
- this.eventManager = eventManager;
- this.data = Object.create(null);
- }
- /**
- * @return {?}
- */
- DefaultDomRenderer2.prototype.destroy = /**
- * @return {?}
- */
- function () { };
- /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createElement = /**
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (name, namespace) {
- if (namespace) {
- return document.createElementNS(NAMESPACE_URIS[namespace], name);
- }
- return document.createElement(name);
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createComment = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return document.createComment(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.createText = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return document.createTextNode(value); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.appendChild = /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- function (parent, newChild) { parent.appendChild(newChild); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- function (parent, newChild, refChild) {
- if (parent) {
- parent.insertBefore(newChild, refChild);
- }
- };
- /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeChild = /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- function (parent, oldChild) {
- if (parent) {
- parent.removeChild(oldChild);
- }
- };
- /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- DefaultDomRenderer2.prototype.selectRootElement = /**
- * @param {?} selectorOrNode
- * @return {?}
- */
- function (selectorOrNode) {
- var /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
- selectorOrNode;
- if (!el) {
- throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
- }
- el.textContent = '';
- return el;
- };
- /**
- * @param {?} node
- * @return {?}
- */
- DefaultDomRenderer2.prototype.parentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.parentNode; };
- /**
- * @param {?} node
- * @return {?}
- */
- DefaultDomRenderer2.prototype.nextSibling = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node.nextSibling; };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, value, namespace) {
- if (namespace) {
- name = namespace + ":" + name;
- var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
- if (namespaceUri) {
- el.setAttributeNS(namespaceUri, name, value);
- }
- else {
- el.setAttribute(name, value);
- }
- }
- else {
- el.setAttribute(name, value);
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeAttribute = /**
- * @param {?} el
- * @param {?} name
- * @param {?=} namespace
- * @return {?}
- */
- function (el, name, namespace) {
- if (namespace) {
- var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
- if (namespaceUri) {
- el.removeAttributeNS(namespaceUri, name);
- }
- else {
- el.removeAttribute(namespace + ":" + name);
- }
- }
- else {
- el.removeAttribute(name);
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DefaultDomRenderer2.prototype.addClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { el.classList.add(name); };
- /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeClass = /**
- * @param {?} el
- * @param {?} name
- * @return {?}
- */
- function (el, name) { el.classList.remove(name); };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} value
- * @param {?} flags
- * @return {?}
- */
- function (el, style, value, flags) {
- if (flags & _angular_core.RendererStyleFlags2.DashCase) {
- el.style.setProperty(style, value, !!(flags & _angular_core.RendererStyleFlags2.Important) ? 'important' : '');
- }
- else {
- el.style[style] = value;
- }
- };
- /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- DefaultDomRenderer2.prototype.removeStyle = /**
- * @param {?} el
- * @param {?} style
- * @param {?} flags
- * @return {?}
- */
- function (el, style, flags) {
- if (flags & _angular_core.RendererStyleFlags2.DashCase) {
- el.style.removeProperty(style);
- }
- else {
- // IE requires '' instead of null
- // see https://github.com/angular/angular/issues/7916
- el.style[style] = '';
- }
- };
- /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setProperty = /**
- * @param {?} el
- * @param {?} name
- * @param {?} value
- * @return {?}
- */
- function (el, name, value) {
- checkNoSyntheticProp(name, 'property');
- el[name] = value;
- };
- /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- DefaultDomRenderer2.prototype.setValue = /**
- * @param {?} node
- * @param {?} value
- * @return {?}
- */
- function (node, value) { node.nodeValue = value; };
- /**
- * @param {?} target
- * @param {?} event
- * @param {?} callback
- * @return {?}
- */
- DefaultDomRenderer2.prototype.listen = /**
- * @param {?} target
- * @param {?} event
- * @param {?} callback
- * @return {?}
- */
- function (target, event, callback) {
- checkNoSyntheticProp(event, 'listener');
- if (typeof target === 'string') {
- return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)));
- }
- return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback))));
- };
- return DefaultDomRenderer2;
- }());
- var AT_CHARCODE = '@'.charCodeAt(0);
- /**
- * @param {?} name
- * @param {?} nameKind
- * @return {?}
- */
- function checkNoSyntheticProp(name, nameKind) {
- if (name.charCodeAt(0) === AT_CHARCODE) {
- throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
- }
- }
- var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
- __extends(EmulatedEncapsulationDomRenderer2, _super);
- function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) {
- var _this = _super.call(this, eventManager) || this;
- _this.component = component;
- var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
- sharedStylesHost.addStyles(styles);
- _this.contentAttr = shimContentAttribute(component.id);
- _this.hostAttr = shimHostAttribute(component.id);
- return _this;
- }
- /**
- * @param {?} element
- * @return {?}
- */
- EmulatedEncapsulationDomRenderer2.prototype.applyToHost = /**
- * @param {?} element
- * @return {?}
- */
- function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
- /**
- * @param {?} parent
- * @param {?} name
- * @return {?}
- */
- EmulatedEncapsulationDomRenderer2.prototype.createElement = /**
- * @param {?} parent
- * @param {?} name
- * @return {?}
- */
- function (parent, name) {
- var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name);
- _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
- return el;
- };
- return EmulatedEncapsulationDomRenderer2;
- }(DefaultDomRenderer2));
- var ShadowDomRenderer = /** @class */ (function (_super) {
- __extends(ShadowDomRenderer, _super);
- function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
- var _this = _super.call(this, eventManager) || this;
- _this.sharedStylesHost = sharedStylesHost;
- _this.hostEl = hostEl;
- _this.component = component;
- _this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot();
- _this.sharedStylesHost.addHost(_this.shadowRoot);
- var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
- for (var /** @type {?} */ i = 0; i < styles.length; i++) {
- var /** @type {?} */ styleEl = document.createElement('style');
- styleEl.textContent = styles[i];
- _this.shadowRoot.appendChild(styleEl);
- }
- return _this;
- }
- /**
- * @param {?} node
- * @return {?}
- */
- ShadowDomRenderer.prototype.nodeOrShadowRoot = /**
- * @param {?} node
- * @return {?}
- */
- function (node) { return node === this.hostEl ? this.shadowRoot : node; };
- /**
- * @return {?}
- */
- ShadowDomRenderer.prototype.destroy = /**
- * @return {?}
- */
- function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.appendChild = /**
- * @param {?} parent
- * @param {?} newChild
- * @return {?}
- */
- function (parent, newChild) {
- return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
- };
- /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.insertBefore = /**
- * @param {?} parent
- * @param {?} newChild
- * @param {?} refChild
- * @return {?}
- */
- function (parent, newChild, refChild) {
- return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
- };
- /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- ShadowDomRenderer.prototype.removeChild = /**
- * @param {?} parent
- * @param {?} oldChild
- * @return {?}
- */
- function (parent, oldChild) {
- return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
- };
- /**
- * @param {?} node
- * @return {?}
- */
- ShadowDomRenderer.prototype.parentNode = /**
- * @param {?} node
- * @return {?}
- */
- function (node) {
- return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
- };
- return ShadowDomRenderer;
- }(DefaultDomRenderer2));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ɵ0 = function (v) {
- return '__zone_symbol__' + v;
- };
- /**
- * Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
- * since Angular can do much more
- * efficient bookkeeping than Zone can, because we have additional information. This speeds up
- * addEventListener by 3x.
- */
- var __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0;
- var ADD_EVENT_LISTENER = __symbol__('addEventListener');
- var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
- var symbolNames = {};
- var FALSE = 'FALSE';
- var ANGULAR = 'ANGULAR';
- var NATIVE_ADD_LISTENER = 'addEventListener';
- var NATIVE_REMOVE_LISTENER = 'removeEventListener';
- // use the same symbol string which is used in zone.js
- var stopSymbol = '__zone_symbol__propagationStopped';
- var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
- var blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')];
- var blackListedMap;
- if (blackListedEvents) {
- blackListedMap = {};
- blackListedEvents.forEach(function (eventName) { blackListedMap[eventName] = eventName; });
- }
- var isBlackListedEvent = function (eventName) {
- if (!blackListedMap) {
- return false;
- }
- return blackListedMap.hasOwnProperty(eventName);
- };
- // a global listener to handle all dom event,
- // so we do not need to create a closure everytime
- var globalListener = function (event) {
- var /** @type {?} */ symbolName = symbolNames[event.type];
- if (!symbolName) {
- return;
- }
- var /** @type {?} */ taskDatas = this[symbolName];
- if (!taskDatas) {
- return;
- }
- var /** @type {?} */ args = [event];
- if (taskDatas.length === 1) {
- // if taskDatas only have one element, just invoke it
- var /** @type {?} */ taskData = taskDatas[0];
- if (taskData.zone !== Zone.current) {
- // only use Zone.run when Zone.current not equals to stored zone
- return taskData.zone.run(taskData.handler, this, args);
- }
- else {
- return taskData.handler.apply(this, args);
- }
- }
- else {
- // copy tasks as a snapshot to avoid event handlers remove
- // itself or others
- var /** @type {?} */ copiedTasks = taskDatas.slice();
- for (var /** @type {?} */ i = 0; i < copiedTasks.length; i++) {
- // if other listener call event.stopImmediatePropagation
- // just break
- if ((/** @type {?} */ (event))[stopSymbol] === true) {
- break;
- }
- var /** @type {?} */ taskData = copiedTasks[i];
- if (taskData.zone !== Zone.current) {
- // only use Zone.run when Zone.current not equals to stored zone
- taskData.zone.run(taskData.handler, this, args);
- }
- else {
- taskData.handler.apply(this, args);
- }
- }
- }
- };
- var DomEventsPlugin = /** @class */ (function (_super) {
- __extends(DomEventsPlugin, _super);
- function DomEventsPlugin(doc, ngZone) {
- var _this = _super.call(this, doc) || this;
- _this.ngZone = ngZone;
- _this.patchEvent();
- return _this;
- }
- /**
- * @return {?}
- */
- DomEventsPlugin.prototype.patchEvent = /**
- * @return {?}
- */
- function () {
- if (!Event || !Event.prototype) {
- return;
- }
- if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) {
- // already patched by zone.js
- return;
- }
- var /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] =
- Event.prototype.stopImmediatePropagation;
- Event.prototype.stopImmediatePropagation = function () {
- if (this) {
- this[stopSymbol] = true;
- }
- // should call native delegate in case
- // in some enviroment part of the application
- // will not use the patched Event
- delegate && delegate.apply(this, arguments);
- };
- };
- // This plugin should come last in the list of plugins, because it accepts all
- // events.
- /**
- * @param {?} eventName
- * @return {?}
- */
- DomEventsPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return true; };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- DomEventsPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var _this = this;
- /**
- * This code is about to add a listener to the DOM. If Zone.js is present, than
- * `addEventListener` has been patched. The patched code adds overhead in both
- * memory and speed (3x slower) than native. For this reason if we detect that
- * Zone.js is present we use a simple version of zone aware addEventListener instead.
- * The result is faster registration and the zone will be restored.
- * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask
- * will not be invoked
- * We also do manual zone restoration in element.ts renderEventHandlerClosure method.
- *
- * NOTE: it is possible that the element is from different iframe, and so we
- * have to check before we execute the method.
- */
- var /** @type {?} */ self = this;
- var /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER];
- var /** @type {?} */ callback = /** @type {?} */ (handler);
- // if zonejs is loaded and current zone is not ngZone
- // we keep Zone.current on target for later restoration.
- if (zoneJsLoaded && (!_angular_core.NgZone.isInAngularZone() || isBlackListedEvent(eventName))) {
- var /** @type {?} */ symbolName = symbolNames[eventName];
- if (!symbolName) {
- symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
- }
- var /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName];
- var /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0;
- if (!taskDatas) {
- taskDatas = (/** @type {?} */ (element))[symbolName] = [];
- }
- var /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
- if (taskDatas.length === 0) {
- taskDatas.push({ zone: zone, handler: callback });
- }
- else {
- var /** @type {?} */ callbackRegistered = false;
- for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
- if (taskDatas[i].handler === callback) {
- callbackRegistered = true;
- break;
- }
- }
- if (!callbackRegistered) {
- taskDatas.push({ zone: zone, handler: callback });
- }
- }
- if (!globalListenerRegistered) {
- element[ADD_EVENT_LISTENER](eventName, globalListener, false);
- }
- }
- else {
- element[NATIVE_ADD_LISTENER](eventName, callback, false);
- }
- return function () { return _this.removeEventListener(element, eventName, callback); };
- };
- /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- DomEventsPlugin.prototype.removeEventListener = /**
- * @param {?} target
- * @param {?} eventName
- * @param {?} callback
- * @return {?}
- */
- function (target, eventName, callback) {
- var /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER];
- // zone.js not loaded, use native removeEventListener
- if (!underlyingRemove) {
- return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- var /** @type {?} */ symbolName = symbolNames[eventName];
- var /** @type {?} */ taskDatas = symbolName && target[symbolName];
- if (!taskDatas) {
- // addEventListener not using patched version
- // just call native removeEventListener
- return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- // fix issue 20532, should be able to remove
- // listener which was added inside of ngZone
- var /** @type {?} */ found = false;
- for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
- // remove listener from taskDatas if the callback equals
- if (taskDatas[i].handler === callback) {
- found = true;
- taskDatas.splice(i, 1);
- break;
- }
- }
- if (found) {
- if (taskDatas.length === 0) {
- // all listeners are removed, we can remove the globalListener from target
- underlyingRemove.apply(target, [eventName, globalListener, false]);
- }
- }
- else {
- // not found in taskDatas, the callback may be added inside of ngZone
- // use native remove listener to remove the calback
- target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
- }
- };
- DomEventsPlugin.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- DomEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- { type: _angular_core.NgZone, },
- ]; };
- return DomEventsPlugin;
- }(EventManagerPlugin));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var EVENT_NAMES = {
- // pan
- 'pan': true,
- 'panstart': true,
- 'panmove': true,
- 'panend': true,
- 'pancancel': true,
- 'panleft': true,
- 'panright': true,
- 'panup': true,
- 'pandown': true,
- // pinch
- 'pinch': true,
- 'pinchstart': true,
- 'pinchmove': true,
- 'pinchend': true,
- 'pinchcancel': true,
- 'pinchin': true,
- 'pinchout': true,
- // press
- 'press': true,
- 'pressup': true,
- // rotate
- 'rotate': true,
- 'rotatestart': true,
- 'rotatemove': true,
- 'rotateend': true,
- 'rotatecancel': true,
- // swipe
- 'swipe': true,
- 'swipeleft': true,
- 'swiperight': true,
- 'swipeup': true,
- 'swipedown': true,
- // tap
- 'tap': true,
- };
- /**
- * A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure
- * Hammer gestures.
- *
- * \@experimental
- */
- var HAMMER_GESTURE_CONFIG = new _angular_core.InjectionToken('HammerGestureConfig');
- /**
- * @record
- */
-
- /**
- * \@experimental
- */
- var HammerGestureConfig = /** @class */ (function () {
- function HammerGestureConfig() {
- this.events = [];
- this.overrides = {};
- }
- /**
- * @param {?} element
- * @return {?}
- */
- HammerGestureConfig.prototype.buildHammer = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var /** @type {?} */ mc = new Hammer(element);
- mc.get('pinch').set({ enable: true });
- mc.get('rotate').set({ enable: true });
- for (var /** @type {?} */ eventName in this.overrides) {
- mc.get(eventName).set(this.overrides[eventName]);
- }
- return mc;
- };
- HammerGestureConfig.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- HammerGestureConfig.ctorParameters = function () { return []; };
- return HammerGestureConfig;
- }());
- var HammerGesturesPlugin = /** @class */ (function (_super) {
- __extends(HammerGesturesPlugin, _super);
- function HammerGesturesPlugin(doc, _config) {
- var _this = _super.call(this, doc) || this;
- _this._config = _config;
- return _this;
- }
- /**
- * @param {?} eventName
- * @return {?}
- */
- HammerGesturesPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
- return false;
- }
- if (!(/** @type {?} */ (window)).Hammer) {
- throw new Error("Hammer.js is not loaded, can not bind " + eventName + " event");
- }
- return true;
- };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- HammerGesturesPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var _this = this;
- var /** @type {?} */ zone = this.manager.getZone();
- eventName = eventName.toLowerCase();
- return zone.runOutsideAngular(function () {
- // Creating the manager bind events, must be done outside of angular
- var /** @type {?} */ mc = _this._config.buildHammer(element);
- var /** @type {?} */ callback = function (eventObj) {
- zone.runGuarded(function () { handler(eventObj); });
- };
- mc.on(eventName, callback);
- return function () { return mc.off(eventName, callback); };
- });
- };
- /**
- * @param {?} eventName
- * @return {?}
- */
- HammerGesturesPlugin.prototype.isCustomEvent = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return this._config.events.indexOf(eventName) > -1; };
- HammerGesturesPlugin.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- HammerGesturesPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- { type: HammerGestureConfig, decorators: [{ type: _angular_core.Inject, args: [HAMMER_GESTURE_CONFIG,] },] },
- ]; };
- return HammerGesturesPlugin;
- }(EventManagerPlugin));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
- var ɵ0$1 = function (event) { return event.altKey; };
- var ɵ1$1 = function (event) { return event.ctrlKey; };
- var ɵ2$1 = function (event) { return event.metaKey; };
- var ɵ3 = function (event) { return event.shiftKey; };
- var MODIFIER_KEY_GETTERS = {
- 'alt': ɵ0$1,
- 'control': ɵ1$1,
- 'meta': ɵ2$1,
- 'shift': ɵ3
- };
- /**
- * \@experimental
- */
- var KeyEventsPlugin = /** @class */ (function (_super) {
- __extends(KeyEventsPlugin, _super);
- function KeyEventsPlugin(doc) {
- return _super.call(this, doc) || this;
- }
- /**
- * @param {?} eventName
- * @return {?}
- */
- KeyEventsPlugin.prototype.supports = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; };
- /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- KeyEventsPlugin.prototype.addEventListener = /**
- * @param {?} element
- * @param {?} eventName
- * @param {?} handler
- * @return {?}
- */
- function (element, eventName, handler) {
- var /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName)));
- var /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
- return this.manager.getZone().runOutsideAngular(function () {
- return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
- });
- };
- /**
- * @param {?} eventName
- * @return {?}
- */
- KeyEventsPlugin.parseEventName = /**
- * @param {?} eventName
- * @return {?}
- */
- function (eventName) {
- var /** @type {?} */ parts = eventName.toLowerCase().split('.');
- var /** @type {?} */ domEventName = parts.shift();
- if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
- return null;
- }
- var /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop())));
- var /** @type {?} */ fullKey = '';
- MODIFIER_KEYS.forEach(function (modifierName) {
- var /** @type {?} */ index = parts.indexOf(modifierName);
- if (index > -1) {
- parts.splice(index, 1);
- fullKey += modifierName + '.';
- }
- });
- fullKey += key;
- if (parts.length != 0 || key.length === 0) {
- // returning null instead of throwing to let another plugin process the event
- return null;
- }
- var /** @type {?} */ result = {};
- result['domEventName'] = domEventName;
- result['fullKey'] = fullKey;
- return result;
- };
- /**
- * @param {?} event
- * @return {?}
- */
- KeyEventsPlugin.getEventFullKey = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- var /** @type {?} */ fullKey = '';
- var /** @type {?} */ key = getDOM().getEventKey(event);
- key = key.toLowerCase();
- if (key === ' ') {
- key = 'space'; // for readability
- }
- else if (key === '.') {
- key = 'dot'; // because '.' is used as a separator in event names
- }
- MODIFIER_KEYS.forEach(function (modifierName) {
- if (modifierName != key) {
- var /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
- if (modifierGetter(event)) {
- fullKey += modifierName + '.';
- }
- }
- });
- fullKey += key;
- return fullKey;
- };
- /**
- * @param {?} fullKey
- * @param {?} handler
- * @param {?} zone
- * @return {?}
- */
- KeyEventsPlugin.eventCallback = /**
- * @param {?} fullKey
- * @param {?} handler
- * @param {?} zone
- * @return {?}
- */
- function (fullKey, handler, zone) {
- return function (event /** TODO #9100 */) {
- if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
- zone.runGuarded(function () { return handler(event); });
- }
- };
- };
- /** @internal */
- /**
- * \@internal
- * @param {?} keyName
- * @return {?}
- */
- KeyEventsPlugin._normalizeKey = /**
- * \@internal
- * @param {?} keyName
- * @return {?}
- */
- function (keyName) {
- // TODO: switch to a Map if the mapping grows too much
- switch (keyName) {
- case 'esc':
- return 'escape';
- default:
- return keyName;
- }
- };
- KeyEventsPlugin.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- KeyEventsPlugin.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return KeyEventsPlugin;
- }(EventManagerPlugin));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML
- * that needs sanitizing.
- * Depending upon browser support we must use one of three strategies for doing this.
- * Support: Safari 10.x -> XHR strategy
- * Support: Firefox -> DomParser strategy
- * Default: InertDocument strategy
- */
- var InertBodyHelper = /** @class */ (function () {
- function InertBodyHelper(defaultDoc, DOM) {
- this.defaultDoc = defaultDoc;
- this.DOM = DOM;
- var /** @type {?} */ inertDocument = this.DOM.createHtmlDocument();
- this.inertBodyElement = inertDocument.body;
- if (this.inertBodyElement == null) {
- // usually there should be only one body element in the document, but IE doesn't have any, so
- // we need to create one.
- var /** @type {?} */ inertHtml = this.DOM.createElement('html', inertDocument);
- this.inertBodyElement = this.DOM.createElement('body', inertDocument);
- this.DOM.appendChild(inertHtml, this.inertBodyElement);
- this.DOM.appendChild(inertDocument, inertHtml);
- }
- this.DOM.setInnerHTML(this.inertBodyElement, '<svg><g onload="this.parentNode.remove()"></g></svg>');
- if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) {
- // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element
- // so use the XHR strategy.
- this.getInertBodyElement = this.getInertBodyElement_XHR;
- return;
- }
- this.DOM.setInnerHTML(this.inertBodyElement, '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">');
- if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) {
- // We just hit the Firefox bug - which prevents the inner img JS from being sanitized
- // so use the DOMParser strategy, if it is available.
- // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we
- // fall through to the default strategy below.
- if (isDOMParserAvailable()) {
- this.getInertBodyElement = this.getInertBodyElement_DOMParser;
- return;
- }
- }
- // None of the bugs were hit so it is safe for us to use the default InertDocument strategy
- this.getInertBodyElement = this.getInertBodyElement_InertDocument;
- }
- /**
- * Use XHR to create and fill an inert body element (on Safari 10.1)
- * See
- * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_XHR = /**
- * Use XHR to create and fill an inert body element (on Safari 10.1)
- * See
- * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // We add these extra elements to ensure that the rest of the content is parsed as expected
- // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
- // `<head>` tag.
- html = '<body><remove></remove>' + html + '</body>';
- try {
- html = encodeURI(html);
- }
- catch (/** @type {?} */ e) {
- return null;
- }
- var /** @type {?} */ xhr = new XMLHttpRequest();
- xhr.responseType = 'document';
- xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false);
- xhr.send(null);
- var /** @type {?} */ body = xhr.response.body;
- body.removeChild(/** @type {?} */ ((body.firstChild)));
- return body;
- };
- /**
- * Use DOMParser to create and fill an inert body element (on Firefox)
- * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
- *
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_DOMParser = /**
- * Use DOMParser to create and fill an inert body element (on Firefox)
- * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
- *
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // We add these extra elements to ensure that the rest of the content is parsed as expected
- // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
- // `<head>` tag.
- html = '<body><remove></remove>' + html + '</body>';
- try {
- var /** @type {?} */ body = /** @type {?} */ (new (/** @type {?} */ (window))
- .DOMParser()
- .parseFromString(html, 'text/html')
- .body);
- body.removeChild(/** @type {?} */ ((body.firstChild)));
- return body;
- }
- catch (/** @type {?} */ e) {
- return null;
- }
- };
- /**
- * Use an HTML5 `template` element, if supported, or an inert body element created via
- * `createHtmlDocument` to create and fill an inert DOM element.
- * This is the default sane strategy to use if the browser does not require one of the specialised
- * strategies above.
- * @param {?} html
- * @return {?}
- */
- InertBodyHelper.prototype.getInertBodyElement_InertDocument = /**
- * Use an HTML5 `template` element, if supported, or an inert body element created via
- * `createHtmlDocument` to create and fill an inert DOM element.
- * This is the default sane strategy to use if the browser does not require one of the specialised
- * strategies above.
- * @param {?} html
- * @return {?}
- */
- function (html) {
- // Prefer using <template> element if supported.
- var /** @type {?} */ templateEl = this.DOM.createElement('template');
- if ('content' in templateEl) {
- this.DOM.setInnerHTML(templateEl, html);
- return templateEl;
- }
- this.DOM.setInnerHTML(this.inertBodyElement, html);
- // Support: IE 9-11 only
- // strip custom-namespaced attributes on IE<=11
- if (this.defaultDoc.documentMode) {
- this.stripCustomNsAttrs(this.inertBodyElement);
- }
- return this.inertBodyElement;
- };
- /**
- * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
- * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
- * 'ns1:xlink:foo').
- *
- * This is undesirable since we don't want to allow any of these custom attributes. This method
- * strips them all.
- * @param {?} el
- * @return {?}
- */
- InertBodyHelper.prototype.stripCustomNsAttrs = /**
- * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
- * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
- * 'ns1:xlink:foo').
- *
- * This is undesirable since we don't want to allow any of these custom attributes. This method
- * strips them all.
- * @param {?} el
- * @return {?}
- */
- function (el) {
- var _this = this;
- this.DOM.attributeMap(el).forEach(function (_, attrName) {
- if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
- _this.DOM.removeAttribute(el, attrName);
- }
- });
- for (var _i = 0, _a = this.DOM.childNodesAsList(el); _i < _a.length; _i++) {
- var n = _a[_i];
- if (this.DOM.isElementNode(n))
- this.stripCustomNsAttrs(/** @type {?} */ (n));
- }
- };
- return InertBodyHelper;
- }());
- /**
- * We need to determine whether the DOMParser exists in the global context.
- * The try-catch is because, on some browsers, trying to access this property
- * on window can actually throw an error.
- *
- * @suppress {uselessCode}
- * @return {?}
- */
- function isDOMParserAvailable() {
- try {
- return !!(/** @type {?} */ (window)).DOMParser;
- }
- catch (/** @type {?} */ e) {
- return false;
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * A pattern that recognizes a commonly useful subset of URLs that are safe.
- *
- * This regular expression matches a subset of URLs that will not cause script
- * execution if used in URL context within a HTML document. Specifically, this
- * regular expression matches if (comment from here on and regex copied from
- * Soy's EscapingConventions):
- * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
- * (2) or no protocol. A protocol must be followed by a colon. The below
- * allows that by allowing colons only after one of the characters [/?#].
- * A colon after a hash (#) must be in the fragment.
- * Otherwise, a colon after a (?) must be in a query.
- * Otherwise, a colon after a single solidus (/) must be in a path.
- * Otherwise, a colon after a double solidus (//) must be in the authority
- * (before port).
- *
- * The pattern disallows &, used in HTML entity declarations before
- * one of the characters in [/?#]. This disallows HTML entities used in the
- * protocol name, which should never happen, e.g. "http" for "http".
- * It also disallows HTML entities in the first path part of a relative path,
- * e.g. "foo<bar/baz". Our existing escaping functions should not produce
- * that. More importantly, it disallows masking of a colon,
- * e.g. "javascript:...".
- *
- * This regular expression was taken from the Closure sanitization library.
- */
- var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
- /**
- * A pattern that matches safe data URLs. Only matches image, video and audio types.
- */
- var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;
- /**
- * @param {?} url
- * @return {?}
- */
- function sanitizeUrl(url) {
- url = String(url);
- if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
- return url;
- if (_angular_core.isDevMode()) {
- getDOM().log("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)");
- }
- return 'unsafe:' + url;
- }
- /**
- * @param {?} srcset
- * @return {?}
- */
- function sanitizeSrcset(srcset) {
- srcset = String(srcset);
- return srcset.split(',').map(function (srcset) { return sanitizeUrl(srcset.trim()); }).join(', ');
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} tags
- * @return {?}
- */
- function tagSet(tags) {
- var /** @type {?} */ res = {};
- for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) {
- var t = _a[_i];
- res[t] = true;
- }
- return res;
- }
- /**
- * @param {...?} sets
- * @return {?}
- */
- function merge() {
- var sets = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- sets[_i] = arguments[_i];
- }
- var /** @type {?} */ res = {};
- for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) {
- var s = sets_1[_a];
- for (var /** @type {?} */ v in s) {
- if (s.hasOwnProperty(v))
- res[v] = true;
- }
- }
- return res;
- }
- // Good source of info about elements and attributes
- // http://dev.w3.org/html5/spec/Overview.html#semantics
- // http://simon.html5.org/html-elements
- // Safe Void Elements - HTML5
- // http://dev.w3.org/html5/spec/Overview.html#void-elements
- var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
- // Elements that you can, intentionally, leave open (and which close themselves)
- // http://dev.w3.org/html5/spec/Overview.html#optional-tags
- var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
- var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
- var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
- // Safe Block Elements - HTML5
- var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
- 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
- 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
- // Inline Elements - HTML5
- var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
- 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
- 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
- var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
- // Attributes that have href and hence need to be sanitized
- var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
- // Attributes that have special href set hence need to be sanitized
- var SRCSET_ATTRS = tagSet('srcset');
- var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
- 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
- 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
- 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
- 'valign,value,vspace,width');
- // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security
- // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
- // innerHTML is required, SVG attributes should be added here.
- // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
- // can be sanitized, but they increase security surface area without a legitimate use case, so they
- // are left out here.
- var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS);
- /**
- * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
- * attributes.
- */
- var SanitizingHtmlSerializer = /** @class */ (function () {
- function SanitizingHtmlSerializer() {
- this.sanitizedSomething = false;
- this.buf = [];
- this.DOM = getDOM();
- }
- /**
- * @param {?} el
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.sanitizeChildren = /**
- * @param {?} el
- * @return {?}
- */
- function (el) {
- // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
- // However this code never accesses properties off of `document` before deleting its contents
- // again, so it shouldn't be vulnerable to DOM clobbering.
- var /** @type {?} */ current = /** @type {?} */ ((this.DOM.firstChild(el)));
- while (current) {
- if (this.DOM.isElementNode(current)) {
- this.startElement(/** @type {?} */ (current));
- }
- else if (this.DOM.isTextNode(current)) {
- this.chars(/** @type {?} */ ((this.DOM.nodeValue(current))));
- }
- else {
- // Strip non-element, non-text nodes.
- this.sanitizedSomething = true;
- }
- if (this.DOM.firstChild(current)) {
- current = /** @type {?} */ ((this.DOM.firstChild(current)));
- continue;
- }
- while (current) {
- // Leaving the element. Walk up and to the right, closing tags as we go.
- if (this.DOM.isElementNode(current)) {
- this.endElement(/** @type {?} */ (current));
- }
- var /** @type {?} */ next = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.nextSibling(current))));
- if (next) {
- current = next;
- break;
- }
- current = this.checkClobberedElement(current, /** @type {?} */ ((this.DOM.parentElement(current))));
- }
- }
- return this.buf.join('');
- };
- /**
- * @param {?} element
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.startElement = /**
- * @param {?} element
- * @return {?}
- */
- function (element) {
- var _this = this;
- var /** @type {?} */ tagName = this.DOM.nodeName(element).toLowerCase();
- if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
- this.sanitizedSomething = true;
- return;
- }
- this.buf.push('<');
- this.buf.push(tagName);
- this.DOM.attributeMap(element).forEach(function (value, attrName) {
- var /** @type {?} */ lower = attrName.toLowerCase();
- if (!VALID_ATTRS.hasOwnProperty(lower)) {
- _this.sanitizedSomething = true;
- return;
- }
- // TODO(martinprobst): Special case image URIs for data:image/...
- if (URI_ATTRS[lower])
- value = sanitizeUrl(value);
- if (SRCSET_ATTRS[lower])
- value = sanitizeSrcset(value);
- _this.buf.push(' ');
- _this.buf.push(attrName);
- _this.buf.push('="');
- _this.buf.push(encodeEntities(value));
- _this.buf.push('"');
- });
- this.buf.push('>');
- };
- /**
- * @param {?} current
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.endElement = /**
- * @param {?} current
- * @return {?}
- */
- function (current) {
- var /** @type {?} */ tagName = this.DOM.nodeName(current).toLowerCase();
- if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
- this.buf.push('</');
- this.buf.push(tagName);
- this.buf.push('>');
- }
- };
- /**
- * @param {?} chars
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.chars = /**
- * @param {?} chars
- * @return {?}
- */
- function (chars) { this.buf.push(encodeEntities(chars)); };
- /**
- * @param {?} node
- * @param {?} nextNode
- * @return {?}
- */
- SanitizingHtmlSerializer.prototype.checkClobberedElement = /**
- * @param {?} node
- * @param {?} nextNode
- * @return {?}
- */
- function (node, nextNode) {
- if (nextNode && this.DOM.contains(node, nextNode)) {
- throw new Error("Failed to sanitize html because the element is clobbered: " + this.DOM.getOuterHTML(node));
- }
- return nextNode;
- };
- return SanitizingHtmlSerializer;
- }());
- // Regular Expressions for parsing tags and attributes
- var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
- // ! to ~ is the ASCII range.
- var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
- /**
- * Escapes all potentially dangerous characters, so that the
- * resulting string can be safely inserted into attribute or
- * element text.
- * @param {?} value
- * @return {?}
- */
- function encodeEntities(value) {
- return value.replace(/&/g, '&')
- .replace(SURROGATE_PAIR_REGEXP, function (match) {
- var /** @type {?} */ hi = match.charCodeAt(0);
- var /** @type {?} */ low = match.charCodeAt(1);
- return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
- })
- .replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; })
- .replace(/</g, '<')
- .replace(/>/g, '>');
- }
- var inertBodyHelper;
- /**
- * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
- * the DOM in a browser environment.
- * @param {?} defaultDoc
- * @param {?} unsafeHtmlInput
- * @return {?}
- */
- function sanitizeHtml(defaultDoc, unsafeHtmlInput) {
- var /** @type {?} */ DOM = getDOM();
- var /** @type {?} */ inertBodyElement = null;
- try {
- inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc, DOM);
- // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
- var /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
- inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
- // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
- // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
- var /** @type {?} */ mXSSAttempts = 5;
- var /** @type {?} */ parsedHtml = unsafeHtml;
- do {
- if (mXSSAttempts === 0) {
- throw new Error('Failed to sanitize html because the input is unstable');
- }
- mXSSAttempts--;
- unsafeHtml = parsedHtml;
- parsedHtml = DOM.getInnerHTML(inertBodyElement);
- inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
- } while (unsafeHtml !== parsedHtml);
- var /** @type {?} */ sanitizer = new SanitizingHtmlSerializer();
- var /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(inertBodyElement) || inertBodyElement);
- if (_angular_core.isDevMode() && sanitizer.sanitizedSomething) {
- DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).');
- }
- return safeHtml;
- }
- finally {
- // In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
- if (inertBodyElement) {
- var /** @type {?} */ parent_1 = DOM.getTemplateContent(inertBodyElement) || inertBodyElement;
- for (var _i = 0, _a = DOM.childNodesAsList(parent_1); _i < _a.length; _i++) {
- var child = _a[_i];
- DOM.removeChild(parent_1, child);
- }
- }
- }
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Regular expression for safe style values.
- *
- * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
- *
- * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
- * font-family) and hence could allow multiple values to get injected, but that should pose no risk
- * of XSS.
- *
- * The function expression checks only for XSS safety, not for CSS validity.
- *
- * This regular expression was taken from the Closure sanitization library, and augmented for
- * transformation values.
- */
- var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
- var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
- var COLOR_FNS = '(?:rgb|hsl)a?';
- var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient';
- var CSS3_FNS = '(?:calc|attr)';
- var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)';
- var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" +
- ("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") +
- (FN_ARGS + ")$"), 'g');
- /**
- * Matches a `url(...)` value with an arbitrary argument as long as it does
- * not contain parentheses.
- *
- * The URL value still needs to be sanitized separately.
- *
- * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
- * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
- * by observing whether scroll bars are displayed, or character ranges used by a font face
- * definition.
- *
- * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
- * binding a URL value without further cooperation from the page will cause an information leak, and
- * if so, it is just a leak, not a full blown XSS vulnerability.
- *
- * Given the common use case, low likelihood of attack vector, and low impact of an attack, this
- * code is permissive and allows URLs that sanitize otherwise.
- */
- var URL_RE = /^url\(([^)]+)\)$/;
- /**
- * Checks that quotes (" and ') are properly balanced inside a string. Assumes
- * that neither escape (\) nor any other character that could result in
- * breaking out of a string parsing context are allowed;
- * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
- *
- * This code was taken from the Closure sanitization library.
- * @param {?} value
- * @return {?}
- */
- function hasBalancedQuotes(value) {
- var /** @type {?} */ outsideSingle = true;
- var /** @type {?} */ outsideDouble = true;
- for (var /** @type {?} */ i = 0; i < value.length; i++) {
- var /** @type {?} */ c = value.charAt(i);
- if (c === '\'' && outsideDouble) {
- outsideSingle = !outsideSingle;
- }
- else if (c === '"' && outsideSingle) {
- outsideDouble = !outsideDouble;
- }
- }
- return outsideSingle && outsideDouble;
- }
- /**
- * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
- * value) and returns a value that is safe to use in a browser environment.
- * @param {?} value
- * @return {?}
- */
- function sanitizeStyle(value) {
- value = String(value).trim(); // Make sure it's actually a string.
- if (!value)
- return '';
- // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
- // reasoning behind this.
- var /** @type {?} */ urlMatch = value.match(URL_RE);
- if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
- value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
- return value; // Safe style values.
- }
- if (_angular_core.isDevMode()) {
- getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
- }
- return 'unsafe';
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Marker interface for a value that's safe to use in a particular context.
- *
- * \@stable
- * @record
- */
-
- /**
- * Marker interface for a value that's safe to use as HTML.
- *
- * \@stable
- * @record
- */
-
- /**
- * Marker interface for a value that's safe to use as style (CSS).
- *
- * \@stable
- * @record
- */
-
- /**
- * Marker interface for a value that's safe to use as JavaScript.
- *
- * \@stable
- * @record
- */
-
- /**
- * Marker interface for a value that's safe to use as a URL linking to a document.
- *
- * \@stable
- * @record
- */
-
- /**
- * Marker interface for a value that's safe to use as a URL to load executable code from.
- *
- * \@stable
- * @record
- */
-
- /**
- * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
- * values to be safe to use in the different DOM contexts.
- *
- * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
- * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
- * the website.
- *
- * In specific situations, it might be necessary to disable sanitization, for example if the
- * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
- * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
- * methods, and then binding to that value from the template.
- *
- * These situations should be very rare, and extraordinary care must be taken to avoid creating a
- * Cross Site Scripting (XSS) security bug!
- *
- * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
- * close as possible to the source of the value, to make it easy to verify no security bug is
- * created by its use.
- *
- * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
- * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
- * code. The sanitizer leaves safe values intact.
- *
- * \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
- * sanitization for the value passed in. Carefully check and audit all values and code paths going
- * into this call. Make sure any user data is appropriately escaped for this security context.
- * For more detail, see the [Security Guide](http://g.co/ng/security).
- *
- * \@stable
- * @abstract
- */
- var DomSanitizer = /** @class */ (function () {
- function DomSanitizer() {
- }
- return DomSanitizer;
- }());
- var DomSanitizerImpl = /** @class */ (function (_super) {
- __extends(DomSanitizerImpl, _super);
- function DomSanitizerImpl(_doc) {
- var _this = _super.call(this) || this;
- _this._doc = _doc;
- return _this;
- }
- /**
- * @param {?} ctx
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.sanitize = /**
- * @param {?} ctx
- * @param {?} value
- * @return {?}
- */
- function (ctx, value) {
- if (value == null)
- return null;
- switch (ctx) {
- case _angular_core.SecurityContext.NONE:
- return /** @type {?} */ (value);
- case _angular_core.SecurityContext.HTML:
- if (value instanceof SafeHtmlImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'HTML');
- return sanitizeHtml(this._doc, String(value));
- case _angular_core.SecurityContext.STYLE:
- if (value instanceof SafeStyleImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Style');
- return sanitizeStyle(/** @type {?} */ (value));
- case _angular_core.SecurityContext.SCRIPT:
- if (value instanceof SafeScriptImpl)
- return value.changingThisBreaksApplicationSecurity;
- this.checkNotSafeValue(value, 'Script');
- throw new Error('unsafe value used in a script context');
- case _angular_core.SecurityContext.URL:
- if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
- // Allow resource URLs in URL contexts, they are strictly more trusted.
- return value.changingThisBreaksApplicationSecurity;
- }
- this.checkNotSafeValue(value, 'URL');
- return sanitizeUrl(String(value));
- case _angular_core.SecurityContext.RESOURCE_URL:
- if (value instanceof SafeResourceUrlImpl) {
- return value.changingThisBreaksApplicationSecurity;
- }
- this.checkNotSafeValue(value, 'ResourceURL');
- throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
- default:
- throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
- }
- };
- /**
- * @param {?} value
- * @param {?} expectedType
- * @return {?}
- */
- DomSanitizerImpl.prototype.checkNotSafeValue = /**
- * @param {?} value
- * @param {?} expectedType
- * @return {?}
- */
- function (value, expectedType) {
- if (value instanceof SafeValueImpl) {
- throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
- "(see http://g.co/ng/security#xss)");
- }
- };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustHtml = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeHtmlImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustStyle = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeStyleImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustScript = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeScriptImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustUrl = /**
- * @param {?} value
- * @return {?}
- */
- function (value) { return new SafeUrlImpl(value); };
- /**
- * @param {?} value
- * @return {?}
- */
- DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return new SafeResourceUrlImpl(value);
- };
- DomSanitizerImpl.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- DomSanitizerImpl.ctorParameters = function () { return [
- { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT$1,] },] },
- ]; };
- return DomSanitizerImpl;
- }(DomSanitizer));
- /**
- * @abstract
- */
- var SafeValueImpl = /** @class */ (function () {
- function SafeValueImpl(changingThisBreaksApplicationSecurity) {
- // empty
- this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
- }
- /**
- * @return {?}
- */
- SafeValueImpl.prototype.toString = /**
- * @return {?}
- */
- function () {
- return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
- " (see http://g.co/ng/security#xss)";
- };
- return SafeValueImpl;
- }());
- var SafeHtmlImpl = /** @class */ (function (_super) {
- __extends(SafeHtmlImpl, _super);
- function SafeHtmlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeHtmlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'HTML'; };
- return SafeHtmlImpl;
- }(SafeValueImpl));
- var SafeStyleImpl = /** @class */ (function (_super) {
- __extends(SafeStyleImpl, _super);
- function SafeStyleImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeStyleImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'Style'; };
- return SafeStyleImpl;
- }(SafeValueImpl));
- var SafeScriptImpl = /** @class */ (function (_super) {
- __extends(SafeScriptImpl, _super);
- function SafeScriptImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeScriptImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'Script'; };
- return SafeScriptImpl;
- }(SafeValueImpl));
- var SafeUrlImpl = /** @class */ (function (_super) {
- __extends(SafeUrlImpl, _super);
- function SafeUrlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeUrlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'URL'; };
- return SafeUrlImpl;
- }(SafeValueImpl));
- var SafeResourceUrlImpl = /** @class */ (function (_super) {
- __extends(SafeResourceUrlImpl, _super);
- function SafeResourceUrlImpl() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- /**
- * @return {?}
- */
- SafeResourceUrlImpl.prototype.getTypeName = /**
- * @return {?}
- */
- function () { return 'ResourceURL'; };
- return SafeResourceUrlImpl;
- }(SafeValueImpl));
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
- { provide: _angular_core.PLATFORM_ID, useValue: _angular_common.ɵPLATFORM_BROWSER_ID },
- { provide: _angular_core.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
- { provide: _angular_common.PlatformLocation, useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] },
- { provide: DOCUMENT$1, useFactory: _document, deps: [] },
- ];
- /**
- * \@security Replacing built-in sanitization providers exposes the application to XSS risks.
- * Attacker-controlled data introduced by an unsanitized provider could expose your
- * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
- * \@experimental
- */
- var BROWSER_SANITIZATION_PROVIDERS = [
- { provide: _angular_core.Sanitizer, useExisting: DomSanitizer },
- { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
- ];
- /**
- * \@stable
- */
- var platformBrowser = _angular_core.createPlatformFactory(_angular_core.platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
- /**
- * @return {?}
- */
- function initDomAdapter() {
- BrowserDomAdapter.makeCurrent();
- BrowserGetTestability.init();
- }
- /**
- * @return {?}
- */
- function errorHandler() {
- return new _angular_core.ErrorHandler();
- }
- /**
- * @return {?}
- */
- function _document() {
- return document;
- }
- /**
- * The ng module for the browser.
- *
- * \@stable
- */
- var BrowserModule = /** @class */ (function () {
- function BrowserModule(parentModule) {
- if (parentModule) {
- throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
- }
- }
- /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * @experimental
- */
- /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * \@experimental
- * @param {?} params
- * @return {?}
- */
- BrowserModule.withServerTransition = /**
- * Configures a browser-based application to transition from a server-rendered app, if
- * one is present on the page. The specified parameters must include an application id,
- * which must match between the client and server applications.
- *
- * \@experimental
- * @param {?} params
- * @return {?}
- */
- function (params) {
- return {
- ngModule: BrowserModule,
- providers: [
- { provide: _angular_core.APP_ID, useValue: params.appId },
- { provide: TRANSITION_ID, useExisting: _angular_core.APP_ID },
- SERVER_TRANSITION_PROVIDERS,
- ],
- };
- };
- BrowserModule.decorators = [
- { type: _angular_core.NgModule, args: [{
- providers: [
- BROWSER_SANITIZATION_PROVIDERS,
- { provide: _angular_core.ErrorHandler, useFactory: errorHandler, deps: [] },
- { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
- { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
- { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
- { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
- DomRendererFactory2,
- { provide: _angular_core.RendererFactory2, useExisting: DomRendererFactory2 },
- { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
- DomSharedStylesHost,
- _angular_core.Testability,
- EventManager,
- ELEMENT_PROBE_PROVIDERS,
- Meta,
- Title,
- ],
- exports: [_angular_common.CommonModule, _angular_core.ApplicationModule]
- },] },
- ];
- /** @nocollapse */
- BrowserModule.ctorParameters = function () { return [
- { type: BrowserModule, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.SkipSelf },] },
- ]; };
- return BrowserModule;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var win = typeof window !== 'undefined' && window || /** @type {?} */ ({});
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var ChangeDetectionPerfRecord = /** @class */ (function () {
- function ChangeDetectionPerfRecord(msPerTick, numTicks) {
- this.msPerTick = msPerTick;
- this.numTicks = numTicks;
- }
- return ChangeDetectionPerfRecord;
- }());
- /**
- * Entry point for all Angular profiling-related debug tools. This object
- * corresponds to the `ng.profiler` in the dev console.
- */
- var AngularProfiler = /** @class */ (function () {
- function AngularProfiler(ref) {
- this.appRef = ref.injector.get(_angular_core.ApplicationRef);
- }
- // tslint:disable:no-console
- /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- */
- /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- * @param {?} config
- * @return {?}
- */
- AngularProfiler.prototype.timeChangeDetection = /**
- * Exercises change detection in a loop and then prints the average amount of
- * time in milliseconds how long a single round of change detection takes for
- * the current state of the UI. It runs a minimum of 5 rounds for a minimum
- * of 500 milliseconds.
- *
- * Optionally, a user may pass a `config` parameter containing a map of
- * options. Supported options are:
- *
- * `record` (boolean) - causes the profiler to record a CPU profile while
- * it exercises the change detector. Example:
- *
- * ```
- * ng.profiler.timeChangeDetection({record: true})
- * ```
- * @param {?} config
- * @return {?}
- */
- function (config) {
- var /** @type {?} */ record = config && config['record'];
- var /** @type {?} */ profileName = 'Change Detection';
- // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
- var /** @type {?} */ isProfilerAvailable = win.console.profile != null;
- if (record && isProfilerAvailable) {
- win.console.profile(profileName);
- }
- var /** @type {?} */ start = getDOM().performanceNow();
- var /** @type {?} */ numTicks = 0;
- while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
- this.appRef.tick();
- numTicks++;
- }
- var /** @type {?} */ end = getDOM().performanceNow();
- if (record && isProfilerAvailable) {
- // need to cast to <any> because type checker thinks there's no argument
- // while in fact there is:
- //
- // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
- (/** @type {?} */ (win.console.profileEnd))(profileName);
- }
- var /** @type {?} */ msPerTick = (end - start) / numTicks;
- win.console.log("ran " + numTicks + " change detection cycles");
- win.console.log(msPerTick.toFixed(2) + " ms per check");
- return new ChangeDetectionPerfRecord(msPerTick, numTicks);
- };
- return AngularProfiler;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- var PROFILER_GLOBAL_NAME = 'profiler';
- /**
- * Enabled Angular debug tools that are accessible via your browser's
- * developer console.
- *
- * Usage:
- *
- * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
- * 1. Type `ng.` (usually the console will show auto-complete suggestion)
- * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
- * then hit Enter.
- *
- * \@experimental All debugging apis are currently experimental.
- * @template T
- * @param {?} ref
- * @return {?}
- */
- function enableDebugTools(ref) {
- exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
- return ref;
- }
- /**
- * Disables Angular tools.
- *
- * \@experimental All debugging apis are currently experimental.
- * @return {?}
- */
- function disableDebugTools() {
- exportNgVar(PROFILER_GLOBAL_NAME, null);
- }
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * @param {?} text
- * @return {?}
- */
- function escapeHtml(text) {
- var /** @type {?} */ escapedText = {
- '&': '&a;',
- '"': '&q;',
- '\'': '&s;',
- '<': '&l;',
- '>': '&g;',
- };
- return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
- }
- /**
- * @param {?} text
- * @return {?}
- */
- function unescapeHtml(text) {
- var /** @type {?} */ unescapedText = {
- '&a;': '&',
- '&q;': '"',
- '&s;': '\'',
- '&l;': '<',
- '&g;': '>',
- };
- return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
- }
- /**
- * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
- *
- * Example:
- *
- * ```
- * const COUNTER_KEY = makeStateKey<number>('counter');
- * let value = 10;
- *
- * transferState.set(COUNTER_KEY, value);
- * ```
- *
- * \@experimental
- * @template T
- * @param {?} key
- * @return {?}
- */
- function makeStateKey(key) {
- return /** @type {?} */ (key);
- }
- /**
- * A key value store that is transferred from the application on the server side to the application
- * on the client side.
- *
- * `TransferState` will be available as an injectable token. To use it import
- * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
- *
- * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
- * boolean, number, string, null and non-class objects will be serialized and deserialzied in a
- * non-lossy manner.
- *
- * \@experimental
- */
- var TransferState = /** @class */ (function () {
- function TransferState() {
- this.store = {};
- this.onSerializeCallbacks = {};
- }
- /** @internal */
- /**
- * \@internal
- * @param {?} initState
- * @return {?}
- */
- TransferState.init = /**
- * \@internal
- * @param {?} initState
- * @return {?}
- */
- function (initState) {
- var /** @type {?} */ transferState = new TransferState();
- transferState.store = initState;
- return transferState;
- };
- /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- */
- /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- * @template T
- * @param {?} key
- * @param {?} defaultValue
- * @return {?}
- */
- TransferState.prototype.get = /**
- * Get the value corresponding to a key. Return `defaultValue` if key is not found.
- * @template T
- * @param {?} key
- * @param {?} defaultValue
- * @return {?}
- */
- function (key, defaultValue) {
- return this.store[key] !== undefined ? /** @type {?} */ (this.store[key]) : defaultValue;
- };
- /**
- * Set the value corresponding to a key.
- */
- /**
- * Set the value corresponding to a key.
- * @template T
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- TransferState.prototype.set = /**
- * Set the value corresponding to a key.
- * @template T
- * @param {?} key
- * @param {?} value
- * @return {?}
- */
- function (key, value) { this.store[key] = value; };
- /**
- * Remove a key from the store.
- */
- /**
- * Remove a key from the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- TransferState.prototype.remove = /**
- * Remove a key from the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- function (key) { delete this.store[key]; };
- /**
- * Test whether a key exists in the store.
- */
- /**
- * Test whether a key exists in the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- TransferState.prototype.hasKey = /**
- * Test whether a key exists in the store.
- * @template T
- * @param {?} key
- * @return {?}
- */
- function (key) { return this.store.hasOwnProperty(key); };
- /**
- * Register a callback to provide the value for a key when `toJson` is called.
- */
- /**
- * Register a callback to provide the value for a key when `toJson` is called.
- * @template T
- * @param {?} key
- * @param {?} callback
- * @return {?}
- */
- TransferState.prototype.onSerialize = /**
- * Register a callback to provide the value for a key when `toJson` is called.
- * @template T
- * @param {?} key
- * @param {?} callback
- * @return {?}
- */
- function (key, callback) {
- this.onSerializeCallbacks[key] = callback;
- };
- /**
- * Serialize the current state of the store to JSON.
- */
- /**
- * Serialize the current state of the store to JSON.
- * @return {?}
- */
- TransferState.prototype.toJson = /**
- * Serialize the current state of the store to JSON.
- * @return {?}
- */
- function () {
- // Call the onSerialize callbacks and put those values into the store.
- for (var /** @type {?} */ key in this.onSerializeCallbacks) {
- if (this.onSerializeCallbacks.hasOwnProperty(key)) {
- try {
- this.store[key] = this.onSerializeCallbacks[key]();
- }
- catch (/** @type {?} */ e) {
- console.warn('Exception in onSerialize callback: ', e);
- }
- }
- }
- return JSON.stringify(this.store);
- };
- TransferState.decorators = [
- { type: _angular_core.Injectable },
- ];
- /** @nocollapse */
- TransferState.ctorParameters = function () { return []; };
- return TransferState;
- }());
- /**
- * @param {?} doc
- * @param {?} appId
- * @return {?}
- */
- function initTransferState(doc, appId) {
- // Locate the script tag with the JSON data transferred from the server.
- // The id of the script tag is set to the Angular appId + 'state'.
- var /** @type {?} */ script = doc.getElementById(appId + '-state');
- var /** @type {?} */ initialState = {};
- if (script && script.textContent) {
- try {
- initialState = JSON.parse(unescapeHtml(script.textContent));
- }
- catch (/** @type {?} */ e) {
- console.warn('Exception while restoring TransferState for app ' + appId, e);
- }
- }
- return TransferState.init(initialState);
- }
- /**
- * NgModule to install on the client side while using the `TransferState` to transfer state from
- * server to client.
- *
- * \@experimental
- */
- var BrowserTransferStateModule = /** @class */ (function () {
- function BrowserTransferStateModule() {
- }
- BrowserTransferStateModule.decorators = [
- { type: _angular_core.NgModule, args: [{
- providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, _angular_core.APP_ID] }],
- },] },
- ];
- /** @nocollapse */
- BrowserTransferStateModule.ctorParameters = function () { return []; };
- return BrowserTransferStateModule;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * Predicates for use with {\@link DebugElement}'s query functions.
- *
- * \@experimental All debugging apis are currently experimental.
- */
- var By = /** @class */ (function () {
- function By() {
- }
- /**
- * Match all elements.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- */
- /**
- * Match all elements.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- * @return {?}
- */
- By.all = /**
- * Match all elements.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
- * @return {?}
- */
- function () { return function (debugElement) { return true; }; };
- /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- */
- /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- * @param {?} selector
- * @return {?}
- */
- By.css = /**
- * Match elements by the given CSS selector.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
- * @param {?} selector
- * @return {?}
- */
- function (selector) {
- return function (debugElement) {
- return debugElement.nativeElement != null ?
- getDOM().elementMatches(debugElement.nativeElement, selector) :
- false;
- };
- };
- /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- */
- /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- * @param {?} type
- * @return {?}
- */
- By.directive = /**
- * Match elements that have the given directive present.
- *
- * ## Example
- *
- * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
- * @param {?} type
- * @return {?}
- */
- function (type) {
- return function (debugElement) { return ((debugElement.providerTokens)).indexOf(type) !== -1; };
- };
- return By;
- }());
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
-
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes} checked by tsc
- */
- /**
- * @license
- * Copyright Google Inc. All Rights Reserved.
- *
- * Use of this source code is governed by an MIT-style license that can be
- * found in the LICENSE file at https://angular.io/license
- */
- /**
- * \@stable
- */
- var VERSION = new _angular_core.Version('5.2.11');
-
- exports.BrowserModule = BrowserModule;
- exports.platformBrowser = platformBrowser;
- exports.Meta = Meta;
- exports.Title = Title;
- exports.disableDebugTools = disableDebugTools;
- exports.enableDebugTools = enableDebugTools;
- exports.BrowserTransferStateModule = BrowserTransferStateModule;
- exports.TransferState = TransferState;
- exports.makeStateKey = makeStateKey;
- exports.By = By;
- exports.DOCUMENT = DOCUMENT$1;
- exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
- exports.EventManager = EventManager;
- exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
- exports.HammerGestureConfig = HammerGestureConfig;
- exports.DomSanitizer = DomSanitizer;
- exports.VERSION = VERSION;
- exports.ɵBROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS;
- exports.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS = INTERNAL_BROWSER_PLATFORM_PROVIDERS;
- exports.ɵinitDomAdapter = initDomAdapter;
- exports.ɵBrowserDomAdapter = BrowserDomAdapter;
- exports.ɵBrowserPlatformLocation = BrowserPlatformLocation;
- exports.ɵTRANSITION_ID = TRANSITION_ID;
- exports.ɵBrowserGetTestability = BrowserGetTestability;
- exports.ɵescapeHtml = escapeHtml;
- exports.ɵELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
- exports.ɵDomAdapter = DomAdapter;
- exports.ɵgetDOM = getDOM;
- exports.ɵsetRootDomAdapter = setRootDomAdapter;
- exports.ɵDomRendererFactory2 = DomRendererFactory2;
- exports.ɵNAMESPACE_URIS = NAMESPACE_URIS;
- exports.ɵflattenStyles = flattenStyles;
- exports.ɵshimContentAttribute = shimContentAttribute;
- exports.ɵshimHostAttribute = shimHostAttribute;
- exports.ɵDomEventsPlugin = DomEventsPlugin;
- exports.ɵHammerGesturesPlugin = HammerGesturesPlugin;
- exports.ɵKeyEventsPlugin = KeyEventsPlugin;
- exports.ɵDomSharedStylesHost = DomSharedStylesHost;
- exports.ɵSharedStylesHost = SharedStylesHost;
- exports.ɵb = _document;
- exports.ɵa = errorHandler;
- exports.ɵi = GenericBrowserDomAdapter;
- exports.ɵg = SERVER_TRANSITION_PROVIDERS;
- exports.ɵf = appInitializerFactory;
- exports.ɵc = initTransferState;
- exports.ɵh = _createNgProbe;
- exports.ɵd = EventManagerPlugin;
- exports.ɵe = DomSanitizerImpl;
-
- Object.defineProperty(exports, '__esModule', { value: true });
-
- })));
- //# sourceMappingURL=platform-browser.umd.js.map
|