1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
  8. typeof define === 'function' && define.amd ? define('@angular/common', ['exports', '@angular/core'], factory) :
  9. (factory((global.ng = global.ng || {}, global.ng.common = {}),global.ng.core));
  10. }(this, (function (exports,_angular_core) { 'use strict';
  11. /*! *****************************************************************************
  12. Copyright (c) Microsoft Corporation. All rights reserved.
  13. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  14. this file except in compliance with the License. You may obtain a copy of the
  15. License at http://www.apache.org/licenses/LICENSE-2.0
  16. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  18. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  19. MERCHANTABLITY OR NON-INFRINGEMENT.
  20. See the Apache Version 2.0 License for specific language governing permissions
  21. and limitations under the License.
  22. ***************************************************************************** */
  23. /* global Reflect, Promise */
  24. var extendStatics = Object.setPrototypeOf ||
  25. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  26. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  27. function __extends(d, b) {
  28. extendStatics(d, b);
  29. function __() { this.constructor = d; }
  30. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  31. }
  32. var __assign = Object.assign || function __assign(t) {
  33. for (var s, i = 1, n = arguments.length; i < n; i++) {
  34. s = arguments[i];
  35. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  36. }
  37. return t;
  38. };
  39. /**
  40. * @license Angular v5.2.11
  41. * (c) 2010-2018 Google, Inc. https://angular.io/
  42. * License: MIT
  43. */
  44. /**
  45. * @fileoverview added by tsickle
  46. * @suppress {checkTypes} checked by tsc
  47. */
  48. /**
  49. * @license
  50. * Copyright Google Inc. All Rights Reserved.
  51. *
  52. * Use of this source code is governed by an MIT-style license that can be
  53. * found in the LICENSE file at https://angular.io/license
  54. */
  55. /**
  56. * This class should not be used directly by an application developer. Instead, use
  57. * {\@link Location}.
  58. *
  59. * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
  60. * agnostic.
  61. * This means that we can have different implementation of `PlatformLocation` for the different
  62. * platforms that angular supports. For example, `\@angular/platform-browser` provides an
  63. * implementation specific to the browser environment, while `\@angular/platform-webworker` provides
  64. * one suitable for use with web workers.
  65. *
  66. * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
  67. * when they need to interact with the DOM apis like pushState, popState, etc...
  68. *
  69. * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
  70. * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
  71. * Router} /
  72. * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
  73. * class they are all platform independent.
  74. *
  75. * \@stable
  76. * @abstract
  77. */
  78. var PlatformLocation = /** @class */ (function () {
  79. function PlatformLocation() {
  80. }
  81. return PlatformLocation;
  82. }());
  83. /**
  84. * \@whatItDoes indicates when a location is initialized
  85. * \@experimental
  86. */
  87. var LOCATION_INITIALIZED = new _angular_core.InjectionToken('Location Initialized');
  88. /**
  89. * A serializable version of the event from onPopState or onHashChange
  90. *
  91. * \@experimental
  92. * @record
  93. */
  94. /**
  95. * \@experimental
  96. * @record
  97. */
  98. /**
  99. * @fileoverview added by tsickle
  100. * @suppress {checkTypes} checked by tsc
  101. */
  102. /**
  103. * @license
  104. * Copyright Google Inc. All Rights Reserved.
  105. *
  106. * Use of this source code is governed by an MIT-style license that can be
  107. * found in the LICENSE file at https://angular.io/license
  108. */
  109. /**
  110. * `LocationStrategy` is responsible for representing and reading route state
  111. * from the browser's URL. Angular provides two strategies:
  112. * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
  113. *
  114. * This is used under the hood of the {\@link Location} service.
  115. *
  116. * Applications should use the {\@link Router} or {\@link Location} services to
  117. * interact with application route state.
  118. *
  119. * For instance, {\@link HashLocationStrategy} produces URLs like
  120. * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
  121. * `http://example.com/foo` as an equivalent URL.
  122. *
  123. * See these two classes for more.
  124. *
  125. * \@stable
  126. * @abstract
  127. */
  128. var LocationStrategy = /** @class */ (function () {
  129. function LocationStrategy() {
  130. }
  131. return LocationStrategy;
  132. }());
  133. /**
  134. * The `APP_BASE_HREF` token represents the base href to be used with the
  135. * {\@link PathLocationStrategy}.
  136. *
  137. * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string
  138. * representing the URL prefix that should be preserved when generating and recognizing
  139. * URLs.
  140. *
  141. * ### Example
  142. *
  143. * ```typescript
  144. * import {Component, NgModule} from '\@angular/core';
  145. * import {APP_BASE_HREF} from '\@angular/common';
  146. *
  147. * \@NgModule({
  148. * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
  149. * })
  150. * class AppModule {}
  151. * ```
  152. *
  153. * \@stable
  154. */
  155. var APP_BASE_HREF = new _angular_core.InjectionToken('appBaseHref');
  156. /**
  157. * @fileoverview added by tsickle
  158. * @suppress {checkTypes} checked by tsc
  159. */
  160. /**
  161. * @license
  162. * Copyright Google Inc. All Rights Reserved.
  163. *
  164. * Use of this source code is governed by an MIT-style license that can be
  165. * found in the LICENSE file at https://angular.io/license
  166. */
  167. /**
  168. * \@experimental
  169. * @record
  170. */
  171. /**
  172. * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
  173. * \@description
  174. * Depending on which {\@link LocationStrategy} is used, `Location` will either persist
  175. * to the URL's path or the URL's hash segment.
  176. *
  177. * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
  178. * `Location` only if you need to interact with or create normalized URLs outside of
  179. * routing.
  180. *
  181. * `Location` is responsible for normalizing the URL against the application's base href.
  182. * A normalized URL is absolute from the URL host, includes the application's base href, and has no
  183. * trailing slash:
  184. * - `/my/app/user/123` is normalized
  185. * - `my/app/user/123` **is not** normalized
  186. * - `/my/app/user/123/` **is not** normalized
  187. *
  188. * ### Example
  189. * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
  190. * \@stable
  191. */
  192. var Location = /** @class */ (function () {
  193. function Location(platformStrategy) {
  194. var _this = this;
  195. /**
  196. * \@internal
  197. */
  198. this._subject = new _angular_core.EventEmitter();
  199. this._platformStrategy = platformStrategy;
  200. var /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref();
  201. this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
  202. this._platformStrategy.onPopState(function (ev) {
  203. _this._subject.emit({
  204. 'url': _this.path(true),
  205. 'pop': true,
  206. 'type': ev.type,
  207. });
  208. });
  209. }
  210. /**
  211. * Returns the normalized URL path.
  212. */
  213. // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
  214. // removed.
  215. /**
  216. * Returns the normalized URL path.
  217. * @param {?=} includeHash
  218. * @return {?}
  219. */
  220. Location.prototype.path = /**
  221. * Returns the normalized URL path.
  222. * @param {?=} includeHash
  223. * @return {?}
  224. */
  225. function (includeHash) {
  226. if (includeHash === void 0) { includeHash = false; }
  227. return this.normalize(this._platformStrategy.path(includeHash));
  228. };
  229. /**
  230. * Normalizes the given path and compares to the current normalized path.
  231. */
  232. /**
  233. * Normalizes the given path and compares to the current normalized path.
  234. * @param {?} path
  235. * @param {?=} query
  236. * @return {?}
  237. */
  238. Location.prototype.isCurrentPathEqualTo = /**
  239. * Normalizes the given path and compares to the current normalized path.
  240. * @param {?} path
  241. * @param {?=} query
  242. * @return {?}
  243. */
  244. function (path, query) {
  245. if (query === void 0) { query = ''; }
  246. return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
  247. };
  248. /**
  249. * Given a string representing a URL, returns the normalized URL path without leading or
  250. * trailing slashes.
  251. */
  252. /**
  253. * Given a string representing a URL, returns the normalized URL path without leading or
  254. * trailing slashes.
  255. * @param {?} url
  256. * @return {?}
  257. */
  258. Location.prototype.normalize = /**
  259. * Given a string representing a URL, returns the normalized URL path without leading or
  260. * trailing slashes.
  261. * @param {?} url
  262. * @return {?}
  263. */
  264. function (url) {
  265. return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
  266. };
  267. /**
  268. * Given a string representing a URL, returns the platform-specific external URL path.
  269. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  270. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  271. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  272. */
  273. /**
  274. * Given a string representing a URL, returns the platform-specific external URL path.
  275. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  276. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  277. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  278. * @param {?} url
  279. * @return {?}
  280. */
  281. Location.prototype.prepareExternalUrl = /**
  282. * Given a string representing a URL, returns the platform-specific external URL path.
  283. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  284. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  285. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  286. * @param {?} url
  287. * @return {?}
  288. */
  289. function (url) {
  290. if (url && url[0] !== '/') {
  291. url = '/' + url;
  292. }
  293. return this._platformStrategy.prepareExternalUrl(url);
  294. };
  295. // TODO: rename this method to pushState
  296. /**
  297. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  298. * new item onto the platform's history.
  299. */
  300. /**
  301. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  302. * new item onto the platform's history.
  303. * @param {?} path
  304. * @param {?=} query
  305. * @return {?}
  306. */
  307. Location.prototype.go = /**
  308. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  309. * new item onto the platform's history.
  310. * @param {?} path
  311. * @param {?=} query
  312. * @return {?}
  313. */
  314. function (path, query) {
  315. if (query === void 0) { query = ''; }
  316. this._platformStrategy.pushState(null, '', path, query);
  317. };
  318. /**
  319. * Changes the browsers URL to the normalized version of the given URL, and replaces
  320. * the top item on the platform's history stack.
  321. */
  322. /**
  323. * Changes the browsers URL to the normalized version of the given URL, and replaces
  324. * the top item on the platform's history stack.
  325. * @param {?} path
  326. * @param {?=} query
  327. * @return {?}
  328. */
  329. Location.prototype.replaceState = /**
  330. * Changes the browsers URL to the normalized version of the given URL, and replaces
  331. * the top item on the platform's history stack.
  332. * @param {?} path
  333. * @param {?=} query
  334. * @return {?}
  335. */
  336. function (path, query) {
  337. if (query === void 0) { query = ''; }
  338. this._platformStrategy.replaceState(null, '', path, query);
  339. };
  340. /**
  341. * Navigates forward in the platform's history.
  342. */
  343. /**
  344. * Navigates forward in the platform's history.
  345. * @return {?}
  346. */
  347. Location.prototype.forward = /**
  348. * Navigates forward in the platform's history.
  349. * @return {?}
  350. */
  351. function () { this._platformStrategy.forward(); };
  352. /**
  353. * Navigates back in the platform's history.
  354. */
  355. /**
  356. * Navigates back in the platform's history.
  357. * @return {?}
  358. */
  359. Location.prototype.back = /**
  360. * Navigates back in the platform's history.
  361. * @return {?}
  362. */
  363. function () { this._platformStrategy.back(); };
  364. /**
  365. * Subscribe to the platform's `popState` events.
  366. */
  367. /**
  368. * Subscribe to the platform's `popState` events.
  369. * @param {?} onNext
  370. * @param {?=} onThrow
  371. * @param {?=} onReturn
  372. * @return {?}
  373. */
  374. Location.prototype.subscribe = /**
  375. * Subscribe to the platform's `popState` events.
  376. * @param {?} onNext
  377. * @param {?=} onThrow
  378. * @param {?=} onReturn
  379. * @return {?}
  380. */
  381. function (onNext, onThrow, onReturn) {
  382. return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
  383. };
  384. /**
  385. * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
  386. * is.
  387. * @param {?} params
  388. * @return {?}
  389. */
  390. Location.normalizeQueryParams = /**
  391. * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
  392. * is.
  393. * @param {?} params
  394. * @return {?}
  395. */
  396. function (params) {
  397. return params && params[0] !== '?' ? '?' + params : params;
  398. };
  399. /**
  400. * Given 2 parts of a url, join them with a slash if needed.
  401. * @param {?} start
  402. * @param {?} end
  403. * @return {?}
  404. */
  405. Location.joinWithSlash = /**
  406. * Given 2 parts of a url, join them with a slash if needed.
  407. * @param {?} start
  408. * @param {?} end
  409. * @return {?}
  410. */
  411. function (start, end) {
  412. if (start.length == 0) {
  413. return end;
  414. }
  415. if (end.length == 0) {
  416. return start;
  417. }
  418. var /** @type {?} */ slashes = 0;
  419. if (start.endsWith('/')) {
  420. slashes++;
  421. }
  422. if (end.startsWith('/')) {
  423. slashes++;
  424. }
  425. if (slashes == 2) {
  426. return start + end.substring(1);
  427. }
  428. if (slashes == 1) {
  429. return start + end;
  430. }
  431. return start + '/' + end;
  432. };
  433. /**
  434. * If url has a trailing slash, remove it, otherwise return url as is. This
  435. * method looks for the first occurence of either #, ?, or the end of the
  436. * line as `/` characters after any of these should not be replaced.
  437. * @param {?} url
  438. * @return {?}
  439. */
  440. Location.stripTrailingSlash = /**
  441. * If url has a trailing slash, remove it, otherwise return url as is. This
  442. * method looks for the first occurence of either #, ?, or the end of the
  443. * line as `/` characters after any of these should not be replaced.
  444. * @param {?} url
  445. * @return {?}
  446. */
  447. function (url) {
  448. var /** @type {?} */ match = url.match(/#|\?|$/);
  449. var /** @type {?} */ pathEndIdx = match && match.index || url.length;
  450. var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
  451. return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
  452. };
  453. Location.decorators = [
  454. { type: _angular_core.Injectable },
  455. ];
  456. /** @nocollapse */
  457. Location.ctorParameters = function () { return [
  458. { type: LocationStrategy, },
  459. ]; };
  460. return Location;
  461. }());
  462. /**
  463. * @param {?} baseHref
  464. * @param {?} url
  465. * @return {?}
  466. */
  467. function _stripBaseHref(baseHref, url) {
  468. return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
  469. }
  470. /**
  471. * @param {?} url
  472. * @return {?}
  473. */
  474. function _stripIndexHtml(url) {
  475. return url.replace(/\/index.html$/, '');
  476. }
  477. /**
  478. * @fileoverview added by tsickle
  479. * @suppress {checkTypes} checked by tsc
  480. */
  481. /**
  482. * @license
  483. * Copyright Google Inc. All Rights Reserved.
  484. *
  485. * Use of this source code is governed by an MIT-style license that can be
  486. * found in the LICENSE file at https://angular.io/license
  487. */
  488. /**
  489. * \@whatItDoes Use URL hash for storing application location data.
  490. * \@description
  491. * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
  492. * {\@link Location} service to represent its state in the
  493. * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
  494. * of the browser's URL.
  495. *
  496. * For instance, if you call `location.go('/foo')`, the browser's URL will become
  497. * `example.com#/foo`.
  498. *
  499. * ### Example
  500. *
  501. * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
  502. *
  503. * \@stable
  504. */
  505. var HashLocationStrategy = /** @class */ (function (_super) {
  506. __extends(HashLocationStrategy, _super);
  507. function HashLocationStrategy(_platformLocation, _baseHref) {
  508. var _this = _super.call(this) || this;
  509. _this._platformLocation = _platformLocation;
  510. _this._baseHref = '';
  511. if (_baseHref != null) {
  512. _this._baseHref = _baseHref;
  513. }
  514. return _this;
  515. }
  516. /**
  517. * @param {?} fn
  518. * @return {?}
  519. */
  520. HashLocationStrategy.prototype.onPopState = /**
  521. * @param {?} fn
  522. * @return {?}
  523. */
  524. function (fn) {
  525. this._platformLocation.onPopState(fn);
  526. this._platformLocation.onHashChange(fn);
  527. };
  528. /**
  529. * @return {?}
  530. */
  531. HashLocationStrategy.prototype.getBaseHref = /**
  532. * @return {?}
  533. */
  534. function () { return this._baseHref; };
  535. /**
  536. * @param {?=} includeHash
  537. * @return {?}
  538. */
  539. HashLocationStrategy.prototype.path = /**
  540. * @param {?=} includeHash
  541. * @return {?}
  542. */
  543. function (includeHash) {
  544. if (includeHash === void 0) { includeHash = false; }
  545. // the hash value is always prefixed with a `#`
  546. // and if it is empty then it will stay empty
  547. var /** @type {?} */ path = this._platformLocation.hash;
  548. if (path == null)
  549. path = '#';
  550. return path.length > 0 ? path.substring(1) : path;
  551. };
  552. /**
  553. * @param {?} internal
  554. * @return {?}
  555. */
  556. HashLocationStrategy.prototype.prepareExternalUrl = /**
  557. * @param {?} internal
  558. * @return {?}
  559. */
  560. function (internal) {
  561. var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
  562. return url.length > 0 ? ('#' + url) : url;
  563. };
  564. /**
  565. * @param {?} state
  566. * @param {?} title
  567. * @param {?} path
  568. * @param {?} queryParams
  569. * @return {?}
  570. */
  571. HashLocationStrategy.prototype.pushState = /**
  572. * @param {?} state
  573. * @param {?} title
  574. * @param {?} path
  575. * @param {?} queryParams
  576. * @return {?}
  577. */
  578. function (state, title, path, queryParams) {
  579. var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  580. if (url.length == 0) {
  581. url = this._platformLocation.pathname;
  582. }
  583. this._platformLocation.pushState(state, title, url);
  584. };
  585. /**
  586. * @param {?} state
  587. * @param {?} title
  588. * @param {?} path
  589. * @param {?} queryParams
  590. * @return {?}
  591. */
  592. HashLocationStrategy.prototype.replaceState = /**
  593. * @param {?} state
  594. * @param {?} title
  595. * @param {?} path
  596. * @param {?} queryParams
  597. * @return {?}
  598. */
  599. function (state, title, path, queryParams) {
  600. var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  601. if (url.length == 0) {
  602. url = this._platformLocation.pathname;
  603. }
  604. this._platformLocation.replaceState(state, title, url);
  605. };
  606. /**
  607. * @return {?}
  608. */
  609. HashLocationStrategy.prototype.forward = /**
  610. * @return {?}
  611. */
  612. function () { this._platformLocation.forward(); };
  613. /**
  614. * @return {?}
  615. */
  616. HashLocationStrategy.prototype.back = /**
  617. * @return {?}
  618. */
  619. function () { this._platformLocation.back(); };
  620. HashLocationStrategy.decorators = [
  621. { type: _angular_core.Injectable },
  622. ];
  623. /** @nocollapse */
  624. HashLocationStrategy.ctorParameters = function () { return [
  625. { type: PlatformLocation, },
  626. { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [APP_BASE_HREF,] },] },
  627. ]; };
  628. return HashLocationStrategy;
  629. }(LocationStrategy));
  630. /**
  631. * @fileoverview added by tsickle
  632. * @suppress {checkTypes} checked by tsc
  633. */
  634. /**
  635. * @license
  636. * Copyright Google Inc. All Rights Reserved.
  637. *
  638. * Use of this source code is governed by an MIT-style license that can be
  639. * found in the LICENSE file at https://angular.io/license
  640. */
  641. /**
  642. * \@whatItDoes Use URL for storing application location data.
  643. * \@description
  644. * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
  645. * {\@link Location} service to represent its state in the
  646. * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
  647. * browser's URL.
  648. *
  649. * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
  650. * or add a base element to the document. This URL prefix that will be preserved
  651. * when generating and recognizing URLs.
  652. *
  653. * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
  654. * `location.go('/foo')`, the browser's URL will become
  655. * `example.com/my/app/foo`.
  656. *
  657. * Similarly, if you add `<base href='/my/app'/>` to the document and call
  658. * `location.go('/foo')`, the browser's URL will become
  659. * `example.com/my/app/foo`.
  660. *
  661. * ### Example
  662. *
  663. * {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
  664. *
  665. * \@stable
  666. */
  667. var PathLocationStrategy = /** @class */ (function (_super) {
  668. __extends(PathLocationStrategy, _super);
  669. function PathLocationStrategy(_platformLocation, href) {
  670. var _this = _super.call(this) || this;
  671. _this._platformLocation = _platformLocation;
  672. if (href == null) {
  673. href = _this._platformLocation.getBaseHrefFromDOM();
  674. }
  675. if (href == null) {
  676. throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
  677. }
  678. _this._baseHref = href;
  679. return _this;
  680. }
  681. /**
  682. * @param {?} fn
  683. * @return {?}
  684. */
  685. PathLocationStrategy.prototype.onPopState = /**
  686. * @param {?} fn
  687. * @return {?}
  688. */
  689. function (fn) {
  690. this._platformLocation.onPopState(fn);
  691. this._platformLocation.onHashChange(fn);
  692. };
  693. /**
  694. * @return {?}
  695. */
  696. PathLocationStrategy.prototype.getBaseHref = /**
  697. * @return {?}
  698. */
  699. function () { return this._baseHref; };
  700. /**
  701. * @param {?} internal
  702. * @return {?}
  703. */
  704. PathLocationStrategy.prototype.prepareExternalUrl = /**
  705. * @param {?} internal
  706. * @return {?}
  707. */
  708. function (internal) {
  709. return Location.joinWithSlash(this._baseHref, internal);
  710. };
  711. /**
  712. * @param {?=} includeHash
  713. * @return {?}
  714. */
  715. PathLocationStrategy.prototype.path = /**
  716. * @param {?=} includeHash
  717. * @return {?}
  718. */
  719. function (includeHash) {
  720. if (includeHash === void 0) { includeHash = false; }
  721. var /** @type {?} */ pathname = this._platformLocation.pathname +
  722. Location.normalizeQueryParams(this._platformLocation.search);
  723. var /** @type {?} */ hash = this._platformLocation.hash;
  724. return hash && includeHash ? "" + pathname + hash : pathname;
  725. };
  726. /**
  727. * @param {?} state
  728. * @param {?} title
  729. * @param {?} url
  730. * @param {?} queryParams
  731. * @return {?}
  732. */
  733. PathLocationStrategy.prototype.pushState = /**
  734. * @param {?} state
  735. * @param {?} title
  736. * @param {?} url
  737. * @param {?} queryParams
  738. * @return {?}
  739. */
  740. function (state, title, url, queryParams) {
  741. var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  742. this._platformLocation.pushState(state, title, externalUrl);
  743. };
  744. /**
  745. * @param {?} state
  746. * @param {?} title
  747. * @param {?} url
  748. * @param {?} queryParams
  749. * @return {?}
  750. */
  751. PathLocationStrategy.prototype.replaceState = /**
  752. * @param {?} state
  753. * @param {?} title
  754. * @param {?} url
  755. * @param {?} queryParams
  756. * @return {?}
  757. */
  758. function (state, title, url, queryParams) {
  759. var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  760. this._platformLocation.replaceState(state, title, externalUrl);
  761. };
  762. /**
  763. * @return {?}
  764. */
  765. PathLocationStrategy.prototype.forward = /**
  766. * @return {?}
  767. */
  768. function () { this._platformLocation.forward(); };
  769. /**
  770. * @return {?}
  771. */
  772. PathLocationStrategy.prototype.back = /**
  773. * @return {?}
  774. */
  775. function () { this._platformLocation.back(); };
  776. PathLocationStrategy.decorators = [
  777. { type: _angular_core.Injectable },
  778. ];
  779. /** @nocollapse */
  780. PathLocationStrategy.ctorParameters = function () { return [
  781. { type: PlatformLocation, },
  782. { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [APP_BASE_HREF,] },] },
  783. ]; };
  784. return PathLocationStrategy;
  785. }(LocationStrategy));
  786. /**
  787. * @fileoverview added by tsickle
  788. * @suppress {checkTypes} checked by tsc
  789. */
  790. /**
  791. * @license
  792. * Copyright Google Inc. All Rights Reserved.
  793. *
  794. * Use of this source code is governed by an MIT-style license that can be
  795. * found in the LICENSE file at https://angular.io/license
  796. */
  797. /**
  798. * @fileoverview added by tsickle
  799. * @suppress {checkTypes} checked by tsc
  800. */
  801. /**
  802. * @license
  803. * Copyright Google Inc. All Rights Reserved.
  804. *
  805. * Use of this source code is governed by an MIT-style license that can be
  806. * found in the LICENSE file at https://angular.io/license
  807. */
  808. // THIS CODE IS GENERATED - DO NOT MODIFY
  809. // See angular/tools/gulp-tasks/cldr/extract.js
  810. /**
  811. * \@internal
  812. */
  813. var CURRENCIES = {
  814. 'AOA': [, 'Kz'],
  815. 'ARS': [, '$'],
  816. 'AUD': ['A$', '$'],
  817. 'BAM': [, 'KM'],
  818. 'BBD': [, '$'],
  819. 'BDT': [, '৳'],
  820. 'BMD': [, '$'],
  821. 'BND': [, '$'],
  822. 'BOB': [, 'Bs'],
  823. 'BRL': ['R$'],
  824. 'BSD': [, '$'],
  825. 'BWP': [, 'P'],
  826. 'BYN': [, 'р.'],
  827. 'BZD': [, '$'],
  828. 'CAD': ['CA$', '$'],
  829. 'CLP': [, '$'],
  830. 'CNY': ['CN¥', '¥'],
  831. 'COP': [, '$'],
  832. 'CRC': [, '₡'],
  833. 'CUC': [, '$'],
  834. 'CUP': [, '$'],
  835. 'CZK': [, 'Kč'],
  836. 'DKK': [, 'kr'],
  837. 'DOP': [, '$'],
  838. 'EGP': [, 'E£'],
  839. 'ESP': [, '₧'],
  840. 'EUR': ['€'],
  841. 'FJD': [, '$'],
  842. 'FKP': [, '£'],
  843. 'GBP': ['£'],
  844. 'GEL': [, '₾'],
  845. 'GIP': [, '£'],
  846. 'GNF': [, 'FG'],
  847. 'GTQ': [, 'Q'],
  848. 'GYD': [, '$'],
  849. 'HKD': ['HK$', '$'],
  850. 'HNL': [, 'L'],
  851. 'HRK': [, 'kn'],
  852. 'HUF': [, 'Ft'],
  853. 'IDR': [, 'Rp'],
  854. 'ILS': ['₪'],
  855. 'INR': ['₹'],
  856. 'ISK': [, 'kr'],
  857. 'JMD': [, '$'],
  858. 'JPY': ['¥'],
  859. 'KHR': [, '៛'],
  860. 'KMF': [, 'CF'],
  861. 'KPW': [, '₩'],
  862. 'KRW': ['₩'],
  863. 'KYD': [, '$'],
  864. 'KZT': [, '₸'],
  865. 'LAK': [, '₭'],
  866. 'LBP': [, 'L£'],
  867. 'LKR': [, 'Rs'],
  868. 'LRD': [, '$'],
  869. 'LTL': [, 'Lt'],
  870. 'LVL': [, 'Ls'],
  871. 'MGA': [, 'Ar'],
  872. 'MMK': [, 'K'],
  873. 'MNT': [, '₮'],
  874. 'MUR': [, 'Rs'],
  875. 'MXN': ['MX$', '$'],
  876. 'MYR': [, 'RM'],
  877. 'NAD': [, '$'],
  878. 'NGN': [, '₦'],
  879. 'NIO': [, 'C$'],
  880. 'NOK': [, 'kr'],
  881. 'NPR': [, 'Rs'],
  882. 'NZD': ['NZ$', '$'],
  883. 'PHP': [, '₱'],
  884. 'PKR': [, 'Rs'],
  885. 'PLN': [, 'zł'],
  886. 'PYG': [, '₲'],
  887. 'RON': [, 'lei'],
  888. 'RUB': [, '₽'],
  889. 'RUR': [, 'р.'],
  890. 'RWF': [, 'RF'],
  891. 'SBD': [, '$'],
  892. 'SEK': [, 'kr'],
  893. 'SGD': [, '$'],
  894. 'SHP': [, '£'],
  895. 'SRD': [, '$'],
  896. 'SSP': [, '£'],
  897. 'STD': [, 'Db'],
  898. 'SYP': [, '£'],
  899. 'THB': [, '฿'],
  900. 'TOP': [, 'T$'],
  901. 'TRY': [, '₺'],
  902. 'TTD': [, '$'],
  903. 'TWD': ['NT$', '$'],
  904. 'UAH': [, '₴'],
  905. 'USD': ['$'],
  906. 'UYU': [, '$'],
  907. 'VEF': [, 'Bs'],
  908. 'VND': ['₫'],
  909. 'XAF': ['FCFA'],
  910. 'XCD': ['EC$', '$'],
  911. 'XOF': ['CFA'],
  912. 'XPF': ['CFPF'],
  913. 'ZAR': [, 'R'],
  914. 'ZMW': [, 'ZK'],
  915. };
  916. /**
  917. * @fileoverview added by tsickle
  918. * @suppress {checkTypes} checked by tsc
  919. */
  920. /**
  921. * @license
  922. * Copyright Google Inc. All Rights Reserved.
  923. *
  924. * Use of this source code is governed by an MIT-style license that can be
  925. * found in the LICENSE file at https://angular.io/license
  926. */
  927. // THIS CODE IS GENERATED - DO NOT MODIFY
  928. // See angular/tools/gulp-tasks/cldr/extract.js
  929. /**
  930. * @param {?} n
  931. * @return {?}
  932. */
  933. function plural(n) {
  934. var /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length;
  935. if (i === 1 && v === 0)
  936. return 1;
  937. return 5;
  938. }
  939. var localeEn = [
  940. 'en',
  941. [
  942. ['a', 'p'],
  943. ['AM', 'PM'],
  944. ],
  945. [
  946. ['AM', 'PM'],
  947. ,
  948. ],
  949. [
  950. ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  951. ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  952. ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
  953. ],
  954. ,
  955. [
  956. ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  957. ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  958. [
  959. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
  960. 'October', 'November', 'December'
  961. ]
  962. ],
  963. ,
  964. [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0],
  965. ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
  966. ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
  967. [
  968. '{1}, {0}',
  969. ,
  970. '{1} \'at\' {0}',
  971. ],
  972. ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
  973. ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', plural
  974. ];
  975. /**
  976. * @fileoverview added by tsickle
  977. * @suppress {checkTypes} checked by tsc
  978. */
  979. /**
  980. * @license
  981. * Copyright Google Inc. All Rights Reserved.
  982. *
  983. * Use of this source code is governed by an MIT-style license that can be
  984. * found in the LICENSE file at https://angular.io/license
  985. */
  986. /**
  987. * \@experimental i18n support is experimental.
  988. */
  989. var LOCALE_DATA = {};
  990. /**
  991. * Register global data to be used internally by Angular. See the
  992. * {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data.
  993. *
  994. * \@experimental i18n support is experimental.
  995. * @param {?} data
  996. * @param {?=} localeId
  997. * @param {?=} extraData
  998. * @return {?}
  999. */
  1000. function registerLocaleData(data, localeId, extraData) {
  1001. if (typeof localeId !== 'string') {
  1002. extraData = localeId;
  1003. localeId = data[0 /* LocaleId */];
  1004. }
  1005. localeId = localeId.toLowerCase().replace(/_/g, '-');
  1006. LOCALE_DATA[localeId] = data;
  1007. if (extraData) {
  1008. LOCALE_DATA[localeId][18 /* ExtraData */] = extraData;
  1009. }
  1010. }
  1011. /**
  1012. * @fileoverview added by tsickle
  1013. * @suppress {checkTypes} checked by tsc
  1014. */
  1015. /**
  1016. * @license
  1017. * Copyright Google Inc. All Rights Reserved.
  1018. *
  1019. * Use of this source code is governed by an MIT-style license that can be
  1020. * found in the LICENSE file at https://angular.io/license
  1021. */
  1022. /** @enum {number} */
  1023. var NumberFormatStyle = {
  1024. Decimal: 0,
  1025. Percent: 1,
  1026. Currency: 2,
  1027. Scientific: 3,
  1028. };
  1029. NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal";
  1030. NumberFormatStyle[NumberFormatStyle.Percent] = "Percent";
  1031. NumberFormatStyle[NumberFormatStyle.Currency] = "Currency";
  1032. NumberFormatStyle[NumberFormatStyle.Scientific] = "Scientific";
  1033. /** @enum {number} */
  1034. var Plural = {
  1035. Zero: 0,
  1036. One: 1,
  1037. Two: 2,
  1038. Few: 3,
  1039. Many: 4,
  1040. Other: 5,
  1041. };
  1042. Plural[Plural.Zero] = "Zero";
  1043. Plural[Plural.One] = "One";
  1044. Plural[Plural.Two] = "Two";
  1045. Plural[Plural.Few] = "Few";
  1046. Plural[Plural.Many] = "Many";
  1047. Plural[Plural.Other] = "Other";
  1048. /** @enum {number} */
  1049. var FormStyle = {
  1050. Format: 0,
  1051. Standalone: 1,
  1052. };
  1053. FormStyle[FormStyle.Format] = "Format";
  1054. FormStyle[FormStyle.Standalone] = "Standalone";
  1055. /** @enum {number} */
  1056. var TranslationWidth = {
  1057. Narrow: 0,
  1058. Abbreviated: 1,
  1059. Wide: 2,
  1060. Short: 3,
  1061. };
  1062. TranslationWidth[TranslationWidth.Narrow] = "Narrow";
  1063. TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated";
  1064. TranslationWidth[TranslationWidth.Wide] = "Wide";
  1065. TranslationWidth[TranslationWidth.Short] = "Short";
  1066. /** @enum {number} */
  1067. var FormatWidth = {
  1068. Short: 0,
  1069. Medium: 1,
  1070. Long: 2,
  1071. Full: 3,
  1072. };
  1073. FormatWidth[FormatWidth.Short] = "Short";
  1074. FormatWidth[FormatWidth.Medium] = "Medium";
  1075. FormatWidth[FormatWidth.Long] = "Long";
  1076. FormatWidth[FormatWidth.Full] = "Full";
  1077. /** @enum {number} */
  1078. var NumberSymbol = {
  1079. Decimal: 0,
  1080. Group: 1,
  1081. List: 2,
  1082. PercentSign: 3,
  1083. PlusSign: 4,
  1084. MinusSign: 5,
  1085. Exponential: 6,
  1086. SuperscriptingExponent: 7,
  1087. PerMille: 8,
  1088. Infinity: 9,
  1089. NaN: 10,
  1090. TimeSeparator: 11,
  1091. CurrencyDecimal: 12,
  1092. CurrencyGroup: 13,
  1093. };
  1094. NumberSymbol[NumberSymbol.Decimal] = "Decimal";
  1095. NumberSymbol[NumberSymbol.Group] = "Group";
  1096. NumberSymbol[NumberSymbol.List] = "List";
  1097. NumberSymbol[NumberSymbol.PercentSign] = "PercentSign";
  1098. NumberSymbol[NumberSymbol.PlusSign] = "PlusSign";
  1099. NumberSymbol[NumberSymbol.MinusSign] = "MinusSign";
  1100. NumberSymbol[NumberSymbol.Exponential] = "Exponential";
  1101. NumberSymbol[NumberSymbol.SuperscriptingExponent] = "SuperscriptingExponent";
  1102. NumberSymbol[NumberSymbol.PerMille] = "PerMille";
  1103. NumberSymbol[NumberSymbol.Infinity] = "Infinity";
  1104. NumberSymbol[NumberSymbol.NaN] = "NaN";
  1105. NumberSymbol[NumberSymbol.TimeSeparator] = "TimeSeparator";
  1106. NumberSymbol[NumberSymbol.CurrencyDecimal] = "CurrencyDecimal";
  1107. NumberSymbol[NumberSymbol.CurrencyGroup] = "CurrencyGroup";
  1108. /** @enum {number} */
  1109. var WeekDay = {
  1110. Sunday: 0,
  1111. Monday: 1,
  1112. Tuesday: 2,
  1113. Wednesday: 3,
  1114. Thursday: 4,
  1115. Friday: 5,
  1116. Saturday: 6,
  1117. };
  1118. WeekDay[WeekDay.Sunday] = "Sunday";
  1119. WeekDay[WeekDay.Monday] = "Monday";
  1120. WeekDay[WeekDay.Tuesday] = "Tuesday";
  1121. WeekDay[WeekDay.Wednesday] = "Wednesday";
  1122. WeekDay[WeekDay.Thursday] = "Thursday";
  1123. WeekDay[WeekDay.Friday] = "Friday";
  1124. WeekDay[WeekDay.Saturday] = "Saturday";
  1125. /**
  1126. * The locale id for the chosen locale (e.g `en-GB`).
  1127. *
  1128. * \@experimental i18n support is experimental.
  1129. * @param {?} locale
  1130. * @return {?}
  1131. */
  1132. function getLocaleId(locale) {
  1133. return findLocaleData(locale)[0 /* LocaleId */];
  1134. }
  1135. /**
  1136. * Periods of the day (e.g. `[AM, PM]` for en-US).
  1137. *
  1138. * \@experimental i18n support is experimental.
  1139. * @param {?} locale
  1140. * @param {?} formStyle
  1141. * @param {?} width
  1142. * @return {?}
  1143. */
  1144. function getLocaleDayPeriods(locale, formStyle, width) {
  1145. var /** @type {?} */ data = findLocaleData(locale);
  1146. var /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]);
  1147. var /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle);
  1148. return getLastDefinedValue(amPm, width);
  1149. }
  1150. /**
  1151. * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US).
  1152. *
  1153. * \@experimental i18n support is experimental.
  1154. * @param {?} locale
  1155. * @param {?} formStyle
  1156. * @param {?} width
  1157. * @return {?}
  1158. */
  1159. function getLocaleDayNames(locale, formStyle, width) {
  1160. var /** @type {?} */ data = findLocaleData(locale);
  1161. var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]);
  1162. var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle);
  1163. return getLastDefinedValue(days, width);
  1164. }
  1165. /**
  1166. * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US).
  1167. *
  1168. * \@experimental i18n support is experimental.
  1169. * @param {?} locale
  1170. * @param {?} formStyle
  1171. * @param {?} width
  1172. * @return {?}
  1173. */
  1174. function getLocaleMonthNames(locale, formStyle, width) {
  1175. var /** @type {?} */ data = findLocaleData(locale);
  1176. var /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]);
  1177. var /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle);
  1178. return getLastDefinedValue(months, width);
  1179. }
  1180. /**
  1181. * Eras for the Gregorian calendar (e.g. AD/BC).
  1182. *
  1183. * \@experimental i18n support is experimental.
  1184. * @param {?} locale
  1185. * @param {?} width
  1186. * @return {?}
  1187. */
  1188. function getLocaleEraNames(locale, width) {
  1189. var /** @type {?} */ data = findLocaleData(locale);
  1190. var /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]);
  1191. return getLastDefinedValue(erasData, width);
  1192. }
  1193. /**
  1194. * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...).
  1195. * For example in french the value would be 1 because the first day of the week is Monday.
  1196. *
  1197. * \@experimental i18n support is experimental.
  1198. * @param {?} locale
  1199. * @return {?}
  1200. */
  1201. function getLocaleFirstDayOfWeek(locale) {
  1202. var /** @type {?} */ data = findLocaleData(locale);
  1203. return data[8 /* FirstDayOfWeek */];
  1204. }
  1205. /**
  1206. * Range of days in the week that represent the week-end for this locale, based on english days
  1207. * (Sunday = 0, Monday = 1, ...).
  1208. * For example in english the value would be [6,0] for Saturday to Sunday.
  1209. *
  1210. * \@experimental i18n support is experimental.
  1211. * @param {?} locale
  1212. * @return {?}
  1213. */
  1214. function getLocaleWeekEndRange(locale) {
  1215. var /** @type {?} */ data = findLocaleData(locale);
  1216. return data[9 /* WeekendRange */];
  1217. }
  1218. /**
  1219. * Date format that depends on the locale.
  1220. *
  1221. * There are four basic date formats:
  1222. * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d).
  1223. *
  1224. * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like
  1225. * "Tuesday, September 14, 1999".
  1226. *
  1227. * - `long` should contain year, long-month, day.
  1228. *
  1229. * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999".
  1230. *
  1231. * - `medium` should contain year, abbreviated-month (MMM), day.
  1232. *
  1233. * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999".
  1234. * For languages that do not use abbreviated months, use the numeric month (MM/M). For example,
  1235. * `y/MM/dd`, corresponding to a date like "1999/09/14".
  1236. *
  1237. * - `short` should contain year, numeric-month (MM/M), and day.
  1238. *
  1239. * For example, `M/d/yy`, corresponding to a date like "9/14/99".
  1240. *
  1241. * \@experimental i18n support is experimental.
  1242. * @param {?} locale
  1243. * @param {?} width
  1244. * @return {?}
  1245. */
  1246. function getLocaleDateFormat(locale, width) {
  1247. var /** @type {?} */ data = findLocaleData(locale);
  1248. return getLastDefinedValue(data[10 /* DateFormat */], width);
  1249. }
  1250. /**
  1251. * Time format that depends on the locale.
  1252. *
  1253. * The standard formats include four basic time formats:
  1254. * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
  1255. * - `long` should contain hour, minute, second, and zone (z)
  1256. * - `medium` should contain hour, minute, second.
  1257. * - `short` should contain hour, minute.
  1258. *
  1259. * Note: The patterns depend on whether the main country using your language uses 12-hour time or
  1260. * not:
  1261. * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running
  1262. * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle
  1263. * running 0 through 11 (midnight plus 1 minute is 0:01).
  1264. * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0
  1265. * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running
  1266. * 1 through 24 (midnight plus 1 minute is 24:01).
  1267. *
  1268. * \@experimental i18n support is experimental.
  1269. * @param {?} locale
  1270. * @param {?} width
  1271. * @return {?}
  1272. */
  1273. function getLocaleTimeFormat(locale, width) {
  1274. var /** @type {?} */ data = findLocaleData(locale);
  1275. return getLastDefinedValue(data[11 /* TimeFormat */], width);
  1276. }
  1277. /**
  1278. * Date-time format that depends on the locale.
  1279. *
  1280. * The date-time pattern shows how to combine separate patterns for date (represented by {1})
  1281. * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
  1282. * What you want to pay attention to are:
  1283. * - possibly removing a space for languages that don't use it, such as many East Asian languages
  1284. * - possibly adding a comma, other punctuation, or a combining word
  1285. *
  1286. * For example:
  1287. * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses
  1288. * `{1}{0}`.
  1289. * - An English formatted date-time using the combining pattern `{1}, {0}` could be
  1290. * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time
  1291. * portion.
  1292. *
  1293. * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use
  1294. * is normally based on the date style. For example, if the date has a full month and weekday
  1295. * name, the full combining pattern will be used to combine that with a time. If the date has
  1296. * numeric month, the short version of the combining pattern will be used to combine that with a
  1297. * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short
  1298. * styles.
  1299. *
  1300. * \@experimental i18n support is experimental.
  1301. * @param {?} locale
  1302. * @param {?} width
  1303. * @return {?}
  1304. */
  1305. function getLocaleDateTimeFormat(locale, width) {
  1306. var /** @type {?} */ data = findLocaleData(locale);
  1307. var /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]);
  1308. return getLastDefinedValue(dateTimeFormatData, width);
  1309. }
  1310. /**
  1311. * Number symbol that can be used to replace placeholders in number formats.
  1312. * See {\@link NumberSymbol} for more information.
  1313. *
  1314. * \@experimental i18n support is experimental.
  1315. * @param {?} locale
  1316. * @param {?} symbol
  1317. * @return {?}
  1318. */
  1319. function getLocaleNumberSymbol(locale, symbol) {
  1320. var /** @type {?} */ data = findLocaleData(locale);
  1321. var /** @type {?} */ res = data[13 /* NumberSymbols */][symbol];
  1322. if (typeof res === 'undefined') {
  1323. if (symbol === NumberSymbol.CurrencyDecimal) {
  1324. return data[13 /* NumberSymbols */][NumberSymbol.Decimal];
  1325. }
  1326. else if (symbol === NumberSymbol.CurrencyGroup) {
  1327. return data[13 /* NumberSymbols */][NumberSymbol.Group];
  1328. }
  1329. }
  1330. return res;
  1331. }
  1332. /**
  1333. * Number format that depends on the locale.
  1334. *
  1335. * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
  1336. * when used to format the number 12345.678 could result in "12'345,67". That would happen if the
  1337. * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
  1338. *
  1339. * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders;
  1340. * they stand for the decimal separator, and so on, and are NOT real characters.
  1341. * You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in
  1342. * your language the decimal point is written with a comma. The symbols should be replaced by the
  1343. * local equivalents, using the Number Symbols for your language.
  1344. *
  1345. * Here are the special characters used in number patterns:
  1346. *
  1347. * | Symbol | Meaning |
  1348. * |--------|---------|
  1349. * | . | Replaced automatically by the character used for the decimal point. |
  1350. * | , | Replaced by the "grouping" (thousands) separator. |
  1351. * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
  1352. * | # | Replaced by a digit (or nothing if there aren't enough). |
  1353. * | ¤ | This will be replaced by a currency symbol, such as $ or USD. |
  1354. * | % | This marks a percent format. The % symbol may change position, but must be retained. |
  1355. * | E | This marks a scientific format. The E symbol may change position, but must be retained. |
  1356. * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
  1357. *
  1358. * You can find more information
  1359. * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns)
  1360. *
  1361. * \@experimental i18n support is experimental.
  1362. * @param {?} locale
  1363. * @param {?} type
  1364. * @return {?}
  1365. */
  1366. function getLocaleNumberFormat(locale, type) {
  1367. var /** @type {?} */ data = findLocaleData(locale);
  1368. return data[14 /* NumberFormats */][type];
  1369. }
  1370. /**
  1371. * The symbol used to represent the currency for the main country using this locale (e.g. $ for
  1372. * the locale en-US).
  1373. * The symbol will be `null` if the main country cannot be determined.
  1374. *
  1375. * \@experimental i18n support is experimental.
  1376. * @param {?} locale
  1377. * @return {?}
  1378. */
  1379. function getLocaleCurrencySymbol(locale) {
  1380. var /** @type {?} */ data = findLocaleData(locale);
  1381. return data[15 /* CurrencySymbol */] || null;
  1382. }
  1383. /**
  1384. * The name of the currency for the main country using this locale (e.g. USD for the locale
  1385. * en-US).
  1386. * The name will be `null` if the main country cannot be determined.
  1387. *
  1388. * \@experimental i18n support is experimental.
  1389. * @param {?} locale
  1390. * @return {?}
  1391. */
  1392. function getLocaleCurrencyName(locale) {
  1393. var /** @type {?} */ data = findLocaleData(locale);
  1394. return data[16 /* CurrencyName */] || null;
  1395. }
  1396. /**
  1397. * The locale plural function used by ICU expressions to determine the plural case to use.
  1398. * See {\@link NgPlural} for more information.
  1399. *
  1400. * \@experimental i18n support is experimental.
  1401. * @param {?} locale
  1402. * @return {?}
  1403. */
  1404. function getLocalePluralCase(locale) {
  1405. var /** @type {?} */ data = findLocaleData(locale);
  1406. return data[17 /* PluralCase */];
  1407. }
  1408. /**
  1409. * @param {?} data
  1410. * @return {?}
  1411. */
  1412. function checkFullData(data) {
  1413. if (!data[18 /* ExtraData */]) {
  1414. throw new Error("Missing extra locale data for the locale \"" + data[0 /* LocaleId */] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.");
  1415. }
  1416. }
  1417. /**
  1418. * Rules used to determine which day period to use (See `dayPeriods` below).
  1419. * The rules can either be an array or a single value. If it's an array, consider it as "from"
  1420. * and "to". If it's a single value then it means that the period is only valid at this exact
  1421. * value.
  1422. * There is always the same number of rules as the number of day periods, which means that the
  1423. * first rule is applied to the first day period and so on.
  1424. * You should fallback to AM/PM when there are no rules available.
  1425. *
  1426. * Note: this is only available if you load the full locale data.
  1427. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  1428. * data.
  1429. *
  1430. * \@experimental i18n support is experimental.
  1431. * @param {?} locale
  1432. * @return {?}
  1433. */
  1434. function getLocaleExtraDayPeriodRules(locale) {
  1435. var /** @type {?} */ data = findLocaleData(locale);
  1436. checkFullData(data);
  1437. var /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || [];
  1438. return rules.map(function (rule) {
  1439. if (typeof rule === 'string') {
  1440. return extractTime(rule);
  1441. }
  1442. return [extractTime(rule[0]), extractTime(rule[1])];
  1443. });
  1444. }
  1445. /**
  1446. * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning,
  1447. * noon, afternoon, midnight, ...).
  1448. * You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to
  1449. * use.
  1450. * You should fallback to AM/PM when there are no day periods available.
  1451. *
  1452. * Note: this is only available if you load the full locale data.
  1453. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  1454. * data.
  1455. *
  1456. * \@experimental i18n support is experimental.
  1457. * @param {?} locale
  1458. * @param {?} formStyle
  1459. * @param {?} width
  1460. * @return {?}
  1461. */
  1462. function getLocaleExtraDayPeriods(locale, formStyle, width) {
  1463. var /** @type {?} */ data = findLocaleData(locale);
  1464. checkFullData(data);
  1465. var /** @type {?} */ dayPeriodsData = /** @type {?} */ ([
  1466. data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */],
  1467. data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */]
  1468. ]);
  1469. var /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
  1470. return getLastDefinedValue(dayPeriods, width) || [];
  1471. }
  1472. /**
  1473. * Returns the first value that is defined in an array, going backwards.
  1474. *
  1475. * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
  1476. * add the first one to the locale data arrays, the other ones are only defined when different.
  1477. * We use this function to retrieve the first defined value.
  1478. *
  1479. * \@experimental i18n support is experimental.
  1480. * @template T
  1481. * @param {?} data
  1482. * @param {?} index
  1483. * @return {?}
  1484. */
  1485. function getLastDefinedValue(data, index) {
  1486. for (var /** @type {?} */ i = index; i > -1; i--) {
  1487. if (typeof data[i] !== 'undefined') {
  1488. return data[i];
  1489. }
  1490. }
  1491. throw new Error('Locale data API: locale data undefined');
  1492. }
  1493. /**
  1494. * Extract the hours and minutes from a string like "15:45"
  1495. * @param {?} time
  1496. * @return {?}
  1497. */
  1498. function extractTime(time) {
  1499. var _a = time.split(':'), h = _a[0], m = _a[1];
  1500. return { hours: +h, minutes: +m };
  1501. }
  1502. /**
  1503. * Finds the locale data for a locale id
  1504. *
  1505. * \@experimental i18n support is experimental.
  1506. * @param {?} locale
  1507. * @return {?}
  1508. */
  1509. function findLocaleData(locale) {
  1510. var /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
  1511. var /** @type {?} */ match = LOCALE_DATA[normalizedLocale];
  1512. if (match) {
  1513. return match;
  1514. }
  1515. // let's try to find a parent locale
  1516. var /** @type {?} */ parentLocale = normalizedLocale.split('-')[0];
  1517. match = LOCALE_DATA[parentLocale];
  1518. if (match) {
  1519. return match;
  1520. }
  1521. if (parentLocale === 'en') {
  1522. return localeEn;
  1523. }
  1524. throw new Error("Missing locale data for the locale \"" + locale + "\".");
  1525. }
  1526. /**
  1527. * Return the currency symbol for a given currency code, or the code if no symbol available
  1528. * (e.g.: format narrow = $, format wide = US$, code = USD)
  1529. *
  1530. * \@experimental i18n support is experimental.
  1531. * @param {?} code
  1532. * @param {?} format
  1533. * @return {?}
  1534. */
  1535. function getCurrencySymbol(code, format) {
  1536. var /** @type {?} */ currency = CURRENCIES[code] || [];
  1537. var /** @type {?} */ symbolNarrow = currency[1];
  1538. if (format === 'narrow' && typeof symbolNarrow === 'string') {
  1539. return symbolNarrow;
  1540. }
  1541. return currency[0] || code;
  1542. }
  1543. /**
  1544. * @fileoverview added by tsickle
  1545. * @suppress {checkTypes} checked by tsc
  1546. */
  1547. /**
  1548. * @license
  1549. * Copyright Google Inc. All Rights Reserved.
  1550. *
  1551. * Use of this source code is governed by an MIT-style license that can be
  1552. * found in the LICENSE file at https://angular.io/license
  1553. */
  1554. /**
  1555. * @deprecated from v5
  1556. */
  1557. var DEPRECATED_PLURAL_FN = new _angular_core.InjectionToken('UseV4Plurals');
  1558. /**
  1559. * \@experimental
  1560. * @abstract
  1561. */
  1562. var NgLocalization = /** @class */ (function () {
  1563. function NgLocalization() {
  1564. }
  1565. return NgLocalization;
  1566. }());
  1567. /**
  1568. * Returns the plural category for a given value.
  1569. * - "=value" when the case exists,
  1570. * - the plural category otherwise
  1571. * @param {?} value
  1572. * @param {?} cases
  1573. * @param {?} ngLocalization
  1574. * @param {?=} locale
  1575. * @return {?}
  1576. */
  1577. function getPluralCategory(value, cases, ngLocalization, locale) {
  1578. var /** @type {?} */ key = "=" + value;
  1579. if (cases.indexOf(key) > -1) {
  1580. return key;
  1581. }
  1582. key = ngLocalization.getPluralCategory(value, locale);
  1583. if (cases.indexOf(key) > -1) {
  1584. return key;
  1585. }
  1586. if (cases.indexOf('other') > -1) {
  1587. return 'other';
  1588. }
  1589. throw new Error("No plural message found for value \"" + value + "\"");
  1590. }
  1591. /**
  1592. * Returns the plural case based on the locale
  1593. *
  1594. * \@experimental
  1595. */
  1596. var NgLocaleLocalization = /** @class */ (function (_super) {
  1597. __extends(NgLocaleLocalization, _super);
  1598. function NgLocaleLocalization(locale, /** @deprecated from v5 */
  1599. deprecatedPluralFn) {
  1600. var _this = _super.call(this) || this;
  1601. _this.locale = locale;
  1602. _this.deprecatedPluralFn = deprecatedPluralFn;
  1603. return _this;
  1604. }
  1605. /**
  1606. * @param {?} value
  1607. * @param {?=} locale
  1608. * @return {?}
  1609. */
  1610. NgLocaleLocalization.prototype.getPluralCategory = /**
  1611. * @param {?} value
  1612. * @param {?=} locale
  1613. * @return {?}
  1614. */
  1615. function (value, locale) {
  1616. var /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
  1617. getLocalePluralCase(locale || this.locale)(value);
  1618. switch (plural) {
  1619. case Plural.Zero:
  1620. return 'zero';
  1621. case Plural.One:
  1622. return 'one';
  1623. case Plural.Two:
  1624. return 'two';
  1625. case Plural.Few:
  1626. return 'few';
  1627. case Plural.Many:
  1628. return 'many';
  1629. default:
  1630. return 'other';
  1631. }
  1632. };
  1633. NgLocaleLocalization.decorators = [
  1634. { type: _angular_core.Injectable },
  1635. ];
  1636. /** @nocollapse */
  1637. NgLocaleLocalization.ctorParameters = function () { return [
  1638. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  1639. { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [DEPRECATED_PLURAL_FN,] },] },
  1640. ]; };
  1641. return NgLocaleLocalization;
  1642. }(NgLocalization));
  1643. /**
  1644. * Returns the plural case based on the locale
  1645. *
  1646. * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts
  1647. * \@experimental
  1648. * @param {?} locale
  1649. * @param {?} nLike
  1650. * @return {?}
  1651. */
  1652. function getPluralCase(locale, nLike) {
  1653. // TODO(vicb): lazy compute
  1654. if (typeof nLike === 'string') {
  1655. nLike = parseInt(/** @type {?} */ (nLike), 10);
  1656. }
  1657. var /** @type {?} */ n = /** @type {?} */ (nLike);
  1658. var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
  1659. var /** @type {?} */ i = Math.floor(Math.abs(n));
  1660. var /** @type {?} */ v = nDecimal.length;
  1661. var /** @type {?} */ f = parseInt(nDecimal, 10);
  1662. var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
  1663. var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
  1664. switch (lang) {
  1665. case 'af':
  1666. case 'asa':
  1667. case 'az':
  1668. case 'bem':
  1669. case 'bez':
  1670. case 'bg':
  1671. case 'brx':
  1672. case 'ce':
  1673. case 'cgg':
  1674. case 'chr':
  1675. case 'ckb':
  1676. case 'ee':
  1677. case 'el':
  1678. case 'eo':
  1679. case 'es':
  1680. case 'eu':
  1681. case 'fo':
  1682. case 'fur':
  1683. case 'gsw':
  1684. case 'ha':
  1685. case 'haw':
  1686. case 'hu':
  1687. case 'jgo':
  1688. case 'jmc':
  1689. case 'ka':
  1690. case 'kk':
  1691. case 'kkj':
  1692. case 'kl':
  1693. case 'ks':
  1694. case 'ksb':
  1695. case 'ky':
  1696. case 'lb':
  1697. case 'lg':
  1698. case 'mas':
  1699. case 'mgo':
  1700. case 'ml':
  1701. case 'mn':
  1702. case 'nb':
  1703. case 'nd':
  1704. case 'ne':
  1705. case 'nn':
  1706. case 'nnh':
  1707. case 'nyn':
  1708. case 'om':
  1709. case 'or':
  1710. case 'os':
  1711. case 'ps':
  1712. case 'rm':
  1713. case 'rof':
  1714. case 'rwk':
  1715. case 'saq':
  1716. case 'seh':
  1717. case 'sn':
  1718. case 'so':
  1719. case 'sq':
  1720. case 'ta':
  1721. case 'te':
  1722. case 'teo':
  1723. case 'tk':
  1724. case 'tr':
  1725. case 'ug':
  1726. case 'uz':
  1727. case 'vo':
  1728. case 'vun':
  1729. case 'wae':
  1730. case 'xog':
  1731. if (n === 1)
  1732. return Plural.One;
  1733. return Plural.Other;
  1734. case 'ak':
  1735. case 'ln':
  1736. case 'mg':
  1737. case 'pa':
  1738. case 'ti':
  1739. if (n === Math.floor(n) && n >= 0 && n <= 1)
  1740. return Plural.One;
  1741. return Plural.Other;
  1742. case 'am':
  1743. case 'as':
  1744. case 'bn':
  1745. case 'fa':
  1746. case 'gu':
  1747. case 'hi':
  1748. case 'kn':
  1749. case 'mr':
  1750. case 'zu':
  1751. if (i === 0 || n === 1)
  1752. return Plural.One;
  1753. return Plural.Other;
  1754. case 'ar':
  1755. if (n === 0)
  1756. return Plural.Zero;
  1757. if (n === 1)
  1758. return Plural.One;
  1759. if (n === 2)
  1760. return Plural.Two;
  1761. if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
  1762. return Plural.Few;
  1763. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
  1764. return Plural.Many;
  1765. return Plural.Other;
  1766. case 'ast':
  1767. case 'ca':
  1768. case 'de':
  1769. case 'en':
  1770. case 'et':
  1771. case 'fi':
  1772. case 'fy':
  1773. case 'gl':
  1774. case 'it':
  1775. case 'nl':
  1776. case 'sv':
  1777. case 'sw':
  1778. case 'ur':
  1779. case 'yi':
  1780. if (i === 1 && v === 0)
  1781. return Plural.One;
  1782. return Plural.Other;
  1783. case 'be':
  1784. if (n % 10 === 1 && !(n % 100 === 11))
  1785. return Plural.One;
  1786. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
  1787. !(n % 100 >= 12 && n % 100 <= 14))
  1788. return Plural.Few;
  1789. if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
  1790. n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
  1791. return Plural.Many;
  1792. return Plural.Other;
  1793. case 'br':
  1794. if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
  1795. return Plural.One;
  1796. if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
  1797. return Plural.Two;
  1798. if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
  1799. !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
  1800. n % 100 >= 90 && n % 100 <= 99))
  1801. return Plural.Few;
  1802. if (!(n === 0) && n % 1e6 === 0)
  1803. return Plural.Many;
  1804. return Plural.Other;
  1805. case 'bs':
  1806. case 'hr':
  1807. case 'sr':
  1808. if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
  1809. return Plural.One;
  1810. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  1811. !(i % 100 >= 12 && i % 100 <= 14) ||
  1812. f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
  1813. !(f % 100 >= 12 && f % 100 <= 14))
  1814. return Plural.Few;
  1815. return Plural.Other;
  1816. case 'cs':
  1817. case 'sk':
  1818. if (i === 1 && v === 0)
  1819. return Plural.One;
  1820. if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
  1821. return Plural.Few;
  1822. if (!(v === 0))
  1823. return Plural.Many;
  1824. return Plural.Other;
  1825. case 'cy':
  1826. if (n === 0)
  1827. return Plural.Zero;
  1828. if (n === 1)
  1829. return Plural.One;
  1830. if (n === 2)
  1831. return Plural.Two;
  1832. if (n === 3)
  1833. return Plural.Few;
  1834. if (n === 6)
  1835. return Plural.Many;
  1836. return Plural.Other;
  1837. case 'da':
  1838. if (n === 1 || !(t === 0) && (i === 0 || i === 1))
  1839. return Plural.One;
  1840. return Plural.Other;
  1841. case 'dsb':
  1842. case 'hsb':
  1843. if (v === 0 && i % 100 === 1 || f % 100 === 1)
  1844. return Plural.One;
  1845. if (v === 0 && i % 100 === 2 || f % 100 === 2)
  1846. return Plural.Two;
  1847. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
  1848. f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
  1849. return Plural.Few;
  1850. return Plural.Other;
  1851. case 'ff':
  1852. case 'fr':
  1853. case 'hy':
  1854. case 'kab':
  1855. if (i === 0 || i === 1)
  1856. return Plural.One;
  1857. return Plural.Other;
  1858. case 'fil':
  1859. if (v === 0 && (i === 1 || i === 2 || i === 3) ||
  1860. v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
  1861. !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
  1862. return Plural.One;
  1863. return Plural.Other;
  1864. case 'ga':
  1865. if (n === 1)
  1866. return Plural.One;
  1867. if (n === 2)
  1868. return Plural.Two;
  1869. if (n === Math.floor(n) && n >= 3 && n <= 6)
  1870. return Plural.Few;
  1871. if (n === Math.floor(n) && n >= 7 && n <= 10)
  1872. return Plural.Many;
  1873. return Plural.Other;
  1874. case 'gd':
  1875. if (n === 1 || n === 11)
  1876. return Plural.One;
  1877. if (n === 2 || n === 12)
  1878. return Plural.Two;
  1879. if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
  1880. return Plural.Few;
  1881. return Plural.Other;
  1882. case 'gv':
  1883. if (v === 0 && i % 10 === 1)
  1884. return Plural.One;
  1885. if (v === 0 && i % 10 === 2)
  1886. return Plural.Two;
  1887. if (v === 0 &&
  1888. (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
  1889. return Plural.Few;
  1890. if (!(v === 0))
  1891. return Plural.Many;
  1892. return Plural.Other;
  1893. case 'he':
  1894. if (i === 1 && v === 0)
  1895. return Plural.One;
  1896. if (i === 2 && v === 0)
  1897. return Plural.Two;
  1898. if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
  1899. return Plural.Many;
  1900. return Plural.Other;
  1901. case 'is':
  1902. if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
  1903. return Plural.One;
  1904. return Plural.Other;
  1905. case 'ksh':
  1906. if (n === 0)
  1907. return Plural.Zero;
  1908. if (n === 1)
  1909. return Plural.One;
  1910. return Plural.Other;
  1911. case 'kw':
  1912. case 'naq':
  1913. case 'se':
  1914. case 'smn':
  1915. if (n === 1)
  1916. return Plural.One;
  1917. if (n === 2)
  1918. return Plural.Two;
  1919. return Plural.Other;
  1920. case 'lag':
  1921. if (n === 0)
  1922. return Plural.Zero;
  1923. if ((i === 0 || i === 1) && !(n === 0))
  1924. return Plural.One;
  1925. return Plural.Other;
  1926. case 'lt':
  1927. if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
  1928. return Plural.One;
  1929. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
  1930. !(n % 100 >= 11 && n % 100 <= 19))
  1931. return Plural.Few;
  1932. if (!(f === 0))
  1933. return Plural.Many;
  1934. return Plural.Other;
  1935. case 'lv':
  1936. case 'prg':
  1937. if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
  1938. v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
  1939. return Plural.Zero;
  1940. if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
  1941. !(v === 2) && f % 10 === 1)
  1942. return Plural.One;
  1943. return Plural.Other;
  1944. case 'mk':
  1945. if (v === 0 && i % 10 === 1 || f % 10 === 1)
  1946. return Plural.One;
  1947. return Plural.Other;
  1948. case 'mt':
  1949. if (n === 1)
  1950. return Plural.One;
  1951. if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
  1952. return Plural.Few;
  1953. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
  1954. return Plural.Many;
  1955. return Plural.Other;
  1956. case 'pl':
  1957. if (i === 1 && v === 0)
  1958. return Plural.One;
  1959. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  1960. !(i % 100 >= 12 && i % 100 <= 14))
  1961. return Plural.Few;
  1962. if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
  1963. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  1964. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
  1965. return Plural.Many;
  1966. return Plural.Other;
  1967. case 'pt':
  1968. if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
  1969. return Plural.One;
  1970. return Plural.Other;
  1971. case 'ro':
  1972. if (i === 1 && v === 0)
  1973. return Plural.One;
  1974. if (!(v === 0) || n === 0 ||
  1975. !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
  1976. return Plural.Few;
  1977. return Plural.Other;
  1978. case 'ru':
  1979. case 'uk':
  1980. if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
  1981. return Plural.One;
  1982. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  1983. !(i % 100 >= 12 && i % 100 <= 14))
  1984. return Plural.Few;
  1985. if (v === 0 && i % 10 === 0 ||
  1986. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  1987. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
  1988. return Plural.Many;
  1989. return Plural.Other;
  1990. case 'shi':
  1991. if (i === 0 || n === 1)
  1992. return Plural.One;
  1993. if (n === Math.floor(n) && n >= 2 && n <= 10)
  1994. return Plural.Few;
  1995. return Plural.Other;
  1996. case 'si':
  1997. if (n === 0 || n === 1 || i === 0 && f === 1)
  1998. return Plural.One;
  1999. return Plural.Other;
  2000. case 'sl':
  2001. if (v === 0 && i % 100 === 1)
  2002. return Plural.One;
  2003. if (v === 0 && i % 100 === 2)
  2004. return Plural.Two;
  2005. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
  2006. return Plural.Few;
  2007. return Plural.Other;
  2008. case 'tzm':
  2009. if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
  2010. return Plural.One;
  2011. return Plural.Other;
  2012. // When there is no specification, the default is always "other"
  2013. // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
  2014. // > other (required—general plural form — also used if the language only has a single form)
  2015. default:
  2016. return Plural.Other;
  2017. }
  2018. }
  2019. /**
  2020. * @fileoverview added by tsickle
  2021. * @suppress {checkTypes} checked by tsc
  2022. */
  2023. /**
  2024. * @license
  2025. * Copyright Google Inc. All Rights Reserved.
  2026. *
  2027. * Use of this source code is governed by an MIT-style license that can be
  2028. * found in the LICENSE file at https://angular.io/license
  2029. */
  2030. /**
  2031. * @param {?} cookieStr
  2032. * @param {?} name
  2033. * @return {?}
  2034. */
  2035. function parseCookieValue(cookieStr, name) {
  2036. name = encodeURIComponent(name);
  2037. for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) {
  2038. var cookie = _a[_i];
  2039. var /** @type {?} */ eqIndex = cookie.indexOf('=');
  2040. var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1];
  2041. if (cookieName.trim() === name) {
  2042. return decodeURIComponent(cookieValue);
  2043. }
  2044. }
  2045. return null;
  2046. }
  2047. /**
  2048. * @fileoverview added by tsickle
  2049. * @suppress {checkTypes} checked by tsc
  2050. */
  2051. /**
  2052. * @license
  2053. * Copyright Google Inc. All Rights Reserved.
  2054. *
  2055. * Use of this source code is governed by an MIT-style license that can be
  2056. * found in the LICENSE file at https://angular.io/license
  2057. */
  2058. /**
  2059. * \@ngModule CommonModule
  2060. *
  2061. * \@whatItDoes Adds and removes CSS classes on an HTML element.
  2062. *
  2063. * \@howToUse
  2064. * ```
  2065. * <some-element [ngClass]="'first second'">...</some-element>
  2066. *
  2067. * <some-element [ngClass]="['first', 'second']">...</some-element>
  2068. *
  2069. * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
  2070. *
  2071. * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
  2072. *
  2073. * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
  2074. * ```
  2075. *
  2076. * \@description
  2077. *
  2078. * The CSS classes are updated as follows, depending on the type of the expression evaluation:
  2079. * - `string` - the CSS classes listed in the string (space delimited) are added,
  2080. * - `Array` - the CSS classes declared as Array elements are added,
  2081. * - `Object` - keys are CSS classes that get added when the expression given in the value
  2082. * evaluates to a truthy value, otherwise they are removed.
  2083. *
  2084. * \@stable
  2085. */
  2086. var NgClass = /** @class */ (function () {
  2087. function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
  2088. this._iterableDiffers = _iterableDiffers;
  2089. this._keyValueDiffers = _keyValueDiffers;
  2090. this._ngEl = _ngEl;
  2091. this._renderer = _renderer;
  2092. this._initialClasses = [];
  2093. }
  2094. Object.defineProperty(NgClass.prototype, "klass", {
  2095. set: /**
  2096. * @param {?} v
  2097. * @return {?}
  2098. */
  2099. function (v) {
  2100. this._removeClasses(this._initialClasses);
  2101. this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
  2102. this._applyClasses(this._initialClasses);
  2103. this._applyClasses(this._rawClass);
  2104. },
  2105. enumerable: true,
  2106. configurable: true
  2107. });
  2108. Object.defineProperty(NgClass.prototype, "ngClass", {
  2109. set: /**
  2110. * @param {?} v
  2111. * @return {?}
  2112. */
  2113. function (v) {
  2114. this._removeClasses(this._rawClass);
  2115. this._applyClasses(this._initialClasses);
  2116. this._iterableDiffer = null;
  2117. this._keyValueDiffer = null;
  2118. this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
  2119. if (this._rawClass) {
  2120. if (_angular_core.ɵisListLikeIterable(this._rawClass)) {
  2121. this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
  2122. }
  2123. else {
  2124. this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
  2125. }
  2126. }
  2127. },
  2128. enumerable: true,
  2129. configurable: true
  2130. });
  2131. /**
  2132. * @return {?}
  2133. */
  2134. NgClass.prototype.ngDoCheck = /**
  2135. * @return {?}
  2136. */
  2137. function () {
  2138. if (this._iterableDiffer) {
  2139. var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass));
  2140. if (iterableChanges) {
  2141. this._applyIterableChanges(iterableChanges);
  2142. }
  2143. }
  2144. else if (this._keyValueDiffer) {
  2145. var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass));
  2146. if (keyValueChanges) {
  2147. this._applyKeyValueChanges(keyValueChanges);
  2148. }
  2149. }
  2150. };
  2151. /**
  2152. * @param {?} changes
  2153. * @return {?}
  2154. */
  2155. NgClass.prototype._applyKeyValueChanges = /**
  2156. * @param {?} changes
  2157. * @return {?}
  2158. */
  2159. function (changes) {
  2160. var _this = this;
  2161. changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2162. changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2163. changes.forEachRemovedItem(function (record) {
  2164. if (record.previousValue) {
  2165. _this._toggleClass(record.key, false);
  2166. }
  2167. });
  2168. };
  2169. /**
  2170. * @param {?} changes
  2171. * @return {?}
  2172. */
  2173. NgClass.prototype._applyIterableChanges = /**
  2174. * @param {?} changes
  2175. * @return {?}
  2176. */
  2177. function (changes) {
  2178. var _this = this;
  2179. changes.forEachAddedItem(function (record) {
  2180. if (typeof record.item === 'string') {
  2181. _this._toggleClass(record.item, true);
  2182. }
  2183. else {
  2184. throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + _angular_core.ɵstringify(record.item));
  2185. }
  2186. });
  2187. changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
  2188. };
  2189. /**
  2190. * Applies a collection of CSS classes to the DOM element.
  2191. *
  2192. * For argument of type Set and Array CSS class names contained in those collections are always
  2193. * added.
  2194. * For argument of type Map CSS class name in the map's key is toggled based on the value (added
  2195. * for truthy and removed for falsy).
  2196. * @param {?} rawClassVal
  2197. * @return {?}
  2198. */
  2199. NgClass.prototype._applyClasses = /**
  2200. * Applies a collection of CSS classes to the DOM element.
  2201. *
  2202. * For argument of type Set and Array CSS class names contained in those collections are always
  2203. * added.
  2204. * For argument of type Map CSS class name in the map's key is toggled based on the value (added
  2205. * for truthy and removed for falsy).
  2206. * @param {?} rawClassVal
  2207. * @return {?}
  2208. */
  2209. function (rawClassVal) {
  2210. var _this = this;
  2211. if (rawClassVal) {
  2212. if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
  2213. (/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, true); });
  2214. }
  2215. else {
  2216. Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, !!rawClassVal[klass]); });
  2217. }
  2218. }
  2219. };
  2220. /**
  2221. * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
  2222. * purposes.
  2223. * @param {?} rawClassVal
  2224. * @return {?}
  2225. */
  2226. NgClass.prototype._removeClasses = /**
  2227. * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
  2228. * purposes.
  2229. * @param {?} rawClassVal
  2230. * @return {?}
  2231. */
  2232. function (rawClassVal) {
  2233. var _this = this;
  2234. if (rawClassVal) {
  2235. if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
  2236. (/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, false); });
  2237. }
  2238. else {
  2239. Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, false); });
  2240. }
  2241. }
  2242. };
  2243. /**
  2244. * @param {?} klass
  2245. * @param {?} enabled
  2246. * @return {?}
  2247. */
  2248. NgClass.prototype._toggleClass = /**
  2249. * @param {?} klass
  2250. * @param {?} enabled
  2251. * @return {?}
  2252. */
  2253. function (klass, enabled) {
  2254. var _this = this;
  2255. klass = klass.trim();
  2256. if (klass) {
  2257. klass.split(/\s+/g).forEach(function (klass) {
  2258. if (enabled) {
  2259. _this._renderer.addClass(_this._ngEl.nativeElement, klass);
  2260. }
  2261. else {
  2262. _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
  2263. }
  2264. });
  2265. }
  2266. };
  2267. NgClass.decorators = [
  2268. { type: _angular_core.Directive, args: [{ selector: '[ngClass]' },] },
  2269. ];
  2270. /** @nocollapse */
  2271. NgClass.ctorParameters = function () { return [
  2272. { type: _angular_core.IterableDiffers, },
  2273. { type: _angular_core.KeyValueDiffers, },
  2274. { type: _angular_core.ElementRef, },
  2275. { type: _angular_core.Renderer2, },
  2276. ]; };
  2277. NgClass.propDecorators = {
  2278. "klass": [{ type: _angular_core.Input, args: ['class',] },],
  2279. "ngClass": [{ type: _angular_core.Input },],
  2280. };
  2281. return NgClass;
  2282. }());
  2283. /**
  2284. * @fileoverview added by tsickle
  2285. * @suppress {checkTypes} checked by tsc
  2286. */
  2287. /**
  2288. * @license
  2289. * Copyright Google Inc. All Rights Reserved.
  2290. *
  2291. * Use of this source code is governed by an MIT-style license that can be
  2292. * found in the LICENSE file at https://angular.io/license
  2293. */
  2294. /**
  2295. * Instantiates a single {\@link Component} type and inserts its Host View into current View.
  2296. * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
  2297. *
  2298. * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
  2299. * any existing component will get destroyed.
  2300. *
  2301. * ### Fine tune control
  2302. *
  2303. * You can control the component creation process by using the following optional attributes:
  2304. *
  2305. * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for
  2306. * the Component. Defaults to the injector of the current view container.
  2307. *
  2308. * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
  2309. * section of the component, if exists.
  2310. *
  2311. * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
  2312. * module, then load a component from that module.
  2313. *
  2314. * ### Syntax
  2315. *
  2316. * Simple
  2317. * ```
  2318. * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
  2319. * ```
  2320. *
  2321. * Customized injector/content
  2322. * ```
  2323. * <ng-container *ngComponentOutlet="componentTypeExpression;
  2324. * injector: injectorExpression;
  2325. * content: contentNodesExpression;">
  2326. * </ng-container>
  2327. * ```
  2328. *
  2329. * Customized ngModuleFactory
  2330. * ```
  2331. * <ng-container *ngComponentOutlet="componentTypeExpression;
  2332. * ngModuleFactory: moduleFactory;">
  2333. * </ng-container>
  2334. * ```
  2335. * ## Example
  2336. *
  2337. * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
  2338. *
  2339. * A more complete example with additional options:
  2340. *
  2341. * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
  2342. * A more complete example with ngModuleFactory:
  2343. *
  2344. * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
  2345. *
  2346. * \@experimental
  2347. */
  2348. var NgComponentOutlet = /** @class */ (function () {
  2349. function NgComponentOutlet(_viewContainerRef) {
  2350. this._viewContainerRef = _viewContainerRef;
  2351. this._componentRef = null;
  2352. this._moduleRef = null;
  2353. }
  2354. /**
  2355. * @param {?} changes
  2356. * @return {?}
  2357. */
  2358. NgComponentOutlet.prototype.ngOnChanges = /**
  2359. * @param {?} changes
  2360. * @return {?}
  2361. */
  2362. function (changes) {
  2363. this._viewContainerRef.clear();
  2364. this._componentRef = null;
  2365. if (this.ngComponentOutlet) {
  2366. var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
  2367. if (changes['ngComponentOutletNgModuleFactory']) {
  2368. if (this._moduleRef)
  2369. this._moduleRef.destroy();
  2370. if (this.ngComponentOutletNgModuleFactory) {
  2371. var /** @type {?} */ parentModule = elInjector.get(_angular_core.NgModuleRef);
  2372. this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
  2373. }
  2374. else {
  2375. this._moduleRef = null;
  2376. }
  2377. }
  2378. var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
  2379. elInjector.get(_angular_core.ComponentFactoryResolver);
  2380. var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
  2381. this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
  2382. }
  2383. };
  2384. /**
  2385. * @return {?}
  2386. */
  2387. NgComponentOutlet.prototype.ngOnDestroy = /**
  2388. * @return {?}
  2389. */
  2390. function () {
  2391. if (this._moduleRef)
  2392. this._moduleRef.destroy();
  2393. };
  2394. NgComponentOutlet.decorators = [
  2395. { type: _angular_core.Directive, args: [{ selector: '[ngComponentOutlet]' },] },
  2396. ];
  2397. /** @nocollapse */
  2398. NgComponentOutlet.ctorParameters = function () { return [
  2399. { type: _angular_core.ViewContainerRef, },
  2400. ]; };
  2401. NgComponentOutlet.propDecorators = {
  2402. "ngComponentOutlet": [{ type: _angular_core.Input },],
  2403. "ngComponentOutletInjector": [{ type: _angular_core.Input },],
  2404. "ngComponentOutletContent": [{ type: _angular_core.Input },],
  2405. "ngComponentOutletNgModuleFactory": [{ type: _angular_core.Input },],
  2406. };
  2407. return NgComponentOutlet;
  2408. }());
  2409. /**
  2410. * @fileoverview added by tsickle
  2411. * @suppress {checkTypes} checked by tsc
  2412. */
  2413. /**
  2414. * @license
  2415. * Copyright Google Inc. All Rights Reserved.
  2416. *
  2417. * Use of this source code is governed by an MIT-style license that can be
  2418. * found in the LICENSE file at https://angular.io/license
  2419. */
  2420. /**
  2421. * \@stable
  2422. * @template T
  2423. */
  2424. var NgForOfContext = /** @class */ (function () {
  2425. function NgForOfContext($implicit, ngForOf, index, count) {
  2426. this.$implicit = $implicit;
  2427. this.ngForOf = ngForOf;
  2428. this.index = index;
  2429. this.count = count;
  2430. }
  2431. Object.defineProperty(NgForOfContext.prototype, "first", {
  2432. get: /**
  2433. * @return {?}
  2434. */
  2435. function () { return this.index === 0; },
  2436. enumerable: true,
  2437. configurable: true
  2438. });
  2439. Object.defineProperty(NgForOfContext.prototype, "last", {
  2440. get: /**
  2441. * @return {?}
  2442. */
  2443. function () { return this.index === this.count - 1; },
  2444. enumerable: true,
  2445. configurable: true
  2446. });
  2447. Object.defineProperty(NgForOfContext.prototype, "even", {
  2448. get: /**
  2449. * @return {?}
  2450. */
  2451. function () { return this.index % 2 === 0; },
  2452. enumerable: true,
  2453. configurable: true
  2454. });
  2455. Object.defineProperty(NgForOfContext.prototype, "odd", {
  2456. get: /**
  2457. * @return {?}
  2458. */
  2459. function () { return !this.even; },
  2460. enumerable: true,
  2461. configurable: true
  2462. });
  2463. return NgForOfContext;
  2464. }());
  2465. /**
  2466. * The `NgForOf` directive instantiates a template once per item from an iterable. The context
  2467. * for each instantiated template inherits from the outer context with the given loop variable
  2468. * set to the current item from the iterable.
  2469. *
  2470. * ### Local Variables
  2471. *
  2472. * `NgForOf` provides several exported values that can be aliased to local variables:
  2473. *
  2474. * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
  2475. * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
  2476. * more complex then a property access, for example when using the async pipe (`userStreams |
  2477. * async`).
  2478. * - `index: number`: The index of the current item in the iterable.
  2479. * - `first: boolean`: True when the item is the first item in the iterable.
  2480. * - `last: boolean`: True when the item is the last item in the iterable.
  2481. * - `even: boolean`: True when the item has an even index in the iterable.
  2482. * - `odd: boolean`: True when the item has an odd index in the iterable.
  2483. *
  2484. * ```
  2485. * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
  2486. * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
  2487. * </li>
  2488. * ```
  2489. *
  2490. * ### Change Propagation
  2491. *
  2492. * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
  2493. *
  2494. * * When an item is added, a new instance of the template is added to the DOM.
  2495. * * When an item is removed, its template instance is removed from the DOM.
  2496. * * When items are reordered, their respective templates are reordered in the DOM.
  2497. * * Otherwise, the DOM element for that item will remain the same.
  2498. *
  2499. * Angular uses object identity to track insertions and deletions within the iterator and reproduce
  2500. * those changes in the DOM. This has important implications for animations and any stateful
  2501. * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
  2502. * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
  2503. * such as user input.
  2504. *
  2505. * It is possible for the identities of elements in the iterator to change while the data does not.
  2506. * This can happen, for example, if the iterator produced from an RPC to the server, and that
  2507. * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
  2508. * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
  2509. * elements were deleted and all new elements inserted). This is an expensive operation and should
  2510. * be avoided if possible.
  2511. *
  2512. * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
  2513. * `trackBy` takes a function which has two arguments: `index` and `item`.
  2514. * If `trackBy` is given, Angular tracks changes by the return value of the function.
  2515. *
  2516. * ### Syntax
  2517. *
  2518. * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
  2519. *
  2520. * With `<ng-template>` element:
  2521. *
  2522. * ```
  2523. * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  2524. * <li>...</li>
  2525. * </ng-template>
  2526. * ```
  2527. *
  2528. * ### Example
  2529. *
  2530. * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
  2531. * example.
  2532. *
  2533. * \@stable
  2534. * @template T
  2535. */
  2536. var NgForOf = /** @class */ (function () {
  2537. function NgForOf(_viewContainer, _template, _differs) {
  2538. this._viewContainer = _viewContainer;
  2539. this._template = _template;
  2540. this._differs = _differs;
  2541. this._differ = null;
  2542. }
  2543. Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
  2544. get: /**
  2545. * @return {?}
  2546. */
  2547. function () { return this._trackByFn; },
  2548. set: /**
  2549. * @param {?} fn
  2550. * @return {?}
  2551. */
  2552. function (fn) {
  2553. if (_angular_core.isDevMode() && fn != null && typeof fn !== 'function') {
  2554. // TODO(vicb): use a log service once there is a public one available
  2555. if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
  2556. console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
  2557. "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
  2558. }
  2559. }
  2560. this._trackByFn = fn;
  2561. },
  2562. enumerable: true,
  2563. configurable: true
  2564. });
  2565. Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
  2566. set: /**
  2567. * @param {?} value
  2568. * @return {?}
  2569. */
  2570. function (value) {
  2571. // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
  2572. // The current type is too restrictive; a template that just uses index, for example,
  2573. // should be acceptable.
  2574. if (value) {
  2575. this._template = value;
  2576. }
  2577. },
  2578. enumerable: true,
  2579. configurable: true
  2580. });
  2581. /**
  2582. * @param {?} changes
  2583. * @return {?}
  2584. */
  2585. NgForOf.prototype.ngOnChanges = /**
  2586. * @param {?} changes
  2587. * @return {?}
  2588. */
  2589. function (changes) {
  2590. if ('ngForOf' in changes) {
  2591. // React on ngForOf changes only once all inputs have been initialized
  2592. var /** @type {?} */ value = changes['ngForOf'].currentValue;
  2593. if (!this._differ && value) {
  2594. try {
  2595. this._differ = this._differs.find(value).create(this.ngForTrackBy);
  2596. }
  2597. catch (/** @type {?} */ e) {
  2598. throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
  2599. }
  2600. }
  2601. }
  2602. };
  2603. /**
  2604. * @return {?}
  2605. */
  2606. NgForOf.prototype.ngDoCheck = /**
  2607. * @return {?}
  2608. */
  2609. function () {
  2610. if (this._differ) {
  2611. var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
  2612. if (changes)
  2613. this._applyChanges(changes);
  2614. }
  2615. };
  2616. /**
  2617. * @param {?} changes
  2618. * @return {?}
  2619. */
  2620. NgForOf.prototype._applyChanges = /**
  2621. * @param {?} changes
  2622. * @return {?}
  2623. */
  2624. function (changes) {
  2625. var _this = this;
  2626. var /** @type {?} */ insertTuples = [];
  2627. changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
  2628. if (item.previousIndex == null) {
  2629. var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex);
  2630. var /** @type {?} */ tuple = new RecordViewTuple(item, view);
  2631. insertTuples.push(tuple);
  2632. }
  2633. else if (currentIndex == null) {
  2634. _this._viewContainer.remove(adjustedPreviousIndex);
  2635. }
  2636. else {
  2637. var /** @type {?} */ view = /** @type {?} */ ((_this._viewContainer.get(adjustedPreviousIndex)));
  2638. _this._viewContainer.move(view, currentIndex);
  2639. var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
  2640. insertTuples.push(tuple);
  2641. }
  2642. });
  2643. for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
  2644. this._perViewChange(insertTuples[i].view, insertTuples[i].record);
  2645. }
  2646. for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
  2647. var /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i));
  2648. viewRef.context.index = i;
  2649. viewRef.context.count = ilen;
  2650. }
  2651. changes.forEachIdentityChange(function (record) {
  2652. var /** @type {?} */ viewRef = /** @type {?} */ (_this._viewContainer.get(record.currentIndex));
  2653. viewRef.context.$implicit = record.item;
  2654. });
  2655. };
  2656. /**
  2657. * @param {?} view
  2658. * @param {?} record
  2659. * @return {?}
  2660. */
  2661. NgForOf.prototype._perViewChange = /**
  2662. * @param {?} view
  2663. * @param {?} record
  2664. * @return {?}
  2665. */
  2666. function (view, record) {
  2667. view.context.$implicit = record.item;
  2668. };
  2669. NgForOf.decorators = [
  2670. { type: _angular_core.Directive, args: [{ selector: '[ngFor][ngForOf]' },] },
  2671. ];
  2672. /** @nocollapse */
  2673. NgForOf.ctorParameters = function () { return [
  2674. { type: _angular_core.ViewContainerRef, },
  2675. { type: _angular_core.TemplateRef, },
  2676. { type: _angular_core.IterableDiffers, },
  2677. ]; };
  2678. NgForOf.propDecorators = {
  2679. "ngForOf": [{ type: _angular_core.Input },],
  2680. "ngForTrackBy": [{ type: _angular_core.Input },],
  2681. "ngForTemplate": [{ type: _angular_core.Input },],
  2682. };
  2683. return NgForOf;
  2684. }());
  2685. /**
  2686. * @template T
  2687. */
  2688. var RecordViewTuple = /** @class */ (function () {
  2689. function RecordViewTuple(record, view) {
  2690. this.record = record;
  2691. this.view = view;
  2692. }
  2693. return RecordViewTuple;
  2694. }());
  2695. /**
  2696. * @param {?} type
  2697. * @return {?}
  2698. */
  2699. function getTypeNameForDebugging(type) {
  2700. return type['name'] || typeof type;
  2701. }
  2702. /**
  2703. * @fileoverview added by tsickle
  2704. * @suppress {checkTypes} checked by tsc
  2705. */
  2706. /**
  2707. * @license
  2708. * Copyright Google Inc. All Rights Reserved.
  2709. *
  2710. * Use of this source code is governed by an MIT-style license that can be
  2711. * found in the LICENSE file at https://angular.io/license
  2712. */
  2713. /**
  2714. * Conditionally includes a template based on the value of an `expression`.
  2715. *
  2716. * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
  2717. * when expression is truthy or falsy respectively. Typically the:
  2718. * - `then` template is the inline template of `ngIf` unless bound to a different value.
  2719. * - `else` template is blank unless it is bound.
  2720. *
  2721. * ## Most common usage
  2722. *
  2723. * The most common usage of the `ngIf` directive is to conditionally show the inline template as
  2724. * seen in this example:
  2725. * {\@example common/ngIf/ts/module.ts region='NgIfSimple'}
  2726. *
  2727. * ## Showing an alternative template using `else`
  2728. *
  2729. * If it is necessary to display a template when the `expression` is falsy use the `else` template
  2730. * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
  2731. * The template can be defined anywhere in the component view but is typically placed right after
  2732. * `ngIf` for readability.
  2733. *
  2734. * {\@example common/ngIf/ts/module.ts region='NgIfElse'}
  2735. *
  2736. * ## Using non-inlined `then` template
  2737. *
  2738. * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
  2739. * a binding (just like `else`). Because `then` and `else` are bindings, the template references can
  2740. * change at runtime as shown in this example.
  2741. *
  2742. * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'}
  2743. *
  2744. * ## Storing conditional result in a variable
  2745. *
  2746. * A common pattern is that we need to show a set of properties from the same object. If the
  2747. * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
  2748. * dereferencing a `null` value. This is especially the case when waiting on async data such as
  2749. * when using the `async` pipe as shown in following example:
  2750. *
  2751. * ```
  2752. * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
  2753. * ```
  2754. *
  2755. * There are several inefficiencies in the above example:
  2756. * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
  2757. * example above.
  2758. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
  2759. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
  2760. * - We have to place the `async` pipe in parenthesis.
  2761. *
  2762. * A better way to do this is to use `ngIf` and store the result of the condition in a local
  2763. * variable as shown in the the example below:
  2764. *
  2765. * {\@example common/ngIf/ts/module.ts region='NgIfAs'}
  2766. *
  2767. * Notice that:
  2768. * - We use only one `async` pipe and hence only one subscription gets created.
  2769. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
  2770. * - The local `user` can then be bound repeatedly in a more efficient way.
  2771. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
  2772. * display the data if `userStream` returns a value.
  2773. * - We can display an alternative template while waiting for the data.
  2774. *
  2775. * ### Syntax
  2776. *
  2777. * Simple form:
  2778. * - `<div *ngIf="condition">...</div>`
  2779. * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
  2780. *
  2781. * Form with an else block:
  2782. * ```
  2783. * <div *ngIf="condition; else elseBlock">...</div>
  2784. * <ng-template #elseBlock>...</ng-template>
  2785. * ```
  2786. *
  2787. * Form with a `then` and `else` block:
  2788. * ```
  2789. * <div *ngIf="condition; then thenBlock else elseBlock"></div>
  2790. * <ng-template #thenBlock>...</ng-template>
  2791. * <ng-template #elseBlock>...</ng-template>
  2792. * ```
  2793. *
  2794. * Form with storing the value locally:
  2795. * ```
  2796. * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
  2797. * <ng-template #elseBlock>...</ng-template>
  2798. * ```
  2799. *
  2800. * \@stable
  2801. */
  2802. var NgIf = /** @class */ (function () {
  2803. function NgIf(_viewContainer, templateRef) {
  2804. this._viewContainer = _viewContainer;
  2805. this._context = new NgIfContext();
  2806. this._thenTemplateRef = null;
  2807. this._elseTemplateRef = null;
  2808. this._thenViewRef = null;
  2809. this._elseViewRef = null;
  2810. this._thenTemplateRef = templateRef;
  2811. }
  2812. Object.defineProperty(NgIf.prototype, "ngIf", {
  2813. set: /**
  2814. * @param {?} condition
  2815. * @return {?}
  2816. */
  2817. function (condition) {
  2818. this._context.$implicit = this._context.ngIf = condition;
  2819. this._updateView();
  2820. },
  2821. enumerable: true,
  2822. configurable: true
  2823. });
  2824. Object.defineProperty(NgIf.prototype, "ngIfThen", {
  2825. set: /**
  2826. * @param {?} templateRef
  2827. * @return {?}
  2828. */
  2829. function (templateRef) {
  2830. this._thenTemplateRef = templateRef;
  2831. this._thenViewRef = null; // clear previous view if any.
  2832. this._updateView();
  2833. },
  2834. enumerable: true,
  2835. configurable: true
  2836. });
  2837. Object.defineProperty(NgIf.prototype, "ngIfElse", {
  2838. set: /**
  2839. * @param {?} templateRef
  2840. * @return {?}
  2841. */
  2842. function (templateRef) {
  2843. this._elseTemplateRef = templateRef;
  2844. this._elseViewRef = null; // clear previous view if any.
  2845. this._updateView();
  2846. },
  2847. enumerable: true,
  2848. configurable: true
  2849. });
  2850. /**
  2851. * @return {?}
  2852. */
  2853. NgIf.prototype._updateView = /**
  2854. * @return {?}
  2855. */
  2856. function () {
  2857. if (this._context.$implicit) {
  2858. if (!this._thenViewRef) {
  2859. this._viewContainer.clear();
  2860. this._elseViewRef = null;
  2861. if (this._thenTemplateRef) {
  2862. this._thenViewRef =
  2863. this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
  2864. }
  2865. }
  2866. }
  2867. else {
  2868. if (!this._elseViewRef) {
  2869. this._viewContainer.clear();
  2870. this._thenViewRef = null;
  2871. if (this._elseTemplateRef) {
  2872. this._elseViewRef =
  2873. this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
  2874. }
  2875. }
  2876. }
  2877. };
  2878. NgIf.decorators = [
  2879. { type: _angular_core.Directive, args: [{ selector: '[ngIf]' },] },
  2880. ];
  2881. /** @nocollapse */
  2882. NgIf.ctorParameters = function () { return [
  2883. { type: _angular_core.ViewContainerRef, },
  2884. { type: _angular_core.TemplateRef, },
  2885. ]; };
  2886. NgIf.propDecorators = {
  2887. "ngIf": [{ type: _angular_core.Input },],
  2888. "ngIfThen": [{ type: _angular_core.Input },],
  2889. "ngIfElse": [{ type: _angular_core.Input },],
  2890. };
  2891. return NgIf;
  2892. }());
  2893. /**
  2894. * \@stable
  2895. */
  2896. var NgIfContext = /** @class */ (function () {
  2897. function NgIfContext() {
  2898. this.$implicit = null;
  2899. this.ngIf = null;
  2900. }
  2901. return NgIfContext;
  2902. }());
  2903. /**
  2904. * @fileoverview added by tsickle
  2905. * @suppress {checkTypes} checked by tsc
  2906. */
  2907. /**
  2908. * @license
  2909. * Copyright Google Inc. All Rights Reserved.
  2910. *
  2911. * Use of this source code is governed by an MIT-style license that can be
  2912. * found in the LICENSE file at https://angular.io/license
  2913. */
  2914. var SwitchView = /** @class */ (function () {
  2915. function SwitchView(_viewContainerRef, _templateRef) {
  2916. this._viewContainerRef = _viewContainerRef;
  2917. this._templateRef = _templateRef;
  2918. this._created = false;
  2919. }
  2920. /**
  2921. * @return {?}
  2922. */
  2923. SwitchView.prototype.create = /**
  2924. * @return {?}
  2925. */
  2926. function () {
  2927. this._created = true;
  2928. this._viewContainerRef.createEmbeddedView(this._templateRef);
  2929. };
  2930. /**
  2931. * @return {?}
  2932. */
  2933. SwitchView.prototype.destroy = /**
  2934. * @return {?}
  2935. */
  2936. function () {
  2937. this._created = false;
  2938. this._viewContainerRef.clear();
  2939. };
  2940. /**
  2941. * @param {?} created
  2942. * @return {?}
  2943. */
  2944. SwitchView.prototype.enforceState = /**
  2945. * @param {?} created
  2946. * @return {?}
  2947. */
  2948. function (created) {
  2949. if (created && !this._created) {
  2950. this.create();
  2951. }
  2952. else if (!created && this._created) {
  2953. this.destroy();
  2954. }
  2955. };
  2956. return SwitchView;
  2957. }());
  2958. /**
  2959. * \@ngModule CommonModule
  2960. *
  2961. * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch
  2962. * expression.
  2963. *
  2964. * \@howToUse
  2965. * ```
  2966. * <container-element [ngSwitch]="switch_expression">
  2967. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  2968. * <some-element *ngSwitchCase="match_expression_2">...</some-element>
  2969. * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  2970. * <ng-container *ngSwitchCase="match_expression_3">
  2971. * <!-- use a ng-container to group multiple root nodes -->
  2972. * <inner-element></inner-element>
  2973. * <inner-other-element></inner-other-element>
  2974. * </ng-container>
  2975. * <some-element *ngSwitchDefault>...</some-element>
  2976. * </container-element>
  2977. * ```
  2978. * \@description
  2979. *
  2980. * `NgSwitch` stamps out nested views when their match expression value matches the value of the
  2981. * switch expression.
  2982. *
  2983. * In other words:
  2984. * - you define a container element (where you place the directive with a switch expression on the
  2985. * `[ngSwitch]="..."` attribute)
  2986. * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
  2987. * root elements.
  2988. *
  2989. * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
  2990. * be preserved at the location.
  2991. *
  2992. * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
  2993. * expression is evaluated.
  2994. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
  2995. * stamped out.
  2996. *
  2997. * \@stable
  2998. */
  2999. var NgSwitch = /** @class */ (function () {
  3000. function NgSwitch() {
  3001. this._defaultUsed = false;
  3002. this._caseCount = 0;
  3003. this._lastCaseCheckIndex = 0;
  3004. this._lastCasesMatched = false;
  3005. }
  3006. Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
  3007. set: /**
  3008. * @param {?} newValue
  3009. * @return {?}
  3010. */
  3011. function (newValue) {
  3012. this._ngSwitch = newValue;
  3013. if (this._caseCount === 0) {
  3014. this._updateDefaultCases(true);
  3015. }
  3016. },
  3017. enumerable: true,
  3018. configurable: true
  3019. });
  3020. /** @internal */
  3021. /**
  3022. * \@internal
  3023. * @return {?}
  3024. */
  3025. NgSwitch.prototype._addCase = /**
  3026. * \@internal
  3027. * @return {?}
  3028. */
  3029. function () { return this._caseCount++; };
  3030. /** @internal */
  3031. /**
  3032. * \@internal
  3033. * @param {?} view
  3034. * @return {?}
  3035. */
  3036. NgSwitch.prototype._addDefault = /**
  3037. * \@internal
  3038. * @param {?} view
  3039. * @return {?}
  3040. */
  3041. function (view) {
  3042. if (!this._defaultViews) {
  3043. this._defaultViews = [];
  3044. }
  3045. this._defaultViews.push(view);
  3046. };
  3047. /** @internal */
  3048. /**
  3049. * \@internal
  3050. * @param {?} value
  3051. * @return {?}
  3052. */
  3053. NgSwitch.prototype._matchCase = /**
  3054. * \@internal
  3055. * @param {?} value
  3056. * @return {?}
  3057. */
  3058. function (value) {
  3059. var /** @type {?} */ matched = value == this._ngSwitch;
  3060. this._lastCasesMatched = this._lastCasesMatched || matched;
  3061. this._lastCaseCheckIndex++;
  3062. if (this._lastCaseCheckIndex === this._caseCount) {
  3063. this._updateDefaultCases(!this._lastCasesMatched);
  3064. this._lastCaseCheckIndex = 0;
  3065. this._lastCasesMatched = false;
  3066. }
  3067. return matched;
  3068. };
  3069. /**
  3070. * @param {?} useDefault
  3071. * @return {?}
  3072. */
  3073. NgSwitch.prototype._updateDefaultCases = /**
  3074. * @param {?} useDefault
  3075. * @return {?}
  3076. */
  3077. function (useDefault) {
  3078. if (this._defaultViews && useDefault !== this._defaultUsed) {
  3079. this._defaultUsed = useDefault;
  3080. for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) {
  3081. var /** @type {?} */ defaultView = this._defaultViews[i];
  3082. defaultView.enforceState(useDefault);
  3083. }
  3084. }
  3085. };
  3086. NgSwitch.decorators = [
  3087. { type: _angular_core.Directive, args: [{ selector: '[ngSwitch]' },] },
  3088. ];
  3089. /** @nocollapse */
  3090. NgSwitch.ctorParameters = function () { return []; };
  3091. NgSwitch.propDecorators = {
  3092. "ngSwitch": [{ type: _angular_core.Input },],
  3093. };
  3094. return NgSwitch;
  3095. }());
  3096. /**
  3097. * \@ngModule CommonModule
  3098. *
  3099. * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the
  3100. * given expression evaluate to respectively the same/different value as the switch
  3101. * expression.
  3102. *
  3103. * \@howToUse
  3104. * ```
  3105. * <container-element [ngSwitch]="switch_expression">
  3106. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3107. * </container-element>
  3108. * ```
  3109. * \@description
  3110. *
  3111. * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
  3112. * expression.
  3113. *
  3114. * If multiple match expressions match the switch expression value, all of them are displayed.
  3115. *
  3116. * See {\@link NgSwitch} for more details and example.
  3117. *
  3118. * \@stable
  3119. */
  3120. var NgSwitchCase = /** @class */ (function () {
  3121. function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
  3122. this.ngSwitch = ngSwitch;
  3123. ngSwitch._addCase();
  3124. this._view = new SwitchView(viewContainer, templateRef);
  3125. }
  3126. /**
  3127. * @return {?}
  3128. */
  3129. NgSwitchCase.prototype.ngDoCheck = /**
  3130. * @return {?}
  3131. */
  3132. function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
  3133. NgSwitchCase.decorators = [
  3134. { type: _angular_core.Directive, args: [{ selector: '[ngSwitchCase]' },] },
  3135. ];
  3136. /** @nocollapse */
  3137. NgSwitchCase.ctorParameters = function () { return [
  3138. { type: _angular_core.ViewContainerRef, },
  3139. { type: _angular_core.TemplateRef, },
  3140. { type: NgSwitch, decorators: [{ type: _angular_core.Host },] },
  3141. ]; };
  3142. NgSwitchCase.propDecorators = {
  3143. "ngSwitchCase": [{ type: _angular_core.Input },],
  3144. };
  3145. return NgSwitchCase;
  3146. }());
  3147. /**
  3148. * \@ngModule CommonModule
  3149. * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions
  3150. * match the
  3151. * switch expression.
  3152. *
  3153. * \@howToUse
  3154. * ```
  3155. * <container-element [ngSwitch]="switch_expression">
  3156. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3157. * <some-other-element *ngSwitchDefault>...</some-other-element>
  3158. * </container-element>
  3159. * ```
  3160. *
  3161. * \@description
  3162. *
  3163. * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
  3164. * expression.
  3165. *
  3166. * See {\@link NgSwitch} for more details and example.
  3167. *
  3168. * \@stable
  3169. */
  3170. var NgSwitchDefault = /** @class */ (function () {
  3171. function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
  3172. ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
  3173. }
  3174. NgSwitchDefault.decorators = [
  3175. { type: _angular_core.Directive, args: [{ selector: '[ngSwitchDefault]' },] },
  3176. ];
  3177. /** @nocollapse */
  3178. NgSwitchDefault.ctorParameters = function () { return [
  3179. { type: _angular_core.ViewContainerRef, },
  3180. { type: _angular_core.TemplateRef, },
  3181. { type: NgSwitch, decorators: [{ type: _angular_core.Host },] },
  3182. ]; };
  3183. return NgSwitchDefault;
  3184. }());
  3185. /**
  3186. * @fileoverview added by tsickle
  3187. * @suppress {checkTypes} checked by tsc
  3188. */
  3189. /**
  3190. * @license
  3191. * Copyright Google Inc. All Rights Reserved.
  3192. *
  3193. * Use of this source code is governed by an MIT-style license that can be
  3194. * found in the LICENSE file at https://angular.io/license
  3195. */
  3196. /**
  3197. * \@ngModule CommonModule
  3198. *
  3199. * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
  3200. *
  3201. * \@howToUse
  3202. * ```
  3203. * <some-element [ngPlural]="value">
  3204. * <ng-template ngPluralCase="=0">there is nothing</ng-template>
  3205. * <ng-template ngPluralCase="=1">there is one</ng-template>
  3206. * <ng-template ngPluralCase="few">there are a few</ng-template>
  3207. * </some-element>
  3208. * ```
  3209. *
  3210. * \@description
  3211. *
  3212. * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
  3213. * that match the switch expression's pluralization category.
  3214. *
  3215. * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
  3216. * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
  3217. * expression:
  3218. * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
  3219. * matches the switch expression exactly,
  3220. * - otherwise, the view will be treated as a "category match", and will only display if exact
  3221. * value matches aren't found and the value maps to its category for the defined locale.
  3222. *
  3223. * See http://cldr.unicode.org/index/cldr-spec/plural-rules
  3224. *
  3225. * \@experimental
  3226. */
  3227. var NgPlural = /** @class */ (function () {
  3228. function NgPlural(_localization) {
  3229. this._localization = _localization;
  3230. this._caseViews = {};
  3231. }
  3232. Object.defineProperty(NgPlural.prototype, "ngPlural", {
  3233. set: /**
  3234. * @param {?} value
  3235. * @return {?}
  3236. */
  3237. function (value) {
  3238. this._switchValue = value;
  3239. this._updateView();
  3240. },
  3241. enumerable: true,
  3242. configurable: true
  3243. });
  3244. /**
  3245. * @param {?} value
  3246. * @param {?} switchView
  3247. * @return {?}
  3248. */
  3249. NgPlural.prototype.addCase = /**
  3250. * @param {?} value
  3251. * @param {?} switchView
  3252. * @return {?}
  3253. */
  3254. function (value, switchView) { this._caseViews[value] = switchView; };
  3255. /**
  3256. * @return {?}
  3257. */
  3258. NgPlural.prototype._updateView = /**
  3259. * @return {?}
  3260. */
  3261. function () {
  3262. this._clearViews();
  3263. var /** @type {?} */ cases = Object.keys(this._caseViews);
  3264. var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization);
  3265. this._activateView(this._caseViews[key]);
  3266. };
  3267. /**
  3268. * @return {?}
  3269. */
  3270. NgPlural.prototype._clearViews = /**
  3271. * @return {?}
  3272. */
  3273. function () {
  3274. if (this._activeView)
  3275. this._activeView.destroy();
  3276. };
  3277. /**
  3278. * @param {?} view
  3279. * @return {?}
  3280. */
  3281. NgPlural.prototype._activateView = /**
  3282. * @param {?} view
  3283. * @return {?}
  3284. */
  3285. function (view) {
  3286. if (view) {
  3287. this._activeView = view;
  3288. this._activeView.create();
  3289. }
  3290. };
  3291. NgPlural.decorators = [
  3292. { type: _angular_core.Directive, args: [{ selector: '[ngPlural]' },] },
  3293. ];
  3294. /** @nocollapse */
  3295. NgPlural.ctorParameters = function () { return [
  3296. { type: NgLocalization, },
  3297. ]; };
  3298. NgPlural.propDecorators = {
  3299. "ngPlural": [{ type: _angular_core.Input },],
  3300. };
  3301. return NgPlural;
  3302. }());
  3303. /**
  3304. * \@ngModule CommonModule
  3305. *
  3306. * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the
  3307. * given expression matches the plural expression according to CLDR rules.
  3308. *
  3309. * \@howToUse
  3310. * ```
  3311. * <some-element [ngPlural]="value">
  3312. * <ng-template ngPluralCase="=0">...</ng-template>
  3313. * <ng-template ngPluralCase="other">...</ng-template>
  3314. * </some-element>
  3315. * ```
  3316. *
  3317. * See {\@link NgPlural} for more details and example.
  3318. *
  3319. * \@experimental
  3320. */
  3321. var NgPluralCase = /** @class */ (function () {
  3322. function NgPluralCase(value, template, viewContainer, ngPlural) {
  3323. this.value = value;
  3324. var /** @type {?} */ isANumber = !isNaN(Number(value));
  3325. ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
  3326. }
  3327. NgPluralCase.decorators = [
  3328. { type: _angular_core.Directive, args: [{ selector: '[ngPluralCase]' },] },
  3329. ];
  3330. /** @nocollapse */
  3331. NgPluralCase.ctorParameters = function () { return [
  3332. { type: undefined, decorators: [{ type: _angular_core.Attribute, args: ['ngPluralCase',] },] },
  3333. { type: _angular_core.TemplateRef, },
  3334. { type: _angular_core.ViewContainerRef, },
  3335. { type: NgPlural, decorators: [{ type: _angular_core.Host },] },
  3336. ]; };
  3337. return NgPluralCase;
  3338. }());
  3339. /**
  3340. * @fileoverview added by tsickle
  3341. * @suppress {checkTypes} checked by tsc
  3342. */
  3343. /**
  3344. * @license
  3345. * Copyright Google Inc. All Rights Reserved.
  3346. *
  3347. * Use of this source code is governed by an MIT-style license that can be
  3348. * found in the LICENSE file at https://angular.io/license
  3349. */
  3350. /**
  3351. * \@ngModule CommonModule
  3352. *
  3353. * \@whatItDoes Update an HTML element styles.
  3354. *
  3355. * \@howToUse
  3356. * ```
  3357. * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
  3358. *
  3359. * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
  3360. *
  3361. * <some-element [ngStyle]="objExp">...</some-element>
  3362. * ```
  3363. *
  3364. * \@description
  3365. *
  3366. * The styles are updated according to the value of the expression evaluation:
  3367. * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
  3368. * - values are the values assigned to those properties (expressed in the given unit).
  3369. *
  3370. * \@stable
  3371. */
  3372. var NgStyle = /** @class */ (function () {
  3373. function NgStyle(_differs, _ngEl, _renderer) {
  3374. this._differs = _differs;
  3375. this._ngEl = _ngEl;
  3376. this._renderer = _renderer;
  3377. }
  3378. Object.defineProperty(NgStyle.prototype, "ngStyle", {
  3379. set: /**
  3380. * @param {?} v
  3381. * @return {?}
  3382. */
  3383. function (v) {
  3384. this._ngStyle = v;
  3385. if (!this._differ && v) {
  3386. this._differ = this._differs.find(v).create();
  3387. }
  3388. },
  3389. enumerable: true,
  3390. configurable: true
  3391. });
  3392. /**
  3393. * @return {?}
  3394. */
  3395. NgStyle.prototype.ngDoCheck = /**
  3396. * @return {?}
  3397. */
  3398. function () {
  3399. if (this._differ) {
  3400. var /** @type {?} */ changes = this._differ.diff(this._ngStyle);
  3401. if (changes) {
  3402. this._applyChanges(changes);
  3403. }
  3404. }
  3405. };
  3406. /**
  3407. * @param {?} changes
  3408. * @return {?}
  3409. */
  3410. NgStyle.prototype._applyChanges = /**
  3411. * @param {?} changes
  3412. * @return {?}
  3413. */
  3414. function (changes) {
  3415. var _this = this;
  3416. changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
  3417. changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3418. changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3419. };
  3420. /**
  3421. * @param {?} nameAndUnit
  3422. * @param {?} value
  3423. * @return {?}
  3424. */
  3425. NgStyle.prototype._setStyle = /**
  3426. * @param {?} nameAndUnit
  3427. * @param {?} value
  3428. * @return {?}
  3429. */
  3430. function (nameAndUnit, value) {
  3431. var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1];
  3432. value = value != null && unit ? "" + value + unit : value;
  3433. if (value != null) {
  3434. this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value));
  3435. }
  3436. else {
  3437. this._renderer.removeStyle(this._ngEl.nativeElement, name);
  3438. }
  3439. };
  3440. NgStyle.decorators = [
  3441. { type: _angular_core.Directive, args: [{ selector: '[ngStyle]' },] },
  3442. ];
  3443. /** @nocollapse */
  3444. NgStyle.ctorParameters = function () { return [
  3445. { type: _angular_core.KeyValueDiffers, },
  3446. { type: _angular_core.ElementRef, },
  3447. { type: _angular_core.Renderer2, },
  3448. ]; };
  3449. NgStyle.propDecorators = {
  3450. "ngStyle": [{ type: _angular_core.Input },],
  3451. };
  3452. return NgStyle;
  3453. }());
  3454. /**
  3455. * @fileoverview added by tsickle
  3456. * @suppress {checkTypes} checked by tsc
  3457. */
  3458. /**
  3459. * @license
  3460. * Copyright Google Inc. All Rights Reserved.
  3461. *
  3462. * Use of this source code is governed by an MIT-style license that can be
  3463. * found in the LICENSE file at https://angular.io/license
  3464. */
  3465. /**
  3466. * \@ngModule CommonModule
  3467. *
  3468. * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef`
  3469. *
  3470. * \@howToUse
  3471. * ```
  3472. * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
  3473. * ```
  3474. *
  3475. * \@description
  3476. *
  3477. * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
  3478. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
  3479. * by the local template `let` declarations.
  3480. *
  3481. * Note: using the key `$implicit` in the context object will set its value as default.
  3482. *
  3483. * ## Example
  3484. *
  3485. * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
  3486. *
  3487. * \@stable
  3488. */
  3489. var NgTemplateOutlet = /** @class */ (function () {
  3490. function NgTemplateOutlet(_viewContainerRef) {
  3491. this._viewContainerRef = _viewContainerRef;
  3492. }
  3493. /**
  3494. * @param {?} changes
  3495. * @return {?}
  3496. */
  3497. NgTemplateOutlet.prototype.ngOnChanges = /**
  3498. * @param {?} changes
  3499. * @return {?}
  3500. */
  3501. function (changes) {
  3502. var /** @type {?} */ recreateView = this._shouldRecreateView(changes);
  3503. if (recreateView) {
  3504. if (this._viewRef) {
  3505. this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
  3506. }
  3507. if (this.ngTemplateOutlet) {
  3508. this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
  3509. }
  3510. }
  3511. else {
  3512. if (this._viewRef && this.ngTemplateOutletContext) {
  3513. this._updateExistingContext(this.ngTemplateOutletContext);
  3514. }
  3515. }
  3516. };
  3517. /**
  3518. * We need to re-create existing embedded view if:
  3519. * - templateRef has changed
  3520. * - context has changes
  3521. *
  3522. * We mark context object as changed when the corresponding object
  3523. * shape changes (new properties are added or existing properties are removed).
  3524. * In other words we consider context with the same properties as "the same" even
  3525. * if object reference changes (see https://github.com/angular/angular/issues/13407).
  3526. * @param {?} changes
  3527. * @return {?}
  3528. */
  3529. NgTemplateOutlet.prototype._shouldRecreateView = /**
  3530. * We need to re-create existing embedded view if:
  3531. * - templateRef has changed
  3532. * - context has changes
  3533. *
  3534. * We mark context object as changed when the corresponding object
  3535. * shape changes (new properties are added or existing properties are removed).
  3536. * In other words we consider context with the same properties as "the same" even
  3537. * if object reference changes (see https://github.com/angular/angular/issues/13407).
  3538. * @param {?} changes
  3539. * @return {?}
  3540. */
  3541. function (changes) {
  3542. var /** @type {?} */ ctxChange = changes['ngTemplateOutletContext'];
  3543. return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
  3544. };
  3545. /**
  3546. * @param {?} ctxChange
  3547. * @return {?}
  3548. */
  3549. NgTemplateOutlet.prototype._hasContextShapeChanged = /**
  3550. * @param {?} ctxChange
  3551. * @return {?}
  3552. */
  3553. function (ctxChange) {
  3554. var /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {});
  3555. var /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {});
  3556. if (prevCtxKeys.length === currCtxKeys.length) {
  3557. for (var _i = 0, currCtxKeys_1 = currCtxKeys; _i < currCtxKeys_1.length; _i++) {
  3558. var propName = currCtxKeys_1[_i];
  3559. if (prevCtxKeys.indexOf(propName) === -1) {
  3560. return true;
  3561. }
  3562. }
  3563. return false;
  3564. }
  3565. else {
  3566. return true;
  3567. }
  3568. };
  3569. /**
  3570. * @param {?} ctx
  3571. * @return {?}
  3572. */
  3573. NgTemplateOutlet.prototype._updateExistingContext = /**
  3574. * @param {?} ctx
  3575. * @return {?}
  3576. */
  3577. function (ctx) {
  3578. for (var _i = 0, _a = Object.keys(ctx); _i < _a.length; _i++) {
  3579. var propName = _a[_i];
  3580. (/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName];
  3581. }
  3582. };
  3583. NgTemplateOutlet.decorators = [
  3584. { type: _angular_core.Directive, args: [{ selector: '[ngTemplateOutlet]' },] },
  3585. ];
  3586. /** @nocollapse */
  3587. NgTemplateOutlet.ctorParameters = function () { return [
  3588. { type: _angular_core.ViewContainerRef, },
  3589. ]; };
  3590. NgTemplateOutlet.propDecorators = {
  3591. "ngTemplateOutletContext": [{ type: _angular_core.Input },],
  3592. "ngTemplateOutlet": [{ type: _angular_core.Input },],
  3593. };
  3594. return NgTemplateOutlet;
  3595. }());
  3596. /**
  3597. * @fileoverview added by tsickle
  3598. * @suppress {checkTypes} checked by tsc
  3599. */
  3600. /**
  3601. * @license
  3602. * Copyright Google Inc. All Rights Reserved.
  3603. *
  3604. * Use of this source code is governed by an MIT-style license that can be
  3605. * found in the LICENSE file at https://angular.io/license
  3606. */
  3607. /**
  3608. * A collection of Angular directives that are likely to be used in each and every Angular
  3609. * application.
  3610. */
  3611. var COMMON_DIRECTIVES = [
  3612. NgClass,
  3613. NgComponentOutlet,
  3614. NgForOf,
  3615. NgIf,
  3616. NgTemplateOutlet,
  3617. NgStyle,
  3618. NgSwitch,
  3619. NgSwitchCase,
  3620. NgSwitchDefault,
  3621. NgPlural,
  3622. NgPluralCase,
  3623. ];
  3624. /**
  3625. * @fileoverview added by tsickle
  3626. * @suppress {checkTypes} checked by tsc
  3627. */
  3628. /**
  3629. * @license
  3630. * Copyright Google Inc. All Rights Reserved.
  3631. *
  3632. * Use of this source code is governed by an MIT-style license that can be
  3633. * found in the LICENSE file at https://angular.io/license
  3634. */
  3635. var NAMED_FORMATS = {};
  3636. var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
  3637. /** @enum {number} */
  3638. var ZoneWidth = {
  3639. Short: 0,
  3640. ShortGMT: 1,
  3641. Long: 2,
  3642. Extended: 3,
  3643. };
  3644. ZoneWidth[ZoneWidth.Short] = "Short";
  3645. ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT";
  3646. ZoneWidth[ZoneWidth.Long] = "Long";
  3647. ZoneWidth[ZoneWidth.Extended] = "Extended";
  3648. /** @enum {number} */
  3649. var DateType = {
  3650. FullYear: 0,
  3651. Month: 1,
  3652. Date: 2,
  3653. Hours: 3,
  3654. Minutes: 4,
  3655. Seconds: 5,
  3656. Milliseconds: 6,
  3657. Day: 7,
  3658. };
  3659. DateType[DateType.FullYear] = "FullYear";
  3660. DateType[DateType.Month] = "Month";
  3661. DateType[DateType.Date] = "Date";
  3662. DateType[DateType.Hours] = "Hours";
  3663. DateType[DateType.Minutes] = "Minutes";
  3664. DateType[DateType.Seconds] = "Seconds";
  3665. DateType[DateType.Milliseconds] = "Milliseconds";
  3666. DateType[DateType.Day] = "Day";
  3667. /** @enum {number} */
  3668. var TranslationType = {
  3669. DayPeriods: 0,
  3670. Days: 1,
  3671. Months: 2,
  3672. Eras: 3,
  3673. };
  3674. TranslationType[TranslationType.DayPeriods] = "DayPeriods";
  3675. TranslationType[TranslationType.Days] = "Days";
  3676. TranslationType[TranslationType.Months] = "Months";
  3677. TranslationType[TranslationType.Eras] = "Eras";
  3678. /**
  3679. * Transforms a date to a locale string based on a pattern and a timezone
  3680. *
  3681. * \@internal
  3682. * @param {?} date
  3683. * @param {?} format
  3684. * @param {?} locale
  3685. * @param {?=} timezone
  3686. * @return {?}
  3687. */
  3688. function formatDate(date, format, locale, timezone) {
  3689. var /** @type {?} */ namedFormat = getNamedFormat(locale, format);
  3690. format = namedFormat || format;
  3691. var /** @type {?} */ parts = [];
  3692. var /** @type {?} */ match;
  3693. while (format) {
  3694. match = DATE_FORMATS_SPLIT.exec(format);
  3695. if (match) {
  3696. parts = parts.concat(match.slice(1));
  3697. var /** @type {?} */ part = parts.pop();
  3698. if (!part) {
  3699. break;
  3700. }
  3701. format = part;
  3702. }
  3703. else {
  3704. parts.push(format);
  3705. break;
  3706. }
  3707. }
  3708. var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
  3709. if (timezone) {
  3710. dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  3711. date = convertTimezoneToLocal(date, timezone, true);
  3712. }
  3713. var /** @type {?} */ text = '';
  3714. parts.forEach(function (value) {
  3715. var /** @type {?} */ dateFormatter = getDateFormatter(value);
  3716. text += dateFormatter ?
  3717. dateFormatter(date, locale, dateTimezoneOffset) :
  3718. value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  3719. });
  3720. return text;
  3721. }
  3722. /**
  3723. * @param {?} locale
  3724. * @param {?} format
  3725. * @return {?}
  3726. */
  3727. function getNamedFormat(locale, format) {
  3728. var /** @type {?} */ localeId = getLocaleId(locale);
  3729. NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
  3730. if (NAMED_FORMATS[localeId][format]) {
  3731. return NAMED_FORMATS[localeId][format];
  3732. }
  3733. var /** @type {?} */ formatValue = '';
  3734. switch (format) {
  3735. case 'shortDate':
  3736. formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
  3737. break;
  3738. case 'mediumDate':
  3739. formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
  3740. break;
  3741. case 'longDate':
  3742. formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
  3743. break;
  3744. case 'fullDate':
  3745. formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
  3746. break;
  3747. case 'shortTime':
  3748. formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
  3749. break;
  3750. case 'mediumTime':
  3751. formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
  3752. break;
  3753. case 'longTime':
  3754. formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
  3755. break;
  3756. case 'fullTime':
  3757. formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
  3758. break;
  3759. case 'short':
  3760. var /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime');
  3761. var /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate');
  3762. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
  3763. break;
  3764. case 'medium':
  3765. var /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime');
  3766. var /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate');
  3767. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
  3768. break;
  3769. case 'long':
  3770. var /** @type {?} */ longTime = getNamedFormat(locale, 'longTime');
  3771. var /** @type {?} */ longDate = getNamedFormat(locale, 'longDate');
  3772. formatValue =
  3773. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
  3774. break;
  3775. case 'full':
  3776. var /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime');
  3777. var /** @type {?} */ fullDate = getNamedFormat(locale, 'fullDate');
  3778. formatValue =
  3779. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
  3780. break;
  3781. }
  3782. if (formatValue) {
  3783. NAMED_FORMATS[localeId][format] = formatValue;
  3784. }
  3785. return formatValue;
  3786. }
  3787. /**
  3788. * @param {?} str
  3789. * @param {?} opt_values
  3790. * @return {?}
  3791. */
  3792. function formatDateTime(str, opt_values) {
  3793. if (opt_values) {
  3794. str = str.replace(/\{([^}]+)}/g, function (match, key) {
  3795. return (opt_values != null && key in opt_values) ? opt_values[key] : match;
  3796. });
  3797. }
  3798. return str;
  3799. }
  3800. /**
  3801. * @param {?} num
  3802. * @param {?} digits
  3803. * @param {?=} minusSign
  3804. * @param {?=} trim
  3805. * @param {?=} negWrap
  3806. * @return {?}
  3807. */
  3808. function padNumber(num, digits, minusSign, trim, negWrap) {
  3809. if (minusSign === void 0) { minusSign = '-'; }
  3810. var /** @type {?} */ neg = '';
  3811. if (num < 0 || (negWrap && num <= 0)) {
  3812. if (negWrap) {
  3813. num = -num + 1;
  3814. }
  3815. else {
  3816. num = -num;
  3817. neg = minusSign;
  3818. }
  3819. }
  3820. var /** @type {?} */ strNum = '' + num;
  3821. while (strNum.length < digits)
  3822. strNum = '0' + strNum;
  3823. if (trim) {
  3824. strNum = strNum.substr(strNum.length - digits);
  3825. }
  3826. return neg + strNum;
  3827. }
  3828. /**
  3829. * Returns a date formatter that transforms a date into its locale digit representation
  3830. * @param {?} name
  3831. * @param {?} size
  3832. * @param {?=} offset
  3833. * @param {?=} trim
  3834. * @param {?=} negWrap
  3835. * @return {?}
  3836. */
  3837. function dateGetter(name, size, offset, trim, negWrap) {
  3838. if (offset === void 0) { offset = 0; }
  3839. if (trim === void 0) { trim = false; }
  3840. if (negWrap === void 0) { negWrap = false; }
  3841. return function (date, locale) {
  3842. var /** @type {?} */ part = getDatePart(name, date, size);
  3843. if (offset > 0 || part > -offset) {
  3844. part += offset;
  3845. }
  3846. if (name === DateType.Hours && part === 0 && offset === -12) {
  3847. part = 12;
  3848. }
  3849. return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap);
  3850. };
  3851. }
  3852. /**
  3853. * @param {?} name
  3854. * @param {?} date
  3855. * @param {?} size
  3856. * @return {?}
  3857. */
  3858. function getDatePart(name, date, size) {
  3859. switch (name) {
  3860. case DateType.FullYear:
  3861. return date.getFullYear();
  3862. case DateType.Month:
  3863. return date.getMonth();
  3864. case DateType.Date:
  3865. return date.getDate();
  3866. case DateType.Hours:
  3867. return date.getHours();
  3868. case DateType.Minutes:
  3869. return date.getMinutes();
  3870. case DateType.Seconds:
  3871. return date.getSeconds();
  3872. case DateType.Milliseconds:
  3873. var /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1);
  3874. return Math.round(date.getMilliseconds() / div);
  3875. case DateType.Day:
  3876. return date.getDay();
  3877. default:
  3878. throw new Error("Unknown DateType value \"" + name + "\".");
  3879. }
  3880. }
  3881. /**
  3882. * Returns a date formatter that transforms a date into its locale string representation
  3883. * @param {?} name
  3884. * @param {?} width
  3885. * @param {?=} form
  3886. * @param {?=} extended
  3887. * @return {?}
  3888. */
  3889. function dateStrGetter(name, width, form, extended) {
  3890. if (form === void 0) { form = FormStyle.Format; }
  3891. if (extended === void 0) { extended = false; }
  3892. return function (date, locale) {
  3893. return getDateTranslation(date, locale, name, width, form, extended);
  3894. };
  3895. }
  3896. /**
  3897. * Returns the locale translation of a date for a given form, type and width
  3898. * @param {?} date
  3899. * @param {?} locale
  3900. * @param {?} name
  3901. * @param {?} width
  3902. * @param {?} form
  3903. * @param {?} extended
  3904. * @return {?}
  3905. */
  3906. function getDateTranslation(date, locale, name, width, form, extended) {
  3907. switch (name) {
  3908. case TranslationType.Months:
  3909. return getLocaleMonthNames(locale, form, width)[date.getMonth()];
  3910. case TranslationType.Days:
  3911. return getLocaleDayNames(locale, form, width)[date.getDay()];
  3912. case TranslationType.DayPeriods:
  3913. var /** @type {?} */ currentHours_1 = date.getHours();
  3914. var /** @type {?} */ currentMinutes_1 = date.getMinutes();
  3915. if (extended) {
  3916. var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale);
  3917. var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
  3918. var /** @type {?} */ result_1;
  3919. rules.forEach(function (rule, index) {
  3920. if (Array.isArray(rule)) {
  3921. // morning, afternoon, evening, night
  3922. var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
  3923. var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
  3924. if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
  3925. (currentHours_1 < hoursTo ||
  3926. (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
  3927. result_1 = dayPeriods_1[index];
  3928. }
  3929. }
  3930. else {
  3931. // noon or midnight
  3932. var hours = rule.hours, minutes = rule.minutes;
  3933. if (hours === currentHours_1 && minutes === currentMinutes_1) {
  3934. result_1 = dayPeriods_1[index];
  3935. }
  3936. }
  3937. });
  3938. if (result_1) {
  3939. return result_1;
  3940. }
  3941. }
  3942. // if no rules for the day periods, we use am/pm by default
  3943. return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 12 ? 0 : 1];
  3944. case TranslationType.Eras:
  3945. return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1];
  3946. default:
  3947. // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
  3948. // However Closure Compiler does not understand that and reports an error in typed mode.
  3949. // The `throw new Error` below works around the problem, and the unexpected: never variable
  3950. // makes sure tsc still checks this code is unreachable.
  3951. var /** @type {?} */ unexpected = name;
  3952. throw new Error("unexpected translation type " + unexpected);
  3953. }
  3954. }
  3955. /**
  3956. * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
  3957. * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
  3958. * extended = +04:30)
  3959. * @param {?} width
  3960. * @return {?}
  3961. */
  3962. function timeZoneGetter(width) {
  3963. return function (date, locale, offset) {
  3964. var /** @type {?} */ zone = -1 * offset;
  3965. var /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  3966. var /** @type {?} */ hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
  3967. switch (width) {
  3968. case ZoneWidth.Short:
  3969. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
  3970. padNumber(Math.abs(zone % 60), 2, minusSign);
  3971. case ZoneWidth.ShortGMT:
  3972. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
  3973. case ZoneWidth.Long:
  3974. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  3975. padNumber(Math.abs(zone % 60), 2, minusSign);
  3976. case ZoneWidth.Extended:
  3977. if (offset === 0) {
  3978. return 'Z';
  3979. }
  3980. else {
  3981. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  3982. padNumber(Math.abs(zone % 60), 2, minusSign);
  3983. }
  3984. default:
  3985. throw new Error("Unknown zone width \"" + width + "\"");
  3986. }
  3987. };
  3988. }
  3989. var JANUARY = 0;
  3990. var THURSDAY = 4;
  3991. /**
  3992. * @param {?} year
  3993. * @return {?}
  3994. */
  3995. function getFirstThursdayOfYear(year) {
  3996. var /** @type {?} */ firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
  3997. return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
  3998. }
  3999. /**
  4000. * @param {?} datetime
  4001. * @return {?}
  4002. */
  4003. function getThursdayThisWeek(datetime) {
  4004. return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
  4005. }
  4006. /**
  4007. * @param {?} size
  4008. * @param {?=} monthBased
  4009. * @return {?}
  4010. */
  4011. function weekGetter(size, monthBased) {
  4012. if (monthBased === void 0) { monthBased = false; }
  4013. return function (date, locale) {
  4014. var /** @type {?} */ result;
  4015. if (monthBased) {
  4016. var /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
  4017. var /** @type {?} */ today = date.getDate();
  4018. result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
  4019. }
  4020. else {
  4021. var /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear());
  4022. var /** @type {?} */ thisThurs = getThursdayThisWeek(date);
  4023. var /** @type {?} */ diff = thisThurs.getTime() - firstThurs.getTime();
  4024. result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
  4025. }
  4026. return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  4027. };
  4028. }
  4029. var DATE_FORMATS = {};
  4030. /**
  4031. * @param {?} format
  4032. * @return {?}
  4033. */
  4034. function getDateFormatter(format) {
  4035. if (DATE_FORMATS[format]) {
  4036. return DATE_FORMATS[format];
  4037. }
  4038. var /** @type {?} */ formatter;
  4039. switch (format) {
  4040. // Era name (AD/BC)
  4041. case 'G':
  4042. case 'GG':
  4043. case 'GGG':
  4044. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
  4045. break;
  4046. case 'GGGG':
  4047. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
  4048. break;
  4049. case 'GGGGG':
  4050. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
  4051. break;
  4052. // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
  4053. case 'y':
  4054. formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
  4055. break;
  4056. // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
  4057. case 'yy':
  4058. formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
  4059. break;
  4060. // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
  4061. case 'yyy':
  4062. formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
  4063. break;
  4064. // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
  4065. case 'yyyy':
  4066. formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
  4067. break;
  4068. // Month of the year (1-12), numeric
  4069. case 'M':
  4070. case 'L':
  4071. formatter = dateGetter(DateType.Month, 1, 1);
  4072. break;
  4073. case 'MM':
  4074. case 'LL':
  4075. formatter = dateGetter(DateType.Month, 2, 1);
  4076. break;
  4077. // Month of the year (January, ...), string, format
  4078. case 'MMM':
  4079. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
  4080. break;
  4081. case 'MMMM':
  4082. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
  4083. break;
  4084. case 'MMMMM':
  4085. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
  4086. break;
  4087. // Month of the year (January, ...), string, standalone
  4088. case 'LLL':
  4089. formatter =
  4090. dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
  4091. break;
  4092. case 'LLLL':
  4093. formatter =
  4094. dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
  4095. break;
  4096. case 'LLLLL':
  4097. formatter =
  4098. dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
  4099. break;
  4100. // Week of the year (1, ... 52)
  4101. case 'w':
  4102. formatter = weekGetter(1);
  4103. break;
  4104. case 'ww':
  4105. formatter = weekGetter(2);
  4106. break;
  4107. // Week of the month (1, ...)
  4108. case 'W':
  4109. formatter = weekGetter(1, true);
  4110. break;
  4111. // Day of the month (1-31)
  4112. case 'd':
  4113. formatter = dateGetter(DateType.Date, 1);
  4114. break;
  4115. case 'dd':
  4116. formatter = dateGetter(DateType.Date, 2);
  4117. break;
  4118. // Day of the Week
  4119. case 'E':
  4120. case 'EE':
  4121. case 'EEE':
  4122. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
  4123. break;
  4124. case 'EEEE':
  4125. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
  4126. break;
  4127. case 'EEEEE':
  4128. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
  4129. break;
  4130. case 'EEEEEE':
  4131. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
  4132. break;
  4133. // Generic period of the day (am-pm)
  4134. case 'a':
  4135. case 'aa':
  4136. case 'aaa':
  4137. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
  4138. break;
  4139. case 'aaaa':
  4140. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
  4141. break;
  4142. case 'aaaaa':
  4143. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
  4144. break;
  4145. // Extended period of the day (midnight, at night, ...), standalone
  4146. case 'b':
  4147. case 'bb':
  4148. case 'bbb':
  4149. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
  4150. break;
  4151. case 'bbbb':
  4152. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
  4153. break;
  4154. case 'bbbbb':
  4155. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
  4156. break;
  4157. // Extended period of the day (midnight, night, ...), standalone
  4158. case 'B':
  4159. case 'BB':
  4160. case 'BBB':
  4161. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
  4162. break;
  4163. case 'BBBB':
  4164. formatter =
  4165. dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
  4166. break;
  4167. case 'BBBBB':
  4168. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
  4169. break;
  4170. // Hour in AM/PM, (1-12)
  4171. case 'h':
  4172. formatter = dateGetter(DateType.Hours, 1, -12);
  4173. break;
  4174. case 'hh':
  4175. formatter = dateGetter(DateType.Hours, 2, -12);
  4176. break;
  4177. // Hour of the day (0-23)
  4178. case 'H':
  4179. formatter = dateGetter(DateType.Hours, 1);
  4180. break;
  4181. // Hour in day, padded (00-23)
  4182. case 'HH':
  4183. formatter = dateGetter(DateType.Hours, 2);
  4184. break;
  4185. // Minute of the hour (0-59)
  4186. case 'm':
  4187. formatter = dateGetter(DateType.Minutes, 1);
  4188. break;
  4189. case 'mm':
  4190. formatter = dateGetter(DateType.Minutes, 2);
  4191. break;
  4192. // Second of the minute (0-59)
  4193. case 's':
  4194. formatter = dateGetter(DateType.Seconds, 1);
  4195. break;
  4196. case 'ss':
  4197. formatter = dateGetter(DateType.Seconds, 2);
  4198. break;
  4199. // Fractional second padded (0-9)
  4200. case 'S':
  4201. formatter = dateGetter(DateType.Milliseconds, 1);
  4202. break;
  4203. case 'SS':
  4204. formatter = dateGetter(DateType.Milliseconds, 2);
  4205. break;
  4206. // = millisecond
  4207. case 'SSS':
  4208. formatter = dateGetter(DateType.Milliseconds, 3);
  4209. break;
  4210. // Timezone ISO8601 short format (-0430)
  4211. case 'Z':
  4212. case 'ZZ':
  4213. case 'ZZZ':
  4214. formatter = timeZoneGetter(ZoneWidth.Short);
  4215. break;
  4216. // Timezone ISO8601 extended format (-04:30)
  4217. case 'ZZZZZ':
  4218. formatter = timeZoneGetter(ZoneWidth.Extended);
  4219. break;
  4220. // Timezone GMT short format (GMT+4)
  4221. case 'O':
  4222. case 'OO':
  4223. case 'OOO':
  4224. // Should be location, but fallback to format O instead because we don't have the data yet
  4225. case 'z':
  4226. case 'zz':
  4227. case 'zzz':
  4228. formatter = timeZoneGetter(ZoneWidth.ShortGMT);
  4229. break;
  4230. // Timezone GMT long format (GMT+0430)
  4231. case 'OOOO':
  4232. case 'ZZZZ':
  4233. // Should be location, but fallback to format O instead because we don't have the data yet
  4234. case 'zzzz':
  4235. formatter = timeZoneGetter(ZoneWidth.Long);
  4236. break;
  4237. default:
  4238. return null;
  4239. }
  4240. DATE_FORMATS[format] = formatter;
  4241. return formatter;
  4242. }
  4243. /**
  4244. * @param {?} timezone
  4245. * @param {?} fallback
  4246. * @return {?}
  4247. */
  4248. function timezoneToOffset(timezone, fallback) {
  4249. // Support: IE 9-11 only, Edge 13-15+
  4250. // IE/Edge do not "understand" colon (`:`) in timezone
  4251. timezone = timezone.replace(/:/g, '');
  4252. var /** @type {?} */ requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
  4253. return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
  4254. }
  4255. /**
  4256. * @param {?} date
  4257. * @param {?} minutes
  4258. * @return {?}
  4259. */
  4260. function addDateMinutes(date, minutes) {
  4261. date = new Date(date.getTime());
  4262. date.setMinutes(date.getMinutes() + minutes);
  4263. return date;
  4264. }
  4265. /**
  4266. * @param {?} date
  4267. * @param {?} timezone
  4268. * @param {?} reverse
  4269. * @return {?}
  4270. */
  4271. function convertTimezoneToLocal(date, timezone, reverse) {
  4272. var /** @type {?} */ reverseValue = reverse ? -1 : 1;
  4273. var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
  4274. var /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  4275. return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
  4276. }
  4277. /**
  4278. * @fileoverview added by tsickle
  4279. * @suppress {checkTypes} checked by tsc
  4280. */
  4281. /**
  4282. * @license
  4283. * Copyright Google Inc. All Rights Reserved.
  4284. *
  4285. * Use of this source code is governed by an MIT-style license that can be
  4286. * found in the LICENSE file at https://angular.io/license
  4287. */
  4288. /**
  4289. * @param {?} type
  4290. * @param {?} value
  4291. * @return {?}
  4292. */
  4293. function invalidPipeArgumentError(type, value) {
  4294. return Error("InvalidPipeArgument: '" + value + "' for pipe '" + _angular_core.ɵstringify(type) + "'");
  4295. }
  4296. /**
  4297. * @fileoverview added by tsickle
  4298. * @suppress {checkTypes} checked by tsc
  4299. */
  4300. /**
  4301. * @license
  4302. * Copyright Google Inc. All Rights Reserved.
  4303. *
  4304. * Use of this source code is governed by an MIT-style license that can be
  4305. * found in the LICENSE file at https://angular.io/license
  4306. */
  4307. var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
  4308. /**
  4309. * \@ngModule CommonModule
  4310. * \@whatItDoes Formats a date according to locale rules.
  4311. * \@howToUse `date_expression | date[:format[:timezone[:locale]]]`
  4312. * \@description
  4313. *
  4314. * Where:
  4315. * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
  4316. * (https://www.w3.org/TR/NOTE-datetime).
  4317. * - `format` indicates which date/time components to include. The format can be predefined as
  4318. * shown below (all examples are given for `en-US`) or custom as shown in the table.
  4319. * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`)
  4320. * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`)
  4321. * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`)
  4322. * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at
  4323. * 9:03:01 AM GMT+01:00`)
  4324. * - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`)
  4325. * - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`)
  4326. * - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`)
  4327. * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`)
  4328. * - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`)
  4329. * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`)
  4330. * - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`)
  4331. * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`)
  4332. * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
  4333. * abbreviations, but for general use, use a time zone offset, for example,
  4334. * `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
  4335. * If not specified, the local system timezone of the end-user's browser will be used.
  4336. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  4337. * default)
  4338. *
  4339. *
  4340. * | Field Type | Format | Description | Example Value |
  4341. * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
  4342. * | Era | G, GG & GGG | Abbreviated | AD |
  4343. * | | GGGG | Wide | Anno Domini |
  4344. * | | GGGGG | Narrow | A |
  4345. * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
  4346. * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
  4347. * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
  4348. * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
  4349. * | Month | M | Numeric: 1 digit | 9, 12 |
  4350. * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
  4351. * | | MMM | Abbreviated | Sep |
  4352. * | | MMMM | Wide | September |
  4353. * | | MMMMM | Narrow | S |
  4354. * | Month standalone | L | Numeric: 1 digit | 9, 12 |
  4355. * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
  4356. * | | LLL | Abbreviated | Sep |
  4357. * | | LLLL | Wide | September |
  4358. * | | LLLLL | Narrow | S |
  4359. * | Week of year | w | Numeric: minimum digits | 1... 53 |
  4360. * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
  4361. * | Week of month | W | Numeric: 1 digit | 1... 5 |
  4362. * | Day of month | d | Numeric: minimum digits | 1 |
  4363. * | | dd | Numeric: 2 digits + zero padded | 01 |
  4364. * | Week day | E, EE & EEE | Abbreviated | Tue |
  4365. * | | EEEE | Wide | Tuesday |
  4366. * | | EEEEE | Narrow | T |
  4367. * | | EEEEEE | Short | Tu |
  4368. * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
  4369. * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
  4370. * | | aaaaa | Narrow | a/p |
  4371. * | Period* | B, BB & BBB | Abbreviated | mid. |
  4372. * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4373. * | | BBBBB | Narrow | md |
  4374. * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
  4375. * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4376. * | | bbbbb | Narrow | md |
  4377. * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
  4378. * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
  4379. * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
  4380. * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
  4381. * | Minute | m | Numeric: minimum digits | 8, 59 |
  4382. * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
  4383. * | Second | s | Numeric: minimum digits | 0... 59 |
  4384. * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
  4385. * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
  4386. * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
  4387. * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
  4388. * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
  4389. * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
  4390. * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
  4391. * | | ZZZZ | Long localized GMT format | GMT-8:00 |
  4392. * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
  4393. * | | O, OO & OOO | Short localized GMT format | GMT-8 |
  4394. * | | OOOO | Long localized GMT format | GMT-08:00 |
  4395. *
  4396. *
  4397. * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
  4398. * applied and the formatted text will have the same day, month and year of the expression.
  4399. *
  4400. * WARNINGS:
  4401. * - this pipe has only access to en-US locale data by default. If you want to localize the dates
  4402. * in another language, you will have to import data for other locales.
  4403. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
  4404. * data.
  4405. * - Fields suffixed with * are only available in the extra dataset.
  4406. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale
  4407. * data.
  4408. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
  4409. * Instead users should treat the date as an immutable object and change the reference when the
  4410. * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
  4411. * which would be an expensive operation).
  4412. *
  4413. * ### Examples
  4414. *
  4415. * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11)
  4416. * in the _local_ time and locale is 'en-US':
  4417. *
  4418. * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'}
  4419. *
  4420. * \@stable
  4421. */
  4422. var DatePipe = /** @class */ (function () {
  4423. function DatePipe(locale) {
  4424. this.locale = locale;
  4425. }
  4426. /**
  4427. * @param {?} value
  4428. * @param {?=} format
  4429. * @param {?=} timezone
  4430. * @param {?=} locale
  4431. * @return {?}
  4432. */
  4433. DatePipe.prototype.transform = /**
  4434. * @param {?} value
  4435. * @param {?=} format
  4436. * @param {?=} timezone
  4437. * @param {?=} locale
  4438. * @return {?}
  4439. */
  4440. function (value, format, timezone, locale) {
  4441. if (format === void 0) { format = 'mediumDate'; }
  4442. if (value == null || value === '' || value !== value)
  4443. return null;
  4444. if (typeof value === 'string') {
  4445. value = value.trim();
  4446. }
  4447. var /** @type {?} */ date;
  4448. var /** @type {?} */ match;
  4449. if (isDate$1(value)) {
  4450. date = value;
  4451. }
  4452. else if (!isNaN(value - parseFloat(value))) {
  4453. date = new Date(parseFloat(value));
  4454. }
  4455. else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  4456. /**
  4457. * For ISO Strings without time the day, month and year must be extracted from the ISO String
  4458. * before Date creation to avoid time offset and errors in the new Date.
  4459. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  4460. * date, some browsers (e.g. IE 9) will throw an invalid Date error
  4461. * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
  4462. * is applied
  4463. * Note: ISO months are 0 for January, 1 for February, ...
  4464. */
  4465. var _a = value.split('-').map(function (val) { return +val; }), y = _a[0], m = _a[1], d = _a[2];
  4466. date = new Date(y, m - 1, d);
  4467. }
  4468. else if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
  4469. date = isoStringToDate(match);
  4470. }
  4471. else {
  4472. date = new Date(value);
  4473. }
  4474. if (!isDate$1(date)) {
  4475. throw invalidPipeArgumentError(DatePipe, value);
  4476. }
  4477. return formatDate(date, format, locale || this.locale, timezone);
  4478. };
  4479. DatePipe.decorators = [
  4480. { type: _angular_core.Pipe, args: [{ name: 'date', pure: true },] },
  4481. ];
  4482. /** @nocollapse */
  4483. DatePipe.ctorParameters = function () { return [
  4484. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  4485. ]; };
  4486. return DatePipe;
  4487. }());
  4488. /**
  4489. * \@internal
  4490. * @param {?} match
  4491. * @return {?}
  4492. */
  4493. function isoStringToDate(match) {
  4494. var /** @type {?} */ date = new Date(0);
  4495. var /** @type {?} */ tzHour = 0;
  4496. var /** @type {?} */ tzMin = 0;
  4497. // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
  4498. var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
  4499. var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours;
  4500. // if there is a timezone defined like "+01:00" or "+0100"
  4501. if (match[9]) {
  4502. tzHour = +(match[9] + match[10]);
  4503. tzMin = +(match[9] + match[11]);
  4504. }
  4505. dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3]));
  4506. var /** @type {?} */ h = +(match[4] || '0') - tzHour;
  4507. var /** @type {?} */ m = +(match[5] || '0') - tzMin;
  4508. var /** @type {?} */ s = +(match[6] || '0');
  4509. var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
  4510. timeSetter.call(date, h, m, s, ms);
  4511. return date;
  4512. }
  4513. /**
  4514. * @param {?} value
  4515. * @return {?}
  4516. */
  4517. function isDate$1(value) {
  4518. return value instanceof Date && !isNaN(value.valueOf());
  4519. }
  4520. /**
  4521. * @fileoverview added by tsickle
  4522. * @suppress {checkTypes} checked by tsc
  4523. */
  4524. var NumberFormatter = /** @class */ (function () {
  4525. function NumberFormatter() {
  4526. }
  4527. /**
  4528. * @param {?} num
  4529. * @param {?} locale
  4530. * @param {?} style
  4531. * @param {?=} opts
  4532. * @return {?}
  4533. */
  4534. NumberFormatter.format = /**
  4535. * @param {?} num
  4536. * @param {?} locale
  4537. * @param {?} style
  4538. * @param {?=} opts
  4539. * @return {?}
  4540. */
  4541. function (num, locale, style, opts) {
  4542. if (opts === void 0) { opts = {}; }
  4543. var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
  4544. var /** @type {?} */ options = {
  4545. minimumIntegerDigits: minimumIntegerDigits,
  4546. minimumFractionDigits: minimumFractionDigits,
  4547. maximumFractionDigits: maximumFractionDigits,
  4548. style: NumberFormatStyle[style].toLowerCase()
  4549. };
  4550. if (style == NumberFormatStyle.Currency) {
  4551. options.currency = typeof currency == 'string' ? currency : undefined;
  4552. options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
  4553. }
  4554. return new Intl.NumberFormat(locale, options).format(num);
  4555. };
  4556. return NumberFormatter;
  4557. }());
  4558. var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
  4559. var PATTERN_ALIASES = {
  4560. // Keys are quoted so they do not get renamed during closure compilation.
  4561. 'yMMMdjms': datePartGetterFactory(combine([
  4562. digitCondition('year', 1),
  4563. nameCondition('month', 3),
  4564. digitCondition('day', 1),
  4565. digitCondition('hour', 1),
  4566. digitCondition('minute', 1),
  4567. digitCondition('second', 1),
  4568. ])),
  4569. 'yMdjm': datePartGetterFactory(combine([
  4570. digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
  4571. digitCondition('hour', 1), digitCondition('minute', 1)
  4572. ])),
  4573. 'yMMMMEEEEd': datePartGetterFactory(combine([
  4574. digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
  4575. digitCondition('day', 1)
  4576. ])),
  4577. 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
  4578. 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
  4579. 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
  4580. 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
  4581. 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
  4582. };
  4583. var DATE_FORMATS$1 = {
  4584. // Keys are quoted so they do not get renamed.
  4585. 'yyyy': datePartGetterFactory(digitCondition('year', 4)),
  4586. 'yy': datePartGetterFactory(digitCondition('year', 2)),
  4587. 'y': datePartGetterFactory(digitCondition('year', 1)),
  4588. 'MMMM': datePartGetterFactory(nameCondition('month', 4)),
  4589. 'MMM': datePartGetterFactory(nameCondition('month', 3)),
  4590. 'MM': datePartGetterFactory(digitCondition('month', 2)),
  4591. 'M': datePartGetterFactory(digitCondition('month', 1)),
  4592. 'LLLL': datePartGetterFactory(nameCondition('month', 4)),
  4593. 'L': datePartGetterFactory(nameCondition('month', 1)),
  4594. 'dd': datePartGetterFactory(digitCondition('day', 2)),
  4595. 'd': datePartGetterFactory(digitCondition('day', 1)),
  4596. 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
  4597. 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
  4598. 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
  4599. 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4600. 'jj': datePartGetterFactory(digitCondition('hour', 2)),
  4601. 'j': datePartGetterFactory(digitCondition('hour', 1)),
  4602. 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
  4603. 'm': datePartGetterFactory(digitCondition('minute', 1)),
  4604. 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
  4605. 's': datePartGetterFactory(digitCondition('second', 1)),
  4606. // while ISO 8601 requires fractions to be prefixed with `.` or `,`
  4607. // we can be just safely rely on using `sss` since we currently don't support single or two digit
  4608. // fractions
  4609. 'sss': datePartGetterFactory(digitCondition('second', 3)),
  4610. 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
  4611. 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
  4612. 'EE': datePartGetterFactory(nameCondition('weekday', 2)),
  4613. 'E': datePartGetterFactory(nameCondition('weekday', 1)),
  4614. 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4615. 'Z': timeZoneGetter$1('short'),
  4616. 'z': timeZoneGetter$1('long'),
  4617. 'ww': datePartGetterFactory({}),
  4618. // Week of year, padded (00-53). Week 01 is the week with the
  4619. // first Thursday of the year. not support ?
  4620. 'w': datePartGetterFactory({}),
  4621. // Week of year (0-53). Week 1 is the week with the first Thursday
  4622. // of the year not support ?
  4623. 'G': datePartGetterFactory(nameCondition('era', 1)),
  4624. 'GG': datePartGetterFactory(nameCondition('era', 2)),
  4625. 'GGG': datePartGetterFactory(nameCondition('era', 3)),
  4626. 'GGGG': datePartGetterFactory(nameCondition('era', 4))
  4627. };
  4628. /**
  4629. * @param {?} inner
  4630. * @return {?}
  4631. */
  4632. function digitModifier(inner) {
  4633. return function (date, locale) {
  4634. var /** @type {?} */ result = inner(date, locale);
  4635. return result.length == 1 ? '0' + result : result;
  4636. };
  4637. }
  4638. /**
  4639. * @param {?} inner
  4640. * @return {?}
  4641. */
  4642. function hourClockExtractor(inner) {
  4643. return function (date, locale) { return inner(date, locale).split(' ')[1]; };
  4644. }
  4645. /**
  4646. * @param {?} inner
  4647. * @return {?}
  4648. */
  4649. function hourExtractor(inner) {
  4650. return function (date, locale) { return inner(date, locale).split(' ')[0]; };
  4651. }
  4652. /**
  4653. * @param {?} date
  4654. * @param {?} locale
  4655. * @param {?} options
  4656. * @return {?}
  4657. */
  4658. function intlDateFormat(date, locale, options) {
  4659. return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
  4660. }
  4661. /**
  4662. * @param {?} timezone
  4663. * @return {?}
  4664. */
  4665. function timeZoneGetter$1(timezone) {
  4666. // To workaround `Intl` API restriction for single timezone let format with 24 hours
  4667. var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
  4668. return function (date, locale) {
  4669. var /** @type {?} */ result = intlDateFormat(date, locale, options);
  4670. // Then extract first 3 letters that related to hours
  4671. return result ? result.substring(3) : '';
  4672. };
  4673. }
  4674. /**
  4675. * @param {?} options
  4676. * @param {?} value
  4677. * @return {?}
  4678. */
  4679. function hour12Modify(options, value) {
  4680. options.hour12 = value;
  4681. return options;
  4682. }
  4683. /**
  4684. * @param {?} prop
  4685. * @param {?} len
  4686. * @return {?}
  4687. */
  4688. function digitCondition(prop, len) {
  4689. var /** @type {?} */ result = {};
  4690. result[prop] = len === 2 ? '2-digit' : 'numeric';
  4691. return result;
  4692. }
  4693. /**
  4694. * @param {?} prop
  4695. * @param {?} len
  4696. * @return {?}
  4697. */
  4698. function nameCondition(prop, len) {
  4699. var /** @type {?} */ result = {};
  4700. if (len < 4) {
  4701. result[prop] = len > 1 ? 'short' : 'narrow';
  4702. }
  4703. else {
  4704. result[prop] = 'long';
  4705. }
  4706. return result;
  4707. }
  4708. /**
  4709. * @param {?} options
  4710. * @return {?}
  4711. */
  4712. function combine(options) {
  4713. return options.reduce(function (merged, opt) { return (__assign({}, merged, opt)); }, {});
  4714. }
  4715. /**
  4716. * @param {?} ret
  4717. * @return {?}
  4718. */
  4719. function datePartGetterFactory(ret) {
  4720. return function (date, locale) { return intlDateFormat(date, locale, ret); };
  4721. }
  4722. var DATE_FORMATTER_CACHE = new Map();
  4723. /**
  4724. * @param {?} format
  4725. * @param {?} date
  4726. * @param {?} locale
  4727. * @return {?}
  4728. */
  4729. function dateFormatter(format, date, locale) {
  4730. var /** @type {?} */ fn = PATTERN_ALIASES[format];
  4731. if (fn)
  4732. return fn(date, locale);
  4733. var /** @type {?} */ cacheKey = format;
  4734. var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey);
  4735. if (!parts) {
  4736. parts = [];
  4737. var /** @type {?} */ match = void 0;
  4738. DATE_FORMATS_SPLIT$1.exec(format);
  4739. var /** @type {?} */ _format = format;
  4740. while (_format) {
  4741. match = DATE_FORMATS_SPLIT$1.exec(_format);
  4742. if (match) {
  4743. parts = parts.concat(match.slice(1));
  4744. _format = /** @type {?} */ ((parts.pop()));
  4745. }
  4746. else {
  4747. parts.push(_format);
  4748. _format = null;
  4749. }
  4750. }
  4751. DATE_FORMATTER_CACHE.set(cacheKey, parts);
  4752. }
  4753. return parts.reduce(function (text, part) {
  4754. var /** @type {?} */ fn = DATE_FORMATS$1[part];
  4755. return text + (fn ? fn(date, locale) : partToTime(part));
  4756. }, '');
  4757. }
  4758. /**
  4759. * @param {?} part
  4760. * @return {?}
  4761. */
  4762. function partToTime(part) {
  4763. return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  4764. }
  4765. var DateFormatter = /** @class */ (function () {
  4766. function DateFormatter() {
  4767. }
  4768. /**
  4769. * @param {?} date
  4770. * @param {?} locale
  4771. * @param {?} pattern
  4772. * @return {?}
  4773. */
  4774. DateFormatter.format = /**
  4775. * @param {?} date
  4776. * @param {?} locale
  4777. * @param {?} pattern
  4778. * @return {?}
  4779. */
  4780. function (date, locale, pattern) {
  4781. return dateFormatter(pattern, date, locale);
  4782. };
  4783. return DateFormatter;
  4784. }());
  4785. /**
  4786. * @fileoverview added by tsickle
  4787. * @suppress {checkTypes} checked by tsc
  4788. */
  4789. /**
  4790. * @license
  4791. * Copyright Google Inc. All Rights Reserved.
  4792. *
  4793. * Use of this source code is governed by an MIT-style license that can be
  4794. * found in the LICENSE file at https://angular.io/license
  4795. */
  4796. /**
  4797. * \@ngModule CommonModule
  4798. * \@whatItDoes Formats a date according to locale rules.
  4799. * \@howToUse `date_expression | date[:format]`
  4800. * \@description
  4801. *
  4802. * Where:
  4803. * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
  4804. * (https://www.w3.org/TR/NOTE-datetime).
  4805. * - `format` indicates which date/time components to include. The format can be predefined as
  4806. * shown below or custom as shown in the table.
  4807. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
  4808. * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
  4809. * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
  4810. * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
  4811. * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
  4812. * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
  4813. * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
  4814. * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
  4815. *
  4816. *
  4817. * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit |
  4818. * |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
  4819. * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - |
  4820. * | year | y | - | - | - | y (2015) | yy (15) |
  4821. * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) |
  4822. * | day | d | - | - | - | d (3) | dd (03) |
  4823. * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - |
  4824. * | hour | j | - | - | - | j (13) | jj (13) |
  4825. * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)|
  4826. * | hour24 | H | - | - | - | H (13) | HH (13) |
  4827. * | minute | m | - | - | - | m (5) | mm (05) |
  4828. * | second | s | - | - | - | s (9) | ss (09) |
  4829. * | timezone | z | - | - | z (Pacific Standard Time)| - | - |
  4830. * | timezone | Z | - | Z (GMT-8:00) | - | - | - |
  4831. * | timezone | a | - | a (PM) | - | - | - |
  4832. *
  4833. * In javascript, only the components specified will be respected (not the ordering,
  4834. * punctuations, ...) and details of the formatting will be dependent on the locale.
  4835. *
  4836. * Timezone of the formatted text will be the local system timezone of the end-user's machine.
  4837. *
  4838. * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
  4839. * applied and the formatted text will have the same day, month and year of the expression.
  4840. *
  4841. * WARNINGS:
  4842. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
  4843. * Instead users should treat the date as an immutable object and change the reference when the
  4844. * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
  4845. * which would be an expensive operation).
  4846. * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
  4847. * browsers.
  4848. *
  4849. * ### Examples
  4850. *
  4851. * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
  4852. * in the _local_ time and locale is 'en-US':
  4853. *
  4854. * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'}
  4855. *
  4856. * \@stable
  4857. */
  4858. var DeprecatedDatePipe = /** @class */ (function () {
  4859. function DeprecatedDatePipe(_locale) {
  4860. this._locale = _locale;
  4861. }
  4862. /**
  4863. * @param {?} value
  4864. * @param {?=} pattern
  4865. * @return {?}
  4866. */
  4867. DeprecatedDatePipe.prototype.transform = /**
  4868. * @param {?} value
  4869. * @param {?=} pattern
  4870. * @return {?}
  4871. */
  4872. function (value, pattern) {
  4873. if (pattern === void 0) { pattern = 'mediumDate'; }
  4874. if (value == null || value === '' || value !== value)
  4875. return null;
  4876. var /** @type {?} */ date;
  4877. if (typeof value === 'string') {
  4878. value = value.trim();
  4879. }
  4880. if (isDate(value)) {
  4881. date = value;
  4882. }
  4883. else if (!isNaN(value - parseFloat(value))) {
  4884. date = new Date(parseFloat(value));
  4885. }
  4886. else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  4887. /**
  4888. * For ISO Strings without time the day, month and year must be extracted from the ISO String
  4889. * before Date creation to avoid time offset and errors in the new Date.
  4890. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  4891. * date, some browsers (e.g. IE 9) will throw an invalid Date error
  4892. * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
  4893. * timeoffset
  4894. * is applied
  4895. * Note: ISO months are 0 for January, 1 for February, ...
  4896. */
  4897. var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2];
  4898. date = new Date(y, m - 1, d);
  4899. }
  4900. else {
  4901. date = new Date(value);
  4902. }
  4903. if (!isDate(date)) {
  4904. var /** @type {?} */ match = void 0;
  4905. if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
  4906. date = isoStringToDate(match);
  4907. }
  4908. else {
  4909. throw invalidPipeArgumentError(DeprecatedDatePipe, value);
  4910. }
  4911. }
  4912. return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern);
  4913. };
  4914. /**
  4915. * \@internal
  4916. */
  4917. DeprecatedDatePipe._ALIASES = {
  4918. 'medium': 'yMMMdjms',
  4919. 'short': 'yMdjm',
  4920. 'fullDate': 'yMMMMEEEEd',
  4921. 'longDate': 'yMMMMd',
  4922. 'mediumDate': 'yMMMd',
  4923. 'shortDate': 'yMd',
  4924. 'mediumTime': 'jms',
  4925. 'shortTime': 'jm'
  4926. };
  4927. DeprecatedDatePipe.decorators = [
  4928. { type: _angular_core.Pipe, args: [{ name: 'date', pure: true },] },
  4929. ];
  4930. /** @nocollapse */
  4931. DeprecatedDatePipe.ctorParameters = function () { return [
  4932. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  4933. ]; };
  4934. return DeprecatedDatePipe;
  4935. }());
  4936. /**
  4937. * @param {?} value
  4938. * @return {?}
  4939. */
  4940. function isDate(value) {
  4941. return value instanceof Date && !isNaN(value.valueOf());
  4942. }
  4943. /**
  4944. * @fileoverview added by tsickle
  4945. * @suppress {checkTypes} checked by tsc
  4946. */
  4947. /**
  4948. * @license
  4949. * Copyright Google Inc. All Rights Reserved.
  4950. *
  4951. * Use of this source code is governed by an MIT-style license that can be
  4952. * found in the LICENSE file at https://angular.io/license
  4953. */
  4954. var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
  4955. var MAX_DIGITS = 22;
  4956. var DECIMAL_SEP = '.';
  4957. var ZERO_CHAR = '0';
  4958. var PATTERN_SEP = ';';
  4959. var GROUP_SEP = ',';
  4960. var DIGIT_CHAR = '#';
  4961. var CURRENCY_CHAR = '¤';
  4962. var PERCENT_CHAR = '%';
  4963. /**
  4964. * Transform a number to a locale string based on a style and a format
  4965. *
  4966. * \@internal
  4967. * @param {?} value
  4968. * @param {?} locale
  4969. * @param {?} style
  4970. * @param {?=} digitsInfo
  4971. * @param {?=} currency
  4972. * @return {?}
  4973. */
  4974. function formatNumber$1(value, locale, style, digitsInfo, currency) {
  4975. if (currency === void 0) { currency = null; }
  4976. var /** @type {?} */ res = { str: null };
  4977. var /** @type {?} */ format = getLocaleNumberFormat(locale, style);
  4978. var /** @type {?} */ num;
  4979. // Convert strings to numbers
  4980. if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) {
  4981. num = +value;
  4982. }
  4983. else if (typeof value !== 'number') {
  4984. res.error = value + " is not a number";
  4985. return res;
  4986. }
  4987. else {
  4988. num = value;
  4989. }
  4990. var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  4991. var /** @type {?} */ formattedText = '';
  4992. var /** @type {?} */ isZero = false;
  4993. if (!isFinite(num)) {
  4994. formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
  4995. }
  4996. else {
  4997. var /** @type {?} */ parsedNumber = parseNumber(num);
  4998. if (style === NumberFormatStyle.Percent) {
  4999. parsedNumber = toPercent(parsedNumber);
  5000. }
  5001. var /** @type {?} */ minInt = pattern.minInt;
  5002. var /** @type {?} */ minFraction = pattern.minFrac;
  5003. var /** @type {?} */ maxFraction = pattern.maxFrac;
  5004. if (digitsInfo) {
  5005. var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
  5006. if (parts === null) {
  5007. res.error = digitsInfo + " is not a valid digit info";
  5008. return res;
  5009. }
  5010. var /** @type {?} */ minIntPart = parts[1];
  5011. var /** @type {?} */ minFractionPart = parts[3];
  5012. var /** @type {?} */ maxFractionPart = parts[5];
  5013. if (minIntPart != null) {
  5014. minInt = parseIntAutoRadix(minIntPart);
  5015. }
  5016. if (minFractionPart != null) {
  5017. minFraction = parseIntAutoRadix(minFractionPart);
  5018. }
  5019. if (maxFractionPart != null) {
  5020. maxFraction = parseIntAutoRadix(maxFractionPart);
  5021. }
  5022. else if (minFractionPart != null && minFraction > maxFraction) {
  5023. maxFraction = minFraction;
  5024. }
  5025. }
  5026. roundNumber(parsedNumber, minFraction, maxFraction);
  5027. var /** @type {?} */ digits = parsedNumber.digits;
  5028. var /** @type {?} */ integerLen = parsedNumber.integerLen;
  5029. var /** @type {?} */ exponent = parsedNumber.exponent;
  5030. var /** @type {?} */ decimals = [];
  5031. isZero = digits.every(function (d) { return !d; });
  5032. // pad zeros for small numbers
  5033. for (; integerLen < minInt; integerLen++) {
  5034. digits.unshift(0);
  5035. }
  5036. // pad zeros for small numbers
  5037. for (; integerLen < 0; integerLen++) {
  5038. digits.unshift(0);
  5039. }
  5040. // extract decimals digits
  5041. if (integerLen > 0) {
  5042. decimals = digits.splice(integerLen, digits.length);
  5043. }
  5044. else {
  5045. decimals = digits;
  5046. digits = [0];
  5047. }
  5048. // format the integer digits with grouping separators
  5049. var /** @type {?} */ groups = [];
  5050. if (digits.length >= pattern.lgSize) {
  5051. groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
  5052. }
  5053. while (digits.length > pattern.gSize) {
  5054. groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
  5055. }
  5056. if (digits.length) {
  5057. groups.unshift(digits.join(''));
  5058. }
  5059. var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group;
  5060. formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
  5061. // append the decimal digits
  5062. if (decimals.length) {
  5063. var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal;
  5064. formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
  5065. }
  5066. if (exponent) {
  5067. formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
  5068. }
  5069. }
  5070. if (num < 0 && !isZero) {
  5071. formattedText = pattern.negPre + formattedText + pattern.negSuf;
  5072. }
  5073. else {
  5074. formattedText = pattern.posPre + formattedText + pattern.posSuf;
  5075. }
  5076. if (style === NumberFormatStyle.Currency && currency !== null) {
  5077. res.str = formattedText
  5078. .replace(CURRENCY_CHAR, currency)
  5079. .replace(CURRENCY_CHAR, '');
  5080. return res;
  5081. }
  5082. if (style === NumberFormatStyle.Percent) {
  5083. res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
  5084. return res;
  5085. }
  5086. res.str = formattedText;
  5087. return res;
  5088. }
  5089. /**
  5090. * @param {?} format
  5091. * @param {?=} minusSign
  5092. * @return {?}
  5093. */
  5094. function parseNumberFormat(format, minusSign) {
  5095. if (minusSign === void 0) { minusSign = '-'; }
  5096. var /** @type {?} */ p = {
  5097. minInt: 1,
  5098. minFrac: 0,
  5099. maxFrac: 0,
  5100. posPre: '',
  5101. posSuf: '',
  5102. negPre: '',
  5103. negSuf: '',
  5104. gSize: 0,
  5105. lgSize: 0
  5106. };
  5107. var /** @type {?} */ patternParts = format.split(PATTERN_SEP);
  5108. var /** @type {?} */ positive = patternParts[0];
  5109. var /** @type {?} */ negative = patternParts[1];
  5110. var /** @type {?} */ positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
  5111. positive.split(DECIMAL_SEP) :
  5112. [
  5113. positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
  5114. positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
  5115. ], /** @type {?} */
  5116. integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || '';
  5117. p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
  5118. for (var /** @type {?} */ i = 0; i < fraction.length; i++) {
  5119. var /** @type {?} */ ch = fraction.charAt(i);
  5120. if (ch === ZERO_CHAR) {
  5121. p.minFrac = p.maxFrac = i + 1;
  5122. }
  5123. else if (ch === DIGIT_CHAR) {
  5124. p.maxFrac = i + 1;
  5125. }
  5126. else {
  5127. p.posSuf += ch;
  5128. }
  5129. }
  5130. var /** @type {?} */ groups = integer.split(GROUP_SEP);
  5131. p.gSize = groups[1] ? groups[1].length : 0;
  5132. p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
  5133. if (negative) {
  5134. var /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */
  5135. pos = negative.indexOf(DIGIT_CHAR);
  5136. p.negPre = negative.substr(0, pos).replace(/'/g, '');
  5137. p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
  5138. }
  5139. else {
  5140. p.negPre = minusSign + p.posPre;
  5141. p.negSuf = p.posSuf;
  5142. }
  5143. return p;
  5144. }
  5145. /**
  5146. * @param {?} parsedNumber
  5147. * @return {?}
  5148. */
  5149. function toPercent(parsedNumber) {
  5150. // if the number is 0, don't do anything
  5151. if (parsedNumber.digits[0] === 0) {
  5152. return parsedNumber;
  5153. }
  5154. // Getting the current number of decimals
  5155. var /** @type {?} */ fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
  5156. if (parsedNumber.exponent) {
  5157. parsedNumber.exponent += 2;
  5158. }
  5159. else {
  5160. if (fractionLen === 0) {
  5161. parsedNumber.digits.push(0, 0);
  5162. }
  5163. else if (fractionLen === 1) {
  5164. parsedNumber.digits.push(0);
  5165. }
  5166. parsedNumber.integerLen += 2;
  5167. }
  5168. return parsedNumber;
  5169. }
  5170. /**
  5171. * Parses a number.
  5172. * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
  5173. * @param {?} num
  5174. * @return {?}
  5175. */
  5176. function parseNumber(num) {
  5177. var /** @type {?} */ numStr = Math.abs(num) + '';
  5178. var /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen;
  5179. var /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ zeros;
  5180. // Decimal point?
  5181. if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
  5182. numStr = numStr.replace(DECIMAL_SEP, '');
  5183. }
  5184. // Exponential form?
  5185. if ((i = numStr.search(/e/i)) > 0) {
  5186. // Work out the exponent.
  5187. if (integerLen < 0)
  5188. integerLen = i;
  5189. integerLen += +numStr.slice(i + 1);
  5190. numStr = numStr.substring(0, i);
  5191. }
  5192. else if (integerLen < 0) {
  5193. // There was no decimal point or exponent so it is an integer.
  5194. integerLen = numStr.length;
  5195. }
  5196. // Count the number of leading zeros.
  5197. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
  5198. /* empty */
  5199. }
  5200. if (i === (zeros = numStr.length)) {
  5201. // The digits are all zero.
  5202. digits = [0];
  5203. integerLen = 1;
  5204. }
  5205. else {
  5206. // Count the number of trailing zeros
  5207. zeros--;
  5208. while (numStr.charAt(zeros) === ZERO_CHAR)
  5209. zeros--;
  5210. // Trailing zeros are insignificant so ignore them
  5211. integerLen -= i;
  5212. digits = [];
  5213. // Convert string to array of digits without leading/trailing zeros.
  5214. for (j = 0; i <= zeros; i++, j++) {
  5215. digits[j] = +numStr.charAt(i);
  5216. }
  5217. }
  5218. // If the number overflows the maximum allowed digits then use an exponent.
  5219. if (integerLen > MAX_DIGITS) {
  5220. digits = digits.splice(0, MAX_DIGITS - 1);
  5221. exponent = integerLen - 1;
  5222. integerLen = 1;
  5223. }
  5224. return { digits: digits, exponent: exponent, integerLen: integerLen };
  5225. }
  5226. /**
  5227. * Round the parsed number to the specified number of decimal places
  5228. * This function changes the parsedNumber in-place
  5229. * @param {?} parsedNumber
  5230. * @param {?} minFrac
  5231. * @param {?} maxFrac
  5232. * @return {?}
  5233. */
  5234. function roundNumber(parsedNumber, minFrac, maxFrac) {
  5235. if (minFrac > maxFrac) {
  5236. throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
  5237. }
  5238. var /** @type {?} */ digits = parsedNumber.digits;
  5239. var /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen;
  5240. var /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
  5241. // The index of the digit to where rounding is to occur
  5242. var /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen;
  5243. var /** @type {?} */ digit = digits[roundAt];
  5244. if (roundAt > 0) {
  5245. // Drop fractional digits beyond `roundAt`
  5246. digits.splice(Math.max(parsedNumber.integerLen, roundAt));
  5247. // Set non-fractional digits beyond `roundAt` to 0
  5248. for (var /** @type {?} */ j = roundAt; j < digits.length; j++) {
  5249. digits[j] = 0;
  5250. }
  5251. }
  5252. else {
  5253. // We rounded to zero so reset the parsedNumber
  5254. fractionLen = Math.max(0, fractionLen);
  5255. parsedNumber.integerLen = 1;
  5256. digits.length = Math.max(1, roundAt = fractionSize + 1);
  5257. digits[0] = 0;
  5258. for (var /** @type {?} */ i = 1; i < roundAt; i++)
  5259. digits[i] = 0;
  5260. }
  5261. if (digit >= 5) {
  5262. if (roundAt - 1 < 0) {
  5263. for (var /** @type {?} */ k = 0; k > roundAt; k--) {
  5264. digits.unshift(0);
  5265. parsedNumber.integerLen++;
  5266. }
  5267. digits.unshift(1);
  5268. parsedNumber.integerLen++;
  5269. }
  5270. else {
  5271. digits[roundAt - 1]++;
  5272. }
  5273. }
  5274. // Pad out with zeros to get the required fraction length
  5275. for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
  5276. digits.push(0);
  5277. var /** @type {?} */ dropTrailingZeros = fractionSize !== 0;
  5278. // Minimal length = nb of decimals required + current nb of integers
  5279. // Any number besides that is optional and can be removed if it's a trailing 0
  5280. var /** @type {?} */ minLen = minFrac + parsedNumber.integerLen;
  5281. // Do any carrying, e.g. a digit was rounded up to 10
  5282. var /** @type {?} */ carry = digits.reduceRight(function (carry, d, i, digits) {
  5283. d = d + carry;
  5284. digits[i] = d < 10 ? d : d - 10; // d % 10
  5285. if (dropTrailingZeros) {
  5286. // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
  5287. if (digits[i] === 0 && i >= minLen) {
  5288. digits.pop();
  5289. }
  5290. else {
  5291. dropTrailingZeros = false;
  5292. }
  5293. }
  5294. return d >= 10 ? 1 : 0; // Math.floor(d / 10);
  5295. }, 0);
  5296. if (carry) {
  5297. digits.unshift(carry);
  5298. parsedNumber.integerLen++;
  5299. }
  5300. }
  5301. /**
  5302. * \@internal
  5303. * @param {?} text
  5304. * @return {?}
  5305. */
  5306. function parseIntAutoRadix(text) {
  5307. var /** @type {?} */ result = parseInt(text);
  5308. if (isNaN(result)) {
  5309. throw new Error('Invalid integer literal when parsing ' + text);
  5310. }
  5311. return result;
  5312. }
  5313. /**
  5314. * @fileoverview added by tsickle
  5315. * @suppress {checkTypes} checked by tsc
  5316. */
  5317. /**
  5318. * @license
  5319. * Copyright Google Inc. All Rights Reserved.
  5320. *
  5321. * Use of this source code is governed by an MIT-style license that can be
  5322. * found in the LICENSE file at https://angular.io/license
  5323. */
  5324. /**
  5325. * @param {?} pipe
  5326. * @param {?} locale
  5327. * @param {?} value
  5328. * @param {?} style
  5329. * @param {?=} digits
  5330. * @param {?=} currency
  5331. * @param {?=} currencyAsSymbol
  5332. * @return {?}
  5333. */
  5334. function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
  5335. if (currency === void 0) { currency = null; }
  5336. if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
  5337. if (value == null)
  5338. return null;
  5339. // Convert strings to numbers
  5340. value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
  5341. if (typeof value !== 'number') {
  5342. throw invalidPipeArgumentError(pipe, value);
  5343. }
  5344. var /** @type {?} */ minInt;
  5345. var /** @type {?} */ minFraction;
  5346. var /** @type {?} */ maxFraction;
  5347. if (style !== NumberFormatStyle.Currency) {
  5348. // rely on Intl default for currency
  5349. minInt = 1;
  5350. minFraction = 0;
  5351. maxFraction = 3;
  5352. }
  5353. if (digits) {
  5354. var /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP);
  5355. if (parts === null) {
  5356. throw new Error(digits + " is not a valid digit info for number pipes");
  5357. }
  5358. if (parts[1] != null) {
  5359. // min integer digits
  5360. minInt = parseIntAutoRadix(parts[1]);
  5361. }
  5362. if (parts[3] != null) {
  5363. // min fraction digits
  5364. minFraction = parseIntAutoRadix(parts[3]);
  5365. }
  5366. if (parts[5] != null) {
  5367. // max fraction digits
  5368. maxFraction = parseIntAutoRadix(parts[5]);
  5369. }
  5370. }
  5371. return NumberFormatter.format(/** @type {?} */ (value), locale, style, {
  5372. minimumIntegerDigits: minInt,
  5373. minimumFractionDigits: minFraction,
  5374. maximumFractionDigits: maxFraction,
  5375. currency: currency,
  5376. currencyAsSymbol: currencyAsSymbol,
  5377. });
  5378. }
  5379. /**
  5380. * \@ngModule CommonModule
  5381. * \@whatItDoes Formats a number according to locale rules.
  5382. * \@howToUse `number_expression | number[:digitInfo]`
  5383. *
  5384. * Formats a number as text. Group sizing and separator and other locale-specific
  5385. * configurations are based on the active locale.
  5386. *
  5387. * where `expression` is a number:
  5388. * - `digitInfo` is a `string` which has a following format: <br>
  5389. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
  5390. * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
  5391. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
  5392. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
  5393. *
  5394. * For more information on the acceptable range for each of these numbers and other
  5395. * details see your native internationalization library.
  5396. *
  5397. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5398. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5399. *
  5400. * ### Example
  5401. *
  5402. * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
  5403. *
  5404. * \@stable
  5405. */
  5406. var DeprecatedDecimalPipe = /** @class */ (function () {
  5407. function DeprecatedDecimalPipe(_locale) {
  5408. this._locale = _locale;
  5409. }
  5410. /**
  5411. * @param {?} value
  5412. * @param {?=} digits
  5413. * @return {?}
  5414. */
  5415. DeprecatedDecimalPipe.prototype.transform = /**
  5416. * @param {?} value
  5417. * @param {?=} digits
  5418. * @return {?}
  5419. */
  5420. function (value, digits) {
  5421. return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
  5422. };
  5423. DeprecatedDecimalPipe.decorators = [
  5424. { type: _angular_core.Pipe, args: [{ name: 'number' },] },
  5425. ];
  5426. /** @nocollapse */
  5427. DeprecatedDecimalPipe.ctorParameters = function () { return [
  5428. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  5429. ]; };
  5430. return DeprecatedDecimalPipe;
  5431. }());
  5432. /**
  5433. * \@ngModule CommonModule
  5434. * \@whatItDoes Formats a number as a percentage according to locale rules.
  5435. * \@howToUse `number_expression | percent[:digitInfo]`
  5436. *
  5437. * \@description
  5438. *
  5439. * Formats a number as percentage.
  5440. *
  5441. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  5442. *
  5443. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5444. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5445. *
  5446. * ### Example
  5447. *
  5448. * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
  5449. *
  5450. * \@stable
  5451. */
  5452. var DeprecatedPercentPipe = /** @class */ (function () {
  5453. function DeprecatedPercentPipe(_locale) {
  5454. this._locale = _locale;
  5455. }
  5456. /**
  5457. * @param {?} value
  5458. * @param {?=} digits
  5459. * @return {?}
  5460. */
  5461. DeprecatedPercentPipe.prototype.transform = /**
  5462. * @param {?} value
  5463. * @param {?=} digits
  5464. * @return {?}
  5465. */
  5466. function (value, digits) {
  5467. return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
  5468. };
  5469. DeprecatedPercentPipe.decorators = [
  5470. { type: _angular_core.Pipe, args: [{ name: 'percent' },] },
  5471. ];
  5472. /** @nocollapse */
  5473. DeprecatedPercentPipe.ctorParameters = function () { return [
  5474. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  5475. ]; };
  5476. return DeprecatedPercentPipe;
  5477. }());
  5478. /**
  5479. * \@ngModule CommonModule
  5480. * \@whatItDoes Formats a number as currency using locale rules.
  5481. * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`
  5482. * \@description
  5483. *
  5484. * Use `currency` to format a number as currency.
  5485. *
  5486. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  5487. * as `USD` for the US dollar and `EUR` for the euro.
  5488. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
  5489. * - `true`: use symbol (e.g. `$`).
  5490. * - `false`(default): use code (e.g. `USD`).
  5491. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  5492. *
  5493. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  5494. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  5495. *
  5496. * ### Example
  5497. *
  5498. * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
  5499. *
  5500. * \@stable
  5501. */
  5502. var DeprecatedCurrencyPipe = /** @class */ (function () {
  5503. function DeprecatedCurrencyPipe(_locale) {
  5504. this._locale = _locale;
  5505. }
  5506. /**
  5507. * @param {?} value
  5508. * @param {?=} currencyCode
  5509. * @param {?=} symbolDisplay
  5510. * @param {?=} digits
  5511. * @return {?}
  5512. */
  5513. DeprecatedCurrencyPipe.prototype.transform = /**
  5514. * @param {?} value
  5515. * @param {?=} currencyCode
  5516. * @param {?=} symbolDisplay
  5517. * @param {?=} digits
  5518. * @return {?}
  5519. */
  5520. function (value, currencyCode, symbolDisplay, digits) {
  5521. if (currencyCode === void 0) { currencyCode = 'USD'; }
  5522. if (symbolDisplay === void 0) { symbolDisplay = false; }
  5523. return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
  5524. };
  5525. DeprecatedCurrencyPipe.decorators = [
  5526. { type: _angular_core.Pipe, args: [{ name: 'currency' },] },
  5527. ];
  5528. /** @nocollapse */
  5529. DeprecatedCurrencyPipe.ctorParameters = function () { return [
  5530. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  5531. ]; };
  5532. return DeprecatedCurrencyPipe;
  5533. }());
  5534. /**
  5535. * @fileoverview added by tsickle
  5536. * @suppress {checkTypes} checked by tsc
  5537. */
  5538. /**
  5539. * @license
  5540. * Copyright Google Inc. All Rights Reserved.
  5541. *
  5542. * Use of this source code is governed by an MIT-style license that can be
  5543. * found in the LICENSE file at https://angular.io/license
  5544. */
  5545. /**
  5546. * A collection of deprecated i18n pipes that require intl api
  5547. *
  5548. * @deprecated from v5
  5549. */
  5550. var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
  5551. /**
  5552. * @fileoverview added by tsickle
  5553. * @suppress {checkTypes} checked by tsc
  5554. */
  5555. /**
  5556. * @license
  5557. * Copyright Google Inc. All Rights Reserved.
  5558. *
  5559. * Use of this source code is governed by an MIT-style license that can be
  5560. * found in the LICENSE file at https://angular.io/license
  5561. */
  5562. var ObservableStrategy = /** @class */ (function () {
  5563. function ObservableStrategy() {
  5564. }
  5565. /**
  5566. * @param {?} async
  5567. * @param {?} updateLatestValue
  5568. * @return {?}
  5569. */
  5570. ObservableStrategy.prototype.createSubscription = /**
  5571. * @param {?} async
  5572. * @param {?} updateLatestValue
  5573. * @return {?}
  5574. */
  5575. function (async, updateLatestValue) {
  5576. return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
  5577. };
  5578. /**
  5579. * @param {?} subscription
  5580. * @return {?}
  5581. */
  5582. ObservableStrategy.prototype.dispose = /**
  5583. * @param {?} subscription
  5584. * @return {?}
  5585. */
  5586. function (subscription) { subscription.unsubscribe(); };
  5587. /**
  5588. * @param {?} subscription
  5589. * @return {?}
  5590. */
  5591. ObservableStrategy.prototype.onDestroy = /**
  5592. * @param {?} subscription
  5593. * @return {?}
  5594. */
  5595. function (subscription) { subscription.unsubscribe(); };
  5596. return ObservableStrategy;
  5597. }());
  5598. var PromiseStrategy = /** @class */ (function () {
  5599. function PromiseStrategy() {
  5600. }
  5601. /**
  5602. * @param {?} async
  5603. * @param {?} updateLatestValue
  5604. * @return {?}
  5605. */
  5606. PromiseStrategy.prototype.createSubscription = /**
  5607. * @param {?} async
  5608. * @param {?} updateLatestValue
  5609. * @return {?}
  5610. */
  5611. function (async, updateLatestValue) {
  5612. return async.then(updateLatestValue, function (e) { throw e; });
  5613. };
  5614. /**
  5615. * @param {?} subscription
  5616. * @return {?}
  5617. */
  5618. PromiseStrategy.prototype.dispose = /**
  5619. * @param {?} subscription
  5620. * @return {?}
  5621. */
  5622. function (subscription) { };
  5623. /**
  5624. * @param {?} subscription
  5625. * @return {?}
  5626. */
  5627. PromiseStrategy.prototype.onDestroy = /**
  5628. * @param {?} subscription
  5629. * @return {?}
  5630. */
  5631. function (subscription) { };
  5632. return PromiseStrategy;
  5633. }());
  5634. var _promiseStrategy = new PromiseStrategy();
  5635. var _observableStrategy = new ObservableStrategy();
  5636. /**
  5637. * \@ngModule CommonModule
  5638. * \@whatItDoes Unwraps a value from an asynchronous primitive.
  5639. * \@howToUse `observable_or_promise_expression | async`
  5640. * \@description
  5641. * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
  5642. * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
  5643. * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
  5644. * potential memory leaks.
  5645. *
  5646. *
  5647. * ## Examples
  5648. *
  5649. * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
  5650. * promise.
  5651. *
  5652. * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
  5653. *
  5654. * It's also possible to use `async` with Observables. The example below binds the `time` Observable
  5655. * to the view. The Observable continuously updates the view with the current time.
  5656. *
  5657. * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
  5658. *
  5659. * \@stable
  5660. */
  5661. var AsyncPipe = /** @class */ (function () {
  5662. function AsyncPipe(_ref) {
  5663. this._ref = _ref;
  5664. this._latestValue = null;
  5665. this._latestReturnedValue = null;
  5666. this._subscription = null;
  5667. this._obj = null;
  5668. this._strategy = /** @type {?} */ ((null));
  5669. }
  5670. /**
  5671. * @return {?}
  5672. */
  5673. AsyncPipe.prototype.ngOnDestroy = /**
  5674. * @return {?}
  5675. */
  5676. function () {
  5677. if (this._subscription) {
  5678. this._dispose();
  5679. }
  5680. };
  5681. /**
  5682. * @param {?} obj
  5683. * @return {?}
  5684. */
  5685. AsyncPipe.prototype.transform = /**
  5686. * @param {?} obj
  5687. * @return {?}
  5688. */
  5689. function (obj) {
  5690. if (!this._obj) {
  5691. if (obj) {
  5692. this._subscribe(obj);
  5693. }
  5694. this._latestReturnedValue = this._latestValue;
  5695. return this._latestValue;
  5696. }
  5697. if (obj !== this._obj) {
  5698. this._dispose();
  5699. return this.transform(/** @type {?} */ (obj));
  5700. }
  5701. if (this._latestValue === this._latestReturnedValue) {
  5702. return this._latestReturnedValue;
  5703. }
  5704. this._latestReturnedValue = this._latestValue;
  5705. return _angular_core.WrappedValue.wrap(this._latestValue);
  5706. };
  5707. /**
  5708. * @param {?} obj
  5709. * @return {?}
  5710. */
  5711. AsyncPipe.prototype._subscribe = /**
  5712. * @param {?} obj
  5713. * @return {?}
  5714. */
  5715. function (obj) {
  5716. var _this = this;
  5717. this._obj = obj;
  5718. this._strategy = this._selectStrategy(obj);
  5719. this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
  5720. };
  5721. /**
  5722. * @param {?} obj
  5723. * @return {?}
  5724. */
  5725. AsyncPipe.prototype._selectStrategy = /**
  5726. * @param {?} obj
  5727. * @return {?}
  5728. */
  5729. function (obj) {
  5730. if (_angular_core.ɵisPromise(obj)) {
  5731. return _promiseStrategy;
  5732. }
  5733. if (_angular_core.ɵisObservable(obj)) {
  5734. return _observableStrategy;
  5735. }
  5736. throw invalidPipeArgumentError(AsyncPipe, obj);
  5737. };
  5738. /**
  5739. * @return {?}
  5740. */
  5741. AsyncPipe.prototype._dispose = /**
  5742. * @return {?}
  5743. */
  5744. function () {
  5745. this._strategy.dispose(/** @type {?} */ ((this._subscription)));
  5746. this._latestValue = null;
  5747. this._latestReturnedValue = null;
  5748. this._subscription = null;
  5749. this._obj = null;
  5750. };
  5751. /**
  5752. * @param {?} async
  5753. * @param {?} value
  5754. * @return {?}
  5755. */
  5756. AsyncPipe.prototype._updateLatestValue = /**
  5757. * @param {?} async
  5758. * @param {?} value
  5759. * @return {?}
  5760. */
  5761. function (async, value) {
  5762. if (async === this._obj) {
  5763. this._latestValue = value;
  5764. this._ref.markForCheck();
  5765. }
  5766. };
  5767. AsyncPipe.decorators = [
  5768. { type: _angular_core.Pipe, args: [{ name: 'async', pure: false },] },
  5769. ];
  5770. /** @nocollapse */
  5771. AsyncPipe.ctorParameters = function () { return [
  5772. { type: _angular_core.ChangeDetectorRef, },
  5773. ]; };
  5774. return AsyncPipe;
  5775. }());
  5776. /**
  5777. * @fileoverview added by tsickle
  5778. * @suppress {checkTypes} checked by tsc
  5779. */
  5780. /**
  5781. * @license
  5782. * Copyright Google Inc. All Rights Reserved.
  5783. *
  5784. * Use of this source code is governed by an MIT-style license that can be
  5785. * found in the LICENSE file at https://angular.io/license
  5786. */
  5787. /**
  5788. * Transforms text to lowercase.
  5789. *
  5790. * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' }
  5791. *
  5792. * \@stable
  5793. */
  5794. var LowerCasePipe = /** @class */ (function () {
  5795. function LowerCasePipe() {
  5796. }
  5797. /**
  5798. * @param {?} value
  5799. * @return {?}
  5800. */
  5801. LowerCasePipe.prototype.transform = /**
  5802. * @param {?} value
  5803. * @return {?}
  5804. */
  5805. function (value) {
  5806. if (!value)
  5807. return value;
  5808. if (typeof value !== 'string') {
  5809. throw invalidPipeArgumentError(LowerCasePipe, value);
  5810. }
  5811. return value.toLowerCase();
  5812. };
  5813. LowerCasePipe.decorators = [
  5814. { type: _angular_core.Pipe, args: [{ name: 'lowercase' },] },
  5815. ];
  5816. /** @nocollapse */
  5817. LowerCasePipe.ctorParameters = function () { return []; };
  5818. return LowerCasePipe;
  5819. }());
  5820. /**
  5821. * Helper method to transform a single word to titlecase.
  5822. *
  5823. * \@stable
  5824. * @param {?} word
  5825. * @return {?}
  5826. */
  5827. function titleCaseWord(word) {
  5828. if (!word)
  5829. return word;
  5830. return word[0].toUpperCase() + word.substr(1).toLowerCase();
  5831. }
  5832. /**
  5833. * Transforms text to titlecase.
  5834. *
  5835. * \@stable
  5836. */
  5837. var TitleCasePipe = /** @class */ (function () {
  5838. function TitleCasePipe() {
  5839. }
  5840. /**
  5841. * @param {?} value
  5842. * @return {?}
  5843. */
  5844. TitleCasePipe.prototype.transform = /**
  5845. * @param {?} value
  5846. * @return {?}
  5847. */
  5848. function (value) {
  5849. if (!value)
  5850. return value;
  5851. if (typeof value !== 'string') {
  5852. throw invalidPipeArgumentError(TitleCasePipe, value);
  5853. }
  5854. return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join('');
  5855. };
  5856. TitleCasePipe.decorators = [
  5857. { type: _angular_core.Pipe, args: [{ name: 'titlecase' },] },
  5858. ];
  5859. /** @nocollapse */
  5860. TitleCasePipe.ctorParameters = function () { return []; };
  5861. return TitleCasePipe;
  5862. }());
  5863. /**
  5864. * Transforms text to uppercase.
  5865. *
  5866. * \@stable
  5867. */
  5868. var UpperCasePipe = /** @class */ (function () {
  5869. function UpperCasePipe() {
  5870. }
  5871. /**
  5872. * @param {?} value
  5873. * @return {?}
  5874. */
  5875. UpperCasePipe.prototype.transform = /**
  5876. * @param {?} value
  5877. * @return {?}
  5878. */
  5879. function (value) {
  5880. if (!value)
  5881. return value;
  5882. if (typeof value !== 'string') {
  5883. throw invalidPipeArgumentError(UpperCasePipe, value);
  5884. }
  5885. return value.toUpperCase();
  5886. };
  5887. UpperCasePipe.decorators = [
  5888. { type: _angular_core.Pipe, args: [{ name: 'uppercase' },] },
  5889. ];
  5890. /** @nocollapse */
  5891. UpperCasePipe.ctorParameters = function () { return []; };
  5892. return UpperCasePipe;
  5893. }());
  5894. /**
  5895. * @fileoverview added by tsickle
  5896. * @suppress {checkTypes} checked by tsc
  5897. */
  5898. /**
  5899. * @license
  5900. * Copyright Google Inc. All Rights Reserved.
  5901. *
  5902. * Use of this source code is governed by an MIT-style license that can be
  5903. * found in the LICENSE file at https://angular.io/license
  5904. */
  5905. var _INTERPOLATION_REGEXP = /#/g;
  5906. /**
  5907. * \@ngModule CommonModule
  5908. * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules.
  5909. * \@howToUse `expression | i18nPlural:mapping[:locale]`
  5910. * \@description
  5911. *
  5912. * Where:
  5913. * - `expression` is a number.
  5914. * - `mapping` is an object that mimics the ICU format, see
  5915. * http://userguide.icu-project.org/formatparse/messages
  5916. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  5917. * default)
  5918. *
  5919. * ## Example
  5920. *
  5921. * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
  5922. *
  5923. * \@experimental
  5924. */
  5925. var I18nPluralPipe = /** @class */ (function () {
  5926. function I18nPluralPipe(_localization) {
  5927. this._localization = _localization;
  5928. }
  5929. /**
  5930. * @param {?} value
  5931. * @param {?} pluralMap
  5932. * @param {?=} locale
  5933. * @return {?}
  5934. */
  5935. I18nPluralPipe.prototype.transform = /**
  5936. * @param {?} value
  5937. * @param {?} pluralMap
  5938. * @param {?=} locale
  5939. * @return {?}
  5940. */
  5941. function (value, pluralMap, locale) {
  5942. if (value == null)
  5943. return '';
  5944. if (typeof pluralMap !== 'object' || pluralMap === null) {
  5945. throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
  5946. }
  5947. var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
  5948. return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
  5949. };
  5950. I18nPluralPipe.decorators = [
  5951. { type: _angular_core.Pipe, args: [{ name: 'i18nPlural', pure: true },] },
  5952. ];
  5953. /** @nocollapse */
  5954. I18nPluralPipe.ctorParameters = function () { return [
  5955. { type: NgLocalization, },
  5956. ]; };
  5957. return I18nPluralPipe;
  5958. }());
  5959. /**
  5960. * @fileoverview added by tsickle
  5961. * @suppress {checkTypes} checked by tsc
  5962. */
  5963. /**
  5964. * @license
  5965. * Copyright Google Inc. All Rights Reserved.
  5966. *
  5967. * Use of this source code is governed by an MIT-style license that can be
  5968. * found in the LICENSE file at https://angular.io/license
  5969. */
  5970. /**
  5971. * \@ngModule CommonModule
  5972. * \@whatItDoes Generic selector that displays the string that matches the current value.
  5973. * \@howToUse `expression | i18nSelect:mapping`
  5974. * \@description
  5975. *
  5976. * Where `mapping` is an object that indicates the text that should be displayed
  5977. * for different values of the provided `expression`.
  5978. * If none of the keys of the mapping match the value of the `expression`, then the content
  5979. * of the `other` key is returned when present, otherwise an empty string is returned.
  5980. *
  5981. * ## Example
  5982. *
  5983. * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
  5984. *
  5985. * \@experimental
  5986. */
  5987. var I18nSelectPipe = /** @class */ (function () {
  5988. function I18nSelectPipe() {
  5989. }
  5990. /**
  5991. * @param {?} value
  5992. * @param {?} mapping
  5993. * @return {?}
  5994. */
  5995. I18nSelectPipe.prototype.transform = /**
  5996. * @param {?} value
  5997. * @param {?} mapping
  5998. * @return {?}
  5999. */
  6000. function (value, mapping) {
  6001. if (value == null)
  6002. return '';
  6003. if (typeof mapping !== 'object' || typeof value !== 'string') {
  6004. throw invalidPipeArgumentError(I18nSelectPipe, mapping);
  6005. }
  6006. if (mapping.hasOwnProperty(value)) {
  6007. return mapping[value];
  6008. }
  6009. if (mapping.hasOwnProperty('other')) {
  6010. return mapping['other'];
  6011. }
  6012. return '';
  6013. };
  6014. I18nSelectPipe.decorators = [
  6015. { type: _angular_core.Pipe, args: [{ name: 'i18nSelect', pure: true },] },
  6016. ];
  6017. /** @nocollapse */
  6018. I18nSelectPipe.ctorParameters = function () { return []; };
  6019. return I18nSelectPipe;
  6020. }());
  6021. /**
  6022. * @fileoverview added by tsickle
  6023. * @suppress {checkTypes} checked by tsc
  6024. */
  6025. /**
  6026. * @license
  6027. * Copyright Google Inc. All Rights Reserved.
  6028. *
  6029. * Use of this source code is governed by an MIT-style license that can be
  6030. * found in the LICENSE file at https://angular.io/license
  6031. */
  6032. /**
  6033. * \@ngModule CommonModule
  6034. * \@whatItDoes Converts value into JSON string.
  6035. * \@howToUse `expression | json`
  6036. * \@description
  6037. *
  6038. * Converts value into string using `JSON.stringify`. Useful for debugging.
  6039. *
  6040. * ### Example
  6041. * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
  6042. *
  6043. * \@stable
  6044. */
  6045. var JsonPipe = /** @class */ (function () {
  6046. function JsonPipe() {
  6047. }
  6048. /**
  6049. * @param {?} value
  6050. * @return {?}
  6051. */
  6052. JsonPipe.prototype.transform = /**
  6053. * @param {?} value
  6054. * @return {?}
  6055. */
  6056. function (value) { return JSON.stringify(value, null, 2); };
  6057. JsonPipe.decorators = [
  6058. { type: _angular_core.Pipe, args: [{ name: 'json', pure: false },] },
  6059. ];
  6060. /** @nocollapse */
  6061. JsonPipe.ctorParameters = function () { return []; };
  6062. return JsonPipe;
  6063. }());
  6064. /**
  6065. * @fileoverview added by tsickle
  6066. * @suppress {checkTypes} checked by tsc
  6067. */
  6068. /**
  6069. * @license
  6070. * Copyright Google Inc. All Rights Reserved.
  6071. *
  6072. * Use of this source code is governed by an MIT-style license that can be
  6073. * found in the LICENSE file at https://angular.io/license
  6074. */
  6075. /**
  6076. * \@ngModule CommonModule
  6077. * \@whatItDoes Formats a number according to locale rules.
  6078. * \@howToUse `number_expression | number[:digitInfo[:locale]]`
  6079. *
  6080. * Formats a number as text. Group sizing and separator and other locale-specific
  6081. * configurations are based on the active locale.
  6082. *
  6083. * where `expression` is a number:
  6084. * - `digitInfo` is a `string` which has a following format: <br>
  6085. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
  6086. * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
  6087. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
  6088. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
  6089. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6090. * default)
  6091. *
  6092. * For more information on the acceptable range for each of these numbers and other
  6093. * details see your native internationalization library.
  6094. *
  6095. * ### Example
  6096. *
  6097. * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
  6098. *
  6099. * \@stable
  6100. */
  6101. var DecimalPipe = /** @class */ (function () {
  6102. function DecimalPipe(_locale) {
  6103. this._locale = _locale;
  6104. }
  6105. /**
  6106. * @param {?} value
  6107. * @param {?=} digits
  6108. * @param {?=} locale
  6109. * @return {?}
  6110. */
  6111. DecimalPipe.prototype.transform = /**
  6112. * @param {?} value
  6113. * @param {?=} digits
  6114. * @param {?=} locale
  6115. * @return {?}
  6116. */
  6117. function (value, digits, locale) {
  6118. if (isEmpty(value))
  6119. return null;
  6120. locale = locale || this._locale;
  6121. var _a = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits), str = _a.str, error = _a.error;
  6122. if (error) {
  6123. throw invalidPipeArgumentError(DecimalPipe, error);
  6124. }
  6125. return str;
  6126. };
  6127. DecimalPipe.decorators = [
  6128. { type: _angular_core.Pipe, args: [{ name: 'number' },] },
  6129. ];
  6130. /** @nocollapse */
  6131. DecimalPipe.ctorParameters = function () { return [
  6132. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  6133. ]; };
  6134. return DecimalPipe;
  6135. }());
  6136. /**
  6137. * \@ngModule CommonModule
  6138. * \@whatItDoes Formats a number as a percentage according to locale rules.
  6139. * \@howToUse `number_expression | percent[:digitInfo[:locale]]`
  6140. *
  6141. * \@description
  6142. *
  6143. * Formats a number as percentage.
  6144. *
  6145. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  6146. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6147. * default)
  6148. *
  6149. * ### Example
  6150. *
  6151. * {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
  6152. *
  6153. * \@stable
  6154. */
  6155. var PercentPipe = /** @class */ (function () {
  6156. function PercentPipe(_locale) {
  6157. this._locale = _locale;
  6158. }
  6159. /**
  6160. * @param {?} value
  6161. * @param {?=} digits
  6162. * @param {?=} locale
  6163. * @return {?}
  6164. */
  6165. PercentPipe.prototype.transform = /**
  6166. * @param {?} value
  6167. * @param {?=} digits
  6168. * @param {?=} locale
  6169. * @return {?}
  6170. */
  6171. function (value, digits, locale) {
  6172. if (isEmpty(value))
  6173. return null;
  6174. locale = locale || this._locale;
  6175. var _a = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits), str = _a.str, error = _a.error;
  6176. if (error) {
  6177. throw invalidPipeArgumentError(PercentPipe, error);
  6178. }
  6179. return str;
  6180. };
  6181. PercentPipe.decorators = [
  6182. { type: _angular_core.Pipe, args: [{ name: 'percent' },] },
  6183. ];
  6184. /** @nocollapse */
  6185. PercentPipe.ctorParameters = function () { return [
  6186. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  6187. ]; };
  6188. return PercentPipe;
  6189. }());
  6190. /**
  6191. * \@ngModule CommonModule
  6192. * \@whatItDoes Formats a number as currency using locale rules.
  6193. * \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]`
  6194. * \@description
  6195. *
  6196. * Use `currency` to format a number as currency.
  6197. *
  6198. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  6199. * as `USD` for the US dollar and `EUR` for the euro.
  6200. * - `display` indicates whether to show the currency symbol or the code.
  6201. * - `code`: use code (e.g. `USD`).
  6202. * - `symbol`(default): use symbol (e.g. `$`).
  6203. * - `symbol-narrow`: some countries have two symbols for their currency, one regular and one
  6204. * narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`).
  6205. * - boolean (deprecated from v5): `true` for symbol and false for `code`
  6206. * If there is no narrow symbol for the chosen currency, the regular symbol will be used.
  6207. * - `digitInfo` See {\@link DecimalPipe} for detailed description.
  6208. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
  6209. * default)
  6210. *
  6211. * ### Example
  6212. *
  6213. * {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
  6214. *
  6215. * \@stable
  6216. */
  6217. var CurrencyPipe = /** @class */ (function () {
  6218. function CurrencyPipe(_locale) {
  6219. this._locale = _locale;
  6220. }
  6221. /**
  6222. * @param {?} value
  6223. * @param {?=} currencyCode
  6224. * @param {?=} display
  6225. * @param {?=} digits
  6226. * @param {?=} locale
  6227. * @return {?}
  6228. */
  6229. CurrencyPipe.prototype.transform = /**
  6230. * @param {?} value
  6231. * @param {?=} currencyCode
  6232. * @param {?=} display
  6233. * @param {?=} digits
  6234. * @param {?=} locale
  6235. * @return {?}
  6236. */
  6237. function (value, currencyCode, display, digits, locale) {
  6238. if (display === void 0) { display = 'symbol'; }
  6239. if (isEmpty(value))
  6240. return null;
  6241. locale = locale || this._locale;
  6242. if (typeof display === 'boolean') {
  6243. if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
  6244. console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".");
  6245. }
  6246. display = display ? 'symbol' : 'code';
  6247. }
  6248. var /** @type {?} */ currency = currencyCode || 'USD';
  6249. if (display !== 'code') {
  6250. currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow');
  6251. }
  6252. var _a = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency), str = _a.str, error = _a.error;
  6253. if (error) {
  6254. throw invalidPipeArgumentError(CurrencyPipe, error);
  6255. }
  6256. return str;
  6257. };
  6258. CurrencyPipe.decorators = [
  6259. { type: _angular_core.Pipe, args: [{ name: 'currency' },] },
  6260. ];
  6261. /** @nocollapse */
  6262. CurrencyPipe.ctorParameters = function () { return [
  6263. { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_core.LOCALE_ID,] },] },
  6264. ]; };
  6265. return CurrencyPipe;
  6266. }());
  6267. /**
  6268. * @param {?} value
  6269. * @return {?}
  6270. */
  6271. function isEmpty(value) {
  6272. return value == null || value === '' || value !== value;
  6273. }
  6274. /**
  6275. * @fileoverview added by tsickle
  6276. * @suppress {checkTypes} checked by tsc
  6277. */
  6278. /**
  6279. * @license
  6280. * Copyright Google Inc. All Rights Reserved.
  6281. *
  6282. * Use of this source code is governed by an MIT-style license that can be
  6283. * found in the LICENSE file at https://angular.io/license
  6284. */
  6285. /**
  6286. * \@ngModule CommonModule
  6287. * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements.
  6288. * \@howToUse `array_or_string_expression | slice:start[:end]`
  6289. * \@description
  6290. *
  6291. * Where the input expression is a `List` or `String`, and:
  6292. * - `start`: The starting index of the subset to return.
  6293. * - **a positive integer**: return the item at `start` index and all items after
  6294. * in the list or string expression.
  6295. * - **a negative integer**: return the item at `start` index from the end and all items after
  6296. * in the list or string expression.
  6297. * - **if positive and greater than the size of the expression**: return an empty list or string.
  6298. * - **if negative and greater than the size of the expression**: return entire list or string.
  6299. * - `end`: The ending index of the subset to return.
  6300. * - **omitted**: return all items until the end.
  6301. * - **if positive**: return all items before `end` index of the list or string.
  6302. * - **if negative**: return all items before `end` index from the end of the list or string.
  6303. *
  6304. * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
  6305. * and `String.prototype.slice()`.
  6306. *
  6307. * When operating on a [List], the returned list is always a copy even when all
  6308. * the elements are being returned.
  6309. *
  6310. * When operating on a blank value, the pipe returns the blank value.
  6311. *
  6312. * ## List Example
  6313. *
  6314. * This `ngFor` example:
  6315. *
  6316. * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
  6317. *
  6318. * produces the following:
  6319. *
  6320. * <li>b</li>
  6321. * <li>c</li>
  6322. *
  6323. * ## String Examples
  6324. *
  6325. * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
  6326. *
  6327. * \@stable
  6328. */
  6329. var SlicePipe = /** @class */ (function () {
  6330. function SlicePipe() {
  6331. }
  6332. /**
  6333. * @param {?} value
  6334. * @param {?} start
  6335. * @param {?=} end
  6336. * @return {?}
  6337. */
  6338. SlicePipe.prototype.transform = /**
  6339. * @param {?} value
  6340. * @param {?} start
  6341. * @param {?=} end
  6342. * @return {?}
  6343. */
  6344. function (value, start, end) {
  6345. if (value == null)
  6346. return value;
  6347. if (!this.supports(value)) {
  6348. throw invalidPipeArgumentError(SlicePipe, value);
  6349. }
  6350. return value.slice(start, end);
  6351. };
  6352. /**
  6353. * @param {?} obj
  6354. * @return {?}
  6355. */
  6356. SlicePipe.prototype.supports = /**
  6357. * @param {?} obj
  6358. * @return {?}
  6359. */
  6360. function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
  6361. SlicePipe.decorators = [
  6362. { type: _angular_core.Pipe, args: [{ name: 'slice', pure: false },] },
  6363. ];
  6364. /** @nocollapse */
  6365. SlicePipe.ctorParameters = function () { return []; };
  6366. return SlicePipe;
  6367. }());
  6368. /**
  6369. * @fileoverview added by tsickle
  6370. * @suppress {checkTypes} checked by tsc
  6371. */
  6372. /**
  6373. * @license
  6374. * Copyright Google Inc. All Rights Reserved.
  6375. *
  6376. * Use of this source code is governed by an MIT-style license that can be
  6377. * found in the LICENSE file at https://angular.io/license
  6378. */
  6379. /**
  6380. * A collection of Angular pipes that are likely to be used in each and every application.
  6381. */
  6382. var COMMON_PIPES = [
  6383. AsyncPipe,
  6384. UpperCasePipe,
  6385. LowerCasePipe,
  6386. JsonPipe,
  6387. SlicePipe,
  6388. DecimalPipe,
  6389. PercentPipe,
  6390. TitleCasePipe,
  6391. CurrencyPipe,
  6392. DatePipe,
  6393. I18nPluralPipe,
  6394. I18nSelectPipe,
  6395. ];
  6396. /**
  6397. * @fileoverview added by tsickle
  6398. * @suppress {checkTypes} checked by tsc
  6399. */
  6400. /**
  6401. * @license
  6402. * Copyright Google Inc. All Rights Reserved.
  6403. *
  6404. * Use of this source code is governed by an MIT-style license that can be
  6405. * found in the LICENSE file at https://angular.io/license
  6406. */
  6407. /**
  6408. * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ...
  6409. *
  6410. * \@stable
  6411. */
  6412. var CommonModule = /** @class */ (function () {
  6413. function CommonModule() {
  6414. }
  6415. CommonModule.decorators = [
  6416. { type: _angular_core.NgModule, args: [{
  6417. declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
  6418. exports: [COMMON_DIRECTIVES, COMMON_PIPES],
  6419. providers: [
  6420. { provide: NgLocalization, useClass: NgLocaleLocalization },
  6421. ],
  6422. },] },
  6423. ];
  6424. /** @nocollapse */
  6425. CommonModule.ctorParameters = function () { return []; };
  6426. return CommonModule;
  6427. }());
  6428. var ɵ0 = getPluralCase;
  6429. /**
  6430. * A module that contains the deprecated i18n pipes.
  6431. *
  6432. * @deprecated from v5
  6433. */
  6434. var DeprecatedI18NPipesModule = /** @class */ (function () {
  6435. function DeprecatedI18NPipesModule() {
  6436. }
  6437. DeprecatedI18NPipesModule.decorators = [
  6438. { type: _angular_core.NgModule, args: [{
  6439. declarations: [COMMON_DEPRECATED_I18N_PIPES],
  6440. exports: [COMMON_DEPRECATED_I18N_PIPES],
  6441. providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }],
  6442. },] },
  6443. ];
  6444. /** @nocollapse */
  6445. DeprecatedI18NPipesModule.ctorParameters = function () { return []; };
  6446. return DeprecatedI18NPipesModule;
  6447. }());
  6448. /**
  6449. * @fileoverview added by tsickle
  6450. * @suppress {checkTypes} checked by tsc
  6451. */
  6452. /**
  6453. * @license
  6454. * Copyright Google Inc. All Rights Reserved.
  6455. *
  6456. * Use of this source code is governed by an MIT-style license that can be
  6457. * found in the LICENSE file at https://angular.io/license
  6458. */
  6459. /**
  6460. * A DI Token representing the main rendering context. In a browser this is the DOM Document.
  6461. *
  6462. * Note: Document might not be available in the Application Context when Application and Rendering
  6463. * Contexts are not the same (e.g. when running the application into a Web Worker).
  6464. *
  6465. * \@stable
  6466. */
  6467. var DOCUMENT = new _angular_core.InjectionToken('DocumentToken');
  6468. /**
  6469. * @fileoverview added by tsickle
  6470. * @suppress {checkTypes} checked by tsc
  6471. */
  6472. /**
  6473. * @license
  6474. * Copyright Google Inc. All Rights Reserved.
  6475. *
  6476. * Use of this source code is governed by an MIT-style license that can be
  6477. * found in the LICENSE file at https://angular.io/license
  6478. */
  6479. var PLATFORM_BROWSER_ID = 'browser';
  6480. var PLATFORM_SERVER_ID = 'server';
  6481. var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
  6482. var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
  6483. /**
  6484. * Returns whether a platform id represents a browser platform.
  6485. * \@experimental
  6486. * @param {?} platformId
  6487. * @return {?}
  6488. */
  6489. function isPlatformBrowser(platformId) {
  6490. return platformId === PLATFORM_BROWSER_ID;
  6491. }
  6492. /**
  6493. * Returns whether a platform id represents a server platform.
  6494. * \@experimental
  6495. * @param {?} platformId
  6496. * @return {?}
  6497. */
  6498. function isPlatformServer(platformId) {
  6499. return platformId === PLATFORM_SERVER_ID;
  6500. }
  6501. /**
  6502. * Returns whether a platform id represents a web worker app platform.
  6503. * \@experimental
  6504. * @param {?} platformId
  6505. * @return {?}
  6506. */
  6507. function isPlatformWorkerApp(platformId) {
  6508. return platformId === PLATFORM_WORKER_APP_ID;
  6509. }
  6510. /**
  6511. * Returns whether a platform id represents a web worker UI platform.
  6512. * \@experimental
  6513. * @param {?} platformId
  6514. * @return {?}
  6515. */
  6516. function isPlatformWorkerUi(platformId) {
  6517. return platformId === PLATFORM_WORKER_UI_ID;
  6518. }
  6519. /**
  6520. * @fileoverview added by tsickle
  6521. * @suppress {checkTypes} checked by tsc
  6522. */
  6523. /**
  6524. * @license
  6525. * Copyright Google Inc. All Rights Reserved.
  6526. *
  6527. * Use of this source code is governed by an MIT-style license that can be
  6528. * found in the LICENSE file at https://angular.io/license
  6529. */
  6530. /**
  6531. * \@stable
  6532. */
  6533. var VERSION = new _angular_core.Version('5.2.11');
  6534. exports.ɵregisterLocaleData = registerLocaleData;
  6535. exports.NgLocaleLocalization = NgLocaleLocalization;
  6536. exports.NgLocalization = NgLocalization;
  6537. exports.registerLocaleData = registerLocaleData;
  6538. exports.Plural = Plural;
  6539. exports.NumberFormatStyle = NumberFormatStyle;
  6540. exports.FormStyle = FormStyle;
  6541. exports.TranslationWidth = TranslationWidth;
  6542. exports.FormatWidth = FormatWidth;
  6543. exports.NumberSymbol = NumberSymbol;
  6544. exports.WeekDay = WeekDay;
  6545. exports.getCurrencySymbol = getCurrencySymbol;
  6546. exports.getLocaleDayPeriods = getLocaleDayPeriods;
  6547. exports.getLocaleDayNames = getLocaleDayNames;
  6548. exports.getLocaleMonthNames = getLocaleMonthNames;
  6549. exports.getLocaleId = getLocaleId;
  6550. exports.getLocaleEraNames = getLocaleEraNames;
  6551. exports.getLocaleWeekEndRange = getLocaleWeekEndRange;
  6552. exports.getLocaleFirstDayOfWeek = getLocaleFirstDayOfWeek;
  6553. exports.getLocaleDateFormat = getLocaleDateFormat;
  6554. exports.getLocaleDateTimeFormat = getLocaleDateTimeFormat;
  6555. exports.getLocaleExtraDayPeriodRules = getLocaleExtraDayPeriodRules;
  6556. exports.getLocaleExtraDayPeriods = getLocaleExtraDayPeriods;
  6557. exports.getLocalePluralCase = getLocalePluralCase;
  6558. exports.getLocaleTimeFormat = getLocaleTimeFormat;
  6559. exports.getLocaleNumberSymbol = getLocaleNumberSymbol;
  6560. exports.getLocaleNumberFormat = getLocaleNumberFormat;
  6561. exports.getLocaleCurrencyName = getLocaleCurrencyName;
  6562. exports.getLocaleCurrencySymbol = getLocaleCurrencySymbol;
  6563. exports.ɵparseCookieValue = parseCookieValue;
  6564. exports.CommonModule = CommonModule;
  6565. exports.DeprecatedI18NPipesModule = DeprecatedI18NPipesModule;
  6566. exports.NgClass = NgClass;
  6567. exports.NgForOf = NgForOf;
  6568. exports.NgForOfContext = NgForOfContext;
  6569. exports.NgIf = NgIf;
  6570. exports.NgIfContext = NgIfContext;
  6571. exports.NgPlural = NgPlural;
  6572. exports.NgPluralCase = NgPluralCase;
  6573. exports.NgStyle = NgStyle;
  6574. exports.NgSwitch = NgSwitch;
  6575. exports.NgSwitchCase = NgSwitchCase;
  6576. exports.NgSwitchDefault = NgSwitchDefault;
  6577. exports.NgTemplateOutlet = NgTemplateOutlet;
  6578. exports.NgComponentOutlet = NgComponentOutlet;
  6579. exports.DOCUMENT = DOCUMENT;
  6580. exports.AsyncPipe = AsyncPipe;
  6581. exports.DatePipe = DatePipe;
  6582. exports.I18nPluralPipe = I18nPluralPipe;
  6583. exports.I18nSelectPipe = I18nSelectPipe;
  6584. exports.JsonPipe = JsonPipe;
  6585. exports.LowerCasePipe = LowerCasePipe;
  6586. exports.CurrencyPipe = CurrencyPipe;
  6587. exports.DecimalPipe = DecimalPipe;
  6588. exports.PercentPipe = PercentPipe;
  6589. exports.SlicePipe = SlicePipe;
  6590. exports.UpperCasePipe = UpperCasePipe;
  6591. exports.TitleCasePipe = TitleCasePipe;
  6592. exports.DeprecatedDatePipe = DeprecatedDatePipe;
  6593. exports.DeprecatedCurrencyPipe = DeprecatedCurrencyPipe;
  6594. exports.DeprecatedDecimalPipe = DeprecatedDecimalPipe;
  6595. exports.DeprecatedPercentPipe = DeprecatedPercentPipe;
  6596. exports.ɵPLATFORM_BROWSER_ID = PLATFORM_BROWSER_ID;
  6597. exports.ɵPLATFORM_SERVER_ID = PLATFORM_SERVER_ID;
  6598. exports.ɵPLATFORM_WORKER_APP_ID = PLATFORM_WORKER_APP_ID;
  6599. exports.ɵPLATFORM_WORKER_UI_ID = PLATFORM_WORKER_UI_ID;
  6600. exports.isPlatformBrowser = isPlatformBrowser;
  6601. exports.isPlatformServer = isPlatformServer;
  6602. exports.isPlatformWorkerApp = isPlatformWorkerApp;
  6603. exports.isPlatformWorkerUi = isPlatformWorkerUi;
  6604. exports.VERSION = VERSION;
  6605. exports.PlatformLocation = PlatformLocation;
  6606. exports.LOCATION_INITIALIZED = LOCATION_INITIALIZED;
  6607. exports.LocationStrategy = LocationStrategy;
  6608. exports.APP_BASE_HREF = APP_BASE_HREF;
  6609. exports.HashLocationStrategy = HashLocationStrategy;
  6610. exports.PathLocationStrategy = PathLocationStrategy;
  6611. exports.Location = Location;
  6612. exports.ɵe = COMMON_DIRECTIVES;
  6613. exports.ɵd = findLocaleData;
  6614. exports.ɵa = DEPRECATED_PLURAL_FN;
  6615. exports.ɵb = getPluralCase;
  6616. exports.ɵg = COMMON_DEPRECATED_I18N_PIPES;
  6617. exports.ɵf = COMMON_PIPES;
  6618. Object.defineProperty(exports, '__esModule', { value: true });
  6619. })));
  6620. //# sourceMappingURL=common.umd.js.map