You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4956 lines
172KB

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