chunk-VHSNDQRF.js 179 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157
  1. import {
  2. ApplicationRef,
  3. Attribute,
  4. ChangeDetectorRef,
  5. DEFAULT_CURRENCY_CODE,
  6. DOCUMENT,
  7. DestroyRef,
  8. Directive,
  9. ElementRef,
  10. Host,
  11. IMAGE_CONFIG,
  12. IMAGE_CONFIG_DEFAULTS,
  13. INTERNAL_APPLICATION_ERROR_HANDLER,
  14. Inject,
  15. Injectable,
  16. InjectionToken,
  17. Injector,
  18. Input,
  19. IterableDiffers,
  20. KeyValueDiffers,
  21. LOCALE_ID,
  22. LocaleDataIndex,
  23. NgModule,
  24. NgModuleRef$1,
  25. NgZone,
  26. Optional,
  27. Pipe,
  28. Renderer2,
  29. RendererStyleFlags2,
  30. RuntimeError,
  31. Subject,
  32. TemplateRef,
  33. Version,
  34. ViewContainerRef,
  35. booleanAttribute,
  36. createNgModule,
  37. findLocaleData,
  38. formatRuntimeError,
  39. getLocaleCurrencyCode,
  40. getLocalePluralCase,
  41. inject,
  42. isPromise,
  43. isSubscribable,
  44. numberAttribute,
  45. performanceMarkFeature,
  46. registerLocaleData,
  47. setClassMetadata,
  48. stringify,
  49. untracked,
  50. unwrapSafeValue,
  51. ɵɵNgOnChangesFeature,
  52. ɵɵdefineDirective,
  53. ɵɵdefineInjectable,
  54. ɵɵdefineInjector,
  55. ɵɵdefineNgModule,
  56. ɵɵdefinePipe,
  57. ɵɵdirectiveInject,
  58. ɵɵinject,
  59. ɵɵinjectAttribute,
  60. ɵɵstyleProp
  61. } from "./chunk-Y7NS2SYH.js";
  62. import {
  63. __async,
  64. __spreadProps,
  65. __spreadValues
  66. } from "./chunk-WDMUDEB6.js";
  67. // node_modules/@angular/common/fesm2022/location.mjs
  68. var _DOM = null;
  69. function getDOM() {
  70. return _DOM;
  71. }
  72. function setRootDomAdapter(adapter) {
  73. _DOM ??= adapter;
  74. }
  75. var DomAdapter = class {
  76. };
  77. var PlatformLocation = class _PlatformLocation {
  78. historyGo(relativePosition) {
  79. throw new Error(ngDevMode ? "Not implemented" : "");
  80. }
  81. static ɵfac = function PlatformLocation_Factory(__ngFactoryType__) {
  82. return new (__ngFactoryType__ || _PlatformLocation)();
  83. };
  84. static ɵprov = ɵɵdefineInjectable({
  85. token: _PlatformLocation,
  86. factory: () => (() => inject(BrowserPlatformLocation))(),
  87. providedIn: "platform"
  88. });
  89. };
  90. (() => {
  91. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformLocation, [{
  92. type: Injectable,
  93. args: [{
  94. providedIn: "platform",
  95. useFactory: () => inject(BrowserPlatformLocation)
  96. }]
  97. }], null, null);
  98. })();
  99. var LOCATION_INITIALIZED = new InjectionToken(ngDevMode ? "Location Initialized" : "");
  100. var BrowserPlatformLocation = class _BrowserPlatformLocation extends PlatformLocation {
  101. _location;
  102. _history;
  103. _doc = inject(DOCUMENT);
  104. constructor() {
  105. super();
  106. this._location = window.location;
  107. this._history = window.history;
  108. }
  109. getBaseHrefFromDOM() {
  110. return getDOM().getBaseHref(this._doc);
  111. }
  112. onPopState(fn) {
  113. const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
  114. window2.addEventListener("popstate", fn, false);
  115. return () => window2.removeEventListener("popstate", fn);
  116. }
  117. onHashChange(fn) {
  118. const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
  119. window2.addEventListener("hashchange", fn, false);
  120. return () => window2.removeEventListener("hashchange", fn);
  121. }
  122. get href() {
  123. return this._location.href;
  124. }
  125. get protocol() {
  126. return this._location.protocol;
  127. }
  128. get hostname() {
  129. return this._location.hostname;
  130. }
  131. get port() {
  132. return this._location.port;
  133. }
  134. get pathname() {
  135. return this._location.pathname;
  136. }
  137. get search() {
  138. return this._location.search;
  139. }
  140. get hash() {
  141. return this._location.hash;
  142. }
  143. set pathname(newPath) {
  144. this._location.pathname = newPath;
  145. }
  146. pushState(state, title, url) {
  147. this._history.pushState(state, title, url);
  148. }
  149. replaceState(state, title, url) {
  150. this._history.replaceState(state, title, url);
  151. }
  152. forward() {
  153. this._history.forward();
  154. }
  155. back() {
  156. this._history.back();
  157. }
  158. historyGo(relativePosition = 0) {
  159. this._history.go(relativePosition);
  160. }
  161. getState() {
  162. return this._history.state;
  163. }
  164. static ɵfac = function BrowserPlatformLocation_Factory(__ngFactoryType__) {
  165. return new (__ngFactoryType__ || _BrowserPlatformLocation)();
  166. };
  167. static ɵprov = ɵɵdefineInjectable({
  168. token: _BrowserPlatformLocation,
  169. factory: () => (() => new _BrowserPlatformLocation())(),
  170. providedIn: "platform"
  171. });
  172. };
  173. (() => {
  174. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserPlatformLocation, [{
  175. type: Injectable,
  176. args: [{
  177. providedIn: "platform",
  178. useFactory: () => new BrowserPlatformLocation()
  179. }]
  180. }], () => [], null);
  181. })();
  182. function joinWithSlash(start, end) {
  183. if (!start) return end;
  184. if (!end) return start;
  185. if (start.endsWith("/")) {
  186. return end.startsWith("/") ? start + end.slice(1) : start + end;
  187. }
  188. return end.startsWith("/") ? start + end : `${start}/${end}`;
  189. }
  190. function stripTrailingSlash(url) {
  191. const pathEndIdx = url.search(/#|\?|$/);
  192. return url[pathEndIdx - 1] === "/" ? url.slice(0, pathEndIdx - 1) + url.slice(pathEndIdx) : url;
  193. }
  194. function normalizeQueryParams(params) {
  195. return params && params[0] !== "?" ? `?${params}` : params;
  196. }
  197. var LocationStrategy = class _LocationStrategy {
  198. historyGo(relativePosition) {
  199. throw new Error(ngDevMode ? "Not implemented" : "");
  200. }
  201. static ɵfac = function LocationStrategy_Factory(__ngFactoryType__) {
  202. return new (__ngFactoryType__ || _LocationStrategy)();
  203. };
  204. static ɵprov = ɵɵdefineInjectable({
  205. token: _LocationStrategy,
  206. factory: () => (() => inject(PathLocationStrategy))(),
  207. providedIn: "root"
  208. });
  209. };
  210. (() => {
  211. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LocationStrategy, [{
  212. type: Injectable,
  213. args: [{
  214. providedIn: "root",
  215. useFactory: () => inject(PathLocationStrategy)
  216. }]
  217. }], null, null);
  218. })();
  219. var APP_BASE_HREF = new InjectionToken(ngDevMode ? "appBaseHref" : "");
  220. var PathLocationStrategy = class _PathLocationStrategy extends LocationStrategy {
  221. _platformLocation;
  222. _baseHref;
  223. _removeListenerFns = [];
  224. constructor(_platformLocation, href) {
  225. super();
  226. this._platformLocation = _platformLocation;
  227. this._baseHref = href ?? this._platformLocation.getBaseHrefFromDOM() ?? inject(DOCUMENT).location?.origin ?? "";
  228. }
  229. /** @docs-private */
  230. ngOnDestroy() {
  231. while (this._removeListenerFns.length) {
  232. this._removeListenerFns.pop()();
  233. }
  234. }
  235. onPopState(fn) {
  236. this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
  237. }
  238. getBaseHref() {
  239. return this._baseHref;
  240. }
  241. prepareExternalUrl(internal) {
  242. return joinWithSlash(this._baseHref, internal);
  243. }
  244. path(includeHash = false) {
  245. const pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
  246. const hash = this._platformLocation.hash;
  247. return hash && includeHash ? `${pathname}${hash}` : pathname;
  248. }
  249. pushState(state, title, url, queryParams) {
  250. const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
  251. this._platformLocation.pushState(state, title, externalUrl);
  252. }
  253. replaceState(state, title, url, queryParams) {
  254. const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
  255. this._platformLocation.replaceState(state, title, externalUrl);
  256. }
  257. forward() {
  258. this._platformLocation.forward();
  259. }
  260. back() {
  261. this._platformLocation.back();
  262. }
  263. getState() {
  264. return this._platformLocation.getState();
  265. }
  266. historyGo(relativePosition = 0) {
  267. this._platformLocation.historyGo?.(relativePosition);
  268. }
  269. static ɵfac = function PathLocationStrategy_Factory(__ngFactoryType__) {
  270. return new (__ngFactoryType__ || _PathLocationStrategy)(ɵɵinject(PlatformLocation), ɵɵinject(APP_BASE_HREF, 8));
  271. };
  272. static ɵprov = ɵɵdefineInjectable({
  273. token: _PathLocationStrategy,
  274. factory: _PathLocationStrategy.ɵfac,
  275. providedIn: "root"
  276. });
  277. };
  278. (() => {
  279. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PathLocationStrategy, [{
  280. type: Injectable,
  281. args: [{
  282. providedIn: "root"
  283. }]
  284. }], () => [{
  285. type: PlatformLocation
  286. }, {
  287. type: void 0,
  288. decorators: [{
  289. type: Optional
  290. }, {
  291. type: Inject,
  292. args: [APP_BASE_HREF]
  293. }]
  294. }], null);
  295. })();
  296. var Location = class _Location {
  297. /** @internal */
  298. _subject = new Subject();
  299. /** @internal */
  300. _basePath;
  301. /** @internal */
  302. _locationStrategy;
  303. /** @internal */
  304. _urlChangeListeners = [];
  305. /** @internal */
  306. _urlChangeSubscription = null;
  307. constructor(locationStrategy) {
  308. this._locationStrategy = locationStrategy;
  309. const baseHref = this._locationStrategy.getBaseHref();
  310. this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
  311. this._locationStrategy.onPopState((ev) => {
  312. this._subject.next({
  313. "url": this.path(true),
  314. "pop": true,
  315. "state": ev.state,
  316. "type": ev.type
  317. });
  318. });
  319. }
  320. /** @docs-private */
  321. ngOnDestroy() {
  322. this._urlChangeSubscription?.unsubscribe();
  323. this._urlChangeListeners = [];
  324. }
  325. /**
  326. * Normalizes the URL path for this location.
  327. *
  328. * @param includeHash True to include an anchor fragment in the path.
  329. *
  330. * @returns The normalized URL path.
  331. */
  332. // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
  333. // removed.
  334. path(includeHash = false) {
  335. return this.normalize(this._locationStrategy.path(includeHash));
  336. }
  337. /**
  338. * Reports the current state of the location history.
  339. * @returns The current value of the `history.state` object.
  340. */
  341. getState() {
  342. return this._locationStrategy.getState();
  343. }
  344. /**
  345. * Normalizes the given path and compares to the current normalized path.
  346. *
  347. * @param path The given URL path.
  348. * @param query Query parameters.
  349. *
  350. * @returns True if the given URL path is equal to the current normalized path, false
  351. * otherwise.
  352. */
  353. isCurrentPathEqualTo(path, query = "") {
  354. return this.path() == this.normalize(path + normalizeQueryParams(query));
  355. }
  356. /**
  357. * Normalizes a URL path by stripping any trailing slashes.
  358. *
  359. * @param url String representing a URL.
  360. *
  361. * @returns The normalized URL string.
  362. */
  363. normalize(url) {
  364. return _Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));
  365. }
  366. /**
  367. * Normalizes an external URL path.
  368. * If the given URL doesn't begin with a leading slash (`'/'`), adds one
  369. * before normalizing. Adds a hash if `HashLocationStrategy` is
  370. * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  371. *
  372. * @param url String representing a URL.
  373. *
  374. * @returns A normalized platform-specific URL.
  375. */
  376. prepareExternalUrl(url) {
  377. if (url && url[0] !== "/") {
  378. url = "/" + url;
  379. }
  380. return this._locationStrategy.prepareExternalUrl(url);
  381. }
  382. // TODO: rename this method to pushState
  383. /**
  384. * Changes the browser's URL to a normalized version of a given URL, and pushes a
  385. * new item onto the platform's history.
  386. *
  387. * @param path URL path to normalize.
  388. * @param query Query parameters.
  389. * @param state Location history state.
  390. *
  391. */
  392. go(path, query = "", state = null) {
  393. this._locationStrategy.pushState(state, "", path, query);
  394. this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
  395. }
  396. /**
  397. * Changes the browser's URL to a normalized version of the given URL, and replaces
  398. * the top item on the platform's history stack.
  399. *
  400. * @param path URL path to normalize.
  401. * @param query Query parameters.
  402. * @param state Location history state.
  403. */
  404. replaceState(path, query = "", state = null) {
  405. this._locationStrategy.replaceState(state, "", path, query);
  406. this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
  407. }
  408. /**
  409. * Navigates forward in the platform's history.
  410. */
  411. forward() {
  412. this._locationStrategy.forward();
  413. }
  414. /**
  415. * Navigates back in the platform's history.
  416. */
  417. back() {
  418. this._locationStrategy.back();
  419. }
  420. /**
  421. * Navigate to a specific page from session history, identified by its relative position to the
  422. * current page.
  423. *
  424. * @param relativePosition Position of the target page in the history relative to the current
  425. * page.
  426. * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
  427. * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
  428. * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
  429. * when `relativePosition` equals 0.
  430. * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
  431. */
  432. historyGo(relativePosition = 0) {
  433. this._locationStrategy.historyGo?.(relativePosition);
  434. }
  435. /**
  436. * Registers a URL change listener. Use to catch updates performed by the Angular
  437. * framework that are not detectible through "popstate" or "hashchange" events.
  438. *
  439. * @param fn The change handler function, which take a URL and a location history state.
  440. * @returns A function that, when executed, unregisters a URL change listener.
  441. */
  442. onUrlChange(fn) {
  443. this._urlChangeListeners.push(fn);
  444. this._urlChangeSubscription ??= this.subscribe((v) => {
  445. this._notifyUrlChangeListeners(v.url, v.state);
  446. });
  447. return () => {
  448. const fnIndex = this._urlChangeListeners.indexOf(fn);
  449. this._urlChangeListeners.splice(fnIndex, 1);
  450. if (this._urlChangeListeners.length === 0) {
  451. this._urlChangeSubscription?.unsubscribe();
  452. this._urlChangeSubscription = null;
  453. }
  454. };
  455. }
  456. /** @internal */
  457. _notifyUrlChangeListeners(url = "", state) {
  458. this._urlChangeListeners.forEach((fn) => fn(url, state));
  459. }
  460. /**
  461. * Subscribes to the platform's `popState` events.
  462. *
  463. * Note: `Location.go()` does not trigger the `popState` event in the browser. Use
  464. * `Location.onUrlChange()` to subscribe to URL changes instead.
  465. *
  466. * @param value Event that is triggered when the state history changes.
  467. * @param exception The exception to throw.
  468. *
  469. * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
  470. *
  471. * @returns Subscribed events.
  472. */
  473. subscribe(onNext, onThrow, onReturn) {
  474. return this._subject.subscribe({
  475. next: onNext,
  476. error: onThrow ?? void 0,
  477. complete: onReturn ?? void 0
  478. });
  479. }
  480. /**
  481. * Normalizes URL parameters by prepending with `?` if needed.
  482. *
  483. * @param params String of URL parameters.
  484. *
  485. * @returns The normalized URL parameters string.
  486. */
  487. static normalizeQueryParams = normalizeQueryParams;
  488. /**
  489. * Joins two parts of a URL with a slash if needed.
  490. *
  491. * @param start URL string
  492. * @param end URL string
  493. *
  494. *
  495. * @returns The joined URL string.
  496. */
  497. static joinWithSlash = joinWithSlash;
  498. /**
  499. * Removes a trailing slash from a URL string if needed.
  500. * Looks for the first occurrence of either `#`, `?`, or the end of the
  501. * line as `/` characters and removes the trailing slash if one exists.
  502. *
  503. * @param url URL string.
  504. *
  505. * @returns The URL string, modified if needed.
  506. */
  507. static stripTrailingSlash = stripTrailingSlash;
  508. static ɵfac = function Location_Factory(__ngFactoryType__) {
  509. return new (__ngFactoryType__ || _Location)(ɵɵinject(LocationStrategy));
  510. };
  511. static ɵprov = ɵɵdefineInjectable({
  512. token: _Location,
  513. factory: () => createLocation(),
  514. providedIn: "root"
  515. });
  516. };
  517. (() => {
  518. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Location, [{
  519. type: Injectable,
  520. args: [{
  521. providedIn: "root",
  522. // See #23917
  523. useFactory: createLocation
  524. }]
  525. }], () => [{
  526. type: LocationStrategy
  527. }], null);
  528. })();
  529. function createLocation() {
  530. return new Location(ɵɵinject(LocationStrategy));
  531. }
  532. function _stripBasePath(basePath, url) {
  533. if (!basePath || !url.startsWith(basePath)) {
  534. return url;
  535. }
  536. const strippedUrl = url.substring(basePath.length);
  537. if (strippedUrl === "" || ["/", ";", "?", "#"].includes(strippedUrl[0])) {
  538. return strippedUrl;
  539. }
  540. return url;
  541. }
  542. function _stripIndexHtml(url) {
  543. return url.replace(/\/index.html$/, "");
  544. }
  545. function _stripOrigin(baseHref) {
  546. const isAbsoluteUrl2 = new RegExp("^(https?:)?//").test(baseHref);
  547. if (isAbsoluteUrl2) {
  548. const [, pathname] = baseHref.split(/\/\/[^\/]+/);
  549. return pathname;
  550. }
  551. return baseHref;
  552. }
  553. // node_modules/@angular/common/fesm2022/common_module.mjs
  554. var HashLocationStrategy = class _HashLocationStrategy extends LocationStrategy {
  555. _platformLocation;
  556. _baseHref = "";
  557. _removeListenerFns = [];
  558. constructor(_platformLocation, _baseHref) {
  559. super();
  560. this._platformLocation = _platformLocation;
  561. if (_baseHref != null) {
  562. this._baseHref = _baseHref;
  563. }
  564. }
  565. /** @docs-private */
  566. ngOnDestroy() {
  567. while (this._removeListenerFns.length) {
  568. this._removeListenerFns.pop()();
  569. }
  570. }
  571. onPopState(fn) {
  572. this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
  573. }
  574. getBaseHref() {
  575. return this._baseHref;
  576. }
  577. path(includeHash = false) {
  578. const path = this._platformLocation.hash ?? "#";
  579. return path.length > 0 ? path.substring(1) : path;
  580. }
  581. prepareExternalUrl(internal) {
  582. const url = joinWithSlash(this._baseHref, internal);
  583. return url.length > 0 ? "#" + url : url;
  584. }
  585. pushState(state, title, path, queryParams) {
  586. const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
  587. this._platformLocation.pushState(state, title, url);
  588. }
  589. replaceState(state, title, path, queryParams) {
  590. const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
  591. this._platformLocation.replaceState(state, title, url);
  592. }
  593. forward() {
  594. this._platformLocation.forward();
  595. }
  596. back() {
  597. this._platformLocation.back();
  598. }
  599. getState() {
  600. return this._platformLocation.getState();
  601. }
  602. historyGo(relativePosition = 0) {
  603. this._platformLocation.historyGo?.(relativePosition);
  604. }
  605. static ɵfac = function HashLocationStrategy_Factory(__ngFactoryType__) {
  606. return new (__ngFactoryType__ || _HashLocationStrategy)(ɵɵinject(PlatformLocation), ɵɵinject(APP_BASE_HREF, 8));
  607. };
  608. static ɵprov = ɵɵdefineInjectable({
  609. token: _HashLocationStrategy,
  610. factory: _HashLocationStrategy.ɵfac
  611. });
  612. };
  613. (() => {
  614. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HashLocationStrategy, [{
  615. type: Injectable
  616. }], () => [{
  617. type: PlatformLocation
  618. }, {
  619. type: void 0,
  620. decorators: [{
  621. type: Optional
  622. }, {
  623. type: Inject,
  624. args: [APP_BASE_HREF]
  625. }]
  626. }], null);
  627. })();
  628. var CURRENCIES_EN = {
  629. "ADP": [void 0, void 0, 0],
  630. "AFN": [void 0, "؋", 0],
  631. "ALL": [void 0, void 0, 0],
  632. "AMD": [void 0, "֏", 2],
  633. "AOA": [void 0, "Kz"],
  634. "ARS": [void 0, "$"],
  635. "AUD": ["A$", "$"],
  636. "AZN": [void 0, "₼"],
  637. "BAM": [void 0, "KM"],
  638. "BBD": [void 0, "$"],
  639. "BDT": [void 0, "৳"],
  640. "BHD": [void 0, void 0, 3],
  641. "BIF": [void 0, void 0, 0],
  642. "BMD": [void 0, "$"],
  643. "BND": [void 0, "$"],
  644. "BOB": [void 0, "Bs"],
  645. "BRL": ["R$"],
  646. "BSD": [void 0, "$"],
  647. "BWP": [void 0, "P"],
  648. "BYN": [void 0, void 0, 2],
  649. "BYR": [void 0, void 0, 0],
  650. "BZD": [void 0, "$"],
  651. "CAD": ["CA$", "$", 2],
  652. "CHF": [void 0, void 0, 2],
  653. "CLF": [void 0, void 0, 4],
  654. "CLP": [void 0, "$", 0],
  655. "CNY": ["CN¥", "¥"],
  656. "COP": [void 0, "$", 2],
  657. "CRC": [void 0, "₡", 2],
  658. "CUC": [void 0, "$"],
  659. "CUP": [void 0, "$"],
  660. "CZK": [void 0, "Kč", 2],
  661. "DJF": [void 0, void 0, 0],
  662. "DKK": [void 0, "kr", 2],
  663. "DOP": [void 0, "$"],
  664. "EGP": [void 0, "E£"],
  665. "ESP": [void 0, "₧", 0],
  666. "EUR": ["€"],
  667. "FJD": [void 0, "$"],
  668. "FKP": [void 0, "£"],
  669. "GBP": ["£"],
  670. "GEL": [void 0, "₾"],
  671. "GHS": [void 0, "GH₵"],
  672. "GIP": [void 0, "£"],
  673. "GNF": [void 0, "FG", 0],
  674. "GTQ": [void 0, "Q"],
  675. "GYD": [void 0, "$", 2],
  676. "HKD": ["HK$", "$"],
  677. "HNL": [void 0, "L"],
  678. "HRK": [void 0, "kn"],
  679. "HUF": [void 0, "Ft", 2],
  680. "IDR": [void 0, "Rp", 2],
  681. "ILS": ["₪"],
  682. "INR": ["₹"],
  683. "IQD": [void 0, void 0, 0],
  684. "IRR": [void 0, void 0, 0],
  685. "ISK": [void 0, "kr", 0],
  686. "ITL": [void 0, void 0, 0],
  687. "JMD": [void 0, "$"],
  688. "JOD": [void 0, void 0, 3],
  689. "JPY": ["¥", void 0, 0],
  690. "KHR": [void 0, "៛"],
  691. "KMF": [void 0, "CF", 0],
  692. "KPW": [void 0, "₩", 0],
  693. "KRW": ["₩", void 0, 0],
  694. "KWD": [void 0, void 0, 3],
  695. "KYD": [void 0, "$"],
  696. "KZT": [void 0, "₸"],
  697. "LAK": [void 0, "₭", 0],
  698. "LBP": [void 0, "L£", 0],
  699. "LKR": [void 0, "Rs"],
  700. "LRD": [void 0, "$"],
  701. "LTL": [void 0, "Lt"],
  702. "LUF": [void 0, void 0, 0],
  703. "LVL": [void 0, "Ls"],
  704. "LYD": [void 0, void 0, 3],
  705. "MGA": [void 0, "Ar", 0],
  706. "MGF": [void 0, void 0, 0],
  707. "MMK": [void 0, "K", 0],
  708. "MNT": [void 0, "₮", 2],
  709. "MRO": [void 0, void 0, 0],
  710. "MUR": [void 0, "Rs", 2],
  711. "MXN": ["MX$", "$"],
  712. "MYR": [void 0, "RM"],
  713. "NAD": [void 0, "$"],
  714. "NGN": [void 0, "₦"],
  715. "NIO": [void 0, "C$"],
  716. "NOK": [void 0, "kr", 2],
  717. "NPR": [void 0, "Rs"],
  718. "NZD": ["NZ$", "$"],
  719. "OMR": [void 0, void 0, 3],
  720. "PHP": ["₱"],
  721. "PKR": [void 0, "Rs", 2],
  722. "PLN": [void 0, "zł"],
  723. "PYG": [void 0, "₲", 0],
  724. "RON": [void 0, "lei"],
  725. "RSD": [void 0, void 0, 0],
  726. "RUB": [void 0, "₽"],
  727. "RWF": [void 0, "RF", 0],
  728. "SBD": [void 0, "$"],
  729. "SEK": [void 0, "kr", 2],
  730. "SGD": [void 0, "$"],
  731. "SHP": [void 0, "£"],
  732. "SLE": [void 0, void 0, 2],
  733. "SLL": [void 0, void 0, 0],
  734. "SOS": [void 0, void 0, 0],
  735. "SRD": [void 0, "$"],
  736. "SSP": [void 0, "£"],
  737. "STD": [void 0, void 0, 0],
  738. "STN": [void 0, "Db"],
  739. "SYP": [void 0, "£", 0],
  740. "THB": [void 0, "฿"],
  741. "TMM": [void 0, void 0, 0],
  742. "TND": [void 0, void 0, 3],
  743. "TOP": [void 0, "T$"],
  744. "TRL": [void 0, void 0, 0],
  745. "TRY": [void 0, "₺"],
  746. "TTD": [void 0, "$"],
  747. "TWD": ["NT$", "$", 2],
  748. "TZS": [void 0, void 0, 2],
  749. "UAH": [void 0, "₴"],
  750. "UGX": [void 0, void 0, 0],
  751. "USD": ["$"],
  752. "UYI": [void 0, void 0, 0],
  753. "UYU": [void 0, "$"],
  754. "UYW": [void 0, void 0, 4],
  755. "UZS": [void 0, void 0, 2],
  756. "VEF": [void 0, "Bs", 2],
  757. "VND": ["₫", void 0, 0],
  758. "VUV": [void 0, void 0, 0],
  759. "XAF": ["FCFA", void 0, 0],
  760. "XCD": ["EC$", "$"],
  761. "XOF": ["F CFA", void 0, 0],
  762. "XPF": ["CFPF", void 0, 0],
  763. "XXX": ["¤"],
  764. "YER": [void 0, void 0, 0],
  765. "ZAR": [void 0, "R"],
  766. "ZMK": [void 0, void 0, 0],
  767. "ZMW": [void 0, "ZK"],
  768. "ZWD": [void 0, void 0, 0]
  769. };
  770. var NumberFormatStyle;
  771. (function(NumberFormatStyle2) {
  772. NumberFormatStyle2[NumberFormatStyle2["Decimal"] = 0] = "Decimal";
  773. NumberFormatStyle2[NumberFormatStyle2["Percent"] = 1] = "Percent";
  774. NumberFormatStyle2[NumberFormatStyle2["Currency"] = 2] = "Currency";
  775. NumberFormatStyle2[NumberFormatStyle2["Scientific"] = 3] = "Scientific";
  776. })(NumberFormatStyle || (NumberFormatStyle = {}));
  777. var Plural;
  778. (function(Plural2) {
  779. Plural2[Plural2["Zero"] = 0] = "Zero";
  780. Plural2[Plural2["One"] = 1] = "One";
  781. Plural2[Plural2["Two"] = 2] = "Two";
  782. Plural2[Plural2["Few"] = 3] = "Few";
  783. Plural2[Plural2["Many"] = 4] = "Many";
  784. Plural2[Plural2["Other"] = 5] = "Other";
  785. })(Plural || (Plural = {}));
  786. var FormStyle;
  787. (function(FormStyle2) {
  788. FormStyle2[FormStyle2["Format"] = 0] = "Format";
  789. FormStyle2[FormStyle2["Standalone"] = 1] = "Standalone";
  790. })(FormStyle || (FormStyle = {}));
  791. var TranslationWidth;
  792. (function(TranslationWidth2) {
  793. TranslationWidth2[TranslationWidth2["Narrow"] = 0] = "Narrow";
  794. TranslationWidth2[TranslationWidth2["Abbreviated"] = 1] = "Abbreviated";
  795. TranslationWidth2[TranslationWidth2["Wide"] = 2] = "Wide";
  796. TranslationWidth2[TranslationWidth2["Short"] = 3] = "Short";
  797. })(TranslationWidth || (TranslationWidth = {}));
  798. var FormatWidth;
  799. (function(FormatWidth2) {
  800. FormatWidth2[FormatWidth2["Short"] = 0] = "Short";
  801. FormatWidth2[FormatWidth2["Medium"] = 1] = "Medium";
  802. FormatWidth2[FormatWidth2["Long"] = 2] = "Long";
  803. FormatWidth2[FormatWidth2["Full"] = 3] = "Full";
  804. })(FormatWidth || (FormatWidth = {}));
  805. var NumberSymbol = {
  806. /**
  807. * Decimal separator.
  808. * For `en-US`, the dot character.
  809. * Example: 2,345`.`67
  810. */
  811. Decimal: 0,
  812. /**
  813. * Grouping separator, typically for thousands.
  814. * For `en-US`, the comma character.
  815. * Example: 2`,`345.67
  816. */
  817. Group: 1,
  818. /**
  819. * List-item separator.
  820. * Example: "one, two, and three"
  821. */
  822. List: 2,
  823. /**
  824. * Sign for percentage (out of 100).
  825. * Example: 23.4%
  826. */
  827. PercentSign: 3,
  828. /**
  829. * Sign for positive numbers.
  830. * Example: +23
  831. */
  832. PlusSign: 4,
  833. /**
  834. * Sign for negative numbers.
  835. * Example: -23
  836. */
  837. MinusSign: 5,
  838. /**
  839. * Computer notation for exponential value (n times a power of 10).
  840. * Example: 1.2E3
  841. */
  842. Exponential: 6,
  843. /**
  844. * Human-readable format of exponential.
  845. * Example: 1.2x103
  846. */
  847. SuperscriptingExponent: 7,
  848. /**
  849. * Sign for permille (out of 1000).
  850. * Example: 23.4‰
  851. */
  852. PerMille: 8,
  853. /**
  854. * Infinity, can be used with plus and minus.
  855. * Example: ∞, +∞, -∞
  856. */
  857. Infinity: 9,
  858. /**
  859. * Not a number.
  860. * Example: NaN
  861. */
  862. NaN: 10,
  863. /**
  864. * Symbol used between time units.
  865. * Example: 10:52
  866. */
  867. TimeSeparator: 11,
  868. /**
  869. * Decimal separator for currency values (fallback to `Decimal`).
  870. * Example: $2,345.67
  871. */
  872. CurrencyDecimal: 12,
  873. /**
  874. * Group separator for currency values (fallback to `Group`).
  875. * Example: $2,345.67
  876. */
  877. CurrencyGroup: 13
  878. };
  879. var WeekDay;
  880. (function(WeekDay2) {
  881. WeekDay2[WeekDay2["Sunday"] = 0] = "Sunday";
  882. WeekDay2[WeekDay2["Monday"] = 1] = "Monday";
  883. WeekDay2[WeekDay2["Tuesday"] = 2] = "Tuesday";
  884. WeekDay2[WeekDay2["Wednesday"] = 3] = "Wednesday";
  885. WeekDay2[WeekDay2["Thursday"] = 4] = "Thursday";
  886. WeekDay2[WeekDay2["Friday"] = 5] = "Friday";
  887. WeekDay2[WeekDay2["Saturday"] = 6] = "Saturday";
  888. })(WeekDay || (WeekDay = {}));
  889. function getLocaleId(locale) {
  890. return findLocaleData(locale)[LocaleDataIndex.LocaleId];
  891. }
  892. function getLocaleDayPeriods(locale, formStyle, width) {
  893. const data = findLocaleData(locale);
  894. const amPmData = [data[LocaleDataIndex.DayPeriodsFormat], data[LocaleDataIndex.DayPeriodsStandalone]];
  895. const amPm = getLastDefinedValue(amPmData, formStyle);
  896. return getLastDefinedValue(amPm, width);
  897. }
  898. function getLocaleDayNames(locale, formStyle, width) {
  899. const data = findLocaleData(locale);
  900. const daysData = [data[LocaleDataIndex.DaysFormat], data[LocaleDataIndex.DaysStandalone]];
  901. const days = getLastDefinedValue(daysData, formStyle);
  902. return getLastDefinedValue(days, width);
  903. }
  904. function getLocaleMonthNames(locale, formStyle, width) {
  905. const data = findLocaleData(locale);
  906. const monthsData = [data[LocaleDataIndex.MonthsFormat], data[LocaleDataIndex.MonthsStandalone]];
  907. const months = getLastDefinedValue(monthsData, formStyle);
  908. return getLastDefinedValue(months, width);
  909. }
  910. function getLocaleEraNames(locale, width) {
  911. const data = findLocaleData(locale);
  912. const erasData = data[LocaleDataIndex.Eras];
  913. return getLastDefinedValue(erasData, width);
  914. }
  915. function getLocaleFirstDayOfWeek(locale) {
  916. const data = findLocaleData(locale);
  917. return data[LocaleDataIndex.FirstDayOfWeek];
  918. }
  919. function getLocaleWeekEndRange(locale) {
  920. const data = findLocaleData(locale);
  921. return data[LocaleDataIndex.WeekendRange];
  922. }
  923. function getLocaleDateFormat(locale, width) {
  924. const data = findLocaleData(locale);
  925. return getLastDefinedValue(data[LocaleDataIndex.DateFormat], width);
  926. }
  927. function getLocaleTimeFormat(locale, width) {
  928. const data = findLocaleData(locale);
  929. return getLastDefinedValue(data[LocaleDataIndex.TimeFormat], width);
  930. }
  931. function getLocaleDateTimeFormat(locale, width) {
  932. const data = findLocaleData(locale);
  933. const dateTimeFormatData = data[LocaleDataIndex.DateTimeFormat];
  934. return getLastDefinedValue(dateTimeFormatData, width);
  935. }
  936. function getLocaleNumberSymbol(locale, symbol) {
  937. const data = findLocaleData(locale);
  938. const res = data[LocaleDataIndex.NumberSymbols][symbol];
  939. if (typeof res === "undefined") {
  940. if (symbol === NumberSymbol.CurrencyDecimal) {
  941. return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Decimal];
  942. } else if (symbol === NumberSymbol.CurrencyGroup) {
  943. return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Group];
  944. }
  945. }
  946. return res;
  947. }
  948. function getLocaleNumberFormat(locale, type) {
  949. const data = findLocaleData(locale);
  950. return data[LocaleDataIndex.NumberFormats][type];
  951. }
  952. function getLocaleCurrencySymbol(locale) {
  953. const data = findLocaleData(locale);
  954. return data[LocaleDataIndex.CurrencySymbol] || null;
  955. }
  956. function getLocaleCurrencyName(locale) {
  957. const data = findLocaleData(locale);
  958. return data[LocaleDataIndex.CurrencyName] || null;
  959. }
  960. function getLocaleCurrencyCode2(locale) {
  961. return getLocaleCurrencyCode(locale);
  962. }
  963. function getLocaleCurrencies(locale) {
  964. const data = findLocaleData(locale);
  965. return data[LocaleDataIndex.Currencies];
  966. }
  967. var getLocalePluralCase2 = getLocalePluralCase;
  968. function checkFullData(data) {
  969. if (!data[LocaleDataIndex.ExtraData]) {
  970. throw new RuntimeError(2303, ngDevMode && `Missing extra locale data for the locale "${data[LocaleDataIndex.LocaleId]}". Use "registerLocaleData" to load new data. See the "I18n guide" on angular.io to know more.`);
  971. }
  972. }
  973. function getLocaleExtraDayPeriodRules(locale) {
  974. const data = findLocaleData(locale);
  975. checkFullData(data);
  976. const rules = data[LocaleDataIndex.ExtraData][
  977. 2
  978. /* ɵExtraLocaleDataIndex.ExtraDayPeriodsRules */
  979. ] || [];
  980. return rules.map((rule) => {
  981. if (typeof rule === "string") {
  982. return extractTime(rule);
  983. }
  984. return [extractTime(rule[0]), extractTime(rule[1])];
  985. });
  986. }
  987. function getLocaleExtraDayPeriods(locale, formStyle, width) {
  988. const data = findLocaleData(locale);
  989. checkFullData(data);
  990. const dayPeriodsData = [data[LocaleDataIndex.ExtraData][
  991. 0
  992. /* ɵExtraLocaleDataIndex.ExtraDayPeriodFormats */
  993. ], data[LocaleDataIndex.ExtraData][
  994. 1
  995. /* ɵExtraLocaleDataIndex.ExtraDayPeriodStandalone */
  996. ]];
  997. const dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
  998. return getLastDefinedValue(dayPeriods, width) || [];
  999. }
  1000. function getLocaleDirection(locale) {
  1001. const data = findLocaleData(locale);
  1002. return data[LocaleDataIndex.Directionality];
  1003. }
  1004. function getLastDefinedValue(data, index) {
  1005. for (let i = index; i > -1; i--) {
  1006. if (typeof data[i] !== "undefined") {
  1007. return data[i];
  1008. }
  1009. }
  1010. throw new RuntimeError(2304, ngDevMode && "Locale data API: locale data undefined");
  1011. }
  1012. function extractTime(time) {
  1013. const [h, m] = time.split(":");
  1014. return {
  1015. hours: +h,
  1016. minutes: +m
  1017. };
  1018. }
  1019. function getCurrencySymbol(code, format, locale = "en") {
  1020. const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
  1021. const symbolNarrow = currency[
  1022. 1
  1023. /* ɵCurrencyIndex.SymbolNarrow */
  1024. ];
  1025. if (format === "narrow" && typeof symbolNarrow === "string") {
  1026. return symbolNarrow;
  1027. }
  1028. return currency[
  1029. 0
  1030. /* ɵCurrencyIndex.Symbol */
  1031. ] || code;
  1032. }
  1033. var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
  1034. function getNumberOfCurrencyDigits(code) {
  1035. let digits;
  1036. const currency = CURRENCIES_EN[code];
  1037. if (currency) {
  1038. digits = currency[
  1039. 2
  1040. /* ɵCurrencyIndex.NbOfDigits */
  1041. ];
  1042. }
  1043. return typeof digits === "number" ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
  1044. }
  1045. var ISO8601_DATE_REGEX = /^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
  1046. var NAMED_FORMATS = {};
  1047. var DATE_FORMATS_SPLIT = /((?:[^BEGHLMOSWYZabcdhmswyz']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|Y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|c{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]*)/;
  1048. function formatDate(value, format, locale, timezone) {
  1049. let date = toDate(value);
  1050. const namedFormat = getNamedFormat(locale, format);
  1051. format = namedFormat || format;
  1052. let parts = [];
  1053. let match;
  1054. while (format) {
  1055. match = DATE_FORMATS_SPLIT.exec(format);
  1056. if (match) {
  1057. parts = parts.concat(match.slice(1));
  1058. const part = parts.pop();
  1059. if (!part) {
  1060. break;
  1061. }
  1062. format = part;
  1063. } else {
  1064. parts.push(format);
  1065. break;
  1066. }
  1067. }
  1068. if (typeof ngDevMode === "undefined" || ngDevMode) {
  1069. assertValidDateFormat(parts);
  1070. }
  1071. let dateTimezoneOffset = date.getTimezoneOffset();
  1072. if (timezone) {
  1073. dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  1074. date = convertTimezoneToLocal(date, timezone);
  1075. }
  1076. let text = "";
  1077. parts.forEach((value2) => {
  1078. const dateFormatter = getDateFormatter(value2);
  1079. text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value2 === "''" ? "'" : value2.replace(/(^'|'$)/g, "").replace(/''/g, "'");
  1080. });
  1081. return text;
  1082. }
  1083. function assertValidDateFormat(parts) {
  1084. if (parts.some((part) => /^Y+$/.test(part)) && !parts.some((part) => /^w+$/.test(part))) {
  1085. const message = `Suspicious use of week-based year "Y" in date pattern "${parts.join("")}". Did you mean to use calendar year "y" instead?`;
  1086. if (parts.length === 1) {
  1087. console.error(formatRuntimeError(2300, message));
  1088. } else {
  1089. throw new RuntimeError(2300, message);
  1090. }
  1091. }
  1092. }
  1093. function createDate(year, month, date) {
  1094. const newDate = /* @__PURE__ */ new Date(0);
  1095. newDate.setFullYear(year, month, date);
  1096. newDate.setHours(0, 0, 0);
  1097. return newDate;
  1098. }
  1099. function getNamedFormat(locale, format) {
  1100. const localeId = getLocaleId(locale);
  1101. NAMED_FORMATS[localeId] ??= {};
  1102. if (NAMED_FORMATS[localeId][format]) {
  1103. return NAMED_FORMATS[localeId][format];
  1104. }
  1105. let formatValue = "";
  1106. switch (format) {
  1107. case "shortDate":
  1108. formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
  1109. break;
  1110. case "mediumDate":
  1111. formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
  1112. break;
  1113. case "longDate":
  1114. formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
  1115. break;
  1116. case "fullDate":
  1117. formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
  1118. break;
  1119. case "shortTime":
  1120. formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
  1121. break;
  1122. case "mediumTime":
  1123. formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
  1124. break;
  1125. case "longTime":
  1126. formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
  1127. break;
  1128. case "fullTime":
  1129. formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
  1130. break;
  1131. case "short":
  1132. const shortTime = getNamedFormat(locale, "shortTime");
  1133. const shortDate = getNamedFormat(locale, "shortDate");
  1134. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
  1135. break;
  1136. case "medium":
  1137. const mediumTime = getNamedFormat(locale, "mediumTime");
  1138. const mediumDate = getNamedFormat(locale, "mediumDate");
  1139. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
  1140. break;
  1141. case "long":
  1142. const longTime = getNamedFormat(locale, "longTime");
  1143. const longDate = getNamedFormat(locale, "longDate");
  1144. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
  1145. break;
  1146. case "full":
  1147. const fullTime = getNamedFormat(locale, "fullTime");
  1148. const fullDate = getNamedFormat(locale, "fullDate");
  1149. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
  1150. break;
  1151. }
  1152. if (formatValue) {
  1153. NAMED_FORMATS[localeId][format] = formatValue;
  1154. }
  1155. return formatValue;
  1156. }
  1157. function formatDateTime(str, opt_values) {
  1158. if (opt_values) {
  1159. str = str.replace(/\{([^}]+)}/g, function(match, key) {
  1160. return opt_values != null && key in opt_values ? opt_values[key] : match;
  1161. });
  1162. }
  1163. return str;
  1164. }
  1165. function padNumber(num, digits, minusSign = "-", trim, negWrap) {
  1166. let neg = "";
  1167. if (num < 0 || negWrap && num <= 0) {
  1168. if (negWrap) {
  1169. num = -num + 1;
  1170. } else {
  1171. num = -num;
  1172. neg = minusSign;
  1173. }
  1174. }
  1175. let strNum = String(num);
  1176. while (strNum.length < digits) {
  1177. strNum = "0" + strNum;
  1178. }
  1179. if (trim) {
  1180. strNum = strNum.slice(strNum.length - digits);
  1181. }
  1182. return neg + strNum;
  1183. }
  1184. function formatFractionalSeconds(milliseconds, digits) {
  1185. const strMs = padNumber(milliseconds, 3);
  1186. return strMs.substring(0, digits);
  1187. }
  1188. function dateGetter(name, size, offset = 0, trim = false, negWrap = false) {
  1189. return function(date, locale) {
  1190. let part = getDatePart(name, date);
  1191. if (offset > 0 || part > -offset) {
  1192. part += offset;
  1193. }
  1194. if (name === 3) {
  1195. if (part === 0 && offset === -12) {
  1196. part = 12;
  1197. }
  1198. } else if (name === 6) {
  1199. return formatFractionalSeconds(part, size);
  1200. }
  1201. const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  1202. return padNumber(part, size, localeMinus, trim, negWrap);
  1203. };
  1204. }
  1205. function getDatePart(part, date) {
  1206. switch (part) {
  1207. case 0:
  1208. return date.getFullYear();
  1209. case 1:
  1210. return date.getMonth();
  1211. case 2:
  1212. return date.getDate();
  1213. case 3:
  1214. return date.getHours();
  1215. case 4:
  1216. return date.getMinutes();
  1217. case 5:
  1218. return date.getSeconds();
  1219. case 6:
  1220. return date.getMilliseconds();
  1221. case 7:
  1222. return date.getDay();
  1223. default:
  1224. throw new RuntimeError(2301, ngDevMode && `Unknown DateType value "${part}".`);
  1225. }
  1226. }
  1227. function dateStrGetter(name, width, form = FormStyle.Format, extended = false) {
  1228. return function(date, locale) {
  1229. return getDateTranslation(date, locale, name, width, form, extended);
  1230. };
  1231. }
  1232. function getDateTranslation(date, locale, name, width, form, extended) {
  1233. switch (name) {
  1234. case 2:
  1235. return getLocaleMonthNames(locale, form, width)[date.getMonth()];
  1236. case 1:
  1237. return getLocaleDayNames(locale, form, width)[date.getDay()];
  1238. case 0:
  1239. const currentHours = date.getHours();
  1240. const currentMinutes = date.getMinutes();
  1241. if (extended) {
  1242. const rules = getLocaleExtraDayPeriodRules(locale);
  1243. const dayPeriods = getLocaleExtraDayPeriods(locale, form, width);
  1244. const index = rules.findIndex((rule) => {
  1245. if (Array.isArray(rule)) {
  1246. const [from, to] = rule;
  1247. const afterFrom = currentHours >= from.hours && currentMinutes >= from.minutes;
  1248. const beforeTo = currentHours < to.hours || currentHours === to.hours && currentMinutes < to.minutes;
  1249. if (from.hours < to.hours) {
  1250. if (afterFrom && beforeTo) {
  1251. return true;
  1252. }
  1253. } else if (afterFrom || beforeTo) {
  1254. return true;
  1255. }
  1256. } else {
  1257. if (rule.hours === currentHours && rule.minutes === currentMinutes) {
  1258. return true;
  1259. }
  1260. }
  1261. return false;
  1262. });
  1263. if (index !== -1) {
  1264. return dayPeriods[index];
  1265. }
  1266. }
  1267. return getLocaleDayPeriods(locale, form, width)[currentHours < 12 ? 0 : 1];
  1268. case 3:
  1269. return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
  1270. default:
  1271. const unexpected = name;
  1272. throw new RuntimeError(2302, ngDevMode && `unexpected translation type ${unexpected}`);
  1273. }
  1274. }
  1275. function timeZoneGetter(width) {
  1276. return function(date, locale, offset) {
  1277. const zone = -1 * offset;
  1278. const minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  1279. const hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
  1280. switch (width) {
  1281. case 0:
  1282. return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign);
  1283. case 1:
  1284. return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 1, minusSign);
  1285. case 2:
  1286. return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
  1287. case 3:
  1288. if (offset === 0) {
  1289. return "Z";
  1290. } else {
  1291. return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
  1292. }
  1293. default:
  1294. throw new RuntimeError(2302, ngDevMode && `Unknown zone width "${width}"`);
  1295. }
  1296. };
  1297. }
  1298. var JANUARY = 0;
  1299. var THURSDAY = 4;
  1300. function getFirstThursdayOfYear(year) {
  1301. const firstDayOfYear = createDate(year, JANUARY, 1).getDay();
  1302. return createDate(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
  1303. }
  1304. function getThursdayThisIsoWeek(datetime) {
  1305. const currentDay = datetime.getDay();
  1306. const deltaToThursday = currentDay === 0 ? -3 : THURSDAY - currentDay;
  1307. return createDate(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + deltaToThursday);
  1308. }
  1309. function weekGetter(size, monthBased = false) {
  1310. return function(date, locale) {
  1311. let result;
  1312. if (monthBased) {
  1313. const nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
  1314. const today = date.getDate();
  1315. result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
  1316. } else {
  1317. const thisThurs = getThursdayThisIsoWeek(date);
  1318. const firstThurs = getFirstThursdayOfYear(thisThurs.getFullYear());
  1319. const diff = thisThurs.getTime() - firstThurs.getTime();
  1320. result = 1 + Math.round(diff / 6048e5);
  1321. }
  1322. return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  1323. };
  1324. }
  1325. function weekNumberingYearGetter(size, trim = false) {
  1326. return function(date, locale) {
  1327. const thisThurs = getThursdayThisIsoWeek(date);
  1328. const weekNumberingYear = thisThurs.getFullYear();
  1329. return padNumber(weekNumberingYear, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim);
  1330. };
  1331. }
  1332. var DATE_FORMATS = {};
  1333. function getDateFormatter(format) {
  1334. if (DATE_FORMATS[format]) {
  1335. return DATE_FORMATS[format];
  1336. }
  1337. let formatter;
  1338. switch (format) {
  1339. // Era name (AD/BC)
  1340. case "G":
  1341. case "GG":
  1342. case "GGG":
  1343. formatter = dateStrGetter(3, TranslationWidth.Abbreviated);
  1344. break;
  1345. case "GGGG":
  1346. formatter = dateStrGetter(3, TranslationWidth.Wide);
  1347. break;
  1348. case "GGGGG":
  1349. formatter = dateStrGetter(3, TranslationWidth.Narrow);
  1350. break;
  1351. // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
  1352. case "y":
  1353. formatter = dateGetter(0, 1, 0, false, true);
  1354. break;
  1355. // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
  1356. case "yy":
  1357. formatter = dateGetter(0, 2, 0, true, true);
  1358. break;
  1359. // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
  1360. case "yyy":
  1361. formatter = dateGetter(0, 3, 0, false, true);
  1362. break;
  1363. // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
  1364. case "yyyy":
  1365. formatter = dateGetter(0, 4, 0, false, true);
  1366. break;
  1367. // 1 digit representation of the week-numbering year, e.g. (AD 1 => 1, AD 199 => 199)
  1368. case "Y":
  1369. formatter = weekNumberingYearGetter(1);
  1370. break;
  1371. // 2 digit representation of the week-numbering year, padded (00-99). (e.g. AD 2001 => 01, AD
  1372. // 2010 => 10)
  1373. case "YY":
  1374. formatter = weekNumberingYearGetter(2, true);
  1375. break;
  1376. // 3 digit representation of the week-numbering year, padded (000-999). (e.g. AD 1 => 001, AD
  1377. // 2010 => 2010)
  1378. case "YYY":
  1379. formatter = weekNumberingYearGetter(3);
  1380. break;
  1381. // 4 digit representation of the week-numbering year (e.g. AD 1 => 0001, AD 2010 => 2010)
  1382. case "YYYY":
  1383. formatter = weekNumberingYearGetter(4);
  1384. break;
  1385. // Month of the year (1-12), numeric
  1386. case "M":
  1387. case "L":
  1388. formatter = dateGetter(1, 1, 1);
  1389. break;
  1390. case "MM":
  1391. case "LL":
  1392. formatter = dateGetter(1, 2, 1);
  1393. break;
  1394. // Month of the year (January, ...), string, format
  1395. case "MMM":
  1396. formatter = dateStrGetter(2, TranslationWidth.Abbreviated);
  1397. break;
  1398. case "MMMM":
  1399. formatter = dateStrGetter(2, TranslationWidth.Wide);
  1400. break;
  1401. case "MMMMM":
  1402. formatter = dateStrGetter(2, TranslationWidth.Narrow);
  1403. break;
  1404. // Month of the year (January, ...), string, standalone
  1405. case "LLL":
  1406. formatter = dateStrGetter(2, TranslationWidth.Abbreviated, FormStyle.Standalone);
  1407. break;
  1408. case "LLLL":
  1409. formatter = dateStrGetter(2, TranslationWidth.Wide, FormStyle.Standalone);
  1410. break;
  1411. case "LLLLL":
  1412. formatter = dateStrGetter(2, TranslationWidth.Narrow, FormStyle.Standalone);
  1413. break;
  1414. // Week of the year (1, ... 52)
  1415. case "w":
  1416. formatter = weekGetter(1);
  1417. break;
  1418. case "ww":
  1419. formatter = weekGetter(2);
  1420. break;
  1421. // Week of the month (1, ...)
  1422. case "W":
  1423. formatter = weekGetter(1, true);
  1424. break;
  1425. // Day of the month (1-31)
  1426. case "d":
  1427. formatter = dateGetter(2, 1);
  1428. break;
  1429. case "dd":
  1430. formatter = dateGetter(2, 2);
  1431. break;
  1432. // Day of the Week StandAlone (1, 1, Mon, Monday, M, Mo)
  1433. case "c":
  1434. case "cc":
  1435. formatter = dateGetter(7, 1);
  1436. break;
  1437. case "ccc":
  1438. formatter = dateStrGetter(1, TranslationWidth.Abbreviated, FormStyle.Standalone);
  1439. break;
  1440. case "cccc":
  1441. formatter = dateStrGetter(1, TranslationWidth.Wide, FormStyle.Standalone);
  1442. break;
  1443. case "ccccc":
  1444. formatter = dateStrGetter(1, TranslationWidth.Narrow, FormStyle.Standalone);
  1445. break;
  1446. case "cccccc":
  1447. formatter = dateStrGetter(1, TranslationWidth.Short, FormStyle.Standalone);
  1448. break;
  1449. // Day of the Week
  1450. case "E":
  1451. case "EE":
  1452. case "EEE":
  1453. formatter = dateStrGetter(1, TranslationWidth.Abbreviated);
  1454. break;
  1455. case "EEEE":
  1456. formatter = dateStrGetter(1, TranslationWidth.Wide);
  1457. break;
  1458. case "EEEEE":
  1459. formatter = dateStrGetter(1, TranslationWidth.Narrow);
  1460. break;
  1461. case "EEEEEE":
  1462. formatter = dateStrGetter(1, TranslationWidth.Short);
  1463. break;
  1464. // Generic period of the day (am-pm)
  1465. case "a":
  1466. case "aa":
  1467. case "aaa":
  1468. formatter = dateStrGetter(0, TranslationWidth.Abbreviated);
  1469. break;
  1470. case "aaaa":
  1471. formatter = dateStrGetter(0, TranslationWidth.Wide);
  1472. break;
  1473. case "aaaaa":
  1474. formatter = dateStrGetter(0, TranslationWidth.Narrow);
  1475. break;
  1476. // Extended period of the day (midnight, at night, ...), standalone
  1477. case "b":
  1478. case "bb":
  1479. case "bbb":
  1480. formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
  1481. break;
  1482. case "bbbb":
  1483. formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Standalone, true);
  1484. break;
  1485. case "bbbbb":
  1486. formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Standalone, true);
  1487. break;
  1488. // Extended period of the day (midnight, night, ...), standalone
  1489. case "B":
  1490. case "BB":
  1491. case "BBB":
  1492. formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Format, true);
  1493. break;
  1494. case "BBBB":
  1495. formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Format, true);
  1496. break;
  1497. case "BBBBB":
  1498. formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Format, true);
  1499. break;
  1500. // Hour in AM/PM, (1-12)
  1501. case "h":
  1502. formatter = dateGetter(3, 1, -12);
  1503. break;
  1504. case "hh":
  1505. formatter = dateGetter(3, 2, -12);
  1506. break;
  1507. // Hour of the day (0-23)
  1508. case "H":
  1509. formatter = dateGetter(3, 1);
  1510. break;
  1511. // Hour in day, padded (00-23)
  1512. case "HH":
  1513. formatter = dateGetter(3, 2);
  1514. break;
  1515. // Minute of the hour (0-59)
  1516. case "m":
  1517. formatter = dateGetter(4, 1);
  1518. break;
  1519. case "mm":
  1520. formatter = dateGetter(4, 2);
  1521. break;
  1522. // Second of the minute (0-59)
  1523. case "s":
  1524. formatter = dateGetter(5, 1);
  1525. break;
  1526. case "ss":
  1527. formatter = dateGetter(5, 2);
  1528. break;
  1529. // Fractional second
  1530. case "S":
  1531. formatter = dateGetter(6, 1);
  1532. break;
  1533. case "SS":
  1534. formatter = dateGetter(6, 2);
  1535. break;
  1536. case "SSS":
  1537. formatter = dateGetter(6, 3);
  1538. break;
  1539. // Timezone ISO8601 short format (-0430)
  1540. case "Z":
  1541. case "ZZ":
  1542. case "ZZZ":
  1543. formatter = timeZoneGetter(
  1544. 0
  1545. /* ZoneWidth.Short */
  1546. );
  1547. break;
  1548. // Timezone ISO8601 extended format (-04:30)
  1549. case "ZZZZZ":
  1550. formatter = timeZoneGetter(
  1551. 3
  1552. /* ZoneWidth.Extended */
  1553. );
  1554. break;
  1555. // Timezone GMT short format (GMT+4)
  1556. case "O":
  1557. case "OO":
  1558. case "OOO":
  1559. // Should be location, but fallback to format O instead because we don't have the data yet
  1560. case "z":
  1561. case "zz":
  1562. case "zzz":
  1563. formatter = timeZoneGetter(
  1564. 1
  1565. /* ZoneWidth.ShortGMT */
  1566. );
  1567. break;
  1568. // Timezone GMT long format (GMT+0430)
  1569. case "OOOO":
  1570. case "ZZZZ":
  1571. // Should be location, but fallback to format O instead because we don't have the data yet
  1572. case "zzzz":
  1573. formatter = timeZoneGetter(
  1574. 2
  1575. /* ZoneWidth.Long */
  1576. );
  1577. break;
  1578. default:
  1579. return null;
  1580. }
  1581. DATE_FORMATS[format] = formatter;
  1582. return formatter;
  1583. }
  1584. function timezoneToOffset(timezone, fallback) {
  1585. timezone = timezone.replace(/:/g, "");
  1586. const requestedTimezoneOffset = Date.parse("Jan 01, 1970 00:00:00 " + timezone) / 6e4;
  1587. return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
  1588. }
  1589. function addDateMinutes(date, minutes) {
  1590. date = new Date(date.getTime());
  1591. date.setMinutes(date.getMinutes() + minutes);
  1592. return date;
  1593. }
  1594. function convertTimezoneToLocal(date, timezone, reverse) {
  1595. const reverseValue = -1;
  1596. const dateTimezoneOffset = date.getTimezoneOffset();
  1597. const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  1598. return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
  1599. }
  1600. function toDate(value) {
  1601. if (isDate(value)) {
  1602. return value;
  1603. }
  1604. if (typeof value === "number" && !isNaN(value)) {
  1605. return new Date(value);
  1606. }
  1607. if (typeof value === "string") {
  1608. value = value.trim();
  1609. if (/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(value)) {
  1610. const [y, m = 1, d = 1] = value.split("-").map((val) => +val);
  1611. return createDate(y, m - 1, d);
  1612. }
  1613. const parsedNb = parseFloat(value);
  1614. if (!isNaN(value - parsedNb)) {
  1615. return new Date(parsedNb);
  1616. }
  1617. let match;
  1618. if (match = value.match(ISO8601_DATE_REGEX)) {
  1619. return isoStringToDate(match);
  1620. }
  1621. }
  1622. const date = new Date(value);
  1623. if (!isDate(date)) {
  1624. throw new RuntimeError(2302, ngDevMode && `Unable to convert "${value}" into a date`);
  1625. }
  1626. return date;
  1627. }
  1628. function isoStringToDate(match) {
  1629. const date = /* @__PURE__ */ new Date(0);
  1630. let tzHour = 0;
  1631. let tzMin = 0;
  1632. const dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
  1633. const timeSetter = match[8] ? date.setUTCHours : date.setHours;
  1634. if (match[9]) {
  1635. tzHour = Number(match[9] + match[10]);
  1636. tzMin = Number(match[9] + match[11]);
  1637. }
  1638. dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
  1639. const h = Number(match[4] || 0) - tzHour;
  1640. const m = Number(match[5] || 0) - tzMin;
  1641. const s = Number(match[6] || 0);
  1642. const ms = Math.floor(parseFloat("0." + (match[7] || 0)) * 1e3);
  1643. timeSetter.call(date, h, m, s, ms);
  1644. return date;
  1645. }
  1646. function isDate(value) {
  1647. return value instanceof Date && !isNaN(value.valueOf());
  1648. }
  1649. var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
  1650. var MAX_DIGITS = 22;
  1651. var DECIMAL_SEP = ".";
  1652. var ZERO_CHAR = "0";
  1653. var PATTERN_SEP = ";";
  1654. var GROUP_SEP = ",";
  1655. var DIGIT_CHAR = "#";
  1656. var CURRENCY_CHAR = "¤";
  1657. var PERCENT_CHAR = "%";
  1658. function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent = false) {
  1659. let formattedText = "";
  1660. let isZero = false;
  1661. if (!isFinite(value)) {
  1662. formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
  1663. } else {
  1664. let parsedNumber = parseNumber(value);
  1665. if (isPercent) {
  1666. parsedNumber = toPercent(parsedNumber);
  1667. }
  1668. let minInt = pattern.minInt;
  1669. let minFraction = pattern.minFrac;
  1670. let maxFraction = pattern.maxFrac;
  1671. if (digitsInfo) {
  1672. const parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
  1673. if (parts === null) {
  1674. throw new RuntimeError(2306, ngDevMode && `${digitsInfo} is not a valid digit info`);
  1675. }
  1676. const minIntPart = parts[1];
  1677. const minFractionPart = parts[3];
  1678. const maxFractionPart = parts[5];
  1679. if (minIntPart != null) {
  1680. minInt = parseIntAutoRadix(minIntPart);
  1681. }
  1682. if (minFractionPart != null) {
  1683. minFraction = parseIntAutoRadix(minFractionPart);
  1684. }
  1685. if (maxFractionPart != null) {
  1686. maxFraction = parseIntAutoRadix(maxFractionPart);
  1687. } else if (minFractionPart != null && minFraction > maxFraction) {
  1688. maxFraction = minFraction;
  1689. }
  1690. }
  1691. roundNumber(parsedNumber, minFraction, maxFraction);
  1692. let digits = parsedNumber.digits;
  1693. let integerLen = parsedNumber.integerLen;
  1694. const exponent = parsedNumber.exponent;
  1695. let decimals = [];
  1696. isZero = digits.every((d) => !d);
  1697. for (; integerLen < minInt; integerLen++) {
  1698. digits.unshift(0);
  1699. }
  1700. for (; integerLen < 0; integerLen++) {
  1701. digits.unshift(0);
  1702. }
  1703. if (integerLen > 0) {
  1704. decimals = digits.splice(integerLen, digits.length);
  1705. } else {
  1706. decimals = digits;
  1707. digits = [0];
  1708. }
  1709. const groups = [];
  1710. if (digits.length >= pattern.lgSize) {
  1711. groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(""));
  1712. }
  1713. while (digits.length > pattern.gSize) {
  1714. groups.unshift(digits.splice(-pattern.gSize, digits.length).join(""));
  1715. }
  1716. if (digits.length) {
  1717. groups.unshift(digits.join(""));
  1718. }
  1719. formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
  1720. if (decimals.length) {
  1721. formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join("");
  1722. }
  1723. if (exponent) {
  1724. formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + "+" + exponent;
  1725. }
  1726. }
  1727. if (value < 0 && !isZero) {
  1728. formattedText = pattern.negPre + formattedText + pattern.negSuf;
  1729. } else {
  1730. formattedText = pattern.posPre + formattedText + pattern.posSuf;
  1731. }
  1732. return formattedText;
  1733. }
  1734. function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
  1735. const format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
  1736. const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  1737. pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
  1738. pattern.maxFrac = pattern.minFrac;
  1739. const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
  1740. return res.replace(CURRENCY_CHAR, currency).replace(CURRENCY_CHAR, "").trim();
  1741. }
  1742. function formatPercent(value, locale, digitsInfo) {
  1743. const format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
  1744. const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  1745. const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
  1746. return res.replace(new RegExp(PERCENT_CHAR, "g"), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
  1747. }
  1748. function formatNumber(value, locale, digitsInfo) {
  1749. const format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
  1750. const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  1751. return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
  1752. }
  1753. function parseNumberFormat(format, minusSign = "-") {
  1754. const p = {
  1755. minInt: 1,
  1756. minFrac: 0,
  1757. maxFrac: 0,
  1758. posPre: "",
  1759. posSuf: "",
  1760. negPre: "",
  1761. negSuf: "",
  1762. gSize: 0,
  1763. lgSize: 0
  1764. };
  1765. const patternParts = format.split(PATTERN_SEP);
  1766. const positive = patternParts[0];
  1767. const negative = patternParts[1];
  1768. const positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? positive.split(DECIMAL_SEP) : [positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)], integer = positiveParts[0], fraction = positiveParts[1] || "";
  1769. p.posPre = integer.substring(0, integer.indexOf(DIGIT_CHAR));
  1770. for (let i = 0; i < fraction.length; i++) {
  1771. const ch = fraction.charAt(i);
  1772. if (ch === ZERO_CHAR) {
  1773. p.minFrac = p.maxFrac = i + 1;
  1774. } else if (ch === DIGIT_CHAR) {
  1775. p.maxFrac = i + 1;
  1776. } else {
  1777. p.posSuf += ch;
  1778. }
  1779. }
  1780. const groups = integer.split(GROUP_SEP);
  1781. p.gSize = groups[1] ? groups[1].length : 0;
  1782. p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0;
  1783. if (negative) {
  1784. const trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
  1785. p.negPre = negative.substring(0, pos).replace(/'/g, "");
  1786. p.negSuf = negative.slice(pos + trunkLen).replace(/'/g, "");
  1787. } else {
  1788. p.negPre = minusSign + p.posPre;
  1789. p.negSuf = p.posSuf;
  1790. }
  1791. return p;
  1792. }
  1793. function toPercent(parsedNumber) {
  1794. if (parsedNumber.digits[0] === 0) {
  1795. return parsedNumber;
  1796. }
  1797. const fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
  1798. if (parsedNumber.exponent) {
  1799. parsedNumber.exponent += 2;
  1800. } else {
  1801. if (fractionLen === 0) {
  1802. parsedNumber.digits.push(0, 0);
  1803. } else if (fractionLen === 1) {
  1804. parsedNumber.digits.push(0);
  1805. }
  1806. parsedNumber.integerLen += 2;
  1807. }
  1808. return parsedNumber;
  1809. }
  1810. function parseNumber(num) {
  1811. let numStr = Math.abs(num) + "";
  1812. let exponent = 0, digits, integerLen;
  1813. let i, j, zeros;
  1814. if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
  1815. numStr = numStr.replace(DECIMAL_SEP, "");
  1816. }
  1817. if ((i = numStr.search(/e/i)) > 0) {
  1818. if (integerLen < 0) integerLen = i;
  1819. integerLen += +numStr.slice(i + 1);
  1820. numStr = numStr.substring(0, i);
  1821. } else if (integerLen < 0) {
  1822. integerLen = numStr.length;
  1823. }
  1824. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
  1825. }
  1826. if (i === (zeros = numStr.length)) {
  1827. digits = [0];
  1828. integerLen = 1;
  1829. } else {
  1830. zeros--;
  1831. while (numStr.charAt(zeros) === ZERO_CHAR) zeros--;
  1832. integerLen -= i;
  1833. digits = [];
  1834. for (j = 0; i <= zeros; i++, j++) {
  1835. digits[j] = Number(numStr.charAt(i));
  1836. }
  1837. }
  1838. if (integerLen > MAX_DIGITS) {
  1839. digits = digits.splice(0, MAX_DIGITS - 1);
  1840. exponent = integerLen - 1;
  1841. integerLen = 1;
  1842. }
  1843. return {
  1844. digits,
  1845. exponent,
  1846. integerLen
  1847. };
  1848. }
  1849. function roundNumber(parsedNumber, minFrac, maxFrac) {
  1850. if (minFrac > maxFrac) {
  1851. throw new RuntimeError(2307, ngDevMode && `The minimum number of digits after fraction (${minFrac}) is higher than the maximum (${maxFrac}).`);
  1852. }
  1853. let digits = parsedNumber.digits;
  1854. let fractionLen = digits.length - parsedNumber.integerLen;
  1855. const fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
  1856. let roundAt = fractionSize + parsedNumber.integerLen;
  1857. let digit = digits[roundAt];
  1858. if (roundAt > 0) {
  1859. digits.splice(Math.max(parsedNumber.integerLen, roundAt));
  1860. for (let j = roundAt; j < digits.length; j++) {
  1861. digits[j] = 0;
  1862. }
  1863. } else {
  1864. fractionLen = Math.max(0, fractionLen);
  1865. parsedNumber.integerLen = 1;
  1866. digits.length = Math.max(1, roundAt = fractionSize + 1);
  1867. digits[0] = 0;
  1868. for (let i = 1; i < roundAt; i++) digits[i] = 0;
  1869. }
  1870. if (digit >= 5) {
  1871. if (roundAt - 1 < 0) {
  1872. for (let k = 0; k > roundAt; k--) {
  1873. digits.unshift(0);
  1874. parsedNumber.integerLen++;
  1875. }
  1876. digits.unshift(1);
  1877. parsedNumber.integerLen++;
  1878. } else {
  1879. digits[roundAt - 1]++;
  1880. }
  1881. }
  1882. for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
  1883. let dropTrailingZeros = fractionSize !== 0;
  1884. const minLen = minFrac + parsedNumber.integerLen;
  1885. const carry = digits.reduceRight(function(carry2, d, i, digits2) {
  1886. d = d + carry2;
  1887. digits2[i] = d < 10 ? d : d - 10;
  1888. if (dropTrailingZeros) {
  1889. if (digits2[i] === 0 && i >= minLen) {
  1890. digits2.pop();
  1891. } else {
  1892. dropTrailingZeros = false;
  1893. }
  1894. }
  1895. return d >= 10 ? 1 : 0;
  1896. }, 0);
  1897. if (carry) {
  1898. digits.unshift(carry);
  1899. parsedNumber.integerLen++;
  1900. }
  1901. }
  1902. function parseIntAutoRadix(text) {
  1903. const result = parseInt(text);
  1904. if (isNaN(result)) {
  1905. throw new RuntimeError(2305, ngDevMode && "Invalid integer literal when parsing " + text);
  1906. }
  1907. return result;
  1908. }
  1909. var NgLocalization = class _NgLocalization {
  1910. static ɵfac = function NgLocalization_Factory(__ngFactoryType__) {
  1911. return new (__ngFactoryType__ || _NgLocalization)();
  1912. };
  1913. static ɵprov = ɵɵdefineInjectable({
  1914. token: _NgLocalization,
  1915. factory: function NgLocalization_Factory(__ngFactoryType__) {
  1916. let __ngConditionalFactory__ = null;
  1917. if (__ngFactoryType__) {
  1918. __ngConditionalFactory__ = new __ngFactoryType__();
  1919. } else {
  1920. __ngConditionalFactory__ = ((locale) => new NgLocaleLocalization(locale))(ɵɵinject(LOCALE_ID));
  1921. }
  1922. return __ngConditionalFactory__;
  1923. },
  1924. providedIn: "root"
  1925. });
  1926. };
  1927. (() => {
  1928. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocalization, [{
  1929. type: Injectable,
  1930. args: [{
  1931. providedIn: "root",
  1932. useFactory: (locale) => new NgLocaleLocalization(locale),
  1933. deps: [LOCALE_ID]
  1934. }]
  1935. }], null, null);
  1936. })();
  1937. function getPluralCategory(value, cases, ngLocalization, locale) {
  1938. let key = `=${value}`;
  1939. if (cases.indexOf(key) > -1) {
  1940. return key;
  1941. }
  1942. key = ngLocalization.getPluralCategory(value, locale);
  1943. if (cases.indexOf(key) > -1) {
  1944. return key;
  1945. }
  1946. if (cases.indexOf("other") > -1) {
  1947. return "other";
  1948. }
  1949. throw new RuntimeError(2308, ngDevMode && `No plural message found for value "${value}"`);
  1950. }
  1951. var NgLocaleLocalization = class _NgLocaleLocalization extends NgLocalization {
  1952. locale;
  1953. constructor(locale) {
  1954. super();
  1955. this.locale = locale;
  1956. }
  1957. getPluralCategory(value, locale) {
  1958. const plural = getLocalePluralCase2(locale || this.locale)(value);
  1959. switch (plural) {
  1960. case Plural.Zero:
  1961. return "zero";
  1962. case Plural.One:
  1963. return "one";
  1964. case Plural.Two:
  1965. return "two";
  1966. case Plural.Few:
  1967. return "few";
  1968. case Plural.Many:
  1969. return "many";
  1970. default:
  1971. return "other";
  1972. }
  1973. }
  1974. static ɵfac = function NgLocaleLocalization_Factory(__ngFactoryType__) {
  1975. return new (__ngFactoryType__ || _NgLocaleLocalization)(ɵɵinject(LOCALE_ID));
  1976. };
  1977. static ɵprov = ɵɵdefineInjectable({
  1978. token: _NgLocaleLocalization,
  1979. factory: _NgLocaleLocalization.ɵfac
  1980. });
  1981. };
  1982. (() => {
  1983. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocaleLocalization, [{
  1984. type: Injectable
  1985. }], () => [{
  1986. type: void 0,
  1987. decorators: [{
  1988. type: Inject,
  1989. args: [LOCALE_ID]
  1990. }]
  1991. }], null);
  1992. })();
  1993. var WS_REGEXP = /\s+/;
  1994. var EMPTY_ARRAY = [];
  1995. var NgClass = class _NgClass {
  1996. _ngEl;
  1997. _renderer;
  1998. initialClasses = EMPTY_ARRAY;
  1999. rawClass;
  2000. stateMap = /* @__PURE__ */ new Map();
  2001. constructor(_ngEl, _renderer) {
  2002. this._ngEl = _ngEl;
  2003. this._renderer = _renderer;
  2004. }
  2005. set klass(value) {
  2006. this.initialClasses = value != null ? value.trim().split(WS_REGEXP) : EMPTY_ARRAY;
  2007. }
  2008. set ngClass(value) {
  2009. this.rawClass = typeof value === "string" ? value.trim().split(WS_REGEXP) : value;
  2010. }
  2011. /*
  2012. The NgClass directive uses the custom change detection algorithm for its inputs. The custom
  2013. algorithm is necessary since inputs are represented as complex object or arrays that need to be
  2014. deeply-compared.
  2015. This algorithm is perf-sensitive since NgClass is used very frequently and its poor performance
  2016. might negatively impact runtime performance of the entire change detection cycle. The design of
  2017. this algorithm is making sure that:
  2018. - there is no unnecessary DOM manipulation (CSS classes are added / removed from the DOM only when
  2019. needed), even if references to bound objects change;
  2020. - there is no memory allocation if nothing changes (even relatively modest memory allocation
  2021. during the change detection cycle can result in GC pauses for some of the CD cycles).
  2022. The algorithm works by iterating over the set of bound classes, staring with [class] binding and
  2023. then going over [ngClass] binding. For each CSS class name:
  2024. - check if it was seen before (this information is tracked in the state map) and if its value
  2025. changed;
  2026. - mark it as "touched" - names that are not marked are not present in the latest set of binding
  2027. and we can remove such class name from the internal data structures;
  2028. After iteration over all the CSS class names we've got data structure with all the information
  2029. necessary to synchronize changes to the DOM - it is enough to iterate over the state map, flush
  2030. changes to the DOM and reset internal data structures so those are ready for the next change
  2031. detection cycle.
  2032. */
  2033. ngDoCheck() {
  2034. for (const klass of this.initialClasses) {
  2035. this._updateState(klass, true);
  2036. }
  2037. const rawClass = this.rawClass;
  2038. if (Array.isArray(rawClass) || rawClass instanceof Set) {
  2039. for (const klass of rawClass) {
  2040. this._updateState(klass, true);
  2041. }
  2042. } else if (rawClass != null) {
  2043. for (const klass of Object.keys(rawClass)) {
  2044. this._updateState(klass, Boolean(rawClass[klass]));
  2045. }
  2046. }
  2047. this._applyStateDiff();
  2048. }
  2049. _updateState(klass, nextEnabled) {
  2050. const state = this.stateMap.get(klass);
  2051. if (state !== void 0) {
  2052. if (state.enabled !== nextEnabled) {
  2053. state.changed = true;
  2054. state.enabled = nextEnabled;
  2055. }
  2056. state.touched = true;
  2057. } else {
  2058. this.stateMap.set(klass, {
  2059. enabled: nextEnabled,
  2060. changed: true,
  2061. touched: true
  2062. });
  2063. }
  2064. }
  2065. _applyStateDiff() {
  2066. for (const stateEntry of this.stateMap) {
  2067. const klass = stateEntry[0];
  2068. const state = stateEntry[1];
  2069. if (state.changed) {
  2070. this._toggleClass(klass, state.enabled);
  2071. state.changed = false;
  2072. } else if (!state.touched) {
  2073. if (state.enabled) {
  2074. this._toggleClass(klass, false);
  2075. }
  2076. this.stateMap.delete(klass);
  2077. }
  2078. state.touched = false;
  2079. }
  2080. }
  2081. _toggleClass(klass, enabled) {
  2082. if (ngDevMode) {
  2083. if (typeof klass !== "string") {
  2084. throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${stringify(klass)}`);
  2085. }
  2086. }
  2087. klass = klass.trim();
  2088. if (klass.length > 0) {
  2089. klass.split(WS_REGEXP).forEach((klass2) => {
  2090. if (enabled) {
  2091. this._renderer.addClass(this._ngEl.nativeElement, klass2);
  2092. } else {
  2093. this._renderer.removeClass(this._ngEl.nativeElement, klass2);
  2094. }
  2095. });
  2096. }
  2097. }
  2098. static ɵfac = function NgClass_Factory(__ngFactoryType__) {
  2099. return new (__ngFactoryType__ || _NgClass)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(Renderer2));
  2100. };
  2101. static ɵdir = ɵɵdefineDirective({
  2102. type: _NgClass,
  2103. selectors: [["", "ngClass", ""]],
  2104. inputs: {
  2105. klass: [0, "class", "klass"],
  2106. ngClass: "ngClass"
  2107. }
  2108. });
  2109. };
  2110. (() => {
  2111. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgClass, [{
  2112. type: Directive,
  2113. args: [{
  2114. selector: "[ngClass]"
  2115. }]
  2116. }], () => [{
  2117. type: ElementRef
  2118. }, {
  2119. type: Renderer2
  2120. }], {
  2121. klass: [{
  2122. type: Input,
  2123. args: ["class"]
  2124. }],
  2125. ngClass: [{
  2126. type: Input,
  2127. args: ["ngClass"]
  2128. }]
  2129. });
  2130. })();
  2131. var NgComponentOutlet = class _NgComponentOutlet {
  2132. _viewContainerRef;
  2133. // TODO(crisbeto): this should be `Type<T>`, but doing so broke a few
  2134. // targets in a TGP so we need to do it in a major version.
  2135. /** Component that should be rendered in the outlet. */
  2136. ngComponentOutlet = null;
  2137. ngComponentOutletInputs;
  2138. ngComponentOutletInjector;
  2139. ngComponentOutletContent;
  2140. ngComponentOutletNgModule;
  2141. /**
  2142. * @deprecated This input is deprecated, use `ngComponentOutletNgModule` instead.
  2143. */
  2144. ngComponentOutletNgModuleFactory;
  2145. _componentRef;
  2146. _moduleRef;
  2147. /**
  2148. * A helper data structure that allows us to track inputs that were part of the
  2149. * ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones
  2150. * that are no longer referenced.
  2151. */
  2152. _inputsUsed = /* @__PURE__ */ new Map();
  2153. /**
  2154. * Gets the instance of the currently-rendered component.
  2155. * Will be null if no component has been rendered.
  2156. */
  2157. get componentInstance() {
  2158. return this._componentRef?.instance ?? null;
  2159. }
  2160. constructor(_viewContainerRef) {
  2161. this._viewContainerRef = _viewContainerRef;
  2162. }
  2163. _needToReCreateNgModuleInstance(changes) {
  2164. return changes["ngComponentOutletNgModule"] !== void 0 || changes["ngComponentOutletNgModuleFactory"] !== void 0;
  2165. }
  2166. _needToReCreateComponentInstance(changes) {
  2167. return changes["ngComponentOutlet"] !== void 0 || changes["ngComponentOutletContent"] !== void 0 || changes["ngComponentOutletInjector"] !== void 0 || this._needToReCreateNgModuleInstance(changes);
  2168. }
  2169. /** @docs-private */
  2170. ngOnChanges(changes) {
  2171. if (this._needToReCreateComponentInstance(changes)) {
  2172. this._viewContainerRef.clear();
  2173. this._inputsUsed.clear();
  2174. this._componentRef = void 0;
  2175. if (this.ngComponentOutlet) {
  2176. const injector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
  2177. if (this._needToReCreateNgModuleInstance(changes)) {
  2178. this._moduleRef?.destroy();
  2179. if (this.ngComponentOutletNgModule) {
  2180. this._moduleRef = createNgModule(this.ngComponentOutletNgModule, getParentInjector(injector));
  2181. } else if (this.ngComponentOutletNgModuleFactory) {
  2182. this._moduleRef = this.ngComponentOutletNgModuleFactory.create(getParentInjector(injector));
  2183. } else {
  2184. this._moduleRef = void 0;
  2185. }
  2186. }
  2187. this._componentRef = this._viewContainerRef.createComponent(this.ngComponentOutlet, {
  2188. injector,
  2189. ngModuleRef: this._moduleRef,
  2190. projectableNodes: this.ngComponentOutletContent
  2191. });
  2192. }
  2193. }
  2194. }
  2195. /** @docs-private */
  2196. ngDoCheck() {
  2197. if (this._componentRef) {
  2198. if (this.ngComponentOutletInputs) {
  2199. for (const inputName of Object.keys(this.ngComponentOutletInputs)) {
  2200. this._inputsUsed.set(inputName, true);
  2201. }
  2202. }
  2203. this._applyInputStateDiff(this._componentRef);
  2204. }
  2205. }
  2206. /** @docs-private */
  2207. ngOnDestroy() {
  2208. this._moduleRef?.destroy();
  2209. }
  2210. _applyInputStateDiff(componentRef) {
  2211. for (const [inputName, touched] of this._inputsUsed) {
  2212. if (!touched) {
  2213. componentRef.setInput(inputName, void 0);
  2214. this._inputsUsed.delete(inputName);
  2215. } else {
  2216. componentRef.setInput(inputName, this.ngComponentOutletInputs[inputName]);
  2217. this._inputsUsed.set(inputName, false);
  2218. }
  2219. }
  2220. }
  2221. static ɵfac = function NgComponentOutlet_Factory(__ngFactoryType__) {
  2222. return new (__ngFactoryType__ || _NgComponentOutlet)(ɵɵdirectiveInject(ViewContainerRef));
  2223. };
  2224. static ɵdir = ɵɵdefineDirective({
  2225. type: _NgComponentOutlet,
  2226. selectors: [["", "ngComponentOutlet", ""]],
  2227. inputs: {
  2228. ngComponentOutlet: "ngComponentOutlet",
  2229. ngComponentOutletInputs: "ngComponentOutletInputs",
  2230. ngComponentOutletInjector: "ngComponentOutletInjector",
  2231. ngComponentOutletContent: "ngComponentOutletContent",
  2232. ngComponentOutletNgModule: "ngComponentOutletNgModule",
  2233. ngComponentOutletNgModuleFactory: "ngComponentOutletNgModuleFactory"
  2234. },
  2235. exportAs: ["ngComponentOutlet"],
  2236. features: [ɵɵNgOnChangesFeature]
  2237. });
  2238. };
  2239. (() => {
  2240. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgComponentOutlet, [{
  2241. type: Directive,
  2242. args: [{
  2243. selector: "[ngComponentOutlet]",
  2244. exportAs: "ngComponentOutlet"
  2245. }]
  2246. }], () => [{
  2247. type: ViewContainerRef
  2248. }], {
  2249. ngComponentOutlet: [{
  2250. type: Input
  2251. }],
  2252. ngComponentOutletInputs: [{
  2253. type: Input
  2254. }],
  2255. ngComponentOutletInjector: [{
  2256. type: Input
  2257. }],
  2258. ngComponentOutletContent: [{
  2259. type: Input
  2260. }],
  2261. ngComponentOutletNgModule: [{
  2262. type: Input
  2263. }],
  2264. ngComponentOutletNgModuleFactory: [{
  2265. type: Input
  2266. }]
  2267. });
  2268. })();
  2269. function getParentInjector(injector) {
  2270. const parentNgModule = injector.get(NgModuleRef$1);
  2271. return parentNgModule.injector;
  2272. }
  2273. var NgForOfContext = class {
  2274. $implicit;
  2275. ngForOf;
  2276. index;
  2277. count;
  2278. constructor($implicit, ngForOf, index, count) {
  2279. this.$implicit = $implicit;
  2280. this.ngForOf = ngForOf;
  2281. this.index = index;
  2282. this.count = count;
  2283. }
  2284. // Indicates whether this is the first item in the collection.
  2285. get first() {
  2286. return this.index === 0;
  2287. }
  2288. // Indicates whether this is the last item in the collection.
  2289. get last() {
  2290. return this.index === this.count - 1;
  2291. }
  2292. // Indicates whether an index of this item in the collection is even.
  2293. get even() {
  2294. return this.index % 2 === 0;
  2295. }
  2296. // Indicates whether an index of this item in the collection is odd.
  2297. get odd() {
  2298. return !this.even;
  2299. }
  2300. };
  2301. var NgForOf = class _NgForOf {
  2302. _viewContainer;
  2303. _template;
  2304. _differs;
  2305. /**
  2306. * The value of the iterable expression, which can be used as a
  2307. * [template input variable](guide/directives/structural-directives#shorthand).
  2308. * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
  2309. */
  2310. set ngForOf(ngForOf) {
  2311. this._ngForOf = ngForOf;
  2312. this._ngForOfDirty = true;
  2313. }
  2314. /**
  2315. * Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
  2316. *
  2317. * If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
  2318. * identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
  2319. * as the key.
  2320. *
  2321. * `NgForOf` uses the computed key to associate items in an iterable with DOM elements
  2322. * it produces for these items.
  2323. *
  2324. * A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
  2325. * iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
  2326. * primary key), and this iterable could be updated with new object instances that still
  2327. * represent the same underlying entity (for example, when data is re-fetched from the server,
  2328. * and the iterable is recreated and re-rendered, but most of the data is still the same).
  2329. *
  2330. * @see {@link TrackByFunction}
  2331. * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
  2332. */
  2333. set ngForTrackBy(fn) {
  2334. if ((typeof ngDevMode === "undefined" || ngDevMode) && fn != null && typeof fn !== "function") {
  2335. console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
  2336. }
  2337. this._trackByFn = fn;
  2338. }
  2339. get ngForTrackBy() {
  2340. return this._trackByFn;
  2341. }
  2342. _ngForOf = null;
  2343. _ngForOfDirty = true;
  2344. _differ = null;
  2345. // waiting for microsoft/typescript#43662 to allow the return type `TrackByFunction|undefined` for
  2346. // the getter
  2347. _trackByFn;
  2348. constructor(_viewContainer, _template, _differs) {
  2349. this._viewContainer = _viewContainer;
  2350. this._template = _template;
  2351. this._differs = _differs;
  2352. }
  2353. /**
  2354. * A reference to the template that is stamped out for each item in the iterable.
  2355. * @see [template reference variable](guide/templates/variables#template-reference-variables)
  2356. * @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
  2357. */
  2358. set ngForTemplate(value) {
  2359. if (value) {
  2360. this._template = value;
  2361. }
  2362. }
  2363. /**
  2364. * Applies the changes when needed.
  2365. * @docs-private
  2366. */
  2367. ngDoCheck() {
  2368. if (this._ngForOfDirty) {
  2369. this._ngForOfDirty = false;
  2370. const value = this._ngForOf;
  2371. if (!this._differ && value) {
  2372. if (typeof ngDevMode === "undefined" || ngDevMode) {
  2373. try {
  2374. this._differ = this._differs.find(value).create(this.ngForTrackBy);
  2375. } catch {
  2376. let errorMessage = `Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables, such as Arrays.`;
  2377. if (typeof value === "object") {
  2378. errorMessage += " Did you mean to use the keyvalue pipe?";
  2379. }
  2380. throw new RuntimeError(-2200, errorMessage);
  2381. }
  2382. } else {
  2383. this._differ = this._differs.find(value).create(this.ngForTrackBy);
  2384. }
  2385. }
  2386. }
  2387. if (this._differ) {
  2388. const changes = this._differ.diff(this._ngForOf);
  2389. if (changes) this._applyChanges(changes);
  2390. }
  2391. }
  2392. _applyChanges(changes) {
  2393. const viewContainer = this._viewContainer;
  2394. changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
  2395. if (item.previousIndex == null) {
  2396. viewContainer.createEmbeddedView(this._template, new NgForOfContext(item.item, this._ngForOf, -1, -1), currentIndex === null ? void 0 : currentIndex);
  2397. } else if (currentIndex == null) {
  2398. viewContainer.remove(adjustedPreviousIndex === null ? void 0 : adjustedPreviousIndex);
  2399. } else if (adjustedPreviousIndex !== null) {
  2400. const view = viewContainer.get(adjustedPreviousIndex);
  2401. viewContainer.move(view, currentIndex);
  2402. applyViewChange(view, item);
  2403. }
  2404. });
  2405. for (let i = 0, ilen = viewContainer.length; i < ilen; i++) {
  2406. const viewRef = viewContainer.get(i);
  2407. const context = viewRef.context;
  2408. context.index = i;
  2409. context.count = ilen;
  2410. context.ngForOf = this._ngForOf;
  2411. }
  2412. changes.forEachIdentityChange((record) => {
  2413. const viewRef = viewContainer.get(record.currentIndex);
  2414. applyViewChange(viewRef, record);
  2415. });
  2416. }
  2417. /**
  2418. * Asserts the correct type of the context for the template that `NgForOf` will render.
  2419. *
  2420. * The presence of this method is a signal to the Ivy template type-check compiler that the
  2421. * `NgForOf` structural directive renders its template with a specific context type.
  2422. */
  2423. static ngTemplateContextGuard(dir, ctx) {
  2424. return true;
  2425. }
  2426. static ɵfac = function NgForOf_Factory(__ngFactoryType__) {
  2427. return new (__ngFactoryType__ || _NgForOf)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(IterableDiffers));
  2428. };
  2429. static ɵdir = ɵɵdefineDirective({
  2430. type: _NgForOf,
  2431. selectors: [["", "ngFor", "", "ngForOf", ""]],
  2432. inputs: {
  2433. ngForOf: "ngForOf",
  2434. ngForTrackBy: "ngForTrackBy",
  2435. ngForTemplate: "ngForTemplate"
  2436. }
  2437. });
  2438. };
  2439. (() => {
  2440. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgForOf, [{
  2441. type: Directive,
  2442. args: [{
  2443. selector: "[ngFor][ngForOf]"
  2444. }]
  2445. }], () => [{
  2446. type: ViewContainerRef
  2447. }, {
  2448. type: TemplateRef
  2449. }, {
  2450. type: IterableDiffers
  2451. }], {
  2452. ngForOf: [{
  2453. type: Input
  2454. }],
  2455. ngForTrackBy: [{
  2456. type: Input
  2457. }],
  2458. ngForTemplate: [{
  2459. type: Input
  2460. }]
  2461. });
  2462. })();
  2463. function applyViewChange(view, record) {
  2464. view.context.$implicit = record.item;
  2465. }
  2466. function getTypeName(type) {
  2467. return type["name"] || typeof type;
  2468. }
  2469. var NgIf = class _NgIf {
  2470. _viewContainer;
  2471. _context = new NgIfContext();
  2472. _thenTemplateRef = null;
  2473. _elseTemplateRef = null;
  2474. _thenViewRef = null;
  2475. _elseViewRef = null;
  2476. constructor(_viewContainer, templateRef) {
  2477. this._viewContainer = _viewContainer;
  2478. this._thenTemplateRef = templateRef;
  2479. }
  2480. /**
  2481. * The Boolean expression to evaluate as the condition for showing a template.
  2482. * @deprecated Use the `@if` block instead. Intent to remove in v22
  2483. */
  2484. set ngIf(condition) {
  2485. this._context.$implicit = this._context.ngIf = condition;
  2486. this._updateView();
  2487. }
  2488. /**
  2489. * A template to show if the condition expression evaluates to true.
  2490. * @deprecated Use the `@if` block instead. Intent to remove in v22
  2491. */
  2492. set ngIfThen(templateRef) {
  2493. assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfThen");
  2494. this._thenTemplateRef = templateRef;
  2495. this._thenViewRef = null;
  2496. this._updateView();
  2497. }
  2498. /**
  2499. * A template to show if the condition expression evaluates to false.
  2500. * @deprecated Use the `@if` block instead. Intent to remove in v22
  2501. */
  2502. set ngIfElse(templateRef) {
  2503. assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfElse");
  2504. this._elseTemplateRef = templateRef;
  2505. this._elseViewRef = null;
  2506. this._updateView();
  2507. }
  2508. _updateView() {
  2509. if (this._context.$implicit) {
  2510. if (!this._thenViewRef) {
  2511. this._viewContainer.clear();
  2512. this._elseViewRef = null;
  2513. if (this._thenTemplateRef) {
  2514. this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
  2515. }
  2516. }
  2517. } else {
  2518. if (!this._elseViewRef) {
  2519. this._viewContainer.clear();
  2520. this._thenViewRef = null;
  2521. if (this._elseTemplateRef) {
  2522. this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
  2523. }
  2524. }
  2525. }
  2526. }
  2527. /** @internal */
  2528. static ngIfUseIfTypeGuard;
  2529. /**
  2530. * Assert the correct type of the expression bound to the `ngIf` input within the template.
  2531. *
  2532. * The presence of this static field is a signal to the Ivy template type check compiler that
  2533. * when the `NgIf` structural directive renders its template, the type of the expression bound
  2534. * to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
  2535. * narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
  2536. */
  2537. static ngTemplateGuard_ngIf;
  2538. /**
  2539. * Asserts the correct type of the context for the template that `NgIf` will render.
  2540. *
  2541. * The presence of this method is a signal to the Ivy template type-check compiler that the
  2542. * `NgIf` structural directive renders its template with a specific context type.
  2543. */
  2544. static ngTemplateContextGuard(dir, ctx) {
  2545. return true;
  2546. }
  2547. static ɵfac = function NgIf_Factory(__ngFactoryType__) {
  2548. return new (__ngFactoryType__ || _NgIf)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(TemplateRef));
  2549. };
  2550. static ɵdir = ɵɵdefineDirective({
  2551. type: _NgIf,
  2552. selectors: [["", "ngIf", ""]],
  2553. inputs: {
  2554. ngIf: "ngIf",
  2555. ngIfThen: "ngIfThen",
  2556. ngIfElse: "ngIfElse"
  2557. }
  2558. });
  2559. };
  2560. (() => {
  2561. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgIf, [{
  2562. type: Directive,
  2563. args: [{
  2564. selector: "[ngIf]"
  2565. }]
  2566. }], () => [{
  2567. type: ViewContainerRef
  2568. }, {
  2569. type: TemplateRef
  2570. }], {
  2571. ngIf: [{
  2572. type: Input
  2573. }],
  2574. ngIfThen: [{
  2575. type: Input
  2576. }],
  2577. ngIfElse: [{
  2578. type: Input
  2579. }]
  2580. });
  2581. })();
  2582. var NgIfContext = class {
  2583. $implicit = null;
  2584. ngIf = null;
  2585. };
  2586. function assertTemplate(templateRef, property) {
  2587. if (templateRef && !templateRef.createEmbeddedView) {
  2588. throw new RuntimeError(2020, (typeof ngDevMode === "undefined" || ngDevMode) && `${property} must be a TemplateRef, but received '${stringify(templateRef)}'.`);
  2589. }
  2590. }
  2591. var SwitchView = class {
  2592. _viewContainerRef;
  2593. _templateRef;
  2594. _created = false;
  2595. constructor(_viewContainerRef, _templateRef) {
  2596. this._viewContainerRef = _viewContainerRef;
  2597. this._templateRef = _templateRef;
  2598. }
  2599. create() {
  2600. this._created = true;
  2601. this._viewContainerRef.createEmbeddedView(this._templateRef);
  2602. }
  2603. destroy() {
  2604. this._created = false;
  2605. this._viewContainerRef.clear();
  2606. }
  2607. enforceState(created) {
  2608. if (created && !this._created) {
  2609. this.create();
  2610. } else if (!created && this._created) {
  2611. this.destroy();
  2612. }
  2613. }
  2614. };
  2615. var NgSwitch = class _NgSwitch {
  2616. _defaultViews = [];
  2617. _defaultUsed = false;
  2618. _caseCount = 0;
  2619. _lastCaseCheckIndex = 0;
  2620. _lastCasesMatched = false;
  2621. _ngSwitch;
  2622. /** @deprecated Use the `@switch` block instead. Intent to remove in v22 */
  2623. set ngSwitch(newValue) {
  2624. this._ngSwitch = newValue;
  2625. if (this._caseCount === 0) {
  2626. this._updateDefaultCases(true);
  2627. }
  2628. }
  2629. /** @internal */
  2630. _addCase() {
  2631. return this._caseCount++;
  2632. }
  2633. /** @internal */
  2634. _addDefault(view) {
  2635. this._defaultViews.push(view);
  2636. }
  2637. /** @internal */
  2638. _matchCase(value) {
  2639. const matched = value === this._ngSwitch;
  2640. this._lastCasesMatched ||= matched;
  2641. this._lastCaseCheckIndex++;
  2642. if (this._lastCaseCheckIndex === this._caseCount) {
  2643. this._updateDefaultCases(!this._lastCasesMatched);
  2644. this._lastCaseCheckIndex = 0;
  2645. this._lastCasesMatched = false;
  2646. }
  2647. return matched;
  2648. }
  2649. _updateDefaultCases(useDefault) {
  2650. if (this._defaultViews.length > 0 && useDefault !== this._defaultUsed) {
  2651. this._defaultUsed = useDefault;
  2652. for (const defaultView of this._defaultViews) {
  2653. defaultView.enforceState(useDefault);
  2654. }
  2655. }
  2656. }
  2657. static ɵfac = function NgSwitch_Factory(__ngFactoryType__) {
  2658. return new (__ngFactoryType__ || _NgSwitch)();
  2659. };
  2660. static ɵdir = ɵɵdefineDirective({
  2661. type: _NgSwitch,
  2662. selectors: [["", "ngSwitch", ""]],
  2663. inputs: {
  2664. ngSwitch: "ngSwitch"
  2665. }
  2666. });
  2667. };
  2668. (() => {
  2669. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitch, [{
  2670. type: Directive,
  2671. args: [{
  2672. selector: "[ngSwitch]"
  2673. }]
  2674. }], null, {
  2675. ngSwitch: [{
  2676. type: Input
  2677. }]
  2678. });
  2679. })();
  2680. var NgSwitchCase = class _NgSwitchCase {
  2681. ngSwitch;
  2682. _view;
  2683. /**
  2684. * Stores the HTML template to be selected on match.
  2685. * @deprecated Use the `@case` block within a `@switch` block instead. Intent to remove in v22
  2686. */
  2687. ngSwitchCase;
  2688. constructor(viewContainer, templateRef, ngSwitch) {
  2689. this.ngSwitch = ngSwitch;
  2690. if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
  2691. throwNgSwitchProviderNotFoundError("ngSwitchCase", "NgSwitchCase");
  2692. }
  2693. ngSwitch._addCase();
  2694. this._view = new SwitchView(viewContainer, templateRef);
  2695. }
  2696. /**
  2697. * Performs case matching. For internal use only.
  2698. * @docs-private
  2699. */
  2700. ngDoCheck() {
  2701. this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
  2702. }
  2703. static ɵfac = function NgSwitchCase_Factory(__ngFactoryType__) {
  2704. return new (__ngFactoryType__ || _NgSwitchCase)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(NgSwitch, 9));
  2705. };
  2706. static ɵdir = ɵɵdefineDirective({
  2707. type: _NgSwitchCase,
  2708. selectors: [["", "ngSwitchCase", ""]],
  2709. inputs: {
  2710. ngSwitchCase: "ngSwitchCase"
  2711. }
  2712. });
  2713. };
  2714. (() => {
  2715. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchCase, [{
  2716. type: Directive,
  2717. args: [{
  2718. selector: "[ngSwitchCase]"
  2719. }]
  2720. }], () => [{
  2721. type: ViewContainerRef
  2722. }, {
  2723. type: TemplateRef
  2724. }, {
  2725. type: NgSwitch,
  2726. decorators: [{
  2727. type: Optional
  2728. }, {
  2729. type: Host
  2730. }]
  2731. }], {
  2732. ngSwitchCase: [{
  2733. type: Input
  2734. }]
  2735. });
  2736. })();
  2737. var NgSwitchDefault = class _NgSwitchDefault {
  2738. constructor(viewContainer, templateRef, ngSwitch) {
  2739. if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
  2740. throwNgSwitchProviderNotFoundError("ngSwitchDefault", "NgSwitchDefault");
  2741. }
  2742. ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
  2743. }
  2744. static ɵfac = function NgSwitchDefault_Factory(__ngFactoryType__) {
  2745. return new (__ngFactoryType__ || _NgSwitchDefault)(ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(NgSwitch, 9));
  2746. };
  2747. static ɵdir = ɵɵdefineDirective({
  2748. type: _NgSwitchDefault,
  2749. selectors: [["", "ngSwitchDefault", ""]]
  2750. });
  2751. };
  2752. (() => {
  2753. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchDefault, [{
  2754. type: Directive,
  2755. args: [{
  2756. selector: "[ngSwitchDefault]"
  2757. }]
  2758. }], () => [{
  2759. type: ViewContainerRef
  2760. }, {
  2761. type: TemplateRef
  2762. }, {
  2763. type: NgSwitch,
  2764. decorators: [{
  2765. type: Optional
  2766. }, {
  2767. type: Host
  2768. }]
  2769. }], null);
  2770. })();
  2771. function throwNgSwitchProviderNotFoundError(attrName, directiveName) {
  2772. throw new RuntimeError(2e3, `An element with the "${attrName}" attribute (matching the "${directiveName}" directive) must be located inside an element with the "ngSwitch" attribute (matching "NgSwitch" directive)`);
  2773. }
  2774. var NgPlural = class _NgPlural {
  2775. _localization;
  2776. _activeView;
  2777. _caseViews = {};
  2778. constructor(_localization) {
  2779. this._localization = _localization;
  2780. }
  2781. set ngPlural(value) {
  2782. this._updateView(value);
  2783. }
  2784. addCase(value, switchView) {
  2785. this._caseViews[value] = switchView;
  2786. }
  2787. _updateView(switchValue) {
  2788. this._clearViews();
  2789. const cases = Object.keys(this._caseViews);
  2790. const key = getPluralCategory(switchValue, cases, this._localization);
  2791. this._activateView(this._caseViews[key]);
  2792. }
  2793. _clearViews() {
  2794. if (this._activeView) this._activeView.destroy();
  2795. }
  2796. _activateView(view) {
  2797. if (view) {
  2798. this._activeView = view;
  2799. this._activeView.create();
  2800. }
  2801. }
  2802. static ɵfac = function NgPlural_Factory(__ngFactoryType__) {
  2803. return new (__ngFactoryType__ || _NgPlural)(ɵɵdirectiveInject(NgLocalization));
  2804. };
  2805. static ɵdir = ɵɵdefineDirective({
  2806. type: _NgPlural,
  2807. selectors: [["", "ngPlural", ""]],
  2808. inputs: {
  2809. ngPlural: "ngPlural"
  2810. }
  2811. });
  2812. };
  2813. (() => {
  2814. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPlural, [{
  2815. type: Directive,
  2816. args: [{
  2817. selector: "[ngPlural]"
  2818. }]
  2819. }], () => [{
  2820. type: NgLocalization
  2821. }], {
  2822. ngPlural: [{
  2823. type: Input
  2824. }]
  2825. });
  2826. })();
  2827. var NgPluralCase = class _NgPluralCase {
  2828. value;
  2829. constructor(value, template, viewContainer, ngPlural) {
  2830. this.value = value;
  2831. const isANumber = !isNaN(Number(value));
  2832. ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));
  2833. }
  2834. static ɵfac = function NgPluralCase_Factory(__ngFactoryType__) {
  2835. return new (__ngFactoryType__ || _NgPluralCase)(ɵɵinjectAttribute("ngPluralCase"), ɵɵdirectiveInject(TemplateRef), ɵɵdirectiveInject(ViewContainerRef), ɵɵdirectiveInject(NgPlural, 1));
  2836. };
  2837. static ɵdir = ɵɵdefineDirective({
  2838. type: _NgPluralCase,
  2839. selectors: [["", "ngPluralCase", ""]]
  2840. });
  2841. };
  2842. (() => {
  2843. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPluralCase, [{
  2844. type: Directive,
  2845. args: [{
  2846. selector: "[ngPluralCase]"
  2847. }]
  2848. }], () => [{
  2849. type: void 0,
  2850. decorators: [{
  2851. type: Attribute,
  2852. args: ["ngPluralCase"]
  2853. }]
  2854. }, {
  2855. type: TemplateRef
  2856. }, {
  2857. type: ViewContainerRef
  2858. }, {
  2859. type: NgPlural,
  2860. decorators: [{
  2861. type: Host
  2862. }]
  2863. }], null);
  2864. })();
  2865. var NgStyle = class _NgStyle {
  2866. _ngEl;
  2867. _differs;
  2868. _renderer;
  2869. _ngStyle = null;
  2870. _differ = null;
  2871. constructor(_ngEl, _differs, _renderer) {
  2872. this._ngEl = _ngEl;
  2873. this._differs = _differs;
  2874. this._renderer = _renderer;
  2875. }
  2876. set ngStyle(values) {
  2877. this._ngStyle = values;
  2878. if (!this._differ && values) {
  2879. this._differ = this._differs.find(values).create();
  2880. }
  2881. }
  2882. ngDoCheck() {
  2883. if (this._differ) {
  2884. const changes = this._differ.diff(this._ngStyle);
  2885. if (changes) {
  2886. this._applyChanges(changes);
  2887. }
  2888. }
  2889. }
  2890. _setStyle(nameAndUnit, value) {
  2891. const [name, unit] = nameAndUnit.split(".");
  2892. const flags = name.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
  2893. if (value != null) {
  2894. this._renderer.setStyle(this._ngEl.nativeElement, name, unit ? `${value}${unit}` : value, flags);
  2895. } else {
  2896. this._renderer.removeStyle(this._ngEl.nativeElement, name, flags);
  2897. }
  2898. }
  2899. _applyChanges(changes) {
  2900. changes.forEachRemovedItem((record) => this._setStyle(record.key, null));
  2901. changes.forEachAddedItem((record) => this._setStyle(record.key, record.currentValue));
  2902. changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
  2903. }
  2904. static ɵfac = function NgStyle_Factory(__ngFactoryType__) {
  2905. return new (__ngFactoryType__ || _NgStyle)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(KeyValueDiffers), ɵɵdirectiveInject(Renderer2));
  2906. };
  2907. static ɵdir = ɵɵdefineDirective({
  2908. type: _NgStyle,
  2909. selectors: [["", "ngStyle", ""]],
  2910. inputs: {
  2911. ngStyle: "ngStyle"
  2912. }
  2913. });
  2914. };
  2915. (() => {
  2916. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgStyle, [{
  2917. type: Directive,
  2918. args: [{
  2919. selector: "[ngStyle]"
  2920. }]
  2921. }], () => [{
  2922. type: ElementRef
  2923. }, {
  2924. type: KeyValueDiffers
  2925. }, {
  2926. type: Renderer2
  2927. }], {
  2928. ngStyle: [{
  2929. type: Input,
  2930. args: ["ngStyle"]
  2931. }]
  2932. });
  2933. })();
  2934. var NgTemplateOutlet = class _NgTemplateOutlet {
  2935. _viewContainerRef;
  2936. _viewRef = null;
  2937. /**
  2938. * A context object to attach to the {@link EmbeddedViewRef}. This should be an
  2939. * object, the object's keys will be available for binding by the local template `let`
  2940. * declarations.
  2941. * Using the key `$implicit` in the context object will set its value as default.
  2942. */
  2943. ngTemplateOutletContext = null;
  2944. /**
  2945. * A string defining the template reference and optionally the context object for the template.
  2946. */
  2947. ngTemplateOutlet = null;
  2948. /** Injector to be used within the embedded view. */
  2949. ngTemplateOutletInjector = null;
  2950. constructor(_viewContainerRef) {
  2951. this._viewContainerRef = _viewContainerRef;
  2952. }
  2953. ngOnChanges(changes) {
  2954. if (this._shouldRecreateView(changes)) {
  2955. const viewContainerRef = this._viewContainerRef;
  2956. if (this._viewRef) {
  2957. viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));
  2958. }
  2959. if (!this.ngTemplateOutlet) {
  2960. this._viewRef = null;
  2961. return;
  2962. }
  2963. const viewContext = this._createContextForwardProxy();
  2964. this._viewRef = viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, viewContext, {
  2965. injector: this.ngTemplateOutletInjector ?? void 0
  2966. });
  2967. }
  2968. }
  2969. /**
  2970. * We need to re-create existing embedded view if either is true:
  2971. * - the outlet changed.
  2972. * - the injector changed.
  2973. */
  2974. _shouldRecreateView(changes) {
  2975. return !!changes["ngTemplateOutlet"] || !!changes["ngTemplateOutletInjector"];
  2976. }
  2977. /**
  2978. * For a given outlet instance, we create a proxy object that delegates
  2979. * to the user-specified context. This allows changing, or swapping out
  2980. * the context object completely without having to destroy/re-create the view.
  2981. */
  2982. _createContextForwardProxy() {
  2983. return new Proxy({}, {
  2984. set: (_target, prop, newValue) => {
  2985. if (!this.ngTemplateOutletContext) {
  2986. return false;
  2987. }
  2988. return Reflect.set(this.ngTemplateOutletContext, prop, newValue);
  2989. },
  2990. get: (_target, prop, receiver) => {
  2991. if (!this.ngTemplateOutletContext) {
  2992. return void 0;
  2993. }
  2994. return Reflect.get(this.ngTemplateOutletContext, prop, receiver);
  2995. }
  2996. });
  2997. }
  2998. static ɵfac = function NgTemplateOutlet_Factory(__ngFactoryType__) {
  2999. return new (__ngFactoryType__ || _NgTemplateOutlet)(ɵɵdirectiveInject(ViewContainerRef));
  3000. };
  3001. static ɵdir = ɵɵdefineDirective({
  3002. type: _NgTemplateOutlet,
  3003. selectors: [["", "ngTemplateOutlet", ""]],
  3004. inputs: {
  3005. ngTemplateOutletContext: "ngTemplateOutletContext",
  3006. ngTemplateOutlet: "ngTemplateOutlet",
  3007. ngTemplateOutletInjector: "ngTemplateOutletInjector"
  3008. },
  3009. features: [ɵɵNgOnChangesFeature]
  3010. });
  3011. };
  3012. (() => {
  3013. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgTemplateOutlet, [{
  3014. type: Directive,
  3015. args: [{
  3016. selector: "[ngTemplateOutlet]"
  3017. }]
  3018. }], () => [{
  3019. type: ViewContainerRef
  3020. }], {
  3021. ngTemplateOutletContext: [{
  3022. type: Input
  3023. }],
  3024. ngTemplateOutlet: [{
  3025. type: Input
  3026. }],
  3027. ngTemplateOutletInjector: [{
  3028. type: Input
  3029. }]
  3030. });
  3031. })();
  3032. var COMMON_DIRECTIVES = [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase];
  3033. function invalidPipeArgumentError(type, value) {
  3034. return new RuntimeError(2100, ngDevMode && `InvalidPipeArgument: '${value}' for pipe '${stringify(type)}'`);
  3035. }
  3036. var SubscribableStrategy = class {
  3037. createSubscription(async, updateLatestValue, onError) {
  3038. return untracked(() => async.subscribe({
  3039. next: updateLatestValue,
  3040. error: onError
  3041. }));
  3042. }
  3043. dispose(subscription) {
  3044. untracked(() => subscription.unsubscribe());
  3045. }
  3046. };
  3047. var PromiseStrategy = class {
  3048. createSubscription(async, updateLatestValue, onError) {
  3049. async.then(
  3050. // Using optional chaining because we may have set it to `null`; since the promise
  3051. // is async, the view might be destroyed by the time the promise resolves.
  3052. (v) => updateLatestValue?.(v),
  3053. (e) => onError?.(e)
  3054. );
  3055. return {
  3056. unsubscribe: () => {
  3057. updateLatestValue = null;
  3058. onError = null;
  3059. }
  3060. };
  3061. }
  3062. dispose(subscription) {
  3063. subscription.unsubscribe();
  3064. }
  3065. };
  3066. var _promiseStrategy = new PromiseStrategy();
  3067. var _subscribableStrategy = new SubscribableStrategy();
  3068. var AsyncPipe = class _AsyncPipe {
  3069. _ref;
  3070. _latestValue = null;
  3071. markForCheckOnValueUpdate = true;
  3072. _subscription = null;
  3073. _obj = null;
  3074. _strategy = null;
  3075. applicationErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
  3076. constructor(ref) {
  3077. this._ref = ref;
  3078. }
  3079. ngOnDestroy() {
  3080. if (this._subscription) {
  3081. this._dispose();
  3082. }
  3083. this._ref = null;
  3084. }
  3085. transform(obj) {
  3086. if (!this._obj) {
  3087. if (obj) {
  3088. try {
  3089. this.markForCheckOnValueUpdate = false;
  3090. this._subscribe(obj);
  3091. } finally {
  3092. this.markForCheckOnValueUpdate = true;
  3093. }
  3094. }
  3095. return this._latestValue;
  3096. }
  3097. if (obj !== this._obj) {
  3098. this._dispose();
  3099. return this.transform(obj);
  3100. }
  3101. return this._latestValue;
  3102. }
  3103. _subscribe(obj) {
  3104. this._obj = obj;
  3105. this._strategy = this._selectStrategy(obj);
  3106. this._subscription = this._strategy.createSubscription(obj, (value) => this._updateLatestValue(obj, value), (e) => this.applicationErrorHandler(e));
  3107. }
  3108. _selectStrategy(obj) {
  3109. if (isPromise(obj)) {
  3110. return _promiseStrategy;
  3111. }
  3112. if (isSubscribable(obj)) {
  3113. return _subscribableStrategy;
  3114. }
  3115. throw invalidPipeArgumentError(_AsyncPipe, obj);
  3116. }
  3117. _dispose() {
  3118. this._strategy.dispose(this._subscription);
  3119. this._latestValue = null;
  3120. this._subscription = null;
  3121. this._obj = null;
  3122. }
  3123. _updateLatestValue(async, value) {
  3124. if (async === this._obj) {
  3125. this._latestValue = value;
  3126. if (this.markForCheckOnValueUpdate) {
  3127. this._ref?.markForCheck();
  3128. }
  3129. }
  3130. }
  3131. static ɵfac = function AsyncPipe_Factory(__ngFactoryType__) {
  3132. return new (__ngFactoryType__ || _AsyncPipe)(ɵɵdirectiveInject(ChangeDetectorRef, 16));
  3133. };
  3134. static ɵpipe = ɵɵdefinePipe({
  3135. name: "async",
  3136. type: _AsyncPipe,
  3137. pure: false
  3138. });
  3139. };
  3140. (() => {
  3141. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AsyncPipe, [{
  3142. type: Pipe,
  3143. args: [{
  3144. name: "async",
  3145. pure: false
  3146. }]
  3147. }], () => [{
  3148. type: ChangeDetectorRef
  3149. }], null);
  3150. })();
  3151. var LowerCasePipe = class _LowerCasePipe {
  3152. transform(value) {
  3153. if (value == null) return null;
  3154. if (typeof value !== "string") {
  3155. throw invalidPipeArgumentError(_LowerCasePipe, value);
  3156. }
  3157. return value.toLowerCase();
  3158. }
  3159. static ɵfac = function LowerCasePipe_Factory(__ngFactoryType__) {
  3160. return new (__ngFactoryType__ || _LowerCasePipe)();
  3161. };
  3162. static ɵpipe = ɵɵdefinePipe({
  3163. name: "lowercase",
  3164. type: _LowerCasePipe,
  3165. pure: true
  3166. });
  3167. };
  3168. (() => {
  3169. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LowerCasePipe, [{
  3170. type: Pipe,
  3171. args: [{
  3172. name: "lowercase"
  3173. }]
  3174. }], null, null);
  3175. })();
  3176. var unicodeWordMatch = /(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])\S*/g;
  3177. var TitleCasePipe = class _TitleCasePipe {
  3178. transform(value) {
  3179. if (value == null) return null;
  3180. if (typeof value !== "string") {
  3181. throw invalidPipeArgumentError(_TitleCasePipe, value);
  3182. }
  3183. return value.replace(unicodeWordMatch, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase());
  3184. }
  3185. static ɵfac = function TitleCasePipe_Factory(__ngFactoryType__) {
  3186. return new (__ngFactoryType__ || _TitleCasePipe)();
  3187. };
  3188. static ɵpipe = ɵɵdefinePipe({
  3189. name: "titlecase",
  3190. type: _TitleCasePipe,
  3191. pure: true
  3192. });
  3193. };
  3194. (() => {
  3195. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TitleCasePipe, [{
  3196. type: Pipe,
  3197. args: [{
  3198. name: "titlecase"
  3199. }]
  3200. }], null, null);
  3201. })();
  3202. var UpperCasePipe = class _UpperCasePipe {
  3203. transform(value) {
  3204. if (value == null) return null;
  3205. if (typeof value !== "string") {
  3206. throw invalidPipeArgumentError(_UpperCasePipe, value);
  3207. }
  3208. return value.toUpperCase();
  3209. }
  3210. static ɵfac = function UpperCasePipe_Factory(__ngFactoryType__) {
  3211. return new (__ngFactoryType__ || _UpperCasePipe)();
  3212. };
  3213. static ɵpipe = ɵɵdefinePipe({
  3214. name: "uppercase",
  3215. type: _UpperCasePipe,
  3216. pure: true
  3217. });
  3218. };
  3219. (() => {
  3220. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UpperCasePipe, [{
  3221. type: Pipe,
  3222. args: [{
  3223. name: "uppercase"
  3224. }]
  3225. }], null, null);
  3226. })();
  3227. var DEFAULT_DATE_FORMAT = "mediumDate";
  3228. var DATE_PIPE_DEFAULT_TIMEZONE = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_TIMEZONE" : "");
  3229. var DATE_PIPE_DEFAULT_OPTIONS = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_OPTIONS" : "");
  3230. var DatePipe = class _DatePipe {
  3231. locale;
  3232. defaultTimezone;
  3233. defaultOptions;
  3234. constructor(locale, defaultTimezone, defaultOptions) {
  3235. this.locale = locale;
  3236. this.defaultTimezone = defaultTimezone;
  3237. this.defaultOptions = defaultOptions;
  3238. }
  3239. transform(value, format, timezone, locale) {
  3240. if (value == null || value === "" || value !== value) return null;
  3241. try {
  3242. const _format = format ?? this.defaultOptions?.dateFormat ?? DEFAULT_DATE_FORMAT;
  3243. const _timezone = timezone ?? this.defaultOptions?.timezone ?? this.defaultTimezone ?? void 0;
  3244. return formatDate(value, _format, locale || this.locale, _timezone);
  3245. } catch (error) {
  3246. throw invalidPipeArgumentError(_DatePipe, error.message);
  3247. }
  3248. }
  3249. static ɵfac = function DatePipe_Factory(__ngFactoryType__) {
  3250. return new (__ngFactoryType__ || _DatePipe)(ɵɵdirectiveInject(LOCALE_ID, 16), ɵɵdirectiveInject(DATE_PIPE_DEFAULT_TIMEZONE, 24), ɵɵdirectiveInject(DATE_PIPE_DEFAULT_OPTIONS, 24));
  3251. };
  3252. static ɵpipe = ɵɵdefinePipe({
  3253. name: "date",
  3254. type: _DatePipe,
  3255. pure: true
  3256. });
  3257. };
  3258. (() => {
  3259. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DatePipe, [{
  3260. type: Pipe,
  3261. args: [{
  3262. name: "date"
  3263. }]
  3264. }], () => [{
  3265. type: void 0,
  3266. decorators: [{
  3267. type: Inject,
  3268. args: [LOCALE_ID]
  3269. }]
  3270. }, {
  3271. type: void 0,
  3272. decorators: [{
  3273. type: Inject,
  3274. args: [DATE_PIPE_DEFAULT_TIMEZONE]
  3275. }, {
  3276. type: Optional
  3277. }]
  3278. }, {
  3279. type: void 0,
  3280. decorators: [{
  3281. type: Inject,
  3282. args: [DATE_PIPE_DEFAULT_OPTIONS]
  3283. }, {
  3284. type: Optional
  3285. }]
  3286. }], null);
  3287. })();
  3288. var _INTERPOLATION_REGEXP = /#/g;
  3289. var I18nPluralPipe = class _I18nPluralPipe {
  3290. _localization;
  3291. constructor(_localization) {
  3292. this._localization = _localization;
  3293. }
  3294. /**
  3295. * @param value the number to be formatted
  3296. * @param pluralMap an object that mimics the ICU format, see
  3297. * https://unicode-org.github.io/icu/userguide/format_parse/messages/.
  3298. * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
  3299. * default).
  3300. */
  3301. transform(value, pluralMap, locale) {
  3302. if (value == null) return "";
  3303. if (typeof pluralMap !== "object" || pluralMap === null) {
  3304. throw invalidPipeArgumentError(_I18nPluralPipe, pluralMap);
  3305. }
  3306. const key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
  3307. return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
  3308. }
  3309. static ɵfac = function I18nPluralPipe_Factory(__ngFactoryType__) {
  3310. return new (__ngFactoryType__ || _I18nPluralPipe)(ɵɵdirectiveInject(NgLocalization, 16));
  3311. };
  3312. static ɵpipe = ɵɵdefinePipe({
  3313. name: "i18nPlural",
  3314. type: _I18nPluralPipe,
  3315. pure: true
  3316. });
  3317. };
  3318. (() => {
  3319. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nPluralPipe, [{
  3320. type: Pipe,
  3321. args: [{
  3322. name: "i18nPlural"
  3323. }]
  3324. }], () => [{
  3325. type: NgLocalization
  3326. }], null);
  3327. })();
  3328. var I18nSelectPipe = class _I18nSelectPipe {
  3329. /**
  3330. * @param value a string to be internationalized.
  3331. * @param mapping an object that indicates the text that should be displayed
  3332. * for different values of the provided `value`.
  3333. */
  3334. transform(value, mapping) {
  3335. if (value == null) return "";
  3336. if (typeof mapping !== "object" || typeof value !== "string") {
  3337. throw invalidPipeArgumentError(_I18nSelectPipe, mapping);
  3338. }
  3339. if (mapping.hasOwnProperty(value)) {
  3340. return mapping[value];
  3341. }
  3342. if (mapping.hasOwnProperty("other")) {
  3343. return mapping["other"];
  3344. }
  3345. return "";
  3346. }
  3347. static ɵfac = function I18nSelectPipe_Factory(__ngFactoryType__) {
  3348. return new (__ngFactoryType__ || _I18nSelectPipe)();
  3349. };
  3350. static ɵpipe = ɵɵdefinePipe({
  3351. name: "i18nSelect",
  3352. type: _I18nSelectPipe,
  3353. pure: true
  3354. });
  3355. };
  3356. (() => {
  3357. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nSelectPipe, [{
  3358. type: Pipe,
  3359. args: [{
  3360. name: "i18nSelect"
  3361. }]
  3362. }], null, null);
  3363. })();
  3364. var JsonPipe = class _JsonPipe {
  3365. /**
  3366. * @param value A value of any type to convert into a JSON-format string.
  3367. */
  3368. transform(value) {
  3369. return JSON.stringify(value, null, 2);
  3370. }
  3371. static ɵfac = function JsonPipe_Factory(__ngFactoryType__) {
  3372. return new (__ngFactoryType__ || _JsonPipe)();
  3373. };
  3374. static ɵpipe = ɵɵdefinePipe({
  3375. name: "json",
  3376. type: _JsonPipe,
  3377. pure: false
  3378. });
  3379. };
  3380. (() => {
  3381. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonPipe, [{
  3382. type: Pipe,
  3383. args: [{
  3384. name: "json",
  3385. pure: false
  3386. }]
  3387. }], null, null);
  3388. })();
  3389. function makeKeyValuePair(key, value) {
  3390. return {
  3391. key,
  3392. value
  3393. };
  3394. }
  3395. var KeyValuePipe = class _KeyValuePipe {
  3396. differs;
  3397. constructor(differs) {
  3398. this.differs = differs;
  3399. }
  3400. differ;
  3401. keyValues = [];
  3402. compareFn = defaultComparator;
  3403. transform(input, compareFn = defaultComparator) {
  3404. if (!input || !(input instanceof Map) && typeof input !== "object") {
  3405. return null;
  3406. }
  3407. this.differ ??= this.differs.find(input).create();
  3408. const differChanges = this.differ.diff(input);
  3409. const compareFnChanged = compareFn !== this.compareFn;
  3410. if (differChanges) {
  3411. this.keyValues = [];
  3412. differChanges.forEachItem((r) => {
  3413. this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
  3414. });
  3415. }
  3416. if (differChanges || compareFnChanged) {
  3417. if (compareFn) {
  3418. this.keyValues.sort(compareFn);
  3419. }
  3420. this.compareFn = compareFn;
  3421. }
  3422. return this.keyValues;
  3423. }
  3424. static ɵfac = function KeyValuePipe_Factory(__ngFactoryType__) {
  3425. return new (__ngFactoryType__ || _KeyValuePipe)(ɵɵdirectiveInject(KeyValueDiffers, 16));
  3426. };
  3427. static ɵpipe = ɵɵdefinePipe({
  3428. name: "keyvalue",
  3429. type: _KeyValuePipe,
  3430. pure: false
  3431. });
  3432. };
  3433. (() => {
  3434. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyValuePipe, [{
  3435. type: Pipe,
  3436. args: [{
  3437. name: "keyvalue",
  3438. pure: false
  3439. }]
  3440. }], () => [{
  3441. type: KeyValueDiffers
  3442. }], null);
  3443. })();
  3444. function defaultComparator(keyValueA, keyValueB) {
  3445. const a = keyValueA.key;
  3446. const b = keyValueB.key;
  3447. if (a === b) return 0;
  3448. if (a == null) return 1;
  3449. if (b == null) return -1;
  3450. if (typeof a == "string" && typeof b == "string") {
  3451. return a < b ? -1 : 1;
  3452. }
  3453. if (typeof a == "number" && typeof b == "number") {
  3454. return a - b;
  3455. }
  3456. if (typeof a == "boolean" && typeof b == "boolean") {
  3457. return a < b ? -1 : 1;
  3458. }
  3459. const aString = String(a);
  3460. const bString = String(b);
  3461. return aString == bString ? 0 : aString < bString ? -1 : 1;
  3462. }
  3463. var DecimalPipe = class _DecimalPipe {
  3464. _locale;
  3465. constructor(_locale) {
  3466. this._locale = _locale;
  3467. }
  3468. transform(value, digitsInfo, locale) {
  3469. if (!isValue(value)) return null;
  3470. locale ||= this._locale;
  3471. try {
  3472. const num = strToNumber(value);
  3473. return formatNumber(num, locale, digitsInfo);
  3474. } catch (error) {
  3475. throw invalidPipeArgumentError(_DecimalPipe, error.message);
  3476. }
  3477. }
  3478. static ɵfac = function DecimalPipe_Factory(__ngFactoryType__) {
  3479. return new (__ngFactoryType__ || _DecimalPipe)(ɵɵdirectiveInject(LOCALE_ID, 16));
  3480. };
  3481. static ɵpipe = ɵɵdefinePipe({
  3482. name: "number",
  3483. type: _DecimalPipe,
  3484. pure: true
  3485. });
  3486. };
  3487. (() => {
  3488. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DecimalPipe, [{
  3489. type: Pipe,
  3490. args: [{
  3491. name: "number"
  3492. }]
  3493. }], () => [{
  3494. type: void 0,
  3495. decorators: [{
  3496. type: Inject,
  3497. args: [LOCALE_ID]
  3498. }]
  3499. }], null);
  3500. })();
  3501. var PercentPipe = class _PercentPipe {
  3502. _locale;
  3503. constructor(_locale) {
  3504. this._locale = _locale;
  3505. }
  3506. /**
  3507. *
  3508. * @param value The number to be formatted as a percentage.
  3509. * @param digitsInfo Decimal representation options, specified by a string
  3510. * in the following format:<br>
  3511. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
  3512. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
  3513. * Default is `1`.
  3514. * - `minFractionDigits`: The minimum number of digits after the decimal point.
  3515. * Default is `0`.
  3516. * - `maxFractionDigits`: The maximum number of digits after the decimal point.
  3517. * Default is `0`.
  3518. * @param locale A locale code for the locale format rules to use.
  3519. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  3520. * See [Setting your app locale](guide/i18n/locale-id).
  3521. */
  3522. transform(value, digitsInfo, locale) {
  3523. if (!isValue(value)) return null;
  3524. locale ||= this._locale;
  3525. try {
  3526. const num = strToNumber(value);
  3527. return formatPercent(num, locale, digitsInfo);
  3528. } catch (error) {
  3529. throw invalidPipeArgumentError(_PercentPipe, error.message);
  3530. }
  3531. }
  3532. static ɵfac = function PercentPipe_Factory(__ngFactoryType__) {
  3533. return new (__ngFactoryType__ || _PercentPipe)(ɵɵdirectiveInject(LOCALE_ID, 16));
  3534. };
  3535. static ɵpipe = ɵɵdefinePipe({
  3536. name: "percent",
  3537. type: _PercentPipe,
  3538. pure: true
  3539. });
  3540. };
  3541. (() => {
  3542. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PercentPipe, [{
  3543. type: Pipe,
  3544. args: [{
  3545. name: "percent"
  3546. }]
  3547. }], () => [{
  3548. type: void 0,
  3549. decorators: [{
  3550. type: Inject,
  3551. args: [LOCALE_ID]
  3552. }]
  3553. }], null);
  3554. })();
  3555. var CurrencyPipe = class _CurrencyPipe {
  3556. _locale;
  3557. _defaultCurrencyCode;
  3558. constructor(_locale, _defaultCurrencyCode = "USD") {
  3559. this._locale = _locale;
  3560. this._defaultCurrencyCode = _defaultCurrencyCode;
  3561. }
  3562. transform(value, currencyCode = this._defaultCurrencyCode, display = "symbol", digitsInfo, locale) {
  3563. if (!isValue(value)) return null;
  3564. locale ||= this._locale;
  3565. if (typeof display === "boolean") {
  3566. if (typeof ngDevMode === "undefined" || ngDevMode) {
  3567. 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".`);
  3568. }
  3569. display = display ? "symbol" : "code";
  3570. }
  3571. let currency = currencyCode || this._defaultCurrencyCode;
  3572. if (display !== "code") {
  3573. if (display === "symbol" || display === "symbol-narrow") {
  3574. currency = getCurrencySymbol(currency, display === "symbol" ? "wide" : "narrow", locale);
  3575. } else {
  3576. currency = display;
  3577. }
  3578. }
  3579. try {
  3580. const num = strToNumber(value);
  3581. return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
  3582. } catch (error) {
  3583. throw invalidPipeArgumentError(_CurrencyPipe, error.message);
  3584. }
  3585. }
  3586. static ɵfac = function CurrencyPipe_Factory(__ngFactoryType__) {
  3587. return new (__ngFactoryType__ || _CurrencyPipe)(ɵɵdirectiveInject(LOCALE_ID, 16), ɵɵdirectiveInject(DEFAULT_CURRENCY_CODE, 16));
  3588. };
  3589. static ɵpipe = ɵɵdefinePipe({
  3590. name: "currency",
  3591. type: _CurrencyPipe,
  3592. pure: true
  3593. });
  3594. };
  3595. (() => {
  3596. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CurrencyPipe, [{
  3597. type: Pipe,
  3598. args: [{
  3599. name: "currency"
  3600. }]
  3601. }], () => [{
  3602. type: void 0,
  3603. decorators: [{
  3604. type: Inject,
  3605. args: [LOCALE_ID]
  3606. }]
  3607. }, {
  3608. type: void 0,
  3609. decorators: [{
  3610. type: Inject,
  3611. args: [DEFAULT_CURRENCY_CODE]
  3612. }]
  3613. }], null);
  3614. })();
  3615. function isValue(value) {
  3616. return !(value == null || value === "" || value !== value);
  3617. }
  3618. function strToNumber(value) {
  3619. if (typeof value === "string" && !isNaN(Number(value) - parseFloat(value))) {
  3620. return Number(value);
  3621. }
  3622. if (typeof value !== "number") {
  3623. throw new RuntimeError(2309, ngDevMode && `${value} is not a number`);
  3624. }
  3625. return value;
  3626. }
  3627. var SlicePipe = class _SlicePipe {
  3628. transform(value, start, end) {
  3629. if (value == null) return null;
  3630. const supports = typeof value === "string" || Array.isArray(value);
  3631. if (!supports) {
  3632. throw invalidPipeArgumentError(_SlicePipe, value);
  3633. }
  3634. return value.slice(start, end);
  3635. }
  3636. static ɵfac = function SlicePipe_Factory(__ngFactoryType__) {
  3637. return new (__ngFactoryType__ || _SlicePipe)();
  3638. };
  3639. static ɵpipe = ɵɵdefinePipe({
  3640. name: "slice",
  3641. type: _SlicePipe,
  3642. pure: false
  3643. });
  3644. };
  3645. (() => {
  3646. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SlicePipe, [{
  3647. type: Pipe,
  3648. args: [{
  3649. name: "slice",
  3650. pure: false
  3651. }]
  3652. }], null, null);
  3653. })();
  3654. var COMMON_PIPES = [AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe];
  3655. var CommonModule = class _CommonModule {
  3656. static ɵfac = function CommonModule_Factory(__ngFactoryType__) {
  3657. return new (__ngFactoryType__ || _CommonModule)();
  3658. };
  3659. static ɵmod = ɵɵdefineNgModule({
  3660. type: _CommonModule,
  3661. imports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe],
  3662. exports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe]
  3663. });
  3664. static ɵinj = ɵɵdefineInjector({});
  3665. };
  3666. (() => {
  3667. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CommonModule, [{
  3668. type: NgModule,
  3669. args: [{
  3670. imports: [COMMON_DIRECTIVES, COMMON_PIPES],
  3671. exports: [COMMON_DIRECTIVES, COMMON_PIPES]
  3672. }]
  3673. }], null, null);
  3674. })();
  3675. // node_modules/@angular/common/fesm2022/platform_navigation.mjs
  3676. var PlatformNavigation = class _PlatformNavigation {
  3677. static ɵfac = function PlatformNavigation_Factory(__ngFactoryType__) {
  3678. return new (__ngFactoryType__ || _PlatformNavigation)();
  3679. };
  3680. static ɵprov = ɵɵdefineInjectable({
  3681. token: _PlatformNavigation,
  3682. factory: () => (() => window.navigation)(),
  3683. providedIn: "platform"
  3684. });
  3685. };
  3686. (() => {
  3687. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformNavigation, [{
  3688. type: Injectable,
  3689. args: [{
  3690. providedIn: "platform",
  3691. useFactory: () => window.navigation
  3692. }]
  3693. }], null, null);
  3694. })();
  3695. // node_modules/@angular/common/fesm2022/common.mjs
  3696. function registerLocaleData2(data, localeId, extraData) {
  3697. return registerLocaleData(data, localeId, extraData);
  3698. }
  3699. var PLATFORM_BROWSER_ID = "browser";
  3700. var PLATFORM_SERVER_ID = "server";
  3701. function isPlatformBrowser(platformId) {
  3702. return platformId === PLATFORM_BROWSER_ID;
  3703. }
  3704. function isPlatformServer(platformId) {
  3705. return platformId === PLATFORM_SERVER_ID;
  3706. }
  3707. var VERSION = new Version("20.0.5");
  3708. var ViewportScroller = class _ViewportScroller {
  3709. // De-sugared tree-shakable injection
  3710. // See #23917
  3711. /** @nocollapse */
  3712. static ɵprov = (
  3713. /** @pureOrBreakMyCode */
  3714. ɵɵdefineInjectable({
  3715. token: _ViewportScroller,
  3716. providedIn: "root",
  3717. factory: () => false ? new NullViewportScroller() : new BrowserViewportScroller(inject(DOCUMENT), window)
  3718. })
  3719. );
  3720. };
  3721. var BrowserViewportScroller = class {
  3722. document;
  3723. window;
  3724. offset = () => [0, 0];
  3725. constructor(document, window2) {
  3726. this.document = document;
  3727. this.window = window2;
  3728. }
  3729. /**
  3730. * Configures the top offset used when scrolling to an anchor.
  3731. * @param offset A position in screen coordinates (a tuple with x and y values)
  3732. * or a function that returns the top offset position.
  3733. *
  3734. */
  3735. setOffset(offset) {
  3736. if (Array.isArray(offset)) {
  3737. this.offset = () => offset;
  3738. } else {
  3739. this.offset = offset;
  3740. }
  3741. }
  3742. /**
  3743. * Retrieves the current scroll position.
  3744. * @returns The position in screen coordinates.
  3745. */
  3746. getScrollPosition() {
  3747. return [this.window.scrollX, this.window.scrollY];
  3748. }
  3749. /**
  3750. * Sets the scroll position.
  3751. * @param position The new position in screen coordinates.
  3752. */
  3753. scrollToPosition(position, options) {
  3754. this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
  3755. left: position[0],
  3756. top: position[1]
  3757. }));
  3758. }
  3759. /**
  3760. * Scrolls to an element and attempts to focus the element.
  3761. *
  3762. * Note that the function name here is misleading in that the target string may be an ID for a
  3763. * non-anchor element.
  3764. *
  3765. * @param target The ID of an element or name of the anchor.
  3766. *
  3767. * @see https://html.spec.whatwg.org/#the-indicated-part-of-the-document
  3768. * @see https://html.spec.whatwg.org/#scroll-to-fragid
  3769. */
  3770. scrollToAnchor(target, options) {
  3771. const elSelected = findAnchorFromDocument(this.document, target);
  3772. if (elSelected) {
  3773. this.scrollToElement(elSelected, options);
  3774. elSelected.focus();
  3775. }
  3776. }
  3777. /**
  3778. * Disables automatic scroll restoration provided by the browser.
  3779. */
  3780. setHistoryScrollRestoration(scrollRestoration) {
  3781. try {
  3782. this.window.history.scrollRestoration = scrollRestoration;
  3783. } catch {
  3784. console.warn(formatRuntimeError(2400, ngDevMode && "Failed to set `window.history.scrollRestoration`. This may occur when:\n• The script is running inside a sandboxed iframe\n• The window is partially navigated or inactive\n• The script is executed in an untrusted or special context (e.g., test runners, browser extensions, or content previews)\nScroll position may not be preserved across navigation."));
  3785. }
  3786. }
  3787. /**
  3788. * Scrolls to an element using the native offset and the specified offset set on this scroller.
  3789. *
  3790. * The offset can be used when we know that there is a floating header and scrolling naively to an
  3791. * element (ex: `scrollIntoView`) leaves the element hidden behind the floating header.
  3792. */
  3793. scrollToElement(el, options) {
  3794. const rect = el.getBoundingClientRect();
  3795. const left = rect.left + this.window.pageXOffset;
  3796. const top = rect.top + this.window.pageYOffset;
  3797. const offset = this.offset();
  3798. this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
  3799. left: left - offset[0],
  3800. top: top - offset[1]
  3801. }));
  3802. }
  3803. };
  3804. function findAnchorFromDocument(document, target) {
  3805. const documentResult = document.getElementById(target) || document.getElementsByName(target)[0];
  3806. if (documentResult) {
  3807. return documentResult;
  3808. }
  3809. if (typeof document.createTreeWalker === "function" && document.body && typeof document.body.attachShadow === "function") {
  3810. const treeWalker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
  3811. let currentNode = treeWalker.currentNode;
  3812. while (currentNode) {
  3813. const shadowRoot = currentNode.shadowRoot;
  3814. if (shadowRoot) {
  3815. const result = shadowRoot.getElementById(target) || shadowRoot.querySelector(`[name="${target}"]`);
  3816. if (result) {
  3817. return result;
  3818. }
  3819. }
  3820. currentNode = treeWalker.nextNode();
  3821. }
  3822. }
  3823. return null;
  3824. }
  3825. var NullViewportScroller = class {
  3826. /**
  3827. * Empty implementation
  3828. */
  3829. setOffset(offset) {
  3830. }
  3831. /**
  3832. * Empty implementation
  3833. */
  3834. getScrollPosition() {
  3835. return [0, 0];
  3836. }
  3837. /**
  3838. * Empty implementation
  3839. */
  3840. scrollToPosition(position) {
  3841. }
  3842. /**
  3843. * Empty implementation
  3844. */
  3845. scrollToAnchor(anchor) {
  3846. }
  3847. /**
  3848. * Empty implementation
  3849. */
  3850. setHistoryScrollRestoration(scrollRestoration) {
  3851. }
  3852. };
  3853. var PLACEHOLDER_QUALITY = "20";
  3854. function getUrl(src, win) {
  3855. return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);
  3856. }
  3857. function isAbsoluteUrl(src) {
  3858. return /^https?:\/\//.test(src);
  3859. }
  3860. function extractHostname(url) {
  3861. return isAbsoluteUrl(url) ? new URL(url).hostname : url;
  3862. }
  3863. function isValidPath(path) {
  3864. const isString = typeof path === "string";
  3865. if (!isString || path.trim() === "") {
  3866. return false;
  3867. }
  3868. try {
  3869. const url = new URL(path);
  3870. return true;
  3871. } catch {
  3872. return false;
  3873. }
  3874. }
  3875. function normalizePath(path) {
  3876. return path.endsWith("/") ? path.slice(0, -1) : path;
  3877. }
  3878. function normalizeSrc(src) {
  3879. return src.startsWith("/") ? src.slice(1) : src;
  3880. }
  3881. var noopImageLoader = (config) => config.src;
  3882. var IMAGE_LOADER = new InjectionToken(ngDevMode ? "ImageLoader" : "", {
  3883. providedIn: "root",
  3884. factory: () => noopImageLoader
  3885. });
  3886. function createImageLoader(buildUrlFn, exampleUrls) {
  3887. return function provideImageLoader(path) {
  3888. if (!isValidPath(path)) {
  3889. throwInvalidPathError(path, exampleUrls || []);
  3890. }
  3891. path = normalizePath(path);
  3892. const loaderFn = (config) => {
  3893. if (isAbsoluteUrl(config.src)) {
  3894. throwUnexpectedAbsoluteUrlError(path, config.src);
  3895. }
  3896. return buildUrlFn(path, __spreadProps(__spreadValues({}, config), {
  3897. src: normalizeSrc(config.src)
  3898. }));
  3899. };
  3900. const providers = [{
  3901. provide: IMAGE_LOADER,
  3902. useValue: loaderFn
  3903. }];
  3904. return providers;
  3905. };
  3906. }
  3907. function throwInvalidPathError(path, exampleUrls) {
  3908. throw new RuntimeError(2959, ngDevMode && `Image loader has detected an invalid path (\`${path}\`). To fix this, supply a path using one of the following formats: ${exampleUrls.join(" or ")}`);
  3909. }
  3910. function throwUnexpectedAbsoluteUrlError(path, url) {
  3911. throw new RuntimeError(2959, ngDevMode && `Image loader has detected a \`<img>\` tag with an invalid \`ngSrc\` attribute: ${url}. This image loader expects \`ngSrc\` to be a relative URL - however the provided value is an absolute URL. To fix this, provide \`ngSrc\` as a path relative to the base URL configured for this loader (\`${path}\`).`);
  3912. }
  3913. var provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ["https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>"] : void 0);
  3914. function createCloudflareUrl(path, config) {
  3915. let params = `format=auto`;
  3916. if (config.width) {
  3917. params += `,width=${config.width}`;
  3918. }
  3919. if (config.isPlaceholder) {
  3920. params += `,quality=${PLACEHOLDER_QUALITY}`;
  3921. }
  3922. return `${path}/cdn-cgi/image/${params}/${config.src}`;
  3923. }
  3924. var cloudinaryLoaderInfo = {
  3925. name: "Cloudinary",
  3926. testUrl: isCloudinaryUrl
  3927. };
  3928. var CLOUDINARY_LOADER_REGEX = /https?\:\/\/[^\/]+\.cloudinary\.com\/.+/;
  3929. function isCloudinaryUrl(url) {
  3930. return CLOUDINARY_LOADER_REGEX.test(url);
  3931. }
  3932. var provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode ? ["https://res.cloudinary.com/mysite", "https://mysite.cloudinary.com", "https://subdomain.mysite.com"] : void 0);
  3933. function createCloudinaryUrl(path, config) {
  3934. const quality = config.isPlaceholder ? "q_auto:low" : "q_auto";
  3935. let params = `f_auto,${quality}`;
  3936. if (config.width) {
  3937. params += `,w_${config.width}`;
  3938. }
  3939. if (config.loaderParams?.["rounded"]) {
  3940. params += `,r_max`;
  3941. }
  3942. return `${path}/image/upload/${params}/${config.src}`;
  3943. }
  3944. var imageKitLoaderInfo = {
  3945. name: "ImageKit",
  3946. testUrl: isImageKitUrl
  3947. };
  3948. var IMAGE_KIT_LOADER_REGEX = /https?\:\/\/[^\/]+\.imagekit\.io\/.+/;
  3949. function isImageKitUrl(url) {
  3950. return IMAGE_KIT_LOADER_REGEX.test(url);
  3951. }
  3952. var provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ["https://ik.imagekit.io/mysite", "https://subdomain.mysite.com"] : void 0);
  3953. function createImagekitUrl(path, config) {
  3954. const {
  3955. src,
  3956. width
  3957. } = config;
  3958. const params = [];
  3959. if (width) {
  3960. params.push(`w-${width}`);
  3961. }
  3962. if (config.isPlaceholder) {
  3963. params.push(`q-${PLACEHOLDER_QUALITY}`);
  3964. }
  3965. const urlSegments = params.length ? [path, `tr:${params.join(",")}`, src] : [path, src];
  3966. const url = new URL(urlSegments.join("/"));
  3967. return url.href;
  3968. }
  3969. var imgixLoaderInfo = {
  3970. name: "Imgix",
  3971. testUrl: isImgixUrl
  3972. };
  3973. var IMGIX_LOADER_REGEX = /https?\:\/\/[^\/]+\.imgix\.net\/.+/;
  3974. function isImgixUrl(url) {
  3975. return IMGIX_LOADER_REGEX.test(url);
  3976. }
  3977. var provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ["https://somepath.imgix.net/"] : void 0);
  3978. function createImgixUrl(path, config) {
  3979. const url = new URL(`${path}/${config.src}`);
  3980. url.searchParams.set("auto", "format");
  3981. if (config.width) {
  3982. url.searchParams.set("w", config.width.toString());
  3983. }
  3984. if (config.isPlaceholder) {
  3985. url.searchParams.set("q", PLACEHOLDER_QUALITY);
  3986. }
  3987. return url.href;
  3988. }
  3989. var netlifyLoaderInfo = {
  3990. name: "Netlify",
  3991. testUrl: isNetlifyUrl
  3992. };
  3993. var NETLIFY_LOADER_REGEX = /https?\:\/\/[^\/]+\.netlify\.app\/.+/;
  3994. function isNetlifyUrl(url) {
  3995. return NETLIFY_LOADER_REGEX.test(url);
  3996. }
  3997. function provideNetlifyLoader(path) {
  3998. if (path && !isValidPath(path)) {
  3999. throw new RuntimeError(2959, ngDevMode && `Image loader has detected an invalid path (\`${path}\`). To fix this, supply either the full URL to the Netlify site, or leave it empty to use the current site.`);
  4000. }
  4001. if (path) {
  4002. const url = new URL(path);
  4003. path = url.origin;
  4004. }
  4005. const loaderFn = (config) => {
  4006. return createNetlifyUrl(config, path);
  4007. };
  4008. const providers = [{
  4009. provide: IMAGE_LOADER,
  4010. useValue: loaderFn
  4011. }];
  4012. return providers;
  4013. }
  4014. var validParams = /* @__PURE__ */ new Map([["height", "h"], ["fit", "fit"], ["quality", "q"], ["q", "q"], ["position", "position"]]);
  4015. function createNetlifyUrl(config, path) {
  4016. const url = new URL(path ?? "https://a/");
  4017. url.pathname = "/.netlify/images";
  4018. if (!isAbsoluteUrl(config.src) && !config.src.startsWith("/")) {
  4019. config.src = "/" + config.src;
  4020. }
  4021. url.searchParams.set("url", config.src);
  4022. if (config.width) {
  4023. url.searchParams.set("w", config.width.toString());
  4024. }
  4025. const configQuality = config.loaderParams?.["quality"] ?? config.loaderParams?.["q"];
  4026. if (config.isPlaceholder && !configQuality) {
  4027. url.searchParams.set("q", PLACEHOLDER_QUALITY);
  4028. }
  4029. for (const [param, value] of Object.entries(config.loaderParams ?? {})) {
  4030. if (validParams.has(param)) {
  4031. url.searchParams.set(validParams.get(param), value.toString());
  4032. } else {
  4033. if (ngDevMode) {
  4034. console.warn(formatRuntimeError(2959, `The Netlify image loader has detected an \`<img>\` tag with the unsupported attribute "\`${param}\`".`));
  4035. }
  4036. }
  4037. }
  4038. return url.hostname === "a" ? url.href.replace(url.origin, "") : url.href;
  4039. }
  4040. function imgDirectiveDetails(ngSrc, includeNgSrc = true) {
  4041. const ngSrcInfo = includeNgSrc ? `(activated on an <img> element with the \`ngSrc="${ngSrc}"\`) ` : "";
  4042. return `The NgOptimizedImage directive ${ngSrcInfo}has detected that`;
  4043. }
  4044. function assertDevMode(checkName) {
  4045. if (!ngDevMode) {
  4046. throw new RuntimeError(2958, `Unexpected invocation of the ${checkName} in the prod mode. Please make sure that the prod mode is enabled for production builds.`);
  4047. }
  4048. }
  4049. var LCPImageObserver = class _LCPImageObserver {
  4050. // Map of full image URLs -> original `ngSrc` values.
  4051. images = /* @__PURE__ */ new Map();
  4052. window = inject(DOCUMENT).defaultView;
  4053. observer = null;
  4054. constructor() {
  4055. assertDevMode("LCP checker");
  4056. if (typeof PerformanceObserver !== "undefined") {
  4057. this.observer = this.initPerformanceObserver();
  4058. }
  4059. }
  4060. /**
  4061. * Inits PerformanceObserver and subscribes to LCP events.
  4062. * Based on https://web.dev/lcp/#measure-lcp-in-javascript
  4063. */
  4064. initPerformanceObserver() {
  4065. const observer = new PerformanceObserver((entryList) => {
  4066. const entries = entryList.getEntries();
  4067. if (entries.length === 0) return;
  4068. const lcpElement = entries[entries.length - 1];
  4069. const imgSrc = lcpElement.element?.src ?? "";
  4070. if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:")) return;
  4071. const img = this.images.get(imgSrc);
  4072. if (!img) return;
  4073. if (!img.priority && !img.alreadyWarnedPriority) {
  4074. img.alreadyWarnedPriority = true;
  4075. logMissingPriorityError(imgSrc);
  4076. }
  4077. if (img.modified && !img.alreadyWarnedModified) {
  4078. img.alreadyWarnedModified = true;
  4079. logModifiedWarning(imgSrc);
  4080. }
  4081. });
  4082. observer.observe({
  4083. type: "largest-contentful-paint",
  4084. buffered: true
  4085. });
  4086. return observer;
  4087. }
  4088. registerImage(rewrittenSrc, originalNgSrc, isPriority) {
  4089. if (!this.observer) return;
  4090. const newObservedImageState = {
  4091. priority: isPriority,
  4092. modified: false,
  4093. alreadyWarnedModified: false,
  4094. alreadyWarnedPriority: false
  4095. };
  4096. this.images.set(getUrl(rewrittenSrc, this.window).href, newObservedImageState);
  4097. }
  4098. unregisterImage(rewrittenSrc) {
  4099. if (!this.observer) return;
  4100. this.images.delete(getUrl(rewrittenSrc, this.window).href);
  4101. }
  4102. updateImage(originalSrc, newSrc) {
  4103. if (!this.observer) return;
  4104. const originalUrl = getUrl(originalSrc, this.window).href;
  4105. const img = this.images.get(originalUrl);
  4106. if (img) {
  4107. img.modified = true;
  4108. this.images.set(getUrl(newSrc, this.window).href, img);
  4109. this.images.delete(originalUrl);
  4110. }
  4111. }
  4112. ngOnDestroy() {
  4113. if (!this.observer) return;
  4114. this.observer.disconnect();
  4115. this.images.clear();
  4116. }
  4117. static ɵfac = function LCPImageObserver_Factory(__ngFactoryType__) {
  4118. return new (__ngFactoryType__ || _LCPImageObserver)();
  4119. };
  4120. static ɵprov = ɵɵdefineInjectable({
  4121. token: _LCPImageObserver,
  4122. factory: _LCPImageObserver.ɵfac,
  4123. providedIn: "root"
  4124. });
  4125. };
  4126. (() => {
  4127. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LCPImageObserver, [{
  4128. type: Injectable,
  4129. args: [{
  4130. providedIn: "root"
  4131. }]
  4132. }], () => [], null);
  4133. })();
  4134. function logMissingPriorityError(ngSrc) {
  4135. const directiveDetails = imgDirectiveDetails(ngSrc);
  4136. console.error(formatRuntimeError(2955, `${directiveDetails} this image is the Largest Contentful Paint (LCP) element but was not marked "priority". This image should be marked "priority" in order to prioritize its loading. To fix this, add the "priority" attribute.`));
  4137. }
  4138. function logModifiedWarning(ngSrc) {
  4139. const directiveDetails = imgDirectiveDetails(ngSrc);
  4140. console.warn(formatRuntimeError(2964, `${directiveDetails} this image is the Largest Contentful Paint (LCP) element and has had its "ngSrc" attribute modified. This can cause slower loading performance. It is recommended not to modify the "ngSrc" property on any image which could be the LCP element.`));
  4141. }
  4142. var INTERNAL_PRECONNECT_CHECK_BLOCKLIST = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "0.0.0.0"]);
  4143. var PRECONNECT_CHECK_BLOCKLIST = new InjectionToken(ngDevMode ? "PRECONNECT_CHECK_BLOCKLIST" : "");
  4144. var PreconnectLinkChecker = class _PreconnectLinkChecker {
  4145. document = inject(DOCUMENT);
  4146. /**
  4147. * Set of <link rel="preconnect"> tags found on this page.
  4148. * The `null` value indicates that there was no DOM query operation performed.
  4149. */
  4150. preconnectLinks = null;
  4151. /*
  4152. * Keep track of all already seen origin URLs to avoid repeating the same check.
  4153. */
  4154. alreadySeen = /* @__PURE__ */ new Set();
  4155. window = this.document.defaultView;
  4156. blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);
  4157. constructor() {
  4158. assertDevMode("preconnect link checker");
  4159. const blocklist = inject(PRECONNECT_CHECK_BLOCKLIST, {
  4160. optional: true
  4161. });
  4162. if (blocklist) {
  4163. this.populateBlocklist(blocklist);
  4164. }
  4165. }
  4166. populateBlocklist(origins) {
  4167. if (Array.isArray(origins)) {
  4168. deepForEach(origins, (origin) => {
  4169. this.blocklist.add(extractHostname(origin));
  4170. });
  4171. } else {
  4172. this.blocklist.add(extractHostname(origins));
  4173. }
  4174. }
  4175. /**
  4176. * Checks that a preconnect resource hint exists in the head for the
  4177. * given src.
  4178. *
  4179. * @param rewrittenSrc src formatted with loader
  4180. * @param originalNgSrc ngSrc value
  4181. */
  4182. assertPreconnect(rewrittenSrc, originalNgSrc) {
  4183. if (false) return;
  4184. const imgUrl = getUrl(rewrittenSrc, this.window);
  4185. if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin)) return;
  4186. this.alreadySeen.add(imgUrl.origin);
  4187. this.preconnectLinks ??= this.queryPreconnectLinks();
  4188. if (!this.preconnectLinks.has(imgUrl.origin)) {
  4189. console.warn(formatRuntimeError(2956, `${imgDirectiveDetails(originalNgSrc)} there is no preconnect tag present for this image. Preconnecting to the origin(s) that serve priority images ensures that these images are delivered as soon as possible. To fix this, please add the following element into the <head> of the document:
  4190. <link rel="preconnect" href="${imgUrl.origin}">`));
  4191. }
  4192. }
  4193. queryPreconnectLinks() {
  4194. const preconnectUrls = /* @__PURE__ */ new Set();
  4195. const links = this.document.querySelectorAll("link[rel=preconnect]");
  4196. for (const link of links) {
  4197. const url = getUrl(link.href, this.window);
  4198. preconnectUrls.add(url.origin);
  4199. }
  4200. return preconnectUrls;
  4201. }
  4202. ngOnDestroy() {
  4203. this.preconnectLinks?.clear();
  4204. this.alreadySeen.clear();
  4205. }
  4206. static ɵfac = function PreconnectLinkChecker_Factory(__ngFactoryType__) {
  4207. return new (__ngFactoryType__ || _PreconnectLinkChecker)();
  4208. };
  4209. static ɵprov = ɵɵdefineInjectable({
  4210. token: _PreconnectLinkChecker,
  4211. factory: _PreconnectLinkChecker.ɵfac,
  4212. providedIn: "root"
  4213. });
  4214. };
  4215. (() => {
  4216. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreconnectLinkChecker, [{
  4217. type: Injectable,
  4218. args: [{
  4219. providedIn: "root"
  4220. }]
  4221. }], () => [], null);
  4222. })();
  4223. function deepForEach(input, fn) {
  4224. for (let value of input) {
  4225. Array.isArray(value) ? deepForEach(value, fn) : fn(value);
  4226. }
  4227. }
  4228. var DEFAULT_PRELOADED_IMAGES_LIMIT = 5;
  4229. var PRELOADED_IMAGES = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_OPTIMIZED_PRELOADED_IMAGES" : "", {
  4230. providedIn: "root",
  4231. factory: () => /* @__PURE__ */ new Set()
  4232. });
  4233. var PreloadLinkCreator = class _PreloadLinkCreator {
  4234. preloadedImages = inject(PRELOADED_IMAGES);
  4235. document = inject(DOCUMENT);
  4236. errorShown = false;
  4237. /**
  4238. * @description Add a preload `<link>` to the `<head>` of the `index.html` that is served from the
  4239. * server while using Angular Universal and SSR to kick off image loads for high priority images.
  4240. *
  4241. * The `sizes` (passed in from the user) and `srcset` (parsed and formatted from `ngSrcset`)
  4242. * properties used to set the corresponding attributes, `imagesizes` and `imagesrcset`
  4243. * respectively, on the preload `<link>` tag so that the correctly sized image is preloaded from
  4244. * the CDN.
  4245. *
  4246. * {@link https://web.dev/preload-responsive-images/#imagesrcset-and-imagesizes}
  4247. *
  4248. * @param renderer The `Renderer2` passed in from the directive
  4249. * @param src The original src of the image that is set on the `ngSrc` input.
  4250. * @param srcset The parsed and formatted srcset created from the `ngSrcset` input
  4251. * @param sizes The value of the `sizes` attribute passed in to the `<img>` tag
  4252. */
  4253. createPreloadLinkTag(renderer, src, srcset, sizes) {
  4254. if (ngDevMode && !this.errorShown && this.preloadedImages.size >= DEFAULT_PRELOADED_IMAGES_LIMIT) {
  4255. this.errorShown = true;
  4256. console.warn(formatRuntimeError(2961, `The \`NgOptimizedImage\` directive has detected that more than ${DEFAULT_PRELOADED_IMAGES_LIMIT} images were marked as priority. This might negatively affect an overall performance of the page. To fix this, remove the "priority" attribute from images with less priority.`));
  4257. }
  4258. if (this.preloadedImages.has(src)) {
  4259. return;
  4260. }
  4261. this.preloadedImages.add(src);
  4262. const preload = renderer.createElement("link");
  4263. renderer.setAttribute(preload, "as", "image");
  4264. renderer.setAttribute(preload, "href", src);
  4265. renderer.setAttribute(preload, "rel", "preload");
  4266. renderer.setAttribute(preload, "fetchpriority", "high");
  4267. if (sizes) {
  4268. renderer.setAttribute(preload, "imageSizes", sizes);
  4269. }
  4270. if (srcset) {
  4271. renderer.setAttribute(preload, "imageSrcset", srcset);
  4272. }
  4273. renderer.appendChild(this.document.head, preload);
  4274. }
  4275. static ɵfac = function PreloadLinkCreator_Factory(__ngFactoryType__) {
  4276. return new (__ngFactoryType__ || _PreloadLinkCreator)();
  4277. };
  4278. static ɵprov = ɵɵdefineInjectable({
  4279. token: _PreloadLinkCreator,
  4280. factory: _PreloadLinkCreator.ɵfac,
  4281. providedIn: "root"
  4282. });
  4283. };
  4284. (() => {
  4285. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreloadLinkCreator, [{
  4286. type: Injectable,
  4287. args: [{
  4288. providedIn: "root"
  4289. }]
  4290. }], null, null);
  4291. })();
  4292. var BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;
  4293. var VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\s*\d+w\s*(,|$)){1,})$/;
  4294. var VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\s*\d+(\.\d+)?x\s*(,|$)){1,})$/;
  4295. var ABSOLUTE_SRCSET_DENSITY_CAP = 3;
  4296. var RECOMMENDED_SRCSET_DENSITY_CAP = 2;
  4297. var DENSITY_SRCSET_MULTIPLIERS = [1, 2];
  4298. var VIEWPORT_BREAKPOINT_CUTOFF = 640;
  4299. var ASPECT_RATIO_TOLERANCE = 0.1;
  4300. var OVERSIZED_IMAGE_TOLERANCE = 1e3;
  4301. var FIXED_SRCSET_WIDTH_LIMIT = 1920;
  4302. var FIXED_SRCSET_HEIGHT_LIMIT = 1080;
  4303. var PLACEHOLDER_DIMENSION_LIMIT = 1e3;
  4304. var DATA_URL_WARN_LIMIT = 4e3;
  4305. var DATA_URL_ERROR_LIMIT = 1e4;
  4306. var BUILT_IN_LOADERS = [imgixLoaderInfo, imageKitLoaderInfo, cloudinaryLoaderInfo, netlifyLoaderInfo];
  4307. var PRIORITY_COUNT_THRESHOLD = 10;
  4308. var IMGS_WITH_PRIORITY_ATTR_COUNT = 0;
  4309. var NgOptimizedImage = class _NgOptimizedImage {
  4310. imageLoader = inject(IMAGE_LOADER);
  4311. config = processConfig(inject(IMAGE_CONFIG));
  4312. renderer = inject(Renderer2);
  4313. imgElement = inject(ElementRef).nativeElement;
  4314. injector = inject(Injector);
  4315. // An LCP image observer should be injected only in development mode.
  4316. // Do not assign it to `null` to avoid having a redundant property in the production bundle.
  4317. lcpObserver;
  4318. /**
  4319. * Calculate the rewritten `src` once and store it.
  4320. * This is needed to avoid repetitive calculations and make sure the directive cleanup in the
  4321. * `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
  4322. * instance that might be already destroyed).
  4323. */
  4324. _renderedSrc = null;
  4325. /**
  4326. * Name of the source image.
  4327. * Image name will be processed by the image loader and the final URL will be applied as the `src`
  4328. * property of the image.
  4329. */
  4330. ngSrc;
  4331. /**
  4332. * A comma separated list of width or density descriptors.
  4333. * The image name will be taken from `ngSrc` and combined with the list of width or density
  4334. * descriptors to generate the final `srcset` property of the image.
  4335. *
  4336. * Example:
  4337. * ```html
  4338. * <img ngSrc="hello.jpg" ngSrcset="100w, 200w" /> =>
  4339. * <img src="path/hello.jpg" srcset="path/hello.jpg?w=100 100w, path/hello.jpg?w=200 200w" />
  4340. * ```
  4341. */
  4342. ngSrcset;
  4343. /**
  4344. * The base `sizes` attribute passed through to the `<img>` element.
  4345. * Providing sizes causes the image to create an automatic responsive srcset.
  4346. */
  4347. sizes;
  4348. /**
  4349. * For responsive images: the intrinsic width of the image in pixels.
  4350. * For fixed size images: the desired rendered width of the image in pixels.
  4351. */
  4352. width;
  4353. /**
  4354. * For responsive images: the intrinsic height of the image in pixels.
  4355. * For fixed size images: the desired rendered height of the image in pixels.
  4356. */
  4357. height;
  4358. /**
  4359. * The desired loading behavior (lazy, eager, or auto). Defaults to `lazy`,
  4360. * which is recommended for most images.
  4361. *
  4362. * Warning: Setting images as loading="eager" or loading="auto" marks them
  4363. * as non-priority images and can hurt loading performance. For images which
  4364. * may be the LCP element, use the `priority` attribute instead of `loading`.
  4365. */
  4366. loading;
  4367. /**
  4368. * Indicates whether this image should have a high priority.
  4369. */
  4370. priority = false;
  4371. /**
  4372. * Data to pass through to custom loaders.
  4373. */
  4374. loaderParams;
  4375. /**
  4376. * Disables automatic srcset generation for this image.
  4377. */
  4378. disableOptimizedSrcset = false;
  4379. /**
  4380. * Sets the image to "fill mode", which eliminates the height/width requirement and adds
  4381. * styles such that the image fills its containing element.
  4382. */
  4383. fill = false;
  4384. /**
  4385. * A URL or data URL for an image to be used as a placeholder while this image loads.
  4386. */
  4387. placeholder;
  4388. /**
  4389. * Configuration object for placeholder settings. Options:
  4390. * * blur: Setting this to false disables the automatic CSS blur.
  4391. */
  4392. placeholderConfig;
  4393. /**
  4394. * Value of the `src` attribute if set on the host `<img>` element.
  4395. * This input is exclusively read to assert that `src` is not set in conflict
  4396. * with `ngSrc` and that images don't start to load until a lazy loading strategy is set.
  4397. * @internal
  4398. */
  4399. src;
  4400. /**
  4401. * Value of the `srcset` attribute if set on the host `<img>` element.
  4402. * This input is exclusively read to assert that `srcset` is not set in conflict
  4403. * with `ngSrcset` and that images don't start to load until a lazy loading strategy is set.
  4404. * @internal
  4405. */
  4406. srcset;
  4407. constructor() {
  4408. if (ngDevMode) {
  4409. this.lcpObserver = this.injector.get(LCPImageObserver);
  4410. const destroyRef = inject(DestroyRef);
  4411. destroyRef.onDestroy(() => {
  4412. if (!this.priority && this._renderedSrc !== null) {
  4413. this.lcpObserver.unregisterImage(this._renderedSrc);
  4414. }
  4415. });
  4416. }
  4417. }
  4418. /** @docs-private */
  4419. ngOnInit() {
  4420. performanceMarkFeature("NgOptimizedImage");
  4421. if (ngDevMode) {
  4422. const ngZone = this.injector.get(NgZone);
  4423. assertNonEmptyInput(this, "ngSrc", this.ngSrc);
  4424. assertValidNgSrcset(this, this.ngSrcset);
  4425. assertNoConflictingSrc(this);
  4426. if (this.ngSrcset) {
  4427. assertNoConflictingSrcset(this);
  4428. }
  4429. assertNotBase64Image(this);
  4430. assertNotBlobUrl(this);
  4431. if (this.fill) {
  4432. assertEmptyWidthAndHeight(this);
  4433. ngZone.runOutsideAngular(() => assertNonZeroRenderedHeight(this, this.imgElement, this.renderer));
  4434. } else {
  4435. assertNonEmptyWidthAndHeight(this);
  4436. if (this.height !== void 0) {
  4437. assertGreaterThanZero(this, this.height, "height");
  4438. }
  4439. if (this.width !== void 0) {
  4440. assertGreaterThanZero(this, this.width, "width");
  4441. }
  4442. ngZone.runOutsideAngular(() => assertNoImageDistortion(this, this.imgElement, this.renderer));
  4443. }
  4444. assertValidLoadingInput(this);
  4445. if (!this.ngSrcset) {
  4446. assertNoComplexSizes(this);
  4447. }
  4448. assertValidPlaceholder(this, this.imageLoader);
  4449. assertNotMissingBuiltInLoader(this.ngSrc, this.imageLoader);
  4450. assertNoNgSrcsetWithoutLoader(this, this.imageLoader);
  4451. assertNoLoaderParamsWithoutLoader(this, this.imageLoader);
  4452. ngZone.runOutsideAngular(() => {
  4453. this.lcpObserver.registerImage(this.getRewrittenSrc(), this.ngSrc, this.priority);
  4454. });
  4455. if (this.priority) {
  4456. const checker = this.injector.get(PreconnectLinkChecker);
  4457. checker.assertPreconnect(this.getRewrittenSrc(), this.ngSrc);
  4458. if (true) {
  4459. const applicationRef = this.injector.get(ApplicationRef);
  4460. assetPriorityCountBelowThreshold(applicationRef);
  4461. }
  4462. }
  4463. }
  4464. if (this.placeholder) {
  4465. this.removePlaceholderOnLoad(this.imgElement);
  4466. }
  4467. this.setHostAttributes();
  4468. }
  4469. setHostAttributes() {
  4470. if (this.fill) {
  4471. this.sizes ||= "100vw";
  4472. } else {
  4473. this.setHostAttribute("width", this.width.toString());
  4474. this.setHostAttribute("height", this.height.toString());
  4475. }
  4476. this.setHostAttribute("loading", this.getLoadingBehavior());
  4477. this.setHostAttribute("fetchpriority", this.getFetchPriority());
  4478. this.setHostAttribute("ng-img", "true");
  4479. const rewrittenSrcset = this.updateSrcAndSrcset();
  4480. if (this.sizes) {
  4481. if (this.getLoadingBehavior() === "lazy") {
  4482. this.setHostAttribute("sizes", "auto, " + this.sizes);
  4483. } else {
  4484. this.setHostAttribute("sizes", this.sizes);
  4485. }
  4486. } else {
  4487. if (this.ngSrcset && VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset) && this.getLoadingBehavior() === "lazy") {
  4488. this.setHostAttribute("sizes", "auto, 100vw");
  4489. }
  4490. }
  4491. if (false) {
  4492. const preloadLinkCreator = this.injector.get(PreloadLinkCreator);
  4493. preloadLinkCreator.createPreloadLinkTag(this.renderer, this.getRewrittenSrc(), rewrittenSrcset, this.sizes);
  4494. }
  4495. }
  4496. /** @docs-private */
  4497. ngOnChanges(changes) {
  4498. if (ngDevMode) {
  4499. assertNoPostInitInputChange(this, changes, ["ngSrcset", "width", "height", "priority", "fill", "loading", "sizes", "loaderParams", "disableOptimizedSrcset"]);
  4500. }
  4501. if (changes["ngSrc"] && !changes["ngSrc"].isFirstChange()) {
  4502. const oldSrc = this._renderedSrc;
  4503. this.updateSrcAndSrcset(true);
  4504. if (ngDevMode) {
  4505. const newSrc = this._renderedSrc;
  4506. if (oldSrc && newSrc && oldSrc !== newSrc) {
  4507. const ngZone = this.injector.get(NgZone);
  4508. ngZone.runOutsideAngular(() => {
  4509. this.lcpObserver.updateImage(oldSrc, newSrc);
  4510. });
  4511. }
  4512. }
  4513. }
  4514. if (ngDevMode && changes["placeholder"]?.currentValue && true && true) {
  4515. assertPlaceholderDimensions(this, this.imgElement);
  4516. }
  4517. }
  4518. callImageLoader(configWithoutCustomParams) {
  4519. let augmentedConfig = configWithoutCustomParams;
  4520. if (this.loaderParams) {
  4521. augmentedConfig.loaderParams = this.loaderParams;
  4522. }
  4523. return this.imageLoader(augmentedConfig);
  4524. }
  4525. getLoadingBehavior() {
  4526. if (!this.priority && this.loading !== void 0) {
  4527. return this.loading;
  4528. }
  4529. return this.priority ? "eager" : "lazy";
  4530. }
  4531. getFetchPriority() {
  4532. return this.priority ? "high" : "auto";
  4533. }
  4534. getRewrittenSrc() {
  4535. if (!this._renderedSrc) {
  4536. const imgConfig = {
  4537. src: this.ngSrc
  4538. };
  4539. this._renderedSrc = this.callImageLoader(imgConfig);
  4540. }
  4541. return this._renderedSrc;
  4542. }
  4543. getRewrittenSrcset() {
  4544. const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset);
  4545. const finalSrcs = this.ngSrcset.split(",").filter((src) => src !== "").map((srcStr) => {
  4546. srcStr = srcStr.trim();
  4547. const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;
  4548. return `${this.callImageLoader({
  4549. src: this.ngSrc,
  4550. width
  4551. })} ${srcStr}`;
  4552. });
  4553. return finalSrcs.join(", ");
  4554. }
  4555. getAutomaticSrcset() {
  4556. if (this.sizes) {
  4557. return this.getResponsiveSrcset();
  4558. } else {
  4559. return this.getFixedSrcset();
  4560. }
  4561. }
  4562. getResponsiveSrcset() {
  4563. const {
  4564. breakpoints
  4565. } = this.config;
  4566. let filteredBreakpoints = breakpoints;
  4567. if (this.sizes?.trim() === "100vw") {
  4568. filteredBreakpoints = breakpoints.filter((bp) => bp >= VIEWPORT_BREAKPOINT_CUTOFF);
  4569. }
  4570. const finalSrcs = filteredBreakpoints.map((bp) => `${this.callImageLoader({
  4571. src: this.ngSrc,
  4572. width: bp
  4573. })} ${bp}w`);
  4574. return finalSrcs.join(", ");
  4575. }
  4576. updateSrcAndSrcset(forceSrcRecalc = false) {
  4577. if (forceSrcRecalc) {
  4578. this._renderedSrc = null;
  4579. }
  4580. const rewrittenSrc = this.getRewrittenSrc();
  4581. this.setHostAttribute("src", rewrittenSrc);
  4582. let rewrittenSrcset = void 0;
  4583. if (this.ngSrcset) {
  4584. rewrittenSrcset = this.getRewrittenSrcset();
  4585. } else if (this.shouldGenerateAutomaticSrcset()) {
  4586. rewrittenSrcset = this.getAutomaticSrcset();
  4587. }
  4588. if (rewrittenSrcset) {
  4589. this.setHostAttribute("srcset", rewrittenSrcset);
  4590. }
  4591. return rewrittenSrcset;
  4592. }
  4593. getFixedSrcset() {
  4594. const finalSrcs = DENSITY_SRCSET_MULTIPLIERS.map((multiplier) => `${this.callImageLoader({
  4595. src: this.ngSrc,
  4596. width: this.width * multiplier
  4597. })} ${multiplier}x`);
  4598. return finalSrcs.join(", ");
  4599. }
  4600. shouldGenerateAutomaticSrcset() {
  4601. let oversizedImage = false;
  4602. if (!this.sizes) {
  4603. oversizedImage = this.width > FIXED_SRCSET_WIDTH_LIMIT || this.height > FIXED_SRCSET_HEIGHT_LIMIT;
  4604. }
  4605. return !this.disableOptimizedSrcset && !this.srcset && this.imageLoader !== noopImageLoader && !oversizedImage;
  4606. }
  4607. /**
  4608. * Returns an image url formatted for use with the CSS background-image property. Expects one of:
  4609. * * A base64 encoded image, which is wrapped and passed through.
  4610. * * A boolean. If true, calls the image loader to generate a small placeholder url.
  4611. */
  4612. generatePlaceholder(placeholderInput) {
  4613. const {
  4614. placeholderResolution
  4615. } = this.config;
  4616. if (placeholderInput === true) {
  4617. return `url(${this.callImageLoader({
  4618. src: this.ngSrc,
  4619. width: placeholderResolution,
  4620. isPlaceholder: true
  4621. })})`;
  4622. } else if (typeof placeholderInput === "string") {
  4623. return `url(${placeholderInput})`;
  4624. }
  4625. return null;
  4626. }
  4627. /**
  4628. * Determines if blur should be applied, based on an optional boolean
  4629. * property `blur` within the optional configuration object `placeholderConfig`.
  4630. */
  4631. shouldBlurPlaceholder(placeholderConfig) {
  4632. if (!placeholderConfig || !placeholderConfig.hasOwnProperty("blur")) {
  4633. return true;
  4634. }
  4635. return Boolean(placeholderConfig.blur);
  4636. }
  4637. removePlaceholderOnLoad(img) {
  4638. const callback = () => {
  4639. const changeDetectorRef = this.injector.get(ChangeDetectorRef);
  4640. removeLoadListenerFn();
  4641. removeErrorListenerFn();
  4642. this.placeholder = false;
  4643. changeDetectorRef.markForCheck();
  4644. };
  4645. const removeLoadListenerFn = this.renderer.listen(img, "load", callback);
  4646. const removeErrorListenerFn = this.renderer.listen(img, "error", callback);
  4647. callOnLoadIfImageIsLoaded(img, callback);
  4648. }
  4649. setHostAttribute(name, value) {
  4650. this.renderer.setAttribute(this.imgElement, name, value);
  4651. }
  4652. static ɵfac = function NgOptimizedImage_Factory(__ngFactoryType__) {
  4653. return new (__ngFactoryType__ || _NgOptimizedImage)();
  4654. };
  4655. static ɵdir = ɵɵdefineDirective({
  4656. type: _NgOptimizedImage,
  4657. selectors: [["img", "ngSrc", ""]],
  4658. hostVars: 18,
  4659. hostBindings: function NgOptimizedImage_HostBindings(rf, ctx) {
  4660. if (rf & 2) {
  4661. ɵɵstyleProp("position", ctx.fill ? "absolute" : null)("width", ctx.fill ? "100%" : null)("height", ctx.fill ? "100%" : null)("inset", ctx.fill ? "0" : null)("background-size", ctx.placeholder ? "cover" : null)("background-position", ctx.placeholder ? "50% 50%" : null)("background-repeat", ctx.placeholder ? "no-repeat" : null)("background-image", ctx.placeholder ? ctx.generatePlaceholder(ctx.placeholder) : null)("filter", ctx.placeholder && ctx.shouldBlurPlaceholder(ctx.placeholderConfig) ? "blur(15px)" : null);
  4662. }
  4663. },
  4664. inputs: {
  4665. ngSrc: [2, "ngSrc", "ngSrc", unwrapSafeUrl],
  4666. ngSrcset: "ngSrcset",
  4667. sizes: "sizes",
  4668. width: [2, "width", "width", numberAttribute],
  4669. height: [2, "height", "height", numberAttribute],
  4670. loading: "loading",
  4671. priority: [2, "priority", "priority", booleanAttribute],
  4672. loaderParams: "loaderParams",
  4673. disableOptimizedSrcset: [2, "disableOptimizedSrcset", "disableOptimizedSrcset", booleanAttribute],
  4674. fill: [2, "fill", "fill", booleanAttribute],
  4675. placeholder: [2, "placeholder", "placeholder", booleanOrUrlAttribute],
  4676. placeholderConfig: "placeholderConfig",
  4677. src: "src",
  4678. srcset: "srcset"
  4679. },
  4680. features: [ɵɵNgOnChangesFeature]
  4681. });
  4682. };
  4683. (() => {
  4684. (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgOptimizedImage, [{
  4685. type: Directive,
  4686. args: [{
  4687. selector: "img[ngSrc]",
  4688. host: {
  4689. "[style.position]": 'fill ? "absolute" : null',
  4690. "[style.width]": 'fill ? "100%" : null',
  4691. "[style.height]": 'fill ? "100%" : null',
  4692. "[style.inset]": 'fill ? "0" : null',
  4693. "[style.background-size]": 'placeholder ? "cover" : null',
  4694. "[style.background-position]": 'placeholder ? "50% 50%" : null',
  4695. "[style.background-repeat]": 'placeholder ? "no-repeat" : null',
  4696. "[style.background-image]": "placeholder ? generatePlaceholder(placeholder) : null",
  4697. "[style.filter]": 'placeholder && shouldBlurPlaceholder(placeholderConfig) ? "blur(15px)" : null'
  4698. }
  4699. }]
  4700. }], () => [], {
  4701. ngSrc: [{
  4702. type: Input,
  4703. args: [{
  4704. required: true,
  4705. transform: unwrapSafeUrl
  4706. }]
  4707. }],
  4708. ngSrcset: [{
  4709. type: Input
  4710. }],
  4711. sizes: [{
  4712. type: Input
  4713. }],
  4714. width: [{
  4715. type: Input,
  4716. args: [{
  4717. transform: numberAttribute
  4718. }]
  4719. }],
  4720. height: [{
  4721. type: Input,
  4722. args: [{
  4723. transform: numberAttribute
  4724. }]
  4725. }],
  4726. loading: [{
  4727. type: Input
  4728. }],
  4729. priority: [{
  4730. type: Input,
  4731. args: [{
  4732. transform: booleanAttribute
  4733. }]
  4734. }],
  4735. loaderParams: [{
  4736. type: Input
  4737. }],
  4738. disableOptimizedSrcset: [{
  4739. type: Input,
  4740. args: [{
  4741. transform: booleanAttribute
  4742. }]
  4743. }],
  4744. fill: [{
  4745. type: Input,
  4746. args: [{
  4747. transform: booleanAttribute
  4748. }]
  4749. }],
  4750. placeholder: [{
  4751. type: Input,
  4752. args: [{
  4753. transform: booleanOrUrlAttribute
  4754. }]
  4755. }],
  4756. placeholderConfig: [{
  4757. type: Input
  4758. }],
  4759. src: [{
  4760. type: Input
  4761. }],
  4762. srcset: [{
  4763. type: Input
  4764. }]
  4765. });
  4766. })();
  4767. function processConfig(config) {
  4768. let sortedBreakpoints = {};
  4769. if (config.breakpoints) {
  4770. sortedBreakpoints.breakpoints = config.breakpoints.sort((a, b) => a - b);
  4771. }
  4772. return Object.assign({}, IMAGE_CONFIG_DEFAULTS, config, sortedBreakpoints);
  4773. }
  4774. function assertNoConflictingSrc(dir) {
  4775. if (dir.src) {
  4776. throw new RuntimeError(2950, `${imgDirectiveDetails(dir.ngSrc)} both \`src\` and \`ngSrc\` have been set. Supplying both of these attributes breaks lazy loading. The NgOptimizedImage directive sets \`src\` itself based on the value of \`ngSrc\`. To fix this, please remove the \`src\` attribute.`);
  4777. }
  4778. }
  4779. function assertNoConflictingSrcset(dir) {
  4780. if (dir.srcset) {
  4781. throw new RuntimeError(2951, `${imgDirectiveDetails(dir.ngSrc)} both \`srcset\` and \`ngSrcset\` have been set. Supplying both of these attributes breaks lazy loading. The NgOptimizedImage directive sets \`srcset\` itself based on the value of \`ngSrcset\`. To fix this, please remove the \`srcset\` attribute.`);
  4782. }
  4783. }
  4784. function assertNotBase64Image(dir) {
  4785. let ngSrc = dir.ngSrc.trim();
  4786. if (ngSrc.startsWith("data:")) {
  4787. if (ngSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {
  4788. ngSrc = ngSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + "...";
  4789. }
  4790. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`ngSrc\` is a Base64-encoded string (${ngSrc}). NgOptimizedImage does not support Base64-encoded strings. To fix this, disable the NgOptimizedImage directive for this element by removing \`ngSrc\` and using a standard \`src\` attribute instead.`);
  4791. }
  4792. }
  4793. function assertNoComplexSizes(dir) {
  4794. let sizes = dir.sizes;
  4795. if (sizes?.match(/((\)|,)\s|^)\d+px/)) {
  4796. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`sizes\` was set to a string including pixel values. For automatic \`srcset\` generation, \`sizes\` must only include responsive values, such as \`sizes="50vw"\` or \`sizes="(min-width: 768px) 50vw, 100vw"\`. To fix this, modify the \`sizes\` attribute, or provide your own \`ngSrcset\` value directly.`);
  4797. }
  4798. }
  4799. function assertValidPlaceholder(dir, imageLoader) {
  4800. assertNoPlaceholderConfigWithoutPlaceholder(dir);
  4801. assertNoRelativePlaceholderWithoutLoader(dir, imageLoader);
  4802. assertNoOversizedDataUrl(dir);
  4803. }
  4804. function assertNoPlaceholderConfigWithoutPlaceholder(dir) {
  4805. if (dir.placeholderConfig && !dir.placeholder) {
  4806. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc, false)} \`placeholderConfig\` options were provided for an image that does not use the \`placeholder\` attribute, and will have no effect.`);
  4807. }
  4808. }
  4809. function assertNoRelativePlaceholderWithoutLoader(dir, imageLoader) {
  4810. if (dir.placeholder === true && imageLoader === noopImageLoader) {
  4811. throw new RuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to true but no image loader is configured (i.e. the default one is being used), which would result in the same image being used for the primary image and its placeholder. To fix this, provide a loader or remove the \`placeholder\` attribute from the image.`);
  4812. }
  4813. }
  4814. function assertNoOversizedDataUrl(dir) {
  4815. if (dir.placeholder && typeof dir.placeholder === "string" && dir.placeholder.startsWith("data:")) {
  4816. if (dir.placeholder.length > DATA_URL_ERROR_LIMIT) {
  4817. throw new RuntimeError(2965, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to a data URL which is longer than ${DATA_URL_ERROR_LIMIT} characters. This is strongly discouraged, as large inline placeholders directly increase the bundle size of Angular and hurt page load performance. To fix this, generate a smaller data URL placeholder.`);
  4818. }
  4819. if (dir.placeholder.length > DATA_URL_WARN_LIMIT) {
  4820. console.warn(formatRuntimeError(2965, `${imgDirectiveDetails(dir.ngSrc)} the \`placeholder\` attribute is set to a data URL which is longer than ${DATA_URL_WARN_LIMIT} characters. This is discouraged, as large inline placeholders directly increase the bundle size of Angular and hurt page load performance. For better loading performance, generate a smaller data URL placeholder.`));
  4821. }
  4822. }
  4823. }
  4824. function assertNotBlobUrl(dir) {
  4825. const ngSrc = dir.ngSrc.trim();
  4826. if (ngSrc.startsWith("blob:")) {
  4827. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`ngSrc\` was set to a blob URL (${ngSrc}). Blob URLs are not supported by the NgOptimizedImage directive. To fix this, disable the NgOptimizedImage directive for this element by removing \`ngSrc\` and using a regular \`src\` attribute instead.`);
  4828. }
  4829. }
  4830. function assertNonEmptyInput(dir, name, value) {
  4831. const isString = typeof value === "string";
  4832. const isEmptyString = isString && value.trim() === "";
  4833. if (!isString || isEmptyString) {
  4834. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${name}\` has an invalid value (\`${value}\`). To fix this, change the value to a non-empty string.`);
  4835. }
  4836. }
  4837. function assertValidNgSrcset(dir, value) {
  4838. if (value == null) return;
  4839. assertNonEmptyInput(dir, "ngSrcset", value);
  4840. const stringVal = value;
  4841. const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);
  4842. const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);
  4843. if (isValidDensityDescriptor) {
  4844. assertUnderDensityCap(dir, stringVal);
  4845. }
  4846. const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;
  4847. if (!isValidSrcset) {
  4848. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`ngSrcset\` has an invalid value (\`${value}\`). To fix this, supply \`ngSrcset\` using a comma-separated list of one or more width descriptors (e.g. "100w, 200w") or density descriptors (e.g. "1x, 2x").`);
  4849. }
  4850. }
  4851. function assertUnderDensityCap(dir, value) {
  4852. const underDensityCap = value.split(",").every((num) => num === "" || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);
  4853. if (!underDensityCap) {
  4854. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`ngSrcset\` contains an unsupported image density:\`${value}\`. NgOptimizedImage generally recommends a max image density of ${RECOMMENDED_SRCSET_DENSITY_CAP}x but supports image densities up to ${ABSOLUTE_SRCSET_DENSITY_CAP}x. The human eye cannot distinguish between image densities greater than ${RECOMMENDED_SRCSET_DENSITY_CAP}x - which makes them unnecessary for most use cases. Images that will be pinch-zoomed are typically the primary use case for ${ABSOLUTE_SRCSET_DENSITY_CAP}x images. Please remove the high density descriptor and try again.`);
  4855. }
  4856. }
  4857. function postInitInputChangeError(dir, inputName) {
  4858. let reason;
  4859. if (inputName === "width" || inputName === "height") {
  4860. reason = `Changing \`${inputName}\` may result in different attribute value applied to the underlying image element and cause layout shifts on a page.`;
  4861. } else {
  4862. reason = `Changing the \`${inputName}\` would have no effect on the underlying image element, because the resource loading has already occurred.`;
  4863. }
  4864. return new RuntimeError(2953, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` was updated after initialization. The NgOptimizedImage directive will not react to this input change. ${reason} To fix this, either switch \`${inputName}\` to a static value or wrap the image element in an @if that is gated on the necessary value.`);
  4865. }
  4866. function assertNoPostInitInputChange(dir, changes, inputs) {
  4867. inputs.forEach((input) => {
  4868. const isUpdated = changes.hasOwnProperty(input);
  4869. if (isUpdated && !changes[input].isFirstChange()) {
  4870. if (input === "ngSrc") {
  4871. dir = {
  4872. ngSrc: changes[input].previousValue
  4873. };
  4874. }
  4875. throw postInitInputChangeError(dir, input);
  4876. }
  4877. });
  4878. }
  4879. function assertGreaterThanZero(dir, inputValue, inputName) {
  4880. const validNumber = typeof inputValue === "number" && inputValue > 0;
  4881. const validString = typeof inputValue === "string" && /^\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;
  4882. if (!validNumber && !validString) {
  4883. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` has an invalid value. To fix this, provide \`${inputName}\` as a number greater than 0.`);
  4884. }
  4885. }
  4886. function assertNoImageDistortion(dir, img, renderer) {
  4887. const callback = () => {
  4888. removeLoadListenerFn();
  4889. removeErrorListenerFn();
  4890. const computedStyle = window.getComputedStyle(img);
  4891. let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
  4892. let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
  4893. const boxSizing = computedStyle.getPropertyValue("box-sizing");
  4894. if (boxSizing === "border-box") {
  4895. const paddingTop = computedStyle.getPropertyValue("padding-top");
  4896. const paddingRight = computedStyle.getPropertyValue("padding-right");
  4897. const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
  4898. const paddingLeft = computedStyle.getPropertyValue("padding-left");
  4899. renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
  4900. renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
  4901. }
  4902. const renderedAspectRatio = renderedWidth / renderedHeight;
  4903. const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;
  4904. const intrinsicWidth = img.naturalWidth;
  4905. const intrinsicHeight = img.naturalHeight;
  4906. const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;
  4907. const suppliedWidth = dir.width;
  4908. const suppliedHeight = dir.height;
  4909. const suppliedAspectRatio = suppliedWidth / suppliedHeight;
  4910. const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;
  4911. const stylingDistortion = nonZeroRenderedDimensions && Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;
  4912. if (inaccurateDimensions) {
  4913. console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the image does not match the aspect ratio indicated by the width and height attributes.
  4914. Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}).
  4915. Supplied width and height attributes: ${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${round(suppliedAspectRatio)}).
  4916. To fix this, update the width and height attributes.`));
  4917. } else if (stylingDistortion) {
  4918. console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the rendered image does not match the image's intrinsic aspect ratio.
  4919. Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}).
  4920. Rendered image size: ${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ${round(renderedAspectRatio)}).
  4921. This issue can occur if "width" and "height" attributes are added to an image without updating the corresponding image styling. To fix this, adjust image styling. In most cases, adding "height: auto" or "width: auto" to the image styling will fix this issue.`));
  4922. } else if (!dir.ngSrcset && nonZeroRenderedDimensions) {
  4923. const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;
  4924. const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;
  4925. const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;
  4926. const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;
  4927. if (oversizedWidth || oversizedHeight) {
  4928. console.warn(formatRuntimeError(2960, `${imgDirectiveDetails(dir.ngSrc)} the intrinsic image is significantly larger than necessary.
  4929. Rendered image size: ${renderedWidth}w x ${renderedHeight}h.
  4930. Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h.
  4931. Recommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h.
  4932. Note: Recommended intrinsic image size is calculated assuming a maximum DPR of ${RECOMMENDED_SRCSET_DENSITY_CAP}. To improve loading time, resize the image or consider using the "ngSrcset" and "sizes" attributes.`));
  4933. }
  4934. }
  4935. };
  4936. const removeLoadListenerFn = renderer.listen(img, "load", callback);
  4937. const removeErrorListenerFn = renderer.listen(img, "error", () => {
  4938. removeLoadListenerFn();
  4939. removeErrorListenerFn();
  4940. });
  4941. callOnLoadIfImageIsLoaded(img, callback);
  4942. }
  4943. function assertNonEmptyWidthAndHeight(dir) {
  4944. let missingAttributes = [];
  4945. if (dir.width === void 0) missingAttributes.push("width");
  4946. if (dir.height === void 0) missingAttributes.push("height");
  4947. if (missingAttributes.length > 0) {
  4948. throw new RuntimeError(2954, `${imgDirectiveDetails(dir.ngSrc)} these required attributes are missing: ${missingAttributes.map((attr) => `"${attr}"`).join(", ")}. Including "width" and "height" attributes will prevent image-related layout shifts. To fix this, include "width" and "height" attributes on the image tag or turn on "fill" mode with the \`fill\` attribute.`);
  4949. }
  4950. }
  4951. function assertEmptyWidthAndHeight(dir) {
  4952. if (dir.width || dir.height) {
  4953. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the attributes \`height\` and/or \`width\` are present along with the \`fill\` attribute. Because \`fill\` mode causes an image to fill its containing element, the size attributes have no effect and should be removed.`);
  4954. }
  4955. }
  4956. function assertNonZeroRenderedHeight(dir, img, renderer) {
  4957. const callback = () => {
  4958. removeLoadListenerFn();
  4959. removeErrorListenerFn();
  4960. const renderedHeight = img.clientHeight;
  4961. if (dir.fill && renderedHeight === 0) {
  4962. console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the height of the fill-mode image is zero. This is likely because the containing element does not have the CSS 'position' property set to one of the following: "relative", "fixed", or "absolute". To fix this problem, make sure the container element has the CSS 'position' property defined and the height of the element is not zero.`));
  4963. }
  4964. };
  4965. const removeLoadListenerFn = renderer.listen(img, "load", callback);
  4966. const removeErrorListenerFn = renderer.listen(img, "error", () => {
  4967. removeLoadListenerFn();
  4968. removeErrorListenerFn();
  4969. });
  4970. callOnLoadIfImageIsLoaded(img, callback);
  4971. }
  4972. function assertValidLoadingInput(dir) {
  4973. if (dir.loading && dir.priority) {
  4974. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`loading\` attribute was used on an image that was marked "priority". Setting \`loading\` on priority images is not allowed because these images will always be eagerly loaded. To fix this, remove the “loading” attribute from the priority image.`);
  4975. }
  4976. const validInputs = ["auto", "eager", "lazy"];
  4977. if (typeof dir.loading === "string" && !validInputs.includes(dir.loading)) {
  4978. throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`loading\` attribute has an invalid value (\`${dir.loading}\`). To fix this, provide a valid value ("lazy", "eager", or "auto").`);
  4979. }
  4980. }
  4981. function assertNotMissingBuiltInLoader(ngSrc, imageLoader) {
  4982. if (imageLoader === noopImageLoader) {
  4983. let builtInLoaderName = "";
  4984. for (const loader of BUILT_IN_LOADERS) {
  4985. if (loader.testUrl(ngSrc)) {
  4986. builtInLoaderName = loader.name;
  4987. break;
  4988. }
  4989. }
  4990. if (builtInLoaderName) {
  4991. console.warn(formatRuntimeError(2962, `NgOptimizedImage: It looks like your images may be hosted on the ${builtInLoaderName} CDN, but your app is not using Angular's built-in loader for that CDN. We recommend switching to use the built-in by calling \`provide${builtInLoaderName}Loader()\` in your \`providers\` and passing it your instance's base URL. If you don't want to use the built-in loader, define a custom loader function using IMAGE_LOADER to silence this warning.`));
  4992. }
  4993. }
  4994. }
  4995. function assertNoNgSrcsetWithoutLoader(dir, imageLoader) {
  4996. if (dir.ngSrcset && imageLoader === noopImageLoader) {
  4997. console.warn(formatRuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`ngSrcset\` attribute is present but no image loader is configured (i.e. the default one is being used), which would result in the same image being used for all configured sizes. To fix this, provide a loader or remove the \`ngSrcset\` attribute from the image.`));
  4998. }
  4999. }
  5000. function assertNoLoaderParamsWithoutLoader(dir, imageLoader) {
  5001. if (dir.loaderParams && imageLoader === noopImageLoader) {
  5002. console.warn(formatRuntimeError(2963, `${imgDirectiveDetails(dir.ngSrc)} the \`loaderParams\` attribute is present but no image loader is configured (i.e. the default one is being used), which means that the loaderParams data will not be consumed and will not affect the URL. To fix this, provide a custom loader or remove the \`loaderParams\` attribute from the image.`));
  5003. }
  5004. }
  5005. function assetPriorityCountBelowThreshold(appRef) {
  5006. return __async(this, null, function* () {
  5007. if (IMGS_WITH_PRIORITY_ATTR_COUNT === 0) {
  5008. IMGS_WITH_PRIORITY_ATTR_COUNT++;
  5009. yield appRef.whenStable();
  5010. if (IMGS_WITH_PRIORITY_ATTR_COUNT > PRIORITY_COUNT_THRESHOLD) {
  5011. console.warn(formatRuntimeError(2966, `NgOptimizedImage: The "priority" attribute is set to true more than ${PRIORITY_COUNT_THRESHOLD} times (${IMGS_WITH_PRIORITY_ATTR_COUNT} times). Marking too many images as "high" priority can hurt your application's LCP (https://web.dev/lcp). "Priority" should only be set on the image expected to be the page's LCP element.`));
  5012. }
  5013. } else {
  5014. IMGS_WITH_PRIORITY_ATTR_COUNT++;
  5015. }
  5016. });
  5017. }
  5018. function assertPlaceholderDimensions(dir, imgElement) {
  5019. const computedStyle = window.getComputedStyle(imgElement);
  5020. let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
  5021. let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
  5022. if (renderedWidth > PLACEHOLDER_DIMENSION_LIMIT || renderedHeight > PLACEHOLDER_DIMENSION_LIMIT) {
  5023. console.warn(formatRuntimeError(2967, `${imgDirectiveDetails(dir.ngSrc)} it uses a placeholder image, but at least one of the dimensions attribute (height or width) exceeds the limit of ${PLACEHOLDER_DIMENSION_LIMIT}px. To fix this, use a smaller image as a placeholder.`));
  5024. }
  5025. }
  5026. function callOnLoadIfImageIsLoaded(img, callback) {
  5027. if (img.complete && img.naturalWidth) {
  5028. callback();
  5029. }
  5030. }
  5031. function round(input) {
  5032. return Number.isInteger(input) ? input : input.toFixed(2);
  5033. }
  5034. function unwrapSafeUrl(value) {
  5035. if (typeof value === "string") {
  5036. return value;
  5037. }
  5038. return unwrapSafeValue(value);
  5039. }
  5040. function booleanOrUrlAttribute(value) {
  5041. if (typeof value === "string" && value !== "true" && value !== "false" && value !== "") {
  5042. return value;
  5043. }
  5044. return booleanAttribute(value);
  5045. }
  5046. export {
  5047. getDOM,
  5048. setRootDomAdapter,
  5049. DomAdapter,
  5050. PlatformLocation,
  5051. LOCATION_INITIALIZED,
  5052. BrowserPlatformLocation,
  5053. normalizeQueryParams,
  5054. LocationStrategy,
  5055. APP_BASE_HREF,
  5056. PathLocationStrategy,
  5057. Location,
  5058. HashLocationStrategy,
  5059. NumberFormatStyle,
  5060. Plural,
  5061. FormStyle,
  5062. TranslationWidth,
  5063. FormatWidth,
  5064. NumberSymbol,
  5065. WeekDay,
  5066. getLocaleId,
  5067. getLocaleDayPeriods,
  5068. getLocaleDayNames,
  5069. getLocaleMonthNames,
  5070. getLocaleEraNames,
  5071. getLocaleFirstDayOfWeek,
  5072. getLocaleWeekEndRange,
  5073. getLocaleDateFormat,
  5074. getLocaleTimeFormat,
  5075. getLocaleDateTimeFormat,
  5076. getLocaleNumberSymbol,
  5077. getLocaleNumberFormat,
  5078. getLocaleCurrencySymbol,
  5079. getLocaleCurrencyName,
  5080. getLocaleCurrencyCode2 as getLocaleCurrencyCode,
  5081. getLocalePluralCase2 as getLocalePluralCase,
  5082. getLocaleExtraDayPeriodRules,
  5083. getLocaleExtraDayPeriods,
  5084. getLocaleDirection,
  5085. getCurrencySymbol,
  5086. getNumberOfCurrencyDigits,
  5087. formatDate,
  5088. formatCurrency,
  5089. formatPercent,
  5090. formatNumber,
  5091. NgLocalization,
  5092. NgLocaleLocalization,
  5093. NgClass,
  5094. NgComponentOutlet,
  5095. NgForOfContext,
  5096. NgForOf,
  5097. NgIf,
  5098. NgIfContext,
  5099. NgSwitch,
  5100. NgSwitchCase,
  5101. NgSwitchDefault,
  5102. NgPlural,
  5103. NgPluralCase,
  5104. NgStyle,
  5105. NgTemplateOutlet,
  5106. AsyncPipe,
  5107. LowerCasePipe,
  5108. TitleCasePipe,
  5109. UpperCasePipe,
  5110. DATE_PIPE_DEFAULT_TIMEZONE,
  5111. DATE_PIPE_DEFAULT_OPTIONS,
  5112. DatePipe,
  5113. I18nPluralPipe,
  5114. I18nSelectPipe,
  5115. JsonPipe,
  5116. KeyValuePipe,
  5117. DecimalPipe,
  5118. PercentPipe,
  5119. CurrencyPipe,
  5120. SlicePipe,
  5121. CommonModule,
  5122. PlatformNavigation,
  5123. registerLocaleData2 as registerLocaleData,
  5124. PLATFORM_BROWSER_ID,
  5125. PLATFORM_SERVER_ID,
  5126. isPlatformBrowser,
  5127. isPlatformServer,
  5128. VERSION,
  5129. ViewportScroller,
  5130. NullViewportScroller,
  5131. IMAGE_LOADER,
  5132. provideCloudflareLoader,
  5133. provideCloudinaryLoader,
  5134. provideImageKitLoader,
  5135. provideImgixLoader,
  5136. provideNetlifyLoader,
  5137. PRECONNECT_CHECK_BLOCKLIST,
  5138. NgOptimizedImage
  5139. };
  5140. /*! Bundled license information:
  5141. @angular/common/fesm2022/location.mjs:
  5142. @angular/common/fesm2022/common_module.mjs:
  5143. @angular/common/fesm2022/platform_navigation.mjs:
  5144. @angular/common/fesm2022/common.mjs:
  5145. (**
  5146. * @license Angular v20.0.5
  5147. * (c) 2010-2025 Google LLC. https://angular.io/
  5148. * License: MIT
  5149. *)
  5150. */
  5151. //# sourceMappingURL=chunk-VHSNDQRF.js.map