Files
2026-05-05 10:53:52 +02:00

18662 lines
655 KiB
JavaScript

import {
APP_BOOTSTRAP_LISTENER,
APP_ID,
ApplicationModule,
ApplicationRef,
Attribute,
BehaviorSubject,
CSP_NONCE,
ChangeDetectorRef,
Compiler,
Component,
ConnectableObservable,
Console,
ContentChildren,
DEFAULT_CURRENCY_CODE,
DOCUMENT,
DestroyRef,
Directive,
EMPTY,
ENVIRONMENT_INITIALIZER,
ElementRef,
EmptyError,
EnvironmentInjector,
ErrorHandler,
EventEmitter,
Host,
HostAttributeToken,
HostBinding,
HostListener,
IMAGE_CONFIG,
IMAGE_CONFIG_DEFAULTS,
INJECTOR_SCOPE,
INTERNAL_APPLICATION_ERROR_HANDLER,
IS_ENABLED_BLOCKING_INITIAL_NAVIGATION,
Inject,
Injectable,
InjectionToken,
Injector,
Input,
IterableDiffers,
KeyValueDiffers,
LOCALE_ID,
LocaleDataIndex,
NgModule,
NgModuleFactory$1,
NgModuleRef$1,
NgZone,
Observable,
Optional,
Output,
PLATFORM_ID,
PLATFORM_INITIALIZER,
PendingTasks,
PendingTasksInternal,
Pipe,
Renderer2,
RendererFactory2,
RendererStyleFlags2,
ResourceImpl,
RuntimeError,
SecurityContext,
SkipSelf,
Subject,
Subscription,
TESTABILITY,
TESTABILITY_GETTER,
TemplateRef,
Testability,
TestabilityRegistry,
TracingService,
ViewContainerRef,
ViewEncapsulation,
XSS_SECURITY_URL,
_global,
_sanitizeHtml,
_sanitizeUrl,
afterNextRender,
allLeavingAnimations,
allowSanitizationBypassAndThrow,
animationFrameScheduler,
asapScheduler,
assertInInjectionContext,
booleanAttribute,
bypassSanitizationTrustHtml,
bypassSanitizationTrustResourceUrl,
bypassSanitizationTrustScript,
bypassSanitizationTrustStyle,
bypassSanitizationTrustUrl,
catchError,
combineLatest,
computed,
concat,
concatMap,
createEnvironmentInjector,
createNgModule,
createPlatformFactory,
debounceTime,
defaultIfEmpty,
defer,
encapsulateResourceError,
filter,
finalize,
findLocaleData,
first,
formatRuntimeError,
forwardRef,
from,
getLocalePluralCase,
inject,
input,
internalCreateApplication,
isDevMode,
isInjectable,
isNgModule,
isObservable,
isPromise,
isStandalone,
isSubscribable,
last,
linkedSignal,
makeEnvironmentProviders,
map,
mergeAll,
mergeMap,
numberAttribute,
of,
performanceMarkFeature,
pipe,
platformCore,
provideAppInitializer,
publishExternalGlobalUtil,
refCount,
reflectComponentType,
registerLocaleData,
runInInjectionContext,
scan,
setClassMetadata,
setDocument,
share,
signal,
startWith,
stringify,
switchMap,
take,
takeLast,
takeUntil,
tap,
throwError,
untracked,
unwrapSafeValue,
ɵɵInheritDefinitionFeature,
ɵɵNgOnChangesFeature,
ɵɵattribute,
ɵɵclassMap,
ɵɵclassProp,
ɵɵcontentQuery,
ɵɵdefineComponent,
ɵɵdefineDirective,
ɵɵdefineInjectable,
ɵɵdefineInjector,
ɵɵdefineNgModule,
ɵɵdefinePipe,
ɵɵdirectiveInject,
ɵɵelement,
ɵɵgetInheritedFactory,
ɵɵinject,
ɵɵinjectAttribute,
ɵɵinvalidFactory,
ɵɵlistener,
ɵɵloadQuery,
ɵɵqueryRefresh,
ɵɵsanitizeUrlOrResourceUrl,
ɵɵstyleProp
} from "./chunk-WI7WFVZR.js";
import {
__async,
__spreadProps,
__spreadValues
} from "./chunk-WDMUDEB6.js";
// node_modules/@angular/common/fesm2022/location.mjs
var _DOM = null;
function getDOM() {
return _DOM;
}
function setRootDomAdapter(adapter) {
_DOM ??= adapter;
}
var DomAdapter = class {
};
var PlatformLocation = class _PlatformLocation {
historyGo(relativePosition) {
throw new Error(ngDevMode ? "Not implemented" : "");
}
static \u0275fac = function PlatformLocation_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PlatformLocation)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _PlatformLocation,
factory: () => (() => inject(BrowserPlatformLocation))(),
providedIn: "platform"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformLocation, [{
type: Injectable,
args: [{
providedIn: "platform",
useFactory: () => inject(BrowserPlatformLocation)
}]
}], null, null);
})();
var LOCATION_INITIALIZED = new InjectionToken(ngDevMode ? "Location Initialized" : "");
var BrowserPlatformLocation = class _BrowserPlatformLocation extends PlatformLocation {
_location;
_history;
_doc = inject(DOCUMENT);
constructor() {
super();
this._location = window.location;
this._history = window.history;
}
getBaseHrefFromDOM() {
return getDOM().getBaseHref(this._doc);
}
onPopState(fn) {
const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
window2.addEventListener("popstate", fn, false);
return () => window2.removeEventListener("popstate", fn);
}
onHashChange(fn) {
const window2 = getDOM().getGlobalEventTarget(this._doc, "window");
window2.addEventListener("hashchange", fn, false);
return () => window2.removeEventListener("hashchange", fn);
}
get href() {
return this._location.href;
}
get protocol() {
return this._location.protocol;
}
get hostname() {
return this._location.hostname;
}
get port() {
return this._location.port;
}
get pathname() {
return this._location.pathname;
}
get search() {
return this._location.search;
}
get hash() {
return this._location.hash;
}
set pathname(newPath) {
this._location.pathname = newPath;
}
pushState(state, title, url) {
this._history.pushState(state, title, url);
}
replaceState(state, title, url) {
this._history.replaceState(state, title, url);
}
forward() {
this._history.forward();
}
back() {
this._history.back();
}
historyGo(relativePosition = 0) {
this._history.go(relativePosition);
}
getState() {
return this._history.state;
}
static \u0275fac = function BrowserPlatformLocation_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _BrowserPlatformLocation)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _BrowserPlatformLocation,
factory: () => (() => new _BrowserPlatformLocation())(),
providedIn: "platform"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserPlatformLocation, [{
type: Injectable,
args: [{
providedIn: "platform",
useFactory: () => new BrowserPlatformLocation()
}]
}], () => [], null);
})();
function joinWithSlash(start, end) {
if (!start) return end;
if (!end) return start;
if (start.endsWith("/")) {
return end.startsWith("/") ? start + end.slice(1) : start + end;
}
return end.startsWith("/") ? start + end : `${start}/${end}`;
}
function stripTrailingSlash(url) {
const pathEndIdx = url.search(/#|\?|$/);
return url[pathEndIdx - 1] === "/" ? url.slice(0, pathEndIdx - 1) + url.slice(pathEndIdx) : url;
}
function normalizeQueryParams(params) {
return params && params[0] !== "?" ? `?${params}` : params;
}
var LocationStrategy = class _LocationStrategy {
historyGo(relativePosition) {
throw new Error(ngDevMode ? "Not implemented" : "");
}
static \u0275fac = function LocationStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _LocationStrategy)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _LocationStrategy,
factory: () => (() => inject(PathLocationStrategy))(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LocationStrategy, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => inject(PathLocationStrategy)
}]
}], null, null);
})();
var APP_BASE_HREF = new InjectionToken(ngDevMode ? "appBaseHref" : "");
var PathLocationStrategy = class _PathLocationStrategy extends LocationStrategy {
_platformLocation;
_baseHref;
_removeListenerFns = [];
constructor(_platformLocation, href) {
super();
this._platformLocation = _platformLocation;
this._baseHref = href ?? this._platformLocation.getBaseHrefFromDOM() ?? inject(DOCUMENT).location?.origin ?? "";
}
/** @docs-private */
ngOnDestroy() {
while (this._removeListenerFns.length) {
this._removeListenerFns.pop()();
}
}
onPopState(fn) {
this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
}
getBaseHref() {
return this._baseHref;
}
prepareExternalUrl(internal) {
return joinWithSlash(this._baseHref, internal);
}
path(includeHash = false) {
const pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
const hash = this._platformLocation.hash;
return hash && includeHash ? `${pathname}${hash}` : pathname;
}
pushState(state, title, url, queryParams) {
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
}
replaceState(state, title, url, queryParams) {
const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
}
forward() {
this._platformLocation.forward();
}
back() {
this._platformLocation.back();
}
getState() {
return this._platformLocation.getState();
}
historyGo(relativePosition = 0) {
this._platformLocation.historyGo?.(relativePosition);
}
static \u0275fac = function PathLocationStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PathLocationStrategy)(\u0275\u0275inject(PlatformLocation), \u0275\u0275inject(APP_BASE_HREF, 8));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _PathLocationStrategy,
factory: _PathLocationStrategy.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PathLocationStrategy, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: PlatformLocation
}, {
type: void 0,
decorators: [{
type: Optional
}, {
type: Inject,
args: [APP_BASE_HREF]
}]
}], null);
})();
var Location = class _Location {
/** @internal */
_subject = new Subject();
/** @internal */
_basePath;
/** @internal */
_locationStrategy;
/** @internal */
_urlChangeListeners = [];
/** @internal */
_urlChangeSubscription = null;
constructor(locationStrategy) {
this._locationStrategy = locationStrategy;
const baseHref = this._locationStrategy.getBaseHref();
this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));
this._locationStrategy.onPopState((ev) => {
this._subject.next({
"url": this.path(true),
"pop": true,
"state": ev.state,
"type": ev.type
});
});
}
/** @docs-private */
ngOnDestroy() {
this._urlChangeSubscription?.unsubscribe();
this._urlChangeListeners = [];
}
/**
* Normalizes the URL path for this location.
*
* @param includeHash True to include an anchor fragment in the path.
*
* @returns The normalized URL path.
*/
// TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
// removed.
path(includeHash = false) {
return this.normalize(this._locationStrategy.path(includeHash));
}
/**
* Reports the current state of the location history.
* @returns The current value of the `history.state` object.
*/
getState() {
return this._locationStrategy.getState();
}
/**
* Normalizes the given path and compares to the current normalized path.
*
* @param path The given URL path.
* @param query Query parameters.
*
* @returns True if the given URL path is equal to the current normalized path, false
* otherwise.
*/
isCurrentPathEqualTo(path, query = "") {
return this.path() == this.normalize(path + normalizeQueryParams(query));
}
/**
* Normalizes a URL path by stripping any trailing slashes.
*
* @param url String representing a URL.
*
* @returns The normalized URL string.
*/
normalize(url) {
return _Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));
}
/**
* Normalizes an external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), adds one
* before normalizing. Adds a hash if `HashLocationStrategy` is
* in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
*
* @param url String representing a URL.
*
* @returns A normalized platform-specific URL.
*/
prepareExternalUrl(url) {
if (url && url[0] !== "/") {
url = "/" + url;
}
return this._locationStrategy.prepareExternalUrl(url);
}
// TODO: rename this method to pushState
/**
* Changes the browser's URL to a normalized version of a given URL, and pushes a
* new item onto the platform's history.
*
* @param path URL path to normalize.
* @param query Query parameters.
* @param state Location history state.
*
*/
go(path, query = "", state = null) {
this._locationStrategy.pushState(state, "", path, query);
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
}
/**
* Changes the browser's URL to a normalized version of the given URL, and replaces
* the top item on the platform's history stack.
*
* @param path URL path to normalize.
* @param query Query parameters.
* @param state Location history state.
*/
replaceState(path, query = "", state = null) {
this._locationStrategy.replaceState(state, "", path, query);
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
}
/**
* Navigates forward in the platform's history.
*/
forward() {
this._locationStrategy.forward();
}
/**
* Navigates back in the platform's history.
*/
back() {
this._locationStrategy.back();
}
/**
* Navigate to a specific page from session history, identified by its relative position to the
* current page.
*
* @param relativePosition Position of the target page in the history relative to the current
* page.
* A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`
* moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go
* beyond what's stored in the history session, we stay in the current page. Same behaviour occurs
* when `relativePosition` equals 0.
* @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history
*/
historyGo(relativePosition = 0) {
this._locationStrategy.historyGo?.(relativePosition);
}
/**
* Registers a URL change listener. Use to catch updates performed by the Angular
* framework that are not detectible through "popstate" or "hashchange" events.
*
* @param fn The change handler function, which take a URL and a location history state.
* @returns A function that, when executed, unregisters a URL change listener.
*/
onUrlChange(fn) {
this._urlChangeListeners.push(fn);
this._urlChangeSubscription ??= this.subscribe((v) => {
this._notifyUrlChangeListeners(v.url, v.state);
});
return () => {
const fnIndex = this._urlChangeListeners.indexOf(fn);
this._urlChangeListeners.splice(fnIndex, 1);
if (this._urlChangeListeners.length === 0) {
this._urlChangeSubscription?.unsubscribe();
this._urlChangeSubscription = null;
}
};
}
/** @internal */
_notifyUrlChangeListeners(url = "", state) {
this._urlChangeListeners.forEach((fn) => fn(url, state));
}
/**
* Subscribes to the platform's `popState` events.
*
* Note: `Location.go()` does not trigger the `popState` event in the browser. Use
* `Location.onUrlChange()` to subscribe to URL changes instead.
*
* @param value Event that is triggered when the state history changes.
* @param exception The exception to throw.
*
* @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)
*
* @returns Subscribed events.
*/
subscribe(onNext, onThrow, onReturn) {
return this._subject.subscribe({
next: onNext,
error: onThrow ?? void 0,
complete: onReturn ?? void 0
});
}
/**
* Normalizes URL parameters by prepending with `?` if needed.
*
* @param params String of URL parameters.
*
* @returns The normalized URL parameters string.
*/
static normalizeQueryParams = normalizeQueryParams;
/**
* Joins two parts of a URL with a slash if needed.
*
* @param start URL string
* @param end URL string
*
*
* @returns The joined URL string.
*/
static joinWithSlash = joinWithSlash;
/**
* Removes a trailing slash from a URL string if needed.
* Looks for the first occurrence of either `#`, `?`, or the end of the
* line as `/` characters and removes the trailing slash if one exists.
*
* @param url URL string.
*
* @returns The URL string, modified if needed.
*/
static stripTrailingSlash = stripTrailingSlash;
static \u0275fac = function Location_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _Location)(\u0275\u0275inject(LocationStrategy));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _Location,
factory: () => createLocation(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Location, [{
type: Injectable,
args: [{
providedIn: "root",
// See #23917
useFactory: createLocation
}]
}], () => [{
type: LocationStrategy
}], null);
})();
function createLocation() {
return new Location(\u0275\u0275inject(LocationStrategy));
}
function _stripBasePath(basePath, url) {
if (!basePath || !url.startsWith(basePath)) {
return url;
}
const strippedUrl = url.substring(basePath.length);
if (strippedUrl === "" || ["/", ";", "?", "#"].includes(strippedUrl[0])) {
return strippedUrl;
}
return url;
}
function _stripIndexHtml(url) {
return url.replace(/\/index.html$/, "");
}
function _stripOrigin(baseHref) {
const isAbsoluteUrl2 = new RegExp("^(https?:)?//").test(baseHref);
if (isAbsoluteUrl2) {
const [, pathname] = baseHref.split(/\/\/[^\/]+/);
return pathname;
}
return baseHref;
}
// node_modules/@angular/common/fesm2022/common_module.mjs
var HashLocationStrategy = class _HashLocationStrategy extends LocationStrategy {
_platformLocation;
_baseHref = "";
_removeListenerFns = [];
constructor(_platformLocation, _baseHref) {
super();
this._platformLocation = _platformLocation;
if (_baseHref != null) {
this._baseHref = _baseHref;
}
}
/** @docs-private */
ngOnDestroy() {
while (this._removeListenerFns.length) {
this._removeListenerFns.pop()();
}
}
onPopState(fn) {
this._removeListenerFns.push(this._platformLocation.onPopState(fn), this._platformLocation.onHashChange(fn));
}
getBaseHref() {
return this._baseHref;
}
path(includeHash = false) {
const path = this._platformLocation.hash ?? "#";
return path.length > 0 ? path.substring(1) : path;
}
prepareExternalUrl(internal) {
const url = joinWithSlash(this._baseHref, internal);
return url.length > 0 ? "#" + url : url;
}
pushState(state, title, path, queryParams) {
const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
this._platformLocation.pushState(state, title, url);
}
replaceState(state, title, path, queryParams) {
const url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams)) || this._platformLocation.pathname;
this._platformLocation.replaceState(state, title, url);
}
forward() {
this._platformLocation.forward();
}
back() {
this._platformLocation.back();
}
getState() {
return this._platformLocation.getState();
}
historyGo(relativePosition = 0) {
this._platformLocation.historyGo?.(relativePosition);
}
static \u0275fac = function HashLocationStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HashLocationStrategy)(\u0275\u0275inject(PlatformLocation), \u0275\u0275inject(APP_BASE_HREF, 8));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HashLocationStrategy,
factory: _HashLocationStrategy.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HashLocationStrategy, [{
type: Injectable
}], () => [{
type: PlatformLocation
}, {
type: void 0,
decorators: [{
type: Optional
}, {
type: Inject,
args: [APP_BASE_HREF]
}]
}], null);
})();
var CURRENCIES_EN = {
"ADP": [void 0, void 0, 0],
"AFN": [void 0, "\u060B", 0],
"ALL": [void 0, void 0, 0],
"AMD": [void 0, "\u058F", 2],
"AOA": [void 0, "Kz"],
"ARS": [void 0, "$"],
"AUD": ["A$", "$"],
"AZN": [void 0, "\u20BC"],
"BAM": [void 0, "KM"],
"BBD": [void 0, "$"],
"BDT": [void 0, "\u09F3"],
"BHD": [void 0, void 0, 3],
"BIF": [void 0, void 0, 0],
"BMD": [void 0, "$"],
"BND": [void 0, "$"],
"BOB": [void 0, "Bs"],
"BRL": ["R$"],
"BSD": [void 0, "$"],
"BWP": [void 0, "P"],
"BYN": [void 0, void 0, 2],
"BYR": [void 0, void 0, 0],
"BZD": [void 0, "$"],
"CAD": ["CA$", "$", 2],
"CHF": [void 0, void 0, 2],
"CLF": [void 0, void 0, 4],
"CLP": [void 0, "$", 0],
"CNY": ["CN\xA5", "\xA5"],
"COP": [void 0, "$", 2],
"CRC": [void 0, "\u20A1", 2],
"CUC": [void 0, "$"],
"CUP": [void 0, "$"],
"CZK": [void 0, "K\u010D", 2],
"DJF": [void 0, void 0, 0],
"DKK": [void 0, "kr", 2],
"DOP": [void 0, "$"],
"EGP": [void 0, "E\xA3"],
"ESP": [void 0, "\u20A7", 0],
"EUR": ["\u20AC"],
"FJD": [void 0, "$"],
"FKP": [void 0, "\xA3"],
"GBP": ["\xA3"],
"GEL": [void 0, "\u20BE"],
"GHS": [void 0, "GH\u20B5"],
"GIP": [void 0, "\xA3"],
"GNF": [void 0, "FG", 0],
"GTQ": [void 0, "Q"],
"GYD": [void 0, "$", 2],
"HKD": ["HK$", "$"],
"HNL": [void 0, "L"],
"HRK": [void 0, "kn"],
"HUF": [void 0, "Ft", 2],
"IDR": [void 0, "Rp", 2],
"ILS": ["\u20AA"],
"INR": ["\u20B9"],
"IQD": [void 0, void 0, 0],
"IRR": [void 0, void 0, 0],
"ISK": [void 0, "kr", 0],
"ITL": [void 0, void 0, 0],
"JMD": [void 0, "$"],
"JOD": [void 0, void 0, 3],
"JPY": ["\xA5", void 0, 0],
"KHR": [void 0, "\u17DB"],
"KMF": [void 0, "CF", 0],
"KPW": [void 0, "\u20A9", 0],
"KRW": ["\u20A9", void 0, 0],
"KWD": [void 0, void 0, 3],
"KYD": [void 0, "$"],
"KZT": [void 0, "\u20B8"],
"LAK": [void 0, "\u20AD", 0],
"LBP": [void 0, "L\xA3", 0],
"LKR": [void 0, "Rs"],
"LRD": [void 0, "$"],
"LTL": [void 0, "Lt"],
"LUF": [void 0, void 0, 0],
"LVL": [void 0, "Ls"],
"LYD": [void 0, void 0, 3],
"MGA": [void 0, "Ar", 0],
"MGF": [void 0, void 0, 0],
"MMK": [void 0, "K", 0],
"MNT": [void 0, "\u20AE", 2],
"MRO": [void 0, void 0, 0],
"MUR": [void 0, "Rs", 2],
"MXN": ["MX$", "$"],
"MYR": [void 0, "RM"],
"NAD": [void 0, "$"],
"NGN": [void 0, "\u20A6"],
"NIO": [void 0, "C$"],
"NOK": [void 0, "kr", 2],
"NPR": [void 0, "Rs"],
"NZD": ["NZ$", "$"],
"OMR": [void 0, void 0, 3],
"PHP": ["\u20B1"],
"PKR": [void 0, "Rs", 2],
"PLN": [void 0, "z\u0142"],
"PYG": [void 0, "\u20B2", 0],
"RON": [void 0, "lei"],
"RSD": [void 0, void 0, 0],
"RUB": [void 0, "\u20BD"],
"RWF": [void 0, "RF", 0],
"SBD": [void 0, "$"],
"SEK": [void 0, "kr", 2],
"SGD": [void 0, "$"],
"SHP": [void 0, "\xA3"],
"SLE": [void 0, void 0, 2],
"SLL": [void 0, void 0, 0],
"SOS": [void 0, void 0, 0],
"SRD": [void 0, "$"],
"SSP": [void 0, "\xA3"],
"STD": [void 0, void 0, 0],
"STN": [void 0, "Db"],
"SYP": [void 0, "\xA3", 0],
"THB": [void 0, "\u0E3F"],
"TMM": [void 0, void 0, 0],
"TND": [void 0, void 0, 3],
"TOP": [void 0, "T$"],
"TRL": [void 0, void 0, 0],
"TRY": [void 0, "\u20BA"],
"TTD": [void 0, "$"],
"TWD": ["NT$", "$", 2],
"TZS": [void 0, void 0, 2],
"UAH": [void 0, "\u20B4"],
"UGX": [void 0, void 0, 0],
"USD": ["$"],
"UYI": [void 0, void 0, 0],
"UYU": [void 0, "$"],
"UYW": [void 0, void 0, 4],
"UZS": [void 0, void 0, 2],
"VEF": [void 0, "Bs", 2],
"VND": ["\u20AB", void 0, 0],
"VUV": [void 0, void 0, 0],
"XAF": ["FCFA", void 0, 0],
"XCD": ["EC$", "$"],
"XOF": ["F\u202FCFA", void 0, 0],
"XPF": ["CFPF", void 0, 0],
"XXX": ["\xA4"],
"YER": [void 0, void 0, 0],
"ZAR": [void 0, "R"],
"ZMK": [void 0, void 0, 0],
"ZMW": [void 0, "ZK"],
"ZWD": [void 0, void 0, 0]
};
var NumberFormatStyle;
(function(NumberFormatStyle2) {
NumberFormatStyle2[NumberFormatStyle2["Decimal"] = 0] = "Decimal";
NumberFormatStyle2[NumberFormatStyle2["Percent"] = 1] = "Percent";
NumberFormatStyle2[NumberFormatStyle2["Currency"] = 2] = "Currency";
NumberFormatStyle2[NumberFormatStyle2["Scientific"] = 3] = "Scientific";
})(NumberFormatStyle || (NumberFormatStyle = {}));
var Plural;
(function(Plural2) {
Plural2[Plural2["Zero"] = 0] = "Zero";
Plural2[Plural2["One"] = 1] = "One";
Plural2[Plural2["Two"] = 2] = "Two";
Plural2[Plural2["Few"] = 3] = "Few";
Plural2[Plural2["Many"] = 4] = "Many";
Plural2[Plural2["Other"] = 5] = "Other";
})(Plural || (Plural = {}));
var FormStyle;
(function(FormStyle2) {
FormStyle2[FormStyle2["Format"] = 0] = "Format";
FormStyle2[FormStyle2["Standalone"] = 1] = "Standalone";
})(FormStyle || (FormStyle = {}));
var TranslationWidth;
(function(TranslationWidth2) {
TranslationWidth2[TranslationWidth2["Narrow"] = 0] = "Narrow";
TranslationWidth2[TranslationWidth2["Abbreviated"] = 1] = "Abbreviated";
TranslationWidth2[TranslationWidth2["Wide"] = 2] = "Wide";
TranslationWidth2[TranslationWidth2["Short"] = 3] = "Short";
})(TranslationWidth || (TranslationWidth = {}));
var FormatWidth;
(function(FormatWidth2) {
FormatWidth2[FormatWidth2["Short"] = 0] = "Short";
FormatWidth2[FormatWidth2["Medium"] = 1] = "Medium";
FormatWidth2[FormatWidth2["Long"] = 2] = "Long";
FormatWidth2[FormatWidth2["Full"] = 3] = "Full";
})(FormatWidth || (FormatWidth = {}));
var NumberSymbol = {
/**
* Decimal separator.
* For `en-US`, the dot character.
* Example: 2,345`.`67
*/
Decimal: 0,
/**
* Grouping separator, typically for thousands.
* For `en-US`, the comma character.
* Example: 2`,`345.67
*/
Group: 1,
/**
* List-item separator.
* Example: "one, two, and three"
*/
List: 2,
/**
* Sign for percentage (out of 100).
* Example: 23.4%
*/
PercentSign: 3,
/**
* Sign for positive numbers.
* Example: +23
*/
PlusSign: 4,
/**
* Sign for negative numbers.
* Example: -23
*/
MinusSign: 5,
/**
* Computer notation for exponential value (n times a power of 10).
* Example: 1.2E3
*/
Exponential: 6,
/**
* Human-readable format of exponential.
* Example: 1.2x103
*/
SuperscriptingExponent: 7,
/**
* Sign for permille (out of 1000).
* Example: 23.4‰
*/
PerMille: 8,
/**
* Infinity, can be used with plus and minus.
* Example: ∞, +∞, -∞
*/
Infinity: 9,
/**
* Not a number.
* Example: NaN
*/
NaN: 10,
/**
* Symbol used between time units.
* Example: 10:52
*/
TimeSeparator: 11,
/**
* Decimal separator for currency values (fallback to `Decimal`).
* Example: $2,345.67
*/
CurrencyDecimal: 12,
/**
* Group separator for currency values (fallback to `Group`).
* Example: $2,345.67
*/
CurrencyGroup: 13
};
var WeekDay;
(function(WeekDay2) {
WeekDay2[WeekDay2["Sunday"] = 0] = "Sunday";
WeekDay2[WeekDay2["Monday"] = 1] = "Monday";
WeekDay2[WeekDay2["Tuesday"] = 2] = "Tuesday";
WeekDay2[WeekDay2["Wednesday"] = 3] = "Wednesday";
WeekDay2[WeekDay2["Thursday"] = 4] = "Thursday";
WeekDay2[WeekDay2["Friday"] = 5] = "Friday";
WeekDay2[WeekDay2["Saturday"] = 6] = "Saturday";
})(WeekDay || (WeekDay = {}));
function getLocaleId(locale) {
return findLocaleData(locale)[LocaleDataIndex.LocaleId];
}
function getLocaleDayPeriods(locale, formStyle, width) {
const data = findLocaleData(locale);
const amPmData = [data[LocaleDataIndex.DayPeriodsFormat], data[LocaleDataIndex.DayPeriodsStandalone]];
const amPm = getLastDefinedValue(amPmData, formStyle);
return getLastDefinedValue(amPm, width);
}
function getLocaleDayNames(locale, formStyle, width) {
const data = findLocaleData(locale);
const daysData = [data[LocaleDataIndex.DaysFormat], data[LocaleDataIndex.DaysStandalone]];
const days = getLastDefinedValue(daysData, formStyle);
return getLastDefinedValue(days, width);
}
function getLocaleMonthNames(locale, formStyle, width) {
const data = findLocaleData(locale);
const monthsData = [data[LocaleDataIndex.MonthsFormat], data[LocaleDataIndex.MonthsStandalone]];
const months = getLastDefinedValue(monthsData, formStyle);
return getLastDefinedValue(months, width);
}
function getLocaleEraNames(locale, width) {
const data = findLocaleData(locale);
const erasData = data[LocaleDataIndex.Eras];
return getLastDefinedValue(erasData, width);
}
function getLocaleDateFormat(locale, width) {
const data = findLocaleData(locale);
return getLastDefinedValue(data[LocaleDataIndex.DateFormat], width);
}
function getLocaleTimeFormat(locale, width) {
const data = findLocaleData(locale);
return getLastDefinedValue(data[LocaleDataIndex.TimeFormat], width);
}
function getLocaleDateTimeFormat(locale, width) {
const data = findLocaleData(locale);
const dateTimeFormatData = data[LocaleDataIndex.DateTimeFormat];
return getLastDefinedValue(dateTimeFormatData, width);
}
function getLocaleNumberSymbol(locale, symbol) {
const data = findLocaleData(locale);
const res = data[LocaleDataIndex.NumberSymbols][symbol];
if (typeof res === "undefined") {
if (symbol === NumberSymbol.CurrencyDecimal) {
return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Decimal];
} else if (symbol === NumberSymbol.CurrencyGroup) {
return data[LocaleDataIndex.NumberSymbols][NumberSymbol.Group];
}
}
return res;
}
function getLocaleNumberFormat(locale, type) {
const data = findLocaleData(locale);
return data[LocaleDataIndex.NumberFormats][type];
}
function getLocaleCurrencies(locale) {
const data = findLocaleData(locale);
return data[LocaleDataIndex.Currencies];
}
var getLocalePluralCase2 = getLocalePluralCase;
function checkFullData(data) {
if (!data[LocaleDataIndex.ExtraData]) {
throw new RuntimeError(2303, ngDevMode && `Missing extra locale data for the locale "${data[LocaleDataIndex.LocaleId]}". Use "registerLocaleData" to load new data. See the "I18n guide" on angular.io to know more.`);
}
}
function getLocaleExtraDayPeriodRules(locale) {
const data = findLocaleData(locale);
checkFullData(data);
const rules = data[LocaleDataIndex.ExtraData][
2
/* ɵExtraLocaleDataIndex.ExtraDayPeriodsRules */
] || [];
return rules.map((rule) => {
if (typeof rule === "string") {
return extractTime(rule);
}
return [extractTime(rule[0]), extractTime(rule[1])];
});
}
function getLocaleExtraDayPeriods(locale, formStyle, width) {
const data = findLocaleData(locale);
checkFullData(data);
const dayPeriodsData = [data[LocaleDataIndex.ExtraData][
0
/* ɵExtraLocaleDataIndex.ExtraDayPeriodFormats */
], data[LocaleDataIndex.ExtraData][
1
/* ɵExtraLocaleDataIndex.ExtraDayPeriodStandalone */
]];
const dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
return getLastDefinedValue(dayPeriods, width) || [];
}
function getLastDefinedValue(data, index) {
for (let i = index; i > -1; i--) {
if (typeof data[i] !== "undefined") {
return data[i];
}
}
throw new RuntimeError(2304, ngDevMode && "Locale data API: locale data undefined");
}
function extractTime(time) {
const [h, m] = time.split(":");
return {
hours: +h,
minutes: +m
};
}
function getCurrencySymbol(code, format, locale = "en") {
const currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
const symbolNarrow = currency[
1
/* ɵCurrencyIndex.SymbolNarrow */
];
if (format === "narrow" && typeof symbolNarrow === "string") {
return symbolNarrow;
}
return currency[
0
/* ɵCurrencyIndex.Symbol */
] || code;
}
var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
function getNumberOfCurrencyDigits(code) {
let digits;
const currency = CURRENCIES_EN[code];
if (currency) {
digits = currency[
2
/* ɵCurrencyIndex.NbOfDigits */
];
}
return typeof digits === "number" ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
}
var ISO8601_DATE_REGEX = /^(\d{4,})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
var NAMED_FORMATS = {};
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]*)/;
function formatDate(value, format, locale, timezone) {
let date = toDate(value);
const namedFormat = getNamedFormat(locale, format);
format = namedFormat || format;
let parts = [];
let match2;
while (format) {
match2 = DATE_FORMATS_SPLIT.exec(format);
if (match2) {
parts = parts.concat(match2.slice(1));
const part = parts.pop();
if (!part) {
break;
}
format = part;
} else {
parts.push(format);
break;
}
}
if (typeof ngDevMode === "undefined" || ngDevMode) {
assertValidDateFormat(parts);
}
let dateTimezoneOffset = date.getTimezoneOffset();
if (timezone) {
dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
date = convertTimezoneToLocal(date, timezone);
}
let text = "";
parts.forEach((value2) => {
const dateFormatter = getDateFormatter(value2);
text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value2 === "''" ? "'" : value2.replace(/(^'|'$)/g, "").replace(/''/g, "'");
});
return text;
}
function assertValidDateFormat(parts) {
if (parts.some((part) => /^Y+$/.test(part)) && !parts.some((part) => /^w+$/.test(part))) {
const message = `Suspicious use of week-based year "Y" in date pattern "${parts.join("")}". Did you mean to use calendar year "y" instead?`;
if (parts.length === 1) {
console.error(formatRuntimeError(2300, message));
} else {
throw new RuntimeError(2300, message);
}
}
}
function createDate(year, month, date) {
const newDate = /* @__PURE__ */ new Date(0);
newDate.setFullYear(year, month, date);
newDate.setHours(0, 0, 0);
return newDate;
}
function getNamedFormat(locale, format) {
const localeId = getLocaleId(locale);
NAMED_FORMATS[localeId] ??= {};
if (NAMED_FORMATS[localeId][format]) {
return NAMED_FORMATS[localeId][format];
}
let formatValue = "";
switch (format) {
case "shortDate":
formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
break;
case "mediumDate":
formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
break;
case "longDate":
formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
break;
case "fullDate":
formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
break;
case "shortTime":
formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
break;
case "mediumTime":
formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
break;
case "longTime":
formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
break;
case "fullTime":
formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
break;
case "short":
const shortTime = getNamedFormat(locale, "shortTime");
const shortDate = getNamedFormat(locale, "shortDate");
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
break;
case "medium":
const mediumTime = getNamedFormat(locale, "mediumTime");
const mediumDate = getNamedFormat(locale, "mediumDate");
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
break;
case "long":
const longTime = getNamedFormat(locale, "longTime");
const longDate = getNamedFormat(locale, "longDate");
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
break;
case "full":
const fullTime = getNamedFormat(locale, "fullTime");
const fullDate = getNamedFormat(locale, "fullDate");
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
break;
}
if (formatValue) {
NAMED_FORMATS[localeId][format] = formatValue;
}
return formatValue;
}
function formatDateTime(str, opt_values) {
if (opt_values) {
str = str.replace(/\{([^}]+)}/g, function(match2, key) {
return opt_values != null && key in opt_values ? opt_values[key] : match2;
});
}
return str;
}
function padNumber(num, digits, minusSign = "-", trim, negWrap) {
let neg = "";
if (num < 0 || negWrap && num <= 0) {
if (negWrap) {
num = -num + 1;
} else {
num = -num;
neg = minusSign;
}
}
let strNum = String(num);
while (strNum.length < digits) {
strNum = "0" + strNum;
}
if (trim) {
strNum = strNum.slice(strNum.length - digits);
}
return neg + strNum;
}
function formatFractionalSeconds(milliseconds, digits) {
const strMs = padNumber(milliseconds, 3);
return strMs.substring(0, digits);
}
function dateGetter(name2, size, offset = 0, trim = false, negWrap = false) {
return function(date, locale) {
let part = getDatePart(name2, date);
if (offset > 0 || part > -offset) {
part += offset;
}
if (name2 === 3) {
if (part === 0 && offset === -12) {
part = 12;
}
} else if (name2 === 6) {
return formatFractionalSeconds(part, size);
}
const localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
return padNumber(part, size, localeMinus, trim, negWrap);
};
}
function getDatePart(part, date) {
switch (part) {
case 0:
return date.getFullYear();
case 1:
return date.getMonth();
case 2:
return date.getDate();
case 3:
return date.getHours();
case 4:
return date.getMinutes();
case 5:
return date.getSeconds();
case 6:
return date.getMilliseconds();
case 7:
return date.getDay();
default:
throw new RuntimeError(2301, ngDevMode && `Unknown DateType value "${part}".`);
}
}
function dateStrGetter(name2, width, form = FormStyle.Format, extended = false) {
return function(date, locale) {
return getDateTranslation(date, locale, name2, width, form, extended);
};
}
function getDateTranslation(date, locale, name2, width, form, extended) {
switch (name2) {
case 2:
return getLocaleMonthNames(locale, form, width)[date.getMonth()];
case 1:
return getLocaleDayNames(locale, form, width)[date.getDay()];
case 0:
const currentHours = date.getHours();
const currentMinutes = date.getMinutes();
if (extended) {
const rules = getLocaleExtraDayPeriodRules(locale);
const dayPeriods = getLocaleExtraDayPeriods(locale, form, width);
const index = rules.findIndex((rule) => {
if (Array.isArray(rule)) {
const [from2, to] = rule;
const afterFrom = currentHours >= from2.hours && currentMinutes >= from2.minutes;
const beforeTo = currentHours < to.hours || currentHours === to.hours && currentMinutes < to.minutes;
if (from2.hours < to.hours) {
if (afterFrom && beforeTo) {
return true;
}
} else if (afterFrom || beforeTo) {
return true;
}
} else {
if (rule.hours === currentHours && rule.minutes === currentMinutes) {
return true;
}
}
return false;
});
if (index !== -1) {
return dayPeriods[index];
}
}
return getLocaleDayPeriods(locale, form, width)[currentHours < 12 ? 0 : 1];
case 3:
return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
default:
const unexpected = name2;
throw new RuntimeError(2302, ngDevMode && `unexpected translation type ${unexpected}`);
}
}
function timeZoneGetter(width) {
return function(date, locale, offset) {
const zone = -1 * offset;
const minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
const hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
switch (width) {
case 0:
return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign);
case 1:
return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 1, minusSign);
case 2:
return "GMT" + (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
case 3:
if (offset === 0) {
return "Z";
} else {
return (zone >= 0 ? "+" : "") + padNumber(hours, 2, minusSign) + ":" + padNumber(Math.abs(zone % 60), 2, minusSign);
}
default:
throw new RuntimeError(2310, ngDevMode && `Unknown zone width "${width}"`);
}
};
}
var JANUARY = 0;
var THURSDAY = 4;
function getFirstThursdayOfYear(year) {
const firstDayOfYear = createDate(year, JANUARY, 1).getDay();
return createDate(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
}
function getThursdayThisIsoWeek(datetime) {
const currentDay = datetime.getDay();
const deltaToThursday = currentDay === 0 ? -3 : THURSDAY - currentDay;
return createDate(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + deltaToThursday);
}
function weekGetter(size, monthBased = false) {
return function(date, locale) {
let result;
if (monthBased) {
const nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
const today = date.getDate();
result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
} else {
const thisThurs = getThursdayThisIsoWeek(date);
const firstThurs = getFirstThursdayOfYear(thisThurs.getFullYear());
const diff = thisThurs.getTime() - firstThurs.getTime();
result = 1 + Math.round(diff / 6048e5);
}
return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
};
}
function weekNumberingYearGetter(size, trim = false) {
return function(date, locale) {
const thisThurs = getThursdayThisIsoWeek(date);
const weekNumberingYear = thisThurs.getFullYear();
return padNumber(weekNumberingYear, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim);
};
}
var DATE_FORMATS = {};
function getDateFormatter(format) {
if (DATE_FORMATS[format]) {
return DATE_FORMATS[format];
}
let formatter;
switch (format) {
// Era name (AD/BC)
case "G":
case "GG":
case "GGG":
formatter = dateStrGetter(3, TranslationWidth.Abbreviated);
break;
case "GGGG":
formatter = dateStrGetter(3, TranslationWidth.Wide);
break;
case "GGGGG":
formatter = dateStrGetter(3, TranslationWidth.Narrow);
break;
// 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
case "y":
formatter = dateGetter(0, 1, 0, false, true);
break;
// 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
case "yy":
formatter = dateGetter(0, 2, 0, true, true);
break;
// 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
case "yyy":
formatter = dateGetter(0, 3, 0, false, true);
break;
// 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
case "yyyy":
formatter = dateGetter(0, 4, 0, false, true);
break;
// 1 digit representation of the week-numbering year, e.g. (AD 1 => 1, AD 199 => 199)
case "Y":
formatter = weekNumberingYearGetter(1);
break;
// 2 digit representation of the week-numbering year, padded (00-99). (e.g. AD 2001 => 01, AD
// 2010 => 10)
case "YY":
formatter = weekNumberingYearGetter(2, true);
break;
// 3 digit representation of the week-numbering year, padded (000-999). (e.g. AD 1 => 001, AD
// 2010 => 2010)
case "YYY":
formatter = weekNumberingYearGetter(3);
break;
// 4 digit representation of the week-numbering year (e.g. AD 1 => 0001, AD 2010 => 2010)
case "YYYY":
formatter = weekNumberingYearGetter(4);
break;
// Month of the year (1-12), numeric
case "M":
case "L":
formatter = dateGetter(1, 1, 1);
break;
case "MM":
case "LL":
formatter = dateGetter(1, 2, 1);
break;
// Month of the year (January, ...), string, format
case "MMM":
formatter = dateStrGetter(2, TranslationWidth.Abbreviated);
break;
case "MMMM":
formatter = dateStrGetter(2, TranslationWidth.Wide);
break;
case "MMMMM":
formatter = dateStrGetter(2, TranslationWidth.Narrow);
break;
// Month of the year (January, ...), string, standalone
case "LLL":
formatter = dateStrGetter(2, TranslationWidth.Abbreviated, FormStyle.Standalone);
break;
case "LLLL":
formatter = dateStrGetter(2, TranslationWidth.Wide, FormStyle.Standalone);
break;
case "LLLLL":
formatter = dateStrGetter(2, TranslationWidth.Narrow, FormStyle.Standalone);
break;
// Week of the year (1, ... 52)
case "w":
formatter = weekGetter(1);
break;
case "ww":
formatter = weekGetter(2);
break;
// Week of the month (1, ...)
case "W":
formatter = weekGetter(1, true);
break;
// Day of the month (1-31)
case "d":
formatter = dateGetter(2, 1);
break;
case "dd":
formatter = dateGetter(2, 2);
break;
// Day of the Week StandAlone (1, 1, Mon, Monday, M, Mo)
case "c":
case "cc":
formatter = dateGetter(7, 1);
break;
case "ccc":
formatter = dateStrGetter(1, TranslationWidth.Abbreviated, FormStyle.Standalone);
break;
case "cccc":
formatter = dateStrGetter(1, TranslationWidth.Wide, FormStyle.Standalone);
break;
case "ccccc":
formatter = dateStrGetter(1, TranslationWidth.Narrow, FormStyle.Standalone);
break;
case "cccccc":
formatter = dateStrGetter(1, TranslationWidth.Short, FormStyle.Standalone);
break;
// Day of the Week
case "E":
case "EE":
case "EEE":
formatter = dateStrGetter(1, TranslationWidth.Abbreviated);
break;
case "EEEE":
formatter = dateStrGetter(1, TranslationWidth.Wide);
break;
case "EEEEE":
formatter = dateStrGetter(1, TranslationWidth.Narrow);
break;
case "EEEEEE":
formatter = dateStrGetter(1, TranslationWidth.Short);
break;
// Generic period of the day (am-pm)
case "a":
case "aa":
case "aaa":
formatter = dateStrGetter(0, TranslationWidth.Abbreviated);
break;
case "aaaa":
formatter = dateStrGetter(0, TranslationWidth.Wide);
break;
case "aaaaa":
formatter = dateStrGetter(0, TranslationWidth.Narrow);
break;
// Extended period of the day (midnight, at night, ...), standalone
case "b":
case "bb":
case "bbb":
formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
break;
case "bbbb":
formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Standalone, true);
break;
case "bbbbb":
formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Standalone, true);
break;
// Extended period of the day (midnight, night, ...), standalone
case "B":
case "BB":
case "BBB":
formatter = dateStrGetter(0, TranslationWidth.Abbreviated, FormStyle.Format, true);
break;
case "BBBB":
formatter = dateStrGetter(0, TranslationWidth.Wide, FormStyle.Format, true);
break;
case "BBBBB":
formatter = dateStrGetter(0, TranslationWidth.Narrow, FormStyle.Format, true);
break;
// Hour in AM/PM, (1-12)
case "h":
formatter = dateGetter(3, 1, -12);
break;
case "hh":
formatter = dateGetter(3, 2, -12);
break;
// Hour of the day (0-23)
case "H":
formatter = dateGetter(3, 1);
break;
// Hour in day, padded (00-23)
case "HH":
formatter = dateGetter(3, 2);
break;
// Minute of the hour (0-59)
case "m":
formatter = dateGetter(4, 1);
break;
case "mm":
formatter = dateGetter(4, 2);
break;
// Second of the minute (0-59)
case "s":
formatter = dateGetter(5, 1);
break;
case "ss":
formatter = dateGetter(5, 2);
break;
// Fractional second
case "S":
formatter = dateGetter(6, 1);
break;
case "SS":
formatter = dateGetter(6, 2);
break;
case "SSS":
formatter = dateGetter(6, 3);
break;
// Timezone ISO8601 short format (-0430)
case "Z":
case "ZZ":
case "ZZZ":
formatter = timeZoneGetter(
0
/* ZoneWidth.Short */
);
break;
// Timezone ISO8601 extended format (-04:30)
case "ZZZZZ":
formatter = timeZoneGetter(
3
/* ZoneWidth.Extended */
);
break;
// Timezone GMT short format (GMT+4)
case "O":
case "OO":
case "OOO":
// Should be location, but fallback to format O instead because we don't have the data yet
case "z":
case "zz":
case "zzz":
formatter = timeZoneGetter(
1
/* ZoneWidth.ShortGMT */
);
break;
// Timezone GMT long format (GMT+0430)
case "OOOO":
case "ZZZZ":
// Should be location, but fallback to format O instead because we don't have the data yet
case "zzzz":
formatter = timeZoneGetter(
2
/* ZoneWidth.Long */
);
break;
default:
return null;
}
DATE_FORMATS[format] = formatter;
return formatter;
}
function timezoneToOffset(timezone, fallback) {
timezone = timezone.replace(/:/g, "");
const requestedTimezoneOffset = Date.parse("Jan 01, 1970 00:00:00 " + timezone) / 6e4;
return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
function addDateMinutes(date, minutes) {
date = new Date(date.getTime());
date.setMinutes(date.getMinutes() + minutes);
return date;
}
function convertTimezoneToLocal(date, timezone, reverse) {
const reverseValue = -1;
const dateTimezoneOffset = date.getTimezoneOffset();
const timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
}
function toDate(value) {
if (isDate(value)) {
return value;
}
if (typeof value === "number" && !isNaN(value)) {
return new Date(value);
}
if (typeof value === "string") {
value = value.trim();
if (/^(\d{4}(-\d{1,2}(-\d{1,2})?)?)$/.test(value)) {
const [y, m = 1, d = 1] = value.split("-").map((val) => +val);
return createDate(y, m - 1, d);
}
const parsedNb = parseFloat(value);
if (!isNaN(value - parsedNb)) {
return new Date(parsedNb);
}
let match2;
if (match2 = value.match(ISO8601_DATE_REGEX)) {
return isoStringToDate(match2);
}
}
const date = new Date(value);
if (!isDate(date)) {
throw new RuntimeError(2311, ngDevMode && `Unable to convert "${value}" into a date`);
}
return date;
}
function isoStringToDate(match2) {
const date = /* @__PURE__ */ new Date(0);
let tzHour = 0;
let tzMin = 0;
const dateSetter = match2[8] ? date.setUTCFullYear : date.setFullYear;
const timeSetter = match2[8] ? date.setUTCHours : date.setHours;
if (match2[9]) {
tzHour = Number(match2[9] + match2[10]);
tzMin = Number(match2[9] + match2[11]);
}
dateSetter.call(date, Number(match2[1]), Number(match2[2]) - 1, Number(match2[3]));
const h = Number(match2[4] || 0) - tzHour;
const m = Number(match2[5] || 0) - tzMin;
const s = Number(match2[6] || 0);
const ms = Math.floor(parseFloat("0." + (match2[7] || 0)) * 1e3);
timeSetter.call(date, h, m, s, ms);
return date;
}
function isDate(value) {
return value instanceof Date && !isNaN(value.valueOf());
}
var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
var MAX_DIGITS = 22;
var DECIMAL_SEP = ".";
var ZERO_CHAR = "0";
var PATTERN_SEP = ";";
var GROUP_SEP = ",";
var DIGIT_CHAR = "#";
var CURRENCY_CHAR = "\xA4";
var PERCENT_CHAR = "%";
function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent = false) {
let formattedText = "";
let isZero = false;
if (!isFinite(value)) {
formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
} else {
let parsedNumber = parseNumber(value);
if (isPercent) {
parsedNumber = toPercent(parsedNumber);
}
let minInt = pattern.minInt;
let minFraction = pattern.minFrac;
let maxFraction = pattern.maxFrac;
if (digitsInfo) {
const parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
if (parts === null) {
throw new RuntimeError(2306, ngDevMode && `${digitsInfo} is not a valid digit info`);
}
const minIntPart = parts[1];
const minFractionPart = parts[3];
const maxFractionPart = parts[5];
if (minIntPart != null) {
minInt = parseIntAutoRadix(minIntPart);
}
if (minFractionPart != null) {
minFraction = parseIntAutoRadix(minFractionPart);
}
if (maxFractionPart != null) {
maxFraction = parseIntAutoRadix(maxFractionPart);
} else if (minFractionPart != null && minFraction > maxFraction) {
maxFraction = minFraction;
}
}
roundNumber(parsedNumber, minFraction, maxFraction);
let digits = parsedNumber.digits;
let integerLen = parsedNumber.integerLen;
const exponent = parsedNumber.exponent;
let decimals = [];
isZero = digits.every((d) => !d);
for (; integerLen < minInt; integerLen++) {
digits.unshift(0);
}
for (; integerLen < 0; integerLen++) {
digits.unshift(0);
}
if (integerLen > 0) {
decimals = digits.splice(integerLen, digits.length);
} else {
decimals = digits;
digits = [0];
}
const groups = [];
if (digits.length >= pattern.lgSize) {
groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(""));
}
while (digits.length > pattern.gSize) {
groups.unshift(digits.splice(-pattern.gSize, digits.length).join(""));
}
if (digits.length) {
groups.unshift(digits.join(""));
}
formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
if (decimals.length) {
formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join("");
}
if (exponent) {
formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + "+" + exponent;
}
}
if (value < 0 && !isZero) {
formattedText = pattern.negPre + formattedText + pattern.negSuf;
} else {
formattedText = pattern.posPre + formattedText + pattern.posSuf;
}
return formattedText;
}
function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
const format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
pattern.maxFrac = pattern.minFrac;
const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
return res.replace(CURRENCY_CHAR, currency).replace(CURRENCY_CHAR, "").trim();
}
function formatPercent(value, locale, digitsInfo) {
const format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
const res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
return res.replace(new RegExp(PERCENT_CHAR, "g"), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
}
function formatNumber(value, locale, digitsInfo) {
const format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
const pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
}
function parseNumberFormat(format, minusSign = "-") {
const p = {
minInt: 1,
minFrac: 0,
maxFrac: 0,
posPre: "",
posSuf: "",
negPre: "",
negSuf: "",
gSize: 0,
lgSize: 0
};
const patternParts = format.split(PATTERN_SEP);
const positive = patternParts[0];
const negative = patternParts[1];
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] || "";
p.posPre = integer.substring(0, integer.indexOf(DIGIT_CHAR));
for (let i = 0; i < fraction.length; i++) {
const ch = fraction.charAt(i);
if (ch === ZERO_CHAR) {
p.minFrac = p.maxFrac = i + 1;
} else if (ch === DIGIT_CHAR) {
p.maxFrac = i + 1;
} else {
p.posSuf += ch;
}
}
const groups = integer.split(GROUP_SEP);
p.gSize = groups[1] ? groups[1].length : 0;
p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0;
if (negative) {
const trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
p.negPre = negative.substring(0, pos).replace(/'/g, "");
p.negSuf = negative.slice(pos + trunkLen).replace(/'/g, "");
} else {
p.negPre = minusSign + p.posPre;
p.negSuf = p.posSuf;
}
return p;
}
function toPercent(parsedNumber) {
if (parsedNumber.digits[0] === 0) {
return parsedNumber;
}
const fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
if (parsedNumber.exponent) {
parsedNumber.exponent += 2;
} else {
if (fractionLen === 0) {
parsedNumber.digits.push(0, 0);
} else if (fractionLen === 1) {
parsedNumber.digits.push(0);
}
parsedNumber.integerLen += 2;
}
return parsedNumber;
}
function parseNumber(num) {
let numStr = Math.abs(num) + "";
let exponent = 0, digits, integerLen;
let i, j, zeros;
if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
numStr = numStr.replace(DECIMAL_SEP, "");
}
if ((i = numStr.search(/e/i)) > 0) {
if (integerLen < 0) integerLen = i;
integerLen += +numStr.slice(i + 1);
numStr = numStr.substring(0, i);
} else if (integerLen < 0) {
integerLen = numStr.length;
}
for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
}
if (i === (zeros = numStr.length)) {
digits = [0];
integerLen = 1;
} else {
zeros--;
while (numStr.charAt(zeros) === ZERO_CHAR) zeros--;
integerLen -= i;
digits = [];
for (j = 0; i <= zeros; i++, j++) {
digits[j] = Number(numStr.charAt(i));
}
}
if (integerLen > MAX_DIGITS) {
digits = digits.splice(0, MAX_DIGITS - 1);
exponent = integerLen - 1;
integerLen = 1;
}
return {
digits,
exponent,
integerLen
};
}
function roundNumber(parsedNumber, minFrac, maxFrac) {
if (minFrac > maxFrac) {
throw new RuntimeError(2307, ngDevMode && `The minimum number of digits after fraction (${minFrac}) is higher than the maximum (${maxFrac}).`);
}
let digits = parsedNumber.digits;
let fractionLen = digits.length - parsedNumber.integerLen;
const fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
let roundAt = fractionSize + parsedNumber.integerLen;
let digit = digits[roundAt];
if (roundAt > 0) {
digits.splice(Math.max(parsedNumber.integerLen, roundAt));
for (let j = roundAt; j < digits.length; j++) {
digits[j] = 0;
}
} else {
fractionLen = Math.max(0, fractionLen);
parsedNumber.integerLen = 1;
digits.length = Math.max(1, roundAt = fractionSize + 1);
digits[0] = 0;
for (let i = 1; i < roundAt; i++) digits[i] = 0;
}
if (digit >= 5) {
if (roundAt - 1 < 0) {
for (let k = 0; k > roundAt; k--) {
digits.unshift(0);
parsedNumber.integerLen++;
}
digits.unshift(1);
parsedNumber.integerLen++;
} else {
digits[roundAt - 1]++;
}
}
for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
let dropTrailingZeros = fractionSize !== 0;
const minLen = minFrac + parsedNumber.integerLen;
const carry = digits.reduceRight(function(carry2, d, i, digits2) {
d = d + carry2;
digits2[i] = d < 10 ? d : d - 10;
if (dropTrailingZeros) {
if (digits2[i] === 0 && i >= minLen) {
digits2.pop();
} else {
dropTrailingZeros = false;
}
}
return d >= 10 ? 1 : 0;
}, 0);
if (carry) {
digits.unshift(carry);
parsedNumber.integerLen++;
}
}
function parseIntAutoRadix(text) {
const result = parseInt(text);
if (isNaN(result)) {
throw new RuntimeError(2305, ngDevMode && "Invalid integer literal when parsing " + text);
}
return result;
}
var NgLocalization = class _NgLocalization {
static \u0275fac = function NgLocalization_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgLocalization)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NgLocalization,
factory: function NgLocalization_Factory(__ngFactoryType__) {
let __ngConditionalFactory__ = null;
if (__ngFactoryType__) {
__ngConditionalFactory__ = new __ngFactoryType__();
} else {
__ngConditionalFactory__ = ((locale) => new NgLocaleLocalization(locale))(\u0275\u0275inject(LOCALE_ID));
}
return __ngConditionalFactory__;
},
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocalization, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: (locale) => new NgLocaleLocalization(locale),
deps: [LOCALE_ID]
}]
}], null, null);
})();
function getPluralCategory(value, cases, ngLocalization, locale) {
let key = `=${value}`;
if (cases.indexOf(key) > -1) {
return key;
}
key = ngLocalization.getPluralCategory(value, locale);
if (cases.indexOf(key) > -1) {
return key;
}
if (cases.indexOf("other") > -1) {
return "other";
}
throw new RuntimeError(2308, ngDevMode && `No plural message found for value "${value}"`);
}
var NgLocaleLocalization = class _NgLocaleLocalization extends NgLocalization {
locale;
constructor(locale) {
super();
this.locale = locale;
}
getPluralCategory(value, locale) {
const plural = getLocalePluralCase2(locale || this.locale)(value);
switch (plural) {
case Plural.Zero:
return "zero";
case Plural.One:
return "one";
case Plural.Two:
return "two";
case Plural.Few:
return "few";
case Plural.Many:
return "many";
default:
return "other";
}
}
static \u0275fac = function NgLocaleLocalization_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgLocaleLocalization)(\u0275\u0275inject(LOCALE_ID));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NgLocaleLocalization,
factory: _NgLocaleLocalization.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgLocaleLocalization, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [LOCALE_ID]
}]
}], null);
})();
var WS_REGEXP = /\s+/;
var EMPTY_ARRAY = [];
var NgClass = class _NgClass {
_ngEl;
_renderer;
initialClasses = EMPTY_ARRAY;
rawClass;
stateMap = /* @__PURE__ */ new Map();
constructor(_ngEl, _renderer) {
this._ngEl = _ngEl;
this._renderer = _renderer;
}
set klass(value) {
this.initialClasses = value != null ? value.trim().split(WS_REGEXP) : EMPTY_ARRAY;
}
set ngClass(value) {
this.rawClass = typeof value === "string" ? value.trim().split(WS_REGEXP) : value;
}
/*
The NgClass directive uses the custom change detection algorithm for its inputs. The custom
algorithm is necessary since inputs are represented as complex object or arrays that need to be
deeply-compared.
This algorithm is perf-sensitive since NgClass is used very frequently and its poor performance
might negatively impact runtime performance of the entire change detection cycle. The design of
this algorithm is making sure that:
- there is no unnecessary DOM manipulation (CSS classes are added / removed from the DOM only when
needed), even if references to bound objects change;
- there is no memory allocation if nothing changes (even relatively modest memory allocation
during the change detection cycle can result in GC pauses for some of the CD cycles).
The algorithm works by iterating over the set of bound classes, staring with [class] binding and
then going over [ngClass] binding. For each CSS class name:
- check if it was seen before (this information is tracked in the state map) and if its value
changed;
- mark it as "touched" - names that are not marked are not present in the latest set of binding
and we can remove such class name from the internal data structures;
After iteration over all the CSS class names we've got data structure with all the information
necessary to synchronize changes to the DOM - it is enough to iterate over the state map, flush
changes to the DOM and reset internal data structures so those are ready for the next change
detection cycle.
*/
ngDoCheck() {
for (const klass of this.initialClasses) {
this._updateState(klass, true);
}
const rawClass = this.rawClass;
if (Array.isArray(rawClass) || rawClass instanceof Set) {
for (const klass of rawClass) {
this._updateState(klass, true);
}
} else if (rawClass != null) {
for (const klass of Object.keys(rawClass)) {
this._updateState(klass, Boolean(rawClass[klass]));
}
}
this._applyStateDiff();
}
_updateState(klass, nextEnabled) {
const state = this.stateMap.get(klass);
if (state !== void 0) {
if (state.enabled !== nextEnabled) {
state.changed = true;
state.enabled = nextEnabled;
}
state.touched = true;
} else {
this.stateMap.set(klass, {
enabled: nextEnabled,
changed: true,
touched: true
});
}
}
_applyStateDiff() {
for (const stateEntry of this.stateMap) {
const klass = stateEntry[0];
const state = stateEntry[1];
if (state.changed) {
this._toggleClass(klass, state.enabled);
state.changed = false;
} else if (!state.touched) {
if (state.enabled) {
this._toggleClass(klass, false);
}
this.stateMap.delete(klass);
}
state.touched = false;
}
}
_toggleClass(klass, enabled) {
if (ngDevMode) {
if (typeof klass !== "string") {
throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${stringify(klass)}`);
}
}
klass = klass.trim();
if (klass.length > 0) {
klass.split(WS_REGEXP).forEach((klass2) => {
if (enabled) {
this._renderer.addClass(this._ngEl.nativeElement, klass2);
} else {
this._renderer.removeClass(this._ngEl.nativeElement, klass2);
}
});
}
}
static \u0275fac = function NgClass_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgClass)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgClass,
selectors: [["", "ngClass", ""]],
inputs: {
klass: [0, "class", "klass"],
ngClass: "ngClass"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgClass, [{
type: Directive,
args: [{
selector: "[ngClass]"
}]
}], () => [{
type: ElementRef
}, {
type: Renderer2
}], {
klass: [{
type: Input,
args: ["class"]
}],
ngClass: [{
type: Input,
args: ["ngClass"]
}]
});
})();
var NgComponentOutlet = class _NgComponentOutlet {
_viewContainerRef;
// TODO(crisbeto): this should be `Type<T>`, but doing so broke a few
// targets in a TGP so we need to do it in a major version.
/** Component that should be rendered in the outlet. */
ngComponentOutlet = null;
ngComponentOutletInputs;
ngComponentOutletInjector;
ngComponentOutletEnvironmentInjector;
ngComponentOutletContent;
ngComponentOutletNgModule;
/**
* @deprecated This input is deprecated, use `ngComponentOutletNgModule` instead.
*/
ngComponentOutletNgModuleFactory;
_componentRef;
_moduleRef;
/**
* A helper data structure that allows us to track inputs that were part of the
* ngComponentOutletInputs expression. Tracking inputs is necessary for proper removal of ones
* that are no longer referenced.
*/
_inputsUsed = /* @__PURE__ */ new Map();
/**
* Gets the instance of the currently-rendered component.
* Will be null if no component has been rendered.
*/
get componentInstance() {
return this._componentRef?.instance ?? null;
}
constructor(_viewContainerRef) {
this._viewContainerRef = _viewContainerRef;
}
_needToReCreateNgModuleInstance(changes) {
return changes["ngComponentOutletNgModule"] !== void 0 || changes["ngComponentOutletNgModuleFactory"] !== void 0;
}
_needToReCreateComponentInstance(changes) {
return changes["ngComponentOutlet"] !== void 0 || changes["ngComponentOutletContent"] !== void 0 || changes["ngComponentOutletInjector"] !== void 0 || changes["ngComponentOutletEnvironmentInjector"] !== void 0 || this._needToReCreateNgModuleInstance(changes);
}
/** @docs-private */
ngOnChanges(changes) {
if (this._needToReCreateComponentInstance(changes)) {
this._viewContainerRef.clear();
this._inputsUsed.clear();
this._componentRef = void 0;
if (this.ngComponentOutlet) {
const injector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
if (this._needToReCreateNgModuleInstance(changes)) {
this._moduleRef?.destroy();
if (this.ngComponentOutletNgModule) {
this._moduleRef = createNgModule(this.ngComponentOutletNgModule, getParentInjector(injector));
} else if (this.ngComponentOutletNgModuleFactory) {
this._moduleRef = this.ngComponentOutletNgModuleFactory.create(getParentInjector(injector));
} else {
this._moduleRef = void 0;
}
}
this._componentRef = this._viewContainerRef.createComponent(this.ngComponentOutlet, {
injector,
ngModuleRef: this._moduleRef,
projectableNodes: this.ngComponentOutletContent,
environmentInjector: this.ngComponentOutletEnvironmentInjector
});
}
}
}
/** @docs-private */
ngDoCheck() {
if (this._componentRef) {
if (this.ngComponentOutletInputs) {
for (const inputName of Object.keys(this.ngComponentOutletInputs)) {
this._inputsUsed.set(inputName, true);
}
}
this._applyInputStateDiff(this._componentRef);
}
}
/** @docs-private */
ngOnDestroy() {
this._moduleRef?.destroy();
}
_applyInputStateDiff(componentRef) {
for (const [inputName, touched] of this._inputsUsed) {
if (!touched) {
componentRef.setInput(inputName, void 0);
this._inputsUsed.delete(inputName);
} else {
componentRef.setInput(inputName, this.ngComponentOutletInputs[inputName]);
this._inputsUsed.set(inputName, false);
}
}
}
static \u0275fac = function NgComponentOutlet_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgComponentOutlet)(\u0275\u0275directiveInject(ViewContainerRef));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgComponentOutlet,
selectors: [["", "ngComponentOutlet", ""]],
inputs: {
ngComponentOutlet: "ngComponentOutlet",
ngComponentOutletInputs: "ngComponentOutletInputs",
ngComponentOutletInjector: "ngComponentOutletInjector",
ngComponentOutletEnvironmentInjector: "ngComponentOutletEnvironmentInjector",
ngComponentOutletContent: "ngComponentOutletContent",
ngComponentOutletNgModule: "ngComponentOutletNgModule",
ngComponentOutletNgModuleFactory: "ngComponentOutletNgModuleFactory"
},
exportAs: ["ngComponentOutlet"],
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgComponentOutlet, [{
type: Directive,
args: [{
selector: "[ngComponentOutlet]",
exportAs: "ngComponentOutlet"
}]
}], () => [{
type: ViewContainerRef
}], {
ngComponentOutlet: [{
type: Input
}],
ngComponentOutletInputs: [{
type: Input
}],
ngComponentOutletInjector: [{
type: Input
}],
ngComponentOutletEnvironmentInjector: [{
type: Input
}],
ngComponentOutletContent: [{
type: Input
}],
ngComponentOutletNgModule: [{
type: Input
}],
ngComponentOutletNgModuleFactory: [{
type: Input
}]
});
})();
function getParentInjector(injector) {
const parentNgModule = injector.get(NgModuleRef$1);
return parentNgModule.injector;
}
var NgForOfContext = class {
$implicit;
ngForOf;
index;
count;
constructor($implicit, ngForOf, index, count) {
this.$implicit = $implicit;
this.ngForOf = ngForOf;
this.index = index;
this.count = count;
}
// Indicates whether this is the first item in the collection.
get first() {
return this.index === 0;
}
// Indicates whether this is the last item in the collection.
get last() {
return this.index === this.count - 1;
}
// Indicates whether an index of this item in the collection is even.
get even() {
return this.index % 2 === 0;
}
// Indicates whether an index of this item in the collection is odd.
get odd() {
return !this.even;
}
};
var NgForOf = class _NgForOf {
_viewContainer;
_template;
_differs;
/**
* The value of the iterable expression, which can be used as a
* [template input variable](guide/directives/structural-directives#shorthand).
* @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
*/
set ngForOf(ngForOf) {
this._ngForOf = ngForOf;
this._ngForOfDirty = true;
}
/**
* Specifies a custom `TrackByFunction` to compute the identity of items in an iterable.
*
* If a custom `TrackByFunction` is not provided, `NgForOf` will use the item's [object
* identity](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is)
* as the key.
*
* `NgForOf` uses the computed key to associate items in an iterable with DOM elements
* it produces for these items.
*
* A custom `TrackByFunction` is useful to provide good user experience in cases when items in an
* iterable rendered using `NgForOf` have a natural identifier (for example, custom ID or a
* primary key), and this iterable could be updated with new object instances that still
* represent the same underlying entity (for example, when data is re-fetched from the server,
* and the iterable is recreated and re-rendered, but most of the data is still the same).
*
* @see {@link TrackByFunction}
* @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
*/
set ngForTrackBy(fn) {
if ((typeof ngDevMode === "undefined" || ngDevMode) && fn != null && typeof fn !== "function") {
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. See https://angular.dev/api/common/NgForOf#change-propagation for more information.`);
}
this._trackByFn = fn;
}
get ngForTrackBy() {
return this._trackByFn;
}
_ngForOf = null;
_ngForOfDirty = true;
_differ = null;
// waiting for microsoft/typescript#43662 to allow the return type `TrackByFunction|undefined` for
// the getter
_trackByFn;
constructor(_viewContainer, _template, _differs) {
this._viewContainer = _viewContainer;
this._template = _template;
this._differs = _differs;
}
/**
* A reference to the template that is stamped out for each item in the iterable.
* @see [template reference variable](guide/templates/variables#template-reference-variables)
* @deprecated The `ngFor` directive is deprecated. Use the `@for` block instead.
*/
set ngForTemplate(value) {
if (value) {
this._template = value;
}
}
/**
* Applies the changes when needed.
* @docs-private
*/
ngDoCheck() {
if (this._ngForOfDirty) {
this._ngForOfDirty = false;
const value = this._ngForOf;
if (!this._differ && value) {
if (typeof ngDevMode === "undefined" || ngDevMode) {
try {
this._differ = this._differs.find(value).create(this.ngForTrackBy);
} catch {
let errorMessage = `Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables, such as Arrays.`;
if (typeof value === "object") {
errorMessage += " Did you mean to use the keyvalue pipe?";
}
throw new RuntimeError(-2200, errorMessage);
}
} else {
this._differ = this._differs.find(value).create(this.ngForTrackBy);
}
}
}
if (this._differ) {
const changes = this._differ.diff(this._ngForOf);
if (changes) this._applyChanges(changes);
}
}
_applyChanges(changes) {
const viewContainer = this._viewContainer;
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
if (item.previousIndex == null) {
viewContainer.createEmbeddedView(this._template, new NgForOfContext(item.item, this._ngForOf, -1, -1), currentIndex === null ? void 0 : currentIndex);
} else if (currentIndex == null) {
viewContainer.remove(adjustedPreviousIndex === null ? void 0 : adjustedPreviousIndex);
} else if (adjustedPreviousIndex !== null) {
const view = viewContainer.get(adjustedPreviousIndex);
viewContainer.move(view, currentIndex);
applyViewChange(view, item);
}
});
for (let i = 0, ilen = viewContainer.length; i < ilen; i++) {
const viewRef = viewContainer.get(i);
const context = viewRef.context;
context.index = i;
context.count = ilen;
context.ngForOf = this._ngForOf;
}
changes.forEachIdentityChange((record2) => {
const viewRef = viewContainer.get(record2.currentIndex);
applyViewChange(viewRef, record2);
});
}
/**
* Asserts the correct type of the context for the template that `NgForOf` will render.
*
* The presence of this method is a signal to the Ivy template type-check compiler that the
* `NgForOf` structural directive renders its template with a specific context type.
*/
static ngTemplateContextGuard(dir, ctx) {
return true;
}
static \u0275fac = function NgForOf_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgForOf)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(IterableDiffers));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgForOf,
selectors: [["", "ngFor", "", "ngForOf", ""]],
inputs: {
ngForOf: "ngForOf",
ngForTrackBy: "ngForTrackBy",
ngForTemplate: "ngForTemplate"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgForOf, [{
type: Directive,
args: [{
selector: "[ngFor][ngForOf]"
}]
}], () => [{
type: ViewContainerRef
}, {
type: TemplateRef
}, {
type: IterableDiffers
}], {
ngForOf: [{
type: Input
}],
ngForTrackBy: [{
type: Input
}],
ngForTemplate: [{
type: Input
}]
});
})();
function applyViewChange(view, record2) {
view.context.$implicit = record2.item;
}
function getTypeName(type) {
return type["name"] || typeof type;
}
var NgIf = class _NgIf {
_viewContainer;
_context = new NgIfContext();
_thenTemplateRef = null;
_elseTemplateRef = null;
_thenViewRef = null;
_elseViewRef = null;
constructor(_viewContainer, templateRef) {
this._viewContainer = _viewContainer;
this._thenTemplateRef = templateRef;
}
/**
* The Boolean expression to evaluate as the condition for showing a template.
* @deprecated Use the `@if` block instead. Intent to remove in v22
*/
set ngIf(condition) {
this._context.$implicit = this._context.ngIf = condition;
this._updateView();
}
/**
* A template to show if the condition expression evaluates to true.
* @deprecated Use the `@if` block instead. Intent to remove in v22
*/
set ngIfThen(templateRef) {
assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfThen");
this._thenTemplateRef = templateRef;
this._thenViewRef = null;
this._updateView();
}
/**
* A template to show if the condition expression evaluates to false.
* @deprecated Use the `@if` block instead. Intent to remove in v22
*/
set ngIfElse(templateRef) {
assertTemplate(templateRef, (typeof ngDevMode === "undefined" || ngDevMode) && "ngIfElse");
this._elseTemplateRef = templateRef;
this._elseViewRef = null;
this._updateView();
}
_updateView() {
if (this._context.$implicit) {
if (!this._thenViewRef) {
this._viewContainer.clear();
this._elseViewRef = null;
if (this._thenTemplateRef) {
this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
}
}
} else {
if (!this._elseViewRef) {
this._viewContainer.clear();
this._thenViewRef = null;
if (this._elseTemplateRef) {
this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
}
}
}
}
/** @internal */
static ngIfUseIfTypeGuard;
/**
* Assert the correct type of the expression bound to the `ngIf` input within the template.
*
* The presence of this static field is a signal to the Ivy template type check compiler that
* when the `NgIf` structural directive renders its template, the type of the expression bound
* to `ngIf` should be narrowed in some way. For `NgIf`, the binding expression itself is used to
* narrow its type, which allows the strictNullChecks feature of TypeScript to work with `NgIf`.
*/
static ngTemplateGuard_ngIf;
/**
* Asserts the correct type of the context for the template that `NgIf` will render.
*
* The presence of this method is a signal to the Ivy template type-check compiler that the
* `NgIf` structural directive renders its template with a specific context type.
*/
static ngTemplateContextGuard(dir, ctx) {
return true;
}
static \u0275fac = function NgIf_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgIf)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgIf,
selectors: [["", "ngIf", ""]],
inputs: {
ngIf: "ngIf",
ngIfThen: "ngIfThen",
ngIfElse: "ngIfElse"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgIf, [{
type: Directive,
args: [{
selector: "[ngIf]"
}]
}], () => [{
type: ViewContainerRef
}, {
type: TemplateRef
}], {
ngIf: [{
type: Input
}],
ngIfThen: [{
type: Input
}],
ngIfElse: [{
type: Input
}]
});
})();
var NgIfContext = class {
$implicit = null;
ngIf = null;
};
function assertTemplate(templateRef, property) {
if (templateRef && !templateRef.createEmbeddedView) {
throw new RuntimeError(2020, (typeof ngDevMode === "undefined" || ngDevMode) && `${property} must be a TemplateRef, but received '${stringify(templateRef)}'.`);
}
}
var SwitchView = class {
_viewContainerRef;
_templateRef;
_created = false;
constructor(_viewContainerRef, _templateRef) {
this._viewContainerRef = _viewContainerRef;
this._templateRef = _templateRef;
}
create() {
this._created = true;
this._viewContainerRef.createEmbeddedView(this._templateRef);
}
destroy() {
this._created = false;
this._viewContainerRef.clear();
}
enforceState(created) {
if (created && !this._created) {
this.create();
} else if (!created && this._created) {
this.destroy();
}
}
};
var NgSwitch = class _NgSwitch {
_defaultViews = [];
_defaultUsed = false;
_caseCount = 0;
_lastCaseCheckIndex = 0;
_lastCasesMatched = false;
_ngSwitch;
/** @deprecated Use the `@switch` block instead. Intent to remove in v22 */
set ngSwitch(newValue) {
this._ngSwitch = newValue;
if (this._caseCount === 0) {
this._updateDefaultCases(true);
}
}
/** @internal */
_addCase() {
return this._caseCount++;
}
/** @internal */
_addDefault(view) {
this._defaultViews.push(view);
}
/** @internal */
_matchCase(value) {
const matched = value === this._ngSwitch;
this._lastCasesMatched ||= matched;
this._lastCaseCheckIndex++;
if (this._lastCaseCheckIndex === this._caseCount) {
this._updateDefaultCases(!this._lastCasesMatched);
this._lastCaseCheckIndex = 0;
this._lastCasesMatched = false;
}
return matched;
}
_updateDefaultCases(useDefault) {
if (this._defaultViews.length > 0 && useDefault !== this._defaultUsed) {
this._defaultUsed = useDefault;
for (const defaultView of this._defaultViews) {
defaultView.enforceState(useDefault);
}
}
}
static \u0275fac = function NgSwitch_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgSwitch)();
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgSwitch,
selectors: [["", "ngSwitch", ""]],
inputs: {
ngSwitch: "ngSwitch"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitch, [{
type: Directive,
args: [{
selector: "[ngSwitch]"
}]
}], null, {
ngSwitch: [{
type: Input
}]
});
})();
var NgSwitchCase = class _NgSwitchCase {
ngSwitch;
_view;
/**
* Stores the HTML template to be selected on match.
* @deprecated Use the `@case` block within a `@switch` block instead. Intent to remove in v22
*/
ngSwitchCase;
constructor(viewContainer, templateRef, ngSwitch) {
this.ngSwitch = ngSwitch;
if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
throwNgSwitchProviderNotFoundError("ngSwitchCase", "NgSwitchCase");
}
ngSwitch._addCase();
this._view = new SwitchView(viewContainer, templateRef);
}
/**
* Performs case matching. For internal use only.
* @docs-private
*/
ngDoCheck() {
this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
}
static \u0275fac = function NgSwitchCase_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgSwitchCase)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(NgSwitch, 9));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgSwitchCase,
selectors: [["", "ngSwitchCase", ""]],
inputs: {
ngSwitchCase: "ngSwitchCase"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchCase, [{
type: Directive,
args: [{
selector: "[ngSwitchCase]"
}]
}], () => [{
type: ViewContainerRef
}, {
type: TemplateRef
}, {
type: NgSwitch,
decorators: [{
type: Optional
}, {
type: Host
}]
}], {
ngSwitchCase: [{
type: Input
}]
});
})();
var NgSwitchDefault = class _NgSwitchDefault {
constructor(viewContainer, templateRef, ngSwitch) {
if ((typeof ngDevMode === "undefined" || ngDevMode) && !ngSwitch) {
throwNgSwitchProviderNotFoundError("ngSwitchDefault", "NgSwitchDefault");
}
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
}
static \u0275fac = function NgSwitchDefault_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgSwitchDefault)(\u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(NgSwitch, 9));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgSwitchDefault,
selectors: [["", "ngSwitchDefault", ""]]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgSwitchDefault, [{
type: Directive,
args: [{
selector: "[ngSwitchDefault]"
}]
}], () => [{
type: ViewContainerRef
}, {
type: TemplateRef
}, {
type: NgSwitch,
decorators: [{
type: Optional
}, {
type: Host
}]
}], null);
})();
function throwNgSwitchProviderNotFoundError(attrName, directiveName) {
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)`);
}
var NgPlural = class _NgPlural {
_localization;
_activeView;
_caseViews = {};
constructor(_localization) {
this._localization = _localization;
}
set ngPlural(value) {
this._updateView(value);
}
addCase(value, switchView) {
this._caseViews[value] = switchView;
}
_updateView(switchValue) {
this._clearViews();
const cases = Object.keys(this._caseViews);
const key = getPluralCategory(switchValue, cases, this._localization);
this._activateView(this._caseViews[key]);
}
_clearViews() {
if (this._activeView) this._activeView.destroy();
}
_activateView(view) {
if (view) {
this._activeView = view;
this._activeView.create();
}
}
static \u0275fac = function NgPlural_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgPlural)(\u0275\u0275directiveInject(NgLocalization));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgPlural,
selectors: [["", "ngPlural", ""]],
inputs: {
ngPlural: "ngPlural"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPlural, [{
type: Directive,
args: [{
selector: "[ngPlural]"
}]
}], () => [{
type: NgLocalization
}], {
ngPlural: [{
type: Input
}]
});
})();
var NgPluralCase = class _NgPluralCase {
value;
constructor(value, template, viewContainer, ngPlural) {
this.value = value;
const isANumber = !isNaN(Number(value));
ngPlural.addCase(isANumber ? `=${value}` : value, new SwitchView(viewContainer, template));
}
static \u0275fac = function NgPluralCase_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgPluralCase)(\u0275\u0275injectAttribute("ngPluralCase"), \u0275\u0275directiveInject(TemplateRef), \u0275\u0275directiveInject(ViewContainerRef), \u0275\u0275directiveInject(NgPlural, 1));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgPluralCase,
selectors: [["", "ngPluralCase", ""]]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgPluralCase, [{
type: Directive,
args: [{
selector: "[ngPluralCase]"
}]
}], () => [{
type: void 0,
decorators: [{
type: Attribute,
args: ["ngPluralCase"]
}]
}, {
type: TemplateRef
}, {
type: ViewContainerRef
}, {
type: NgPlural,
decorators: [{
type: Host
}]
}], null);
})();
var NgStyle = class _NgStyle {
_ngEl;
_differs;
_renderer;
_ngStyle = null;
_differ = null;
constructor(_ngEl, _differs, _renderer) {
this._ngEl = _ngEl;
this._differs = _differs;
this._renderer = _renderer;
}
set ngStyle(values) {
this._ngStyle = values;
if (!this._differ && values) {
this._differ = this._differs.find(values).create();
}
}
ngDoCheck() {
if (this._differ) {
const changes = this._differ.diff(this._ngStyle);
if (changes) {
this._applyChanges(changes);
}
}
}
_setStyle(nameAndUnit, value) {
const [name2, unit] = nameAndUnit.split(".");
const flags = name2.indexOf("-") === -1 ? void 0 : RendererStyleFlags2.DashCase;
if (value != null) {
this._renderer.setStyle(this._ngEl.nativeElement, name2, unit ? `${value}${unit}` : value, flags);
} else {
this._renderer.removeStyle(this._ngEl.nativeElement, name2, flags);
}
}
_applyChanges(changes) {
changes.forEachRemovedItem((record2) => this._setStyle(record2.key, null));
changes.forEachAddedItem((record2) => this._setStyle(record2.key, record2.currentValue));
changes.forEachChangedItem((record2) => this._setStyle(record2.key, record2.currentValue));
}
static \u0275fac = function NgStyle_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgStyle)(\u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(KeyValueDiffers), \u0275\u0275directiveInject(Renderer2));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgStyle,
selectors: [["", "ngStyle", ""]],
inputs: {
ngStyle: "ngStyle"
}
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgStyle, [{
type: Directive,
args: [{
selector: "[ngStyle]"
}]
}], () => [{
type: ElementRef
}, {
type: KeyValueDiffers
}, {
type: Renderer2
}], {
ngStyle: [{
type: Input,
args: ["ngStyle"]
}]
});
})();
var NgTemplateOutlet = class _NgTemplateOutlet {
_viewContainerRef;
_viewRef = null;
/**
* A context object to attach to the {@link EmbeddedViewRef}. This should be an
* object, the object's keys will be available for binding by the local template `let`
* declarations.
* Using the key `$implicit` in the context object will set its value as default.
*/
ngTemplateOutletContext = null;
/**
* A string defining the template reference and optionally the context object for the template.
*/
ngTemplateOutlet = null;
/** Injector to be used within the embedded view. */
ngTemplateOutletInjector = null;
constructor(_viewContainerRef) {
this._viewContainerRef = _viewContainerRef;
}
ngOnChanges(changes) {
if (this._shouldRecreateView(changes)) {
const viewContainerRef = this._viewContainerRef;
if (this._viewRef) {
viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));
}
if (!this.ngTemplateOutlet) {
this._viewRef = null;
return;
}
const viewContext = this._createContextForwardProxy();
this._viewRef = viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, viewContext, {
injector: this.ngTemplateOutletInjector ?? void 0
});
}
}
/**
* We need to re-create existing embedded view if either is true:
* - the outlet changed.
* - the injector changed.
*/
_shouldRecreateView(changes) {
return !!changes["ngTemplateOutlet"] || !!changes["ngTemplateOutletInjector"];
}
/**
* For a given outlet instance, we create a proxy object that delegates
* to the user-specified context. This allows changing, or swapping out
* the context object completely without having to destroy/re-create the view.
*/
_createContextForwardProxy() {
return new Proxy({}, {
set: (_target, prop, newValue) => {
if (!this.ngTemplateOutletContext) {
return false;
}
return Reflect.set(this.ngTemplateOutletContext, prop, newValue);
},
get: (_target, prop, receiver) => {
if (!this.ngTemplateOutletContext) {
return void 0;
}
return Reflect.get(this.ngTemplateOutletContext, prop, receiver);
}
});
}
static \u0275fac = function NgTemplateOutlet_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgTemplateOutlet)(\u0275\u0275directiveInject(ViewContainerRef));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgTemplateOutlet,
selectors: [["", "ngTemplateOutlet", ""]],
inputs: {
ngTemplateOutletContext: "ngTemplateOutletContext",
ngTemplateOutlet: "ngTemplateOutlet",
ngTemplateOutletInjector: "ngTemplateOutletInjector"
},
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgTemplateOutlet, [{
type: Directive,
args: [{
selector: "[ngTemplateOutlet]"
}]
}], () => [{
type: ViewContainerRef
}], {
ngTemplateOutletContext: [{
type: Input
}],
ngTemplateOutlet: [{
type: Input
}],
ngTemplateOutletInjector: [{
type: Input
}]
});
})();
var COMMON_DIRECTIVES = [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase];
function invalidPipeArgumentError(type, value) {
return new RuntimeError(2100, ngDevMode && `InvalidPipeArgument: '${value}' for pipe '${stringify(type)}'`);
}
var SubscribableStrategy = class {
createSubscription(async, updateLatestValue, onError) {
return untracked(() => async.subscribe({
next: updateLatestValue,
error: onError
}));
}
dispose(subscription) {
untracked(() => subscription.unsubscribe());
}
};
var PromiseStrategy = class {
createSubscription(async, updateLatestValue, onError) {
async.then(
// Using optional chaining because we may have set it to `null`; since the promise
// is async, the view might be destroyed by the time the promise resolves.
(v) => updateLatestValue?.(v),
(e) => onError?.(e)
);
return {
unsubscribe: () => {
updateLatestValue = null;
onError = null;
}
};
}
dispose(subscription) {
subscription.unsubscribe();
}
};
var _promiseStrategy = new PromiseStrategy();
var _subscribableStrategy = new SubscribableStrategy();
var AsyncPipe = class _AsyncPipe {
_ref;
_latestValue = null;
markForCheckOnValueUpdate = true;
_subscription = null;
_obj = null;
_strategy = null;
applicationErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
constructor(ref) {
this._ref = ref;
}
ngOnDestroy() {
if (this._subscription) {
this._dispose();
}
this._ref = null;
}
transform(obj) {
if (!this._obj) {
if (obj) {
try {
this.markForCheckOnValueUpdate = false;
this._subscribe(obj);
} finally {
this.markForCheckOnValueUpdate = true;
}
}
return this._latestValue;
}
if (obj !== this._obj) {
this._dispose();
return this.transform(obj);
}
return this._latestValue;
}
_subscribe(obj) {
this._obj = obj;
this._strategy = this._selectStrategy(obj);
this._subscription = this._strategy.createSubscription(obj, (value) => this._updateLatestValue(obj, value), (e) => this.applicationErrorHandler(e));
}
_selectStrategy(obj) {
if (isPromise(obj)) {
return _promiseStrategy;
}
if (isSubscribable(obj)) {
return _subscribableStrategy;
}
throw invalidPipeArgumentError(_AsyncPipe, obj);
}
_dispose() {
this._strategy.dispose(this._subscription);
this._latestValue = null;
this._subscription = null;
this._obj = null;
}
_updateLatestValue(async, value) {
if (async === this._obj) {
this._latestValue = value;
if (this.markForCheckOnValueUpdate) {
this._ref?.markForCheck();
}
}
}
static \u0275fac = function AsyncPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _AsyncPipe)(\u0275\u0275directiveInject(ChangeDetectorRef, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "async",
type: _AsyncPipe,
pure: false
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AsyncPipe, [{
type: Pipe,
args: [{
name: "async",
pure: false
}]
}], () => [{
type: ChangeDetectorRef
}], null);
})();
var LowerCasePipe = class _LowerCasePipe {
transform(value) {
if (value == null) return null;
if (typeof value !== "string") {
throw invalidPipeArgumentError(_LowerCasePipe, value);
}
return value.toLowerCase();
}
static \u0275fac = function LowerCasePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _LowerCasePipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "lowercase",
type: _LowerCasePipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LowerCasePipe, [{
type: Pipe,
args: [{
name: "lowercase"
}]
}], null, null);
})();
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;
var TitleCasePipe = class _TitleCasePipe {
transform(value) {
if (value == null) return null;
if (typeof value !== "string") {
throw invalidPipeArgumentError(_TitleCasePipe, value);
}
return value.replace(unicodeWordMatch, (txt) => txt[0].toUpperCase() + txt.slice(1).toLowerCase());
}
static \u0275fac = function TitleCasePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _TitleCasePipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "titlecase",
type: _TitleCasePipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TitleCasePipe, [{
type: Pipe,
args: [{
name: "titlecase"
}]
}], null, null);
})();
var UpperCasePipe = class _UpperCasePipe {
transform(value) {
if (value == null) return null;
if (typeof value !== "string") {
throw invalidPipeArgumentError(_UpperCasePipe, value);
}
return value.toUpperCase();
}
static \u0275fac = function UpperCasePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _UpperCasePipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "uppercase",
type: _UpperCasePipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UpperCasePipe, [{
type: Pipe,
args: [{
name: "uppercase"
}]
}], null, null);
})();
var DEFAULT_DATE_FORMAT = "mediumDate";
var DATE_PIPE_DEFAULT_TIMEZONE = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_TIMEZONE" : "");
var DATE_PIPE_DEFAULT_OPTIONS = new InjectionToken(ngDevMode ? "DATE_PIPE_DEFAULT_OPTIONS" : "");
var DatePipe = class _DatePipe {
locale;
defaultTimezone;
defaultOptions;
constructor(locale, defaultTimezone, defaultOptions) {
this.locale = locale;
this.defaultTimezone = defaultTimezone;
this.defaultOptions = defaultOptions;
}
transform(value, format, timezone, locale) {
if (value == null || value === "" || value !== value) return null;
try {
const _format = format ?? this.defaultOptions?.dateFormat ?? DEFAULT_DATE_FORMAT;
const _timezone = timezone ?? this.defaultOptions?.timezone ?? this.defaultTimezone ?? void 0;
return formatDate(value, _format, locale || this.locale, _timezone);
} catch (error2) {
throw invalidPipeArgumentError(_DatePipe, error2.message);
}
}
static \u0275fac = function DatePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DatePipe)(\u0275\u0275directiveInject(LOCALE_ID, 16), \u0275\u0275directiveInject(DATE_PIPE_DEFAULT_TIMEZONE, 24), \u0275\u0275directiveInject(DATE_PIPE_DEFAULT_OPTIONS, 24));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "date",
type: _DatePipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DatePipe, [{
type: Pipe,
args: [{
name: "date"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [LOCALE_ID]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [DATE_PIPE_DEFAULT_TIMEZONE]
}, {
type: Optional
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [DATE_PIPE_DEFAULT_OPTIONS]
}, {
type: Optional
}]
}], null);
})();
var _INTERPOLATION_REGEXP = /#/g;
var I18nPluralPipe = class _I18nPluralPipe {
_localization;
constructor(_localization) {
this._localization = _localization;
}
/**
* @param value the number to be formatted
* @param pluralMap an object that mimics the ICU format, see
* https://unicode-org.github.io/icu/userguide/format_parse/messages/.
* @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
* default).
*/
transform(value, pluralMap, locale) {
if (value == null) return "";
if (typeof pluralMap !== "object" || pluralMap === null) {
throw invalidPipeArgumentError(_I18nPluralPipe, pluralMap);
}
const key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
}
static \u0275fac = function I18nPluralPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _I18nPluralPipe)(\u0275\u0275directiveInject(NgLocalization, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "i18nPlural",
type: _I18nPluralPipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nPluralPipe, [{
type: Pipe,
args: [{
name: "i18nPlural"
}]
}], () => [{
type: NgLocalization
}], null);
})();
var I18nSelectPipe = class _I18nSelectPipe {
/**
* @param value a string to be internationalized.
* @param mapping an object that indicates the text that should be displayed
* for different values of the provided `value`.
*/
transform(value, mapping) {
if (value == null) return "";
if (typeof mapping !== "object" || typeof value !== "string") {
throw invalidPipeArgumentError(_I18nSelectPipe, mapping);
}
if (mapping.hasOwnProperty(value)) {
return mapping[value];
}
if (mapping.hasOwnProperty("other")) {
return mapping["other"];
}
return "";
}
static \u0275fac = function I18nSelectPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _I18nSelectPipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "i18nSelect",
type: _I18nSelectPipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(I18nSelectPipe, [{
type: Pipe,
args: [{
name: "i18nSelect"
}]
}], null, null);
})();
var JsonPipe = class _JsonPipe {
/**
* @param value A value of any type to convert into a JSON-format string.
*/
transform(value) {
return JSON.stringify(value, null, 2);
}
static \u0275fac = function JsonPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _JsonPipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "json",
type: _JsonPipe,
pure: false
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonPipe, [{
type: Pipe,
args: [{
name: "json",
pure: false
}]
}], null, null);
})();
function makeKeyValuePair(key, value) {
return {
key,
value
};
}
var KeyValuePipe = class _KeyValuePipe {
differs;
constructor(differs) {
this.differs = differs;
}
differ;
keyValues = [];
compareFn = defaultComparator;
transform(input2, compareFn = defaultComparator) {
if (!input2 || !(input2 instanceof Map) && typeof input2 !== "object") {
return null;
}
this.differ ??= this.differs.find(input2).create();
const differChanges = this.differ.diff(input2);
const compareFnChanged = compareFn !== this.compareFn;
if (differChanges) {
this.keyValues = [];
differChanges.forEachItem((r) => {
this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
});
}
if (differChanges || compareFnChanged) {
if (compareFn) {
this.keyValues.sort(compareFn);
}
this.compareFn = compareFn;
}
return this.keyValues;
}
static \u0275fac = function KeyValuePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _KeyValuePipe)(\u0275\u0275directiveInject(KeyValueDiffers, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "keyvalue",
type: _KeyValuePipe,
pure: false
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyValuePipe, [{
type: Pipe,
args: [{
name: "keyvalue",
pure: false
}]
}], () => [{
type: KeyValueDiffers
}], null);
})();
function defaultComparator(keyValueA, keyValueB) {
const a = keyValueA.key;
const b = keyValueB.key;
if (a === b) return 0;
if (a == null) return 1;
if (b == null) return -1;
if (typeof a == "string" && typeof b == "string") {
return a < b ? -1 : 1;
}
if (typeof a == "number" && typeof b == "number") {
return a - b;
}
if (typeof a == "boolean" && typeof b == "boolean") {
return a < b ? -1 : 1;
}
const aString = String(a);
const bString = String(b);
return aString == bString ? 0 : aString < bString ? -1 : 1;
}
var DecimalPipe = class _DecimalPipe {
_locale;
constructor(_locale) {
this._locale = _locale;
}
transform(value, digitsInfo, locale) {
if (!isValue(value)) return null;
locale ||= this._locale;
try {
const num = strToNumber(value);
return formatNumber(num, locale, digitsInfo);
} catch (error2) {
throw invalidPipeArgumentError(_DecimalPipe, error2.message);
}
}
static \u0275fac = function DecimalPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DecimalPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "number",
type: _DecimalPipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DecimalPipe, [{
type: Pipe,
args: [{
name: "number"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [LOCALE_ID]
}]
}], null);
})();
var PercentPipe = class _PercentPipe {
_locale;
constructor(_locale) {
this._locale = _locale;
}
/**
*
* @param value The number to be formatted as a percentage.
* @param digitsInfo Decimal representation options, specified by a string
* in the following format:<br>
* <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
* - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
* Default is `1`.
* - `minFractionDigits`: The minimum number of digits after the decimal point.
* Default is `0`.
* - `maxFractionDigits`: The maximum number of digits after the decimal point.
* Default is `0`.
* @param locale A locale code for the locale format rules to use.
* When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
* See [Setting your app locale](guide/i18n/locale-id).
*/
transform(value, digitsInfo, locale) {
if (!isValue(value)) return null;
locale ||= this._locale;
try {
const num = strToNumber(value);
return formatPercent(num, locale, digitsInfo);
} catch (error2) {
throw invalidPipeArgumentError(_PercentPipe, error2.message);
}
}
static \u0275fac = function PercentPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PercentPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "percent",
type: _PercentPipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PercentPipe, [{
type: Pipe,
args: [{
name: "percent"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [LOCALE_ID]
}]
}], null);
})();
var CurrencyPipe = class _CurrencyPipe {
_locale;
_defaultCurrencyCode;
constructor(_locale, _defaultCurrencyCode = "USD") {
this._locale = _locale;
this._defaultCurrencyCode = _defaultCurrencyCode;
}
transform(value, currencyCode = this._defaultCurrencyCode, display = "symbol", digitsInfo, locale) {
if (!isValue(value)) return null;
locale ||= this._locale;
if (typeof display === "boolean") {
if (typeof ngDevMode === "undefined" || ngDevMode) {
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".`);
}
display = display ? "symbol" : "code";
}
let currency = currencyCode || this._defaultCurrencyCode;
if (display !== "code") {
if (display === "symbol" || display === "symbol-narrow") {
currency = getCurrencySymbol(currency, display === "symbol" ? "wide" : "narrow", locale);
} else {
currency = display;
}
}
try {
const num = strToNumber(value);
return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
} catch (error2) {
throw invalidPipeArgumentError(_CurrencyPipe, error2.message);
}
}
static \u0275fac = function CurrencyPipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _CurrencyPipe)(\u0275\u0275directiveInject(LOCALE_ID, 16), \u0275\u0275directiveInject(DEFAULT_CURRENCY_CODE, 16));
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "currency",
type: _CurrencyPipe,
pure: true
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CurrencyPipe, [{
type: Pipe,
args: [{
name: "currency"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [LOCALE_ID]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [DEFAULT_CURRENCY_CODE]
}]
}], null);
})();
function isValue(value) {
return !(value == null || value === "" || value !== value);
}
function strToNumber(value) {
if (typeof value === "string" && !isNaN(Number(value) - parseFloat(value))) {
return Number(value);
}
if (typeof value !== "number") {
throw new RuntimeError(2309, ngDevMode && `${value} is not a number`);
}
return value;
}
var SlicePipe = class _SlicePipe {
transform(value, start, end) {
if (value == null) return null;
const supports = typeof value === "string" || Array.isArray(value);
if (!supports) {
throw invalidPipeArgumentError(_SlicePipe, value);
}
return value.slice(start, end);
}
static \u0275fac = function SlicePipe_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _SlicePipe)();
};
static \u0275pipe = /* @__PURE__ */ \u0275\u0275definePipe({
name: "slice",
type: _SlicePipe,
pure: false
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SlicePipe, [{
type: Pipe,
args: [{
name: "slice",
pure: false
}]
}], null, null);
})();
var COMMON_PIPES = [AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe];
var CommonModule = class _CommonModule {
static \u0275fac = function CommonModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _CommonModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _CommonModule,
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],
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]
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CommonModule, [{
type: NgModule,
args: [{
imports: [COMMON_DIRECTIVES, COMMON_PIPES],
exports: [COMMON_DIRECTIVES, COMMON_PIPES]
}]
}], null, null);
})();
// node_modules/@angular/common/fesm2022/xhr.mjs
function parseCookieValue(cookieStr, name2) {
name2 = encodeURIComponent(name2);
for (const cookie of cookieStr.split(";")) {
const eqIndex = cookie.indexOf("=");
const [cookieName, cookieValue] = eqIndex == -1 ? [cookie, ""] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)];
if (cookieName.trim() === name2) {
return decodeURIComponent(cookieValue);
}
}
return null;
}
var XhrFactory = class {
};
// node_modules/@angular/common/fesm2022/common.mjs
function registerLocaleData2(data, localeId, extraData) {
return registerLocaleData(data, localeId, extraData);
}
var PLATFORM_BROWSER_ID = "browser";
function isPlatformBrowser(platformId) {
return platformId === PLATFORM_BROWSER_ID;
}
var ViewportScroller = class _ViewportScroller {
// De-sugared tree-shakable injection
// See #23917
/** @nocollapse */
static \u0275prov = (
/** @pureOrBreakMyCode */
/* @__PURE__ */ \u0275\u0275defineInjectable({
token: _ViewportScroller,
providedIn: "root",
factory: () => false ? new NullViewportScroller() : new BrowserViewportScroller(inject(DOCUMENT), window)
})
);
};
var BrowserViewportScroller = class {
document;
window;
offset = () => [0, 0];
constructor(document2, window2) {
this.document = document2;
this.window = window2;
}
/**
* Configures the top offset used when scrolling to an anchor.
* @param offset A position in screen coordinates (a tuple with x and y values)
* or a function that returns the top offset position.
*
*/
setOffset(offset) {
if (Array.isArray(offset)) {
this.offset = () => offset;
} else {
this.offset = offset;
}
}
/**
* Retrieves the current scroll position.
* @returns The position in screen coordinates.
*/
getScrollPosition() {
return [this.window.scrollX, this.window.scrollY];
}
/**
* Sets the scroll position.
* @param position The new position in screen coordinates.
*/
scrollToPosition(position, options) {
this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
left: position[0],
top: position[1]
}));
}
/**
* Scrolls to an element and attempts to focus the element.
*
* Note that the function name here is misleading in that the target string may be an ID for a
* non-anchor element.
*
* @param target The ID of an element or name of the anchor.
*
* @see https://html.spec.whatwg.org/#the-indicated-part-of-the-document
* @see https://html.spec.whatwg.org/#scroll-to-fragid
*/
scrollToAnchor(target, options) {
const elSelected = findAnchorFromDocument(this.document, target);
if (elSelected) {
this.scrollToElement(elSelected, options);
elSelected.focus();
}
}
/**
* Disables automatic scroll restoration provided by the browser.
*/
setHistoryScrollRestoration(scrollRestoration) {
try {
this.window.history.scrollRestoration = scrollRestoration;
} catch {
console.warn(formatRuntimeError(2400, ngDevMode && "Failed to set `window.history.scrollRestoration`. This may occur when:\n\u2022 The script is running inside a sandboxed iframe\n\u2022 The window is partially navigated or inactive\n\u2022 The script is executed in an untrusted or special context (e.g., test runners, browser extensions, or content previews)\nScroll position may not be preserved across navigation."));
}
}
/**
* Scrolls to an element using the native offset and the specified offset set on this scroller.
*
* The offset can be used when we know that there is a floating header and scrolling naively to an
* element (ex: `scrollIntoView`) leaves the element hidden behind the floating header.
*/
scrollToElement(el, options) {
const rect = el.getBoundingClientRect();
const left = rect.left + this.window.pageXOffset;
const top = rect.top + this.window.pageYOffset;
const offset = this.offset();
this.window.scrollTo(__spreadProps(__spreadValues({}, options), {
left: left - offset[0],
top: top - offset[1]
}));
}
};
function findAnchorFromDocument(document2, target) {
const documentResult = document2.getElementById(target) || document2.getElementsByName(target)[0];
if (documentResult) {
return documentResult;
}
if (typeof document2.createTreeWalker === "function" && document2.body && typeof document2.body.attachShadow === "function") {
const treeWalker = document2.createTreeWalker(document2.body, NodeFilter.SHOW_ELEMENT);
let currentNode = treeWalker.currentNode;
while (currentNode) {
const shadowRoot = currentNode.shadowRoot;
if (shadowRoot) {
const result = shadowRoot.getElementById(target) || shadowRoot.querySelector(`[name="${target}"]`);
if (result) {
return result;
}
}
currentNode = treeWalker.nextNode();
}
}
return null;
}
var PLACEHOLDER_QUALITY = "20";
function getUrl(src, win) {
return isAbsoluteUrl(src) ? new URL(src) : new URL(src, win.location.href);
}
function isAbsoluteUrl(src) {
return /^https?:\/\//.test(src);
}
function extractHostname(url) {
return isAbsoluteUrl(url) ? new URL(url).hostname : url;
}
function isValidPath(path) {
const isString = typeof path === "string";
if (!isString || path.trim() === "") {
return false;
}
try {
const url = new URL(path);
return true;
} catch {
return false;
}
}
function normalizePath(path) {
return path.endsWith("/") ? path.slice(0, -1) : path;
}
function normalizeSrc(src) {
return src.startsWith("/") ? src.slice(1) : src;
}
var noopImageLoader = (config) => config.src;
var IMAGE_LOADER = new InjectionToken(ngDevMode ? "ImageLoader" : "", {
providedIn: "root",
factory: () => noopImageLoader
});
function createImageLoader(buildUrlFn, exampleUrls) {
return function provideImageLoader(path) {
if (!isValidPath(path)) {
throwInvalidPathError(path, exampleUrls || []);
}
path = normalizePath(path);
const loaderFn = (config) => {
if (isAbsoluteUrl(config.src)) {
throwUnexpectedAbsoluteUrlError(path, config.src);
}
return buildUrlFn(path, __spreadProps(__spreadValues({}, config), {
src: normalizeSrc(config.src)
}));
};
const providers = [{
provide: IMAGE_LOADER,
useValue: loaderFn
}];
return providers;
};
}
function throwInvalidPathError(path, exampleUrls) {
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 ")}`);
}
function throwUnexpectedAbsoluteUrlError(path, url) {
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}\`).`);
}
var provideCloudflareLoader = createImageLoader(createCloudflareUrl, ngDevMode ? ["https://<ZONE>/cdn-cgi/image/<OPTIONS>/<SOURCE-IMAGE>"] : void 0);
function createCloudflareUrl(path, config) {
let params = `format=auto`;
if (config.width) {
params += `,width=${config.width}`;
}
if (config.isPlaceholder) {
params += `,quality=${PLACEHOLDER_QUALITY}`;
}
return `${path}/cdn-cgi/image/${params}/${config.src}`;
}
var cloudinaryLoaderInfo = {
name: "Cloudinary",
testUrl: isCloudinaryUrl
};
var CLOUDINARY_LOADER_REGEX = /https?\:\/\/[^\/]+\.cloudinary\.com\/.+/;
function isCloudinaryUrl(url) {
return CLOUDINARY_LOADER_REGEX.test(url);
}
var provideCloudinaryLoader = createImageLoader(createCloudinaryUrl, ngDevMode ? ["https://res.cloudinary.com/mysite", "https://mysite.cloudinary.com", "https://subdomain.mysite.com"] : void 0);
function createCloudinaryUrl(path, config) {
const quality = config.isPlaceholder ? "q_auto:low" : "q_auto";
let params = `f_auto,${quality}`;
if (config.width) {
params += `,w_${config.width}`;
}
if (config.loaderParams?.["rounded"]) {
params += `,r_max`;
}
return `${path}/image/upload/${params}/${config.src}`;
}
var imageKitLoaderInfo = {
name: "ImageKit",
testUrl: isImageKitUrl
};
var IMAGE_KIT_LOADER_REGEX = /https?\:\/\/[^\/]+\.imagekit\.io\/.+/;
function isImageKitUrl(url) {
return IMAGE_KIT_LOADER_REGEX.test(url);
}
var provideImageKitLoader = createImageLoader(createImagekitUrl, ngDevMode ? ["https://ik.imagekit.io/mysite", "https://subdomain.mysite.com"] : void 0);
function createImagekitUrl(path, config) {
const {
src,
width
} = config;
const params = [];
if (width) {
params.push(`w-${width}`);
}
if (config.isPlaceholder) {
params.push(`q-${PLACEHOLDER_QUALITY}`);
}
const urlSegments = params.length ? [path, `tr:${params.join(",")}`, src] : [path, src];
const url = new URL(urlSegments.join("/"));
return url.href;
}
var imgixLoaderInfo = {
name: "Imgix",
testUrl: isImgixUrl
};
var IMGIX_LOADER_REGEX = /https?\:\/\/[^\/]+\.imgix\.net\/.+/;
function isImgixUrl(url) {
return IMGIX_LOADER_REGEX.test(url);
}
var provideImgixLoader = createImageLoader(createImgixUrl, ngDevMode ? ["https://somepath.imgix.net/"] : void 0);
function createImgixUrl(path, config) {
const url = new URL(`${path}/${config.src}`);
url.searchParams.set("auto", "format");
if (config.width) {
url.searchParams.set("w", config.width.toString());
}
if (config.isPlaceholder) {
url.searchParams.set("q", PLACEHOLDER_QUALITY);
}
return url.href;
}
var netlifyLoaderInfo = {
name: "Netlify",
testUrl: isNetlifyUrl
};
var NETLIFY_LOADER_REGEX = /https?\:\/\/[^\/]+\.netlify\.app\/.+/;
function isNetlifyUrl(url) {
return NETLIFY_LOADER_REGEX.test(url);
}
function imgDirectiveDetails(ngSrc, includeNgSrc = true) {
const ngSrcInfo = includeNgSrc ? `(activated on an <img> element with the \`ngSrc="${ngSrc}"\`) ` : "";
return `The NgOptimizedImage directive ${ngSrcInfo}has detected that`;
}
function assertDevMode(checkName) {
if (!ngDevMode) {
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.`);
}
}
var LCPImageObserver = class _LCPImageObserver {
// Map of full image URLs -> original `ngSrc` values.
images = /* @__PURE__ */ new Map();
window = inject(DOCUMENT).defaultView;
observer = null;
constructor() {
assertDevMode("LCP checker");
if (typeof PerformanceObserver !== "undefined") {
this.observer = this.initPerformanceObserver();
}
}
/**
* Inits PerformanceObserver and subscribes to LCP events.
* Based on https://web.dev/lcp/#measure-lcp-in-javascript
*/
initPerformanceObserver() {
const observer = new PerformanceObserver((entryList) => {
const entries = entryList.getEntries();
if (entries.length === 0) return;
const lcpElement = entries[entries.length - 1];
const imgSrc = lcpElement.element?.src ?? "";
if (imgSrc.startsWith("data:") || imgSrc.startsWith("blob:")) return;
const img = this.images.get(imgSrc);
if (!img) return;
if (!img.priority && !img.alreadyWarnedPriority) {
img.alreadyWarnedPriority = true;
logMissingPriorityError(imgSrc);
}
if (img.modified && !img.alreadyWarnedModified) {
img.alreadyWarnedModified = true;
logModifiedWarning(imgSrc);
}
});
observer.observe({
type: "largest-contentful-paint",
buffered: true
});
return observer;
}
registerImage(rewrittenSrc, originalNgSrc, isPriority) {
if (!this.observer) return;
const newObservedImageState = {
priority: isPriority,
modified: false,
alreadyWarnedModified: false,
alreadyWarnedPriority: false
};
this.images.set(getUrl(rewrittenSrc, this.window).href, newObservedImageState);
}
unregisterImage(rewrittenSrc) {
if (!this.observer) return;
this.images.delete(getUrl(rewrittenSrc, this.window).href);
}
updateImage(originalSrc, newSrc) {
if (!this.observer) return;
const originalUrl = getUrl(originalSrc, this.window).href;
const img = this.images.get(originalUrl);
if (img) {
img.modified = true;
this.images.set(getUrl(newSrc, this.window).href, img);
this.images.delete(originalUrl);
}
}
ngOnDestroy() {
if (!this.observer) return;
this.observer.disconnect();
this.images.clear();
}
static \u0275fac = function LCPImageObserver_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _LCPImageObserver)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _LCPImageObserver,
factory: _LCPImageObserver.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LCPImageObserver, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
function logMissingPriorityError(ngSrc) {
const directiveDetails = imgDirectiveDetails(ngSrc);
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.`));
}
function logModifiedWarning(ngSrc) {
const directiveDetails = imgDirectiveDetails(ngSrc);
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.`));
}
var INTERNAL_PRECONNECT_CHECK_BLOCKLIST = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "0.0.0.0", "[::1]"]);
var PRECONNECT_CHECK_BLOCKLIST = new InjectionToken(ngDevMode ? "PRECONNECT_CHECK_BLOCKLIST" : "");
var PreconnectLinkChecker = class _PreconnectLinkChecker {
document = inject(DOCUMENT);
/**
* Set of <link rel="preconnect"> tags found on this page.
* The `null` value indicates that there was no DOM query operation performed.
*/
preconnectLinks = null;
/*
* Keep track of all already seen origin URLs to avoid repeating the same check.
*/
alreadySeen = /* @__PURE__ */ new Set();
window = this.document.defaultView;
blocklist = new Set(INTERNAL_PRECONNECT_CHECK_BLOCKLIST);
constructor() {
assertDevMode("preconnect link checker");
const blocklist = inject(PRECONNECT_CHECK_BLOCKLIST, {
optional: true
});
if (blocklist) {
this.populateBlocklist(blocklist);
}
}
populateBlocklist(origins) {
if (Array.isArray(origins)) {
deepForEach(origins, (origin) => {
this.blocklist.add(extractHostname(origin));
});
} else {
this.blocklist.add(extractHostname(origins));
}
}
/**
* Checks that a preconnect resource hint exists in the head for the
* given src.
*
* @param rewrittenSrc src formatted with loader
* @param originalNgSrc ngSrc value
*/
assertPreconnect(rewrittenSrc, originalNgSrc) {
if (false) return;
const imgUrl = getUrl(rewrittenSrc, this.window);
if (this.blocklist.has(imgUrl.hostname) || this.alreadySeen.has(imgUrl.origin)) return;
this.alreadySeen.add(imgUrl.origin);
this.preconnectLinks ??= this.queryPreconnectLinks();
if (!this.preconnectLinks.has(imgUrl.origin)) {
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:
<link rel="preconnect" href="${imgUrl.origin}">`));
}
}
queryPreconnectLinks() {
const preconnectUrls = /* @__PURE__ */ new Set();
const links = this.document.querySelectorAll("link[rel=preconnect]");
for (const link of links) {
const url = getUrl(link.href, this.window);
preconnectUrls.add(url.origin);
}
return preconnectUrls;
}
ngOnDestroy() {
this.preconnectLinks?.clear();
this.alreadySeen.clear();
}
static \u0275fac = function PreconnectLinkChecker_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PreconnectLinkChecker)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _PreconnectLinkChecker,
factory: _PreconnectLinkChecker.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreconnectLinkChecker, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
function deepForEach(input2, fn) {
for (let value of input2) {
Array.isArray(value) ? deepForEach(value, fn) : fn(value);
}
}
var DEFAULT_PRELOADED_IMAGES_LIMIT = 5;
var PRELOADED_IMAGES = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "NG_OPTIMIZED_PRELOADED_IMAGES" : "", {
providedIn: "root",
factory: () => /* @__PURE__ */ new Set()
});
var PreloadLinkCreator = class _PreloadLinkCreator {
preloadedImages = inject(PRELOADED_IMAGES);
document = inject(DOCUMENT);
errorShown = false;
/**
* @description Add a preload `<link>` to the `<head>` of the `index.html` that is served from the
* server while using Angular Universal and SSR to kick off image loads for high priority images.
*
* The `sizes` (passed in from the user) and `srcset` (parsed and formatted from `ngSrcset`)
* properties used to set the corresponding attributes, `imagesizes` and `imagesrcset`
* respectively, on the preload `<link>` tag so that the correctly sized image is preloaded from
* the CDN.
*
* {@link https://web.dev/preload-responsive-images/#imagesrcset-and-imagesizes}
*
* @param renderer The `Renderer2` passed in from the directive
* @param src The original src of the image that is set on the `ngSrc` input.
* @param srcset The parsed and formatted srcset created from the `ngSrcset` input
* @param sizes The value of the `sizes` attribute passed in to the `<img>` tag
*/
createPreloadLinkTag(renderer, src, srcset, sizes) {
if (ngDevMode && !this.errorShown && this.preloadedImages.size >= DEFAULT_PRELOADED_IMAGES_LIMIT) {
this.errorShown = true;
console.warn(formatRuntimeError(2961, `The \`NgOptimizedImage\` directive has detected that more than ${DEFAULT_PRELOADED_IMAGES_LIMIT} images were marked as priority. This might negatively affect an overall performance of the page. To fix this, remove the "priority" attribute from images with less priority.`));
}
if (this.preloadedImages.has(src)) {
return;
}
this.preloadedImages.add(src);
const preload = renderer.createElement("link");
renderer.setAttribute(preload, "as", "image");
renderer.setAttribute(preload, "href", src);
renderer.setAttribute(preload, "rel", "preload");
renderer.setAttribute(preload, "fetchpriority", "high");
if (sizes) {
renderer.setAttribute(preload, "imageSizes", sizes);
}
if (srcset) {
renderer.setAttribute(preload, "imageSrcset", srcset);
}
renderer.appendChild(this.document.head, preload);
}
static \u0275fac = function PreloadLinkCreator_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PreloadLinkCreator)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _PreloadLinkCreator,
factory: _PreloadLinkCreator.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreloadLinkCreator, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
var BASE64_IMG_MAX_LENGTH_IN_ERROR = 50;
var VALID_WIDTH_DESCRIPTOR_SRCSET = /^((\s*\d+w\s*(,|$)){1,})$/;
var VALID_DENSITY_DESCRIPTOR_SRCSET = /^((\s*\d+(\.\d+)?x\s*(,|$)){1,})$/;
var ABSOLUTE_SRCSET_DENSITY_CAP = 3;
var RECOMMENDED_SRCSET_DENSITY_CAP = 2;
var DENSITY_SRCSET_MULTIPLIERS = [1, 2];
var VIEWPORT_BREAKPOINT_CUTOFF = 640;
var ASPECT_RATIO_TOLERANCE = 0.1;
var OVERSIZED_IMAGE_TOLERANCE = 1e3;
var FIXED_SRCSET_WIDTH_LIMIT = 1920;
var FIXED_SRCSET_HEIGHT_LIMIT = 1080;
var PLACEHOLDER_DIMENSION_LIMIT = 1e3;
var DATA_URL_WARN_LIMIT = 4e3;
var DATA_URL_ERROR_LIMIT = 1e4;
var BUILT_IN_LOADERS = [imgixLoaderInfo, imageKitLoaderInfo, cloudinaryLoaderInfo, netlifyLoaderInfo];
var PRIORITY_COUNT_THRESHOLD = 10;
var IMGS_WITH_PRIORITY_ATTR_COUNT = 0;
var NgOptimizedImage = class _NgOptimizedImage {
imageLoader = inject(IMAGE_LOADER);
config = processConfig(inject(IMAGE_CONFIG));
renderer = inject(Renderer2);
imgElement = inject(ElementRef).nativeElement;
injector = inject(Injector);
destroyRef = inject(DestroyRef);
// An LCP image observer should be injected only in development mode.
// Do not assign it to `null` to avoid having a redundant property in the production bundle.
lcpObserver;
/**
* Calculate the rewritten `src` once and store it.
* This is needed to avoid repetitive calculations and make sure the directive cleanup in the
* `ngOnDestroy` does not rely on the `IMAGE_LOADER` logic (which in turn can rely on some other
* instance that might be already destroyed).
*/
_renderedSrc = null;
/**
* Name of the source image.
* Image name will be processed by the image loader and the final URL will be applied as the `src`
* property of the image.
*/
ngSrc;
/**
* A comma separated list of width or density descriptors.
* The image name will be taken from `ngSrc` and combined with the list of width or density
* descriptors to generate the final `srcset` property of the image.
*
* Example:
* ```html
* <img ngSrc="hello.jpg" ngSrcset="100w, 200w" /> =>
* <img src="path/hello.jpg" srcset="path/hello.jpg?w=100 100w, path/hello.jpg?w=200 200w" />
* ```
*/
ngSrcset;
/**
* The base `sizes` attribute passed through to the `<img>` element.
* Providing sizes causes the image to create an automatic responsive srcset.
*/
sizes;
/**
* For responsive images: the intrinsic width of the image in pixels.
* For fixed size images: the desired rendered width of the image in pixels.
*/
width;
/**
* For responsive images: the intrinsic height of the image in pixels.
* For fixed size images: the desired rendered height of the image in pixels.
*/
height;
/**
* The desired decoding behavior for the image. Defaults to `auto`
* if not explicitly set, matching native browser behavior.
*
* Use `async` to decode the image off the main thread (non-blocking),
* `sync` for immediate decoding (blocking), or `auto` to let the
* browser decide the optimal strategy.
*
* [Spec](https://html.spec.whatwg.org/multipage/images.html#image-decoding-hint)
*/
decoding;
/**
* The desired loading behavior (lazy, eager, or auto). Defaults to `lazy`,
* which is recommended for most images.
*
* Warning: Setting images as loading="eager" or loading="auto" marks them
* as non-priority images and can hurt loading performance. For images which
* may be the LCP element, use the `priority` attribute instead of `loading`.
*/
loading;
/**
* Indicates whether this image should have a high priority.
*/
priority = false;
/**
* Data to pass through to custom loaders.
*/
loaderParams;
/**
* Disables automatic srcset generation for this image.
*/
disableOptimizedSrcset = false;
/**
* Sets the image to "fill mode", which eliminates the height/width requirement and adds
* styles such that the image fills its containing element.
*/
fill = false;
/**
* A URL or data URL for an image to be used as a placeholder while this image loads.
*/
placeholder;
/**
* Configuration object for placeholder settings. Options:
* * blur: Setting this to false disables the automatic CSS blur.
*/
placeholderConfig;
/**
* Value of the `src` attribute if set on the host `<img>` element.
* This input is exclusively read to assert that `src` is not set in conflict
* with `ngSrc` and that images don't start to load until a lazy loading strategy is set.
* @internal
*/
src;
/**
* Value of the `srcset` attribute if set on the host `<img>` element.
* This input is exclusively read to assert that `srcset` is not set in conflict
* with `ngSrcset` and that images don't start to load until a lazy loading strategy is set.
* @internal
*/
srcset;
constructor() {
if (ngDevMode) {
this.lcpObserver = this.injector.get(LCPImageObserver);
this.destroyRef.onDestroy(() => {
if (!this.priority && this._renderedSrc !== null) {
this.lcpObserver.unregisterImage(this._renderedSrc);
}
});
}
}
/** @docs-private */
ngOnInit() {
performanceMarkFeature("NgOptimizedImage");
if (ngDevMode) {
const ngZone = this.injector.get(NgZone);
assertNonEmptyInput(this, "ngSrc", this.ngSrc);
assertValidNgSrcset(this, this.ngSrcset);
assertNoConflictingSrc(this);
if (this.ngSrcset) {
assertNoConflictingSrcset(this);
}
assertNotBase64Image(this);
assertNotBlobUrl(this);
if (this.fill) {
assertEmptyWidthAndHeight(this);
ngZone.runOutsideAngular(() => assertNonZeroRenderedHeight(this, this.imgElement, this.renderer, this.destroyRef));
} else {
assertNonEmptyWidthAndHeight(this);
if (this.height !== void 0) {
assertGreaterThanZero(this, this.height, "height");
}
if (this.width !== void 0) {
assertGreaterThanZero(this, this.width, "width");
}
ngZone.runOutsideAngular(() => assertNoImageDistortion(this, this.imgElement, this.renderer, this.destroyRef));
}
assertValidLoadingInput(this);
assertValidDecodingInput(this);
if (!this.ngSrcset) {
assertNoComplexSizes(this);
}
assertValidPlaceholder(this, this.imageLoader);
assertNotMissingBuiltInLoader(this.ngSrc, this.imageLoader);
assertNoNgSrcsetWithoutLoader(this, this.imageLoader);
assertNoLoaderParamsWithoutLoader(this, this.imageLoader);
ngZone.runOutsideAngular(() => {
this.lcpObserver.registerImage(this.getRewrittenSrc(), this.ngSrc, this.priority);
});
if (this.priority) {
const checker = this.injector.get(PreconnectLinkChecker);
checker.assertPreconnect(this.getRewrittenSrc(), this.ngSrc);
if (true) {
const applicationRef = this.injector.get(ApplicationRef);
assetPriorityCountBelowThreshold(applicationRef);
}
}
}
if (this.placeholder) {
this.removePlaceholderOnLoad(this.imgElement);
}
this.setHostAttributes();
}
setHostAttributes() {
if (this.fill) {
this.sizes ||= "100vw";
} else {
this.setHostAttribute("width", this.width.toString());
this.setHostAttribute("height", this.height.toString());
}
this.setHostAttribute("loading", this.getLoadingBehavior());
this.setHostAttribute("fetchpriority", this.getFetchPriority());
this.setHostAttribute("decoding", this.getDecoding());
this.setHostAttribute("ng-img", "true");
const rewrittenSrcset = this.updateSrcAndSrcset();
if (this.sizes) {
if (this.getLoadingBehavior() === "lazy") {
this.setHostAttribute("sizes", "auto, " + this.sizes);
} else {
this.setHostAttribute("sizes", this.sizes);
}
} else {
if (this.ngSrcset && VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset) && this.getLoadingBehavior() === "lazy") {
this.setHostAttribute("sizes", "auto, 100vw");
}
}
if (false) {
const preloadLinkCreator = this.injector.get(PreloadLinkCreator);
preloadLinkCreator.createPreloadLinkTag(this.renderer, this.getRewrittenSrc(), rewrittenSrcset, this.sizes);
}
}
/** @docs-private */
ngOnChanges(changes) {
if (ngDevMode) {
assertNoPostInitInputChange(this, changes, ["ngSrcset", "width", "height", "priority", "fill", "loading", "sizes", "loaderParams", "disableOptimizedSrcset"]);
}
if (changes["ngSrc"] && !changes["ngSrc"].isFirstChange()) {
const oldSrc = this._renderedSrc;
this.updateSrcAndSrcset(true);
if (ngDevMode) {
const newSrc = this._renderedSrc;
if (oldSrc && newSrc && oldSrc !== newSrc) {
const ngZone = this.injector.get(NgZone);
ngZone.runOutsideAngular(() => {
this.lcpObserver.updateImage(oldSrc, newSrc);
});
}
}
}
if (ngDevMode && changes["placeholder"]?.currentValue && true && true) {
assertPlaceholderDimensions(this, this.imgElement);
}
}
callImageLoader(configWithoutCustomParams) {
let augmentedConfig = configWithoutCustomParams;
if (this.loaderParams) {
augmentedConfig.loaderParams = this.loaderParams;
}
return this.imageLoader(augmentedConfig);
}
getLoadingBehavior() {
if (!this.priority && this.loading !== void 0) {
return this.loading;
}
return this.priority ? "eager" : "lazy";
}
getFetchPriority() {
return this.priority ? "high" : "auto";
}
getDecoding() {
if (this.priority) {
return "sync";
}
return this.decoding ?? "auto";
}
getRewrittenSrc() {
if (!this._renderedSrc) {
const imgConfig = {
src: this.ngSrc
};
this._renderedSrc = this.callImageLoader(imgConfig);
}
return this._renderedSrc;
}
getRewrittenSrcset() {
const widthSrcSet = VALID_WIDTH_DESCRIPTOR_SRCSET.test(this.ngSrcset);
const finalSrcs = this.ngSrcset.split(",").filter((src) => src !== "").map((srcStr) => {
srcStr = srcStr.trim();
const width = widthSrcSet ? parseFloat(srcStr) : parseFloat(srcStr) * this.width;
return `${this.callImageLoader({
src: this.ngSrc,
width
})} ${srcStr}`;
});
return finalSrcs.join(", ");
}
getAutomaticSrcset() {
if (this.sizes) {
return this.getResponsiveSrcset();
} else {
return this.getFixedSrcset();
}
}
getResponsiveSrcset() {
const {
breakpoints
} = this.config;
let filteredBreakpoints = breakpoints;
if (this.sizes?.trim() === "100vw") {
filteredBreakpoints = breakpoints.filter((bp) => bp >= VIEWPORT_BREAKPOINT_CUTOFF);
}
const finalSrcs = filteredBreakpoints.map((bp) => `${this.callImageLoader({
src: this.ngSrc,
width: bp
})} ${bp}w`);
return finalSrcs.join(", ");
}
updateSrcAndSrcset(forceSrcRecalc = false) {
if (forceSrcRecalc) {
this._renderedSrc = null;
}
const rewrittenSrc = this.getRewrittenSrc();
this.setHostAttribute("src", rewrittenSrc);
let rewrittenSrcset = void 0;
if (this.ngSrcset) {
rewrittenSrcset = this.getRewrittenSrcset();
} else if (this.shouldGenerateAutomaticSrcset()) {
rewrittenSrcset = this.getAutomaticSrcset();
}
if (rewrittenSrcset) {
this.setHostAttribute("srcset", rewrittenSrcset);
}
return rewrittenSrcset;
}
getFixedSrcset() {
const finalSrcs = DENSITY_SRCSET_MULTIPLIERS.map((multiplier) => `${this.callImageLoader({
src: this.ngSrc,
width: this.width * multiplier
})} ${multiplier}x`);
return finalSrcs.join(", ");
}
shouldGenerateAutomaticSrcset() {
let oversizedImage = false;
if (!this.sizes) {
oversizedImage = this.width > FIXED_SRCSET_WIDTH_LIMIT || this.height > FIXED_SRCSET_HEIGHT_LIMIT;
}
return !this.disableOptimizedSrcset && !this.srcset && this.imageLoader !== noopImageLoader && !oversizedImage;
}
/**
* Returns an image url formatted for use with the CSS background-image property. Expects one of:
* * A base64 encoded image, which is wrapped and passed through.
* * A boolean. If true, calls the image loader to generate a small placeholder url.
*/
generatePlaceholder(placeholderInput) {
const {
placeholderResolution
} = this.config;
if (placeholderInput === true) {
return `url(${this.callImageLoader({
src: this.ngSrc,
width: placeholderResolution,
isPlaceholder: true
})})`;
} else if (typeof placeholderInput === "string") {
return `url(${placeholderInput})`;
}
return null;
}
/**
* Determines if blur should be applied, based on an optional boolean
* property `blur` within the optional configuration object `placeholderConfig`.
*/
shouldBlurPlaceholder(placeholderConfig) {
if (!placeholderConfig || !placeholderConfig.hasOwnProperty("blur")) {
return true;
}
return Boolean(placeholderConfig.blur);
}
removePlaceholderOnLoad(img) {
const callback = () => {
const changeDetectorRef = this.injector.get(ChangeDetectorRef);
removeLoadListenerFn();
removeErrorListenerFn();
this.placeholder = false;
changeDetectorRef.markForCheck();
};
const removeLoadListenerFn = this.renderer.listen(img, "load", callback);
const removeErrorListenerFn = this.renderer.listen(img, "error", callback);
this.destroyRef.onDestroy(() => {
removeLoadListenerFn();
removeErrorListenerFn();
});
callOnLoadIfImageIsLoaded(img, callback);
}
setHostAttribute(name2, value) {
this.renderer.setAttribute(this.imgElement, name2, value);
}
static \u0275fac = function NgOptimizedImage_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NgOptimizedImage)();
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NgOptimizedImage,
selectors: [["img", "ngSrc", ""]],
hostVars: 18,
hostBindings: function NgOptimizedImage_HostBindings(rf, ctx) {
if (rf & 2) {
\u0275\u0275styleProp("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);
}
},
inputs: {
ngSrc: [2, "ngSrc", "ngSrc", unwrapSafeUrl],
ngSrcset: "ngSrcset",
sizes: "sizes",
width: [2, "width", "width", numberAttribute],
height: [2, "height", "height", numberAttribute],
decoding: "decoding",
loading: "loading",
priority: [2, "priority", "priority", booleanAttribute],
loaderParams: "loaderParams",
disableOptimizedSrcset: [2, "disableOptimizedSrcset", "disableOptimizedSrcset", booleanAttribute],
fill: [2, "fill", "fill", booleanAttribute],
placeholder: [2, "placeholder", "placeholder", booleanOrUrlAttribute],
placeholderConfig: "placeholderConfig",
src: "src",
srcset: "srcset"
},
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NgOptimizedImage, [{
type: Directive,
args: [{
selector: "img[ngSrc]",
host: {
"[style.position]": 'fill ? "absolute" : null',
"[style.width]": 'fill ? "100%" : null',
"[style.height]": 'fill ? "100%" : null',
"[style.inset]": 'fill ? "0" : null',
"[style.background-size]": 'placeholder ? "cover" : null',
"[style.background-position]": 'placeholder ? "50% 50%" : null',
"[style.background-repeat]": 'placeholder ? "no-repeat" : null',
"[style.background-image]": "placeholder ? generatePlaceholder(placeholder) : null",
"[style.filter]": 'placeholder && shouldBlurPlaceholder(placeholderConfig) ? "blur(15px)" : null'
}
}]
}], () => [], {
ngSrc: [{
type: Input,
args: [{
required: true,
transform: unwrapSafeUrl
}]
}],
ngSrcset: [{
type: Input
}],
sizes: [{
type: Input
}],
width: [{
type: Input,
args: [{
transform: numberAttribute
}]
}],
height: [{
type: Input,
args: [{
transform: numberAttribute
}]
}],
decoding: [{
type: Input
}],
loading: [{
type: Input
}],
priority: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
loaderParams: [{
type: Input
}],
disableOptimizedSrcset: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
fill: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
placeholder: [{
type: Input,
args: [{
transform: booleanOrUrlAttribute
}]
}],
placeholderConfig: [{
type: Input
}],
src: [{
type: Input
}],
srcset: [{
type: Input
}]
});
})();
function processConfig(config) {
let sortedBreakpoints = {};
if (config.breakpoints) {
sortedBreakpoints.breakpoints = config.breakpoints.sort((a, b) => a - b);
}
return Object.assign({}, IMAGE_CONFIG_DEFAULTS, config, sortedBreakpoints);
}
function assertNoConflictingSrc(dir) {
if (dir.src) {
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.`);
}
}
function assertNoConflictingSrcset(dir) {
if (dir.srcset) {
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.`);
}
}
function assertNotBase64Image(dir) {
let ngSrc = dir.ngSrc.trim();
if (ngSrc.startsWith("data:")) {
if (ngSrc.length > BASE64_IMG_MAX_LENGTH_IN_ERROR) {
ngSrc = ngSrc.substring(0, BASE64_IMG_MAX_LENGTH_IN_ERROR) + "...";
}
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.`);
}
}
function assertNoComplexSizes(dir) {
let sizes = dir.sizes;
if (sizes?.match(/((\)|,)\s|^)\d+px/)) {
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.`);
}
}
function assertValidPlaceholder(dir, imageLoader) {
assertNoPlaceholderConfigWithoutPlaceholder(dir);
assertNoRelativePlaceholderWithoutLoader(dir, imageLoader);
assertNoOversizedDataUrl(dir);
}
function assertNoPlaceholderConfigWithoutPlaceholder(dir) {
if (dir.placeholderConfig && !dir.placeholder) {
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.`);
}
}
function assertNoRelativePlaceholderWithoutLoader(dir, imageLoader) {
if (dir.placeholder === true && imageLoader === noopImageLoader) {
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.`);
}
}
function assertNoOversizedDataUrl(dir) {
if (dir.placeholder && typeof dir.placeholder === "string" && dir.placeholder.startsWith("data:")) {
if (dir.placeholder.length > DATA_URL_ERROR_LIMIT) {
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.`);
}
if (dir.placeholder.length > DATA_URL_WARN_LIMIT) {
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.`));
}
}
}
function assertNotBlobUrl(dir) {
const ngSrc = dir.ngSrc.trim();
if (ngSrc.startsWith("blob:")) {
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.`);
}
}
function assertNonEmptyInput(dir, name2, value) {
const isString = typeof value === "string";
const isEmptyString = isString && value.trim() === "";
if (!isString || isEmptyString) {
throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${name2}\` has an invalid value (\`${value}\`). To fix this, change the value to a non-empty string.`);
}
}
function assertValidNgSrcset(dir, value) {
if (value == null) return;
assertNonEmptyInput(dir, "ngSrcset", value);
const stringVal = value;
const isValidWidthDescriptor = VALID_WIDTH_DESCRIPTOR_SRCSET.test(stringVal);
const isValidDensityDescriptor = VALID_DENSITY_DESCRIPTOR_SRCSET.test(stringVal);
if (isValidDensityDescriptor) {
assertUnderDensityCap(dir, stringVal);
}
const isValidSrcset = isValidWidthDescriptor || isValidDensityDescriptor;
if (!isValidSrcset) {
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").`);
}
}
function assertUnderDensityCap(dir, value) {
const underDensityCap = value.split(",").every((num) => num === "" || parseFloat(num) <= ABSOLUTE_SRCSET_DENSITY_CAP);
if (!underDensityCap) {
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.`);
}
}
function postInitInputChangeError(dir, inputName) {
let reason;
if (inputName === "width" || inputName === "height") {
reason = `Changing \`${inputName}\` may result in different attribute value applied to the underlying image element and cause layout shifts on a page.`;
} else {
reason = `Changing the \`${inputName}\` would have no effect on the underlying image element, because the resource loading has already occurred.`;
}
return new RuntimeError(2953, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` was updated after initialization. The NgOptimizedImage directive will not react to this input change. ${reason} To fix this, either switch \`${inputName}\` to a static value or wrap the image element in an @if that is gated on the necessary value.`);
}
function assertNoPostInitInputChange(dir, changes, inputs) {
inputs.forEach((input2) => {
const isUpdated = changes.hasOwnProperty(input2);
if (isUpdated && !changes[input2].isFirstChange()) {
if (input2 === "ngSrc") {
dir = {
ngSrc: changes[input2].previousValue
};
}
throw postInitInputChangeError(dir, input2);
}
});
}
function assertGreaterThanZero(dir, inputValue, inputName) {
const validNumber = typeof inputValue === "number" && inputValue > 0;
const validString = typeof inputValue === "string" && /^\d+$/.test(inputValue.trim()) && parseInt(inputValue) > 0;
if (!validNumber && !validString) {
throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} \`${inputName}\` has an invalid value. To fix this, provide \`${inputName}\` as a number greater than 0.`);
}
}
function assertNoImageDistortion(dir, img, renderer, destroyRef) {
const callback = () => {
removeLoadListenerFn();
removeErrorListenerFn();
const computedStyle = window.getComputedStyle(img);
let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
const boxSizing = computedStyle.getPropertyValue("box-sizing");
if (boxSizing === "border-box") {
const paddingTop = computedStyle.getPropertyValue("padding-top");
const paddingRight = computedStyle.getPropertyValue("padding-right");
const paddingBottom = computedStyle.getPropertyValue("padding-bottom");
const paddingLeft = computedStyle.getPropertyValue("padding-left");
renderedWidth -= parseFloat(paddingRight) + parseFloat(paddingLeft);
renderedHeight -= parseFloat(paddingTop) + parseFloat(paddingBottom);
}
const renderedAspectRatio = renderedWidth / renderedHeight;
const nonZeroRenderedDimensions = renderedWidth !== 0 && renderedHeight !== 0;
const intrinsicWidth = img.naturalWidth;
const intrinsicHeight = img.naturalHeight;
const intrinsicAspectRatio = intrinsicWidth / intrinsicHeight;
const suppliedWidth = dir.width;
const suppliedHeight = dir.height;
const suppliedAspectRatio = suppliedWidth / suppliedHeight;
const inaccurateDimensions = Math.abs(suppliedAspectRatio - intrinsicAspectRatio) > ASPECT_RATIO_TOLERANCE;
const stylingDistortion = nonZeroRenderedDimensions && Math.abs(intrinsicAspectRatio - renderedAspectRatio) > ASPECT_RATIO_TOLERANCE;
if (inaccurateDimensions) {
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.
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}).
Supplied width and height attributes: ${suppliedWidth}w x ${suppliedHeight}h (aspect-ratio: ${round(suppliedAspectRatio)}).
To fix this, update the width and height attributes.`));
} else if (stylingDistortion) {
console.warn(formatRuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the aspect ratio of the rendered image does not match the image's intrinsic aspect ratio.
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h (aspect-ratio: ${round(intrinsicAspectRatio)}).
Rendered image size: ${renderedWidth}w x ${renderedHeight}h (aspect-ratio: ${round(renderedAspectRatio)}).
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.`));
} else if (!dir.ngSrcset && nonZeroRenderedDimensions) {
const recommendedWidth = RECOMMENDED_SRCSET_DENSITY_CAP * renderedWidth;
const recommendedHeight = RECOMMENDED_SRCSET_DENSITY_CAP * renderedHeight;
const oversizedWidth = intrinsicWidth - recommendedWidth >= OVERSIZED_IMAGE_TOLERANCE;
const oversizedHeight = intrinsicHeight - recommendedHeight >= OVERSIZED_IMAGE_TOLERANCE;
if (oversizedWidth || oversizedHeight) {
console.warn(formatRuntimeError(2960, `${imgDirectiveDetails(dir.ngSrc)} the intrinsic image is significantly larger than necessary.
Rendered image size: ${renderedWidth}w x ${renderedHeight}h.
Intrinsic image size: ${intrinsicWidth}w x ${intrinsicHeight}h.
Recommended intrinsic image size: ${recommendedWidth}w x ${recommendedHeight}h.
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.`));
}
}
};
const removeLoadListenerFn = renderer.listen(img, "load", callback);
const removeErrorListenerFn = renderer.listen(img, "error", () => {
removeLoadListenerFn();
removeErrorListenerFn();
});
destroyRef.onDestroy(() => {
removeLoadListenerFn();
removeErrorListenerFn();
});
callOnLoadIfImageIsLoaded(img, callback);
}
function assertNonEmptyWidthAndHeight(dir) {
let missingAttributes = [];
if (dir.width === void 0) missingAttributes.push("width");
if (dir.height === void 0) missingAttributes.push("height");
if (missingAttributes.length > 0) {
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.`);
}
}
function assertEmptyWidthAndHeight(dir) {
if (dir.width || dir.height) {
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.`);
}
}
function assertNonZeroRenderedHeight(dir, img, renderer, destroyRef) {
const callback = () => {
removeLoadListenerFn();
removeErrorListenerFn();
const renderedHeight = img.clientHeight;
if (dir.fill && renderedHeight === 0) {
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.`));
}
};
const removeLoadListenerFn = renderer.listen(img, "load", callback);
const removeErrorListenerFn = renderer.listen(img, "error", () => {
removeLoadListenerFn();
removeErrorListenerFn();
});
destroyRef.onDestroy(() => {
removeLoadListenerFn();
removeErrorListenerFn();
});
callOnLoadIfImageIsLoaded(img, callback);
}
function assertValidLoadingInput(dir) {
if (dir.loading && dir.priority) {
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 \u201Cloading\u201D attribute from the priority image.`);
}
const validInputs = ["auto", "eager", "lazy"];
if (typeof dir.loading === "string" && !validInputs.includes(dir.loading)) {
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").`);
}
}
function assertValidDecodingInput(dir) {
const validInputs = ["sync", "async", "auto"];
if (typeof dir.decoding === "string" && !validInputs.includes(dir.decoding)) {
throw new RuntimeError(2952, `${imgDirectiveDetails(dir.ngSrc)} the \`decoding\` attribute has an invalid value (\`${dir.decoding}\`). To fix this, provide a valid value ("sync", "async", or "auto").`);
}
}
function assertNotMissingBuiltInLoader(ngSrc, imageLoader) {
if (imageLoader === noopImageLoader) {
let builtInLoaderName = "";
for (const loader of BUILT_IN_LOADERS) {
if (loader.testUrl(ngSrc)) {
builtInLoaderName = loader.name;
break;
}
}
if (builtInLoaderName) {
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.`));
}
}
}
function assertNoNgSrcsetWithoutLoader(dir, imageLoader) {
if (dir.ngSrcset && imageLoader === noopImageLoader) {
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.`));
}
}
function assertNoLoaderParamsWithoutLoader(dir, imageLoader) {
if (dir.loaderParams && imageLoader === noopImageLoader) {
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.`));
}
}
function assetPriorityCountBelowThreshold(appRef) {
return __async(this, null, function* () {
if (IMGS_WITH_PRIORITY_ATTR_COUNT === 0) {
IMGS_WITH_PRIORITY_ATTR_COUNT++;
yield appRef.whenStable();
if (IMGS_WITH_PRIORITY_ATTR_COUNT > PRIORITY_COUNT_THRESHOLD) {
console.warn(formatRuntimeError(2966, `NgOptimizedImage: The "priority" attribute is set to true more than ${PRIORITY_COUNT_THRESHOLD} times (${IMGS_WITH_PRIORITY_ATTR_COUNT} times). Marking too many images as "high" priority can hurt your application's LCP (https://web.dev/lcp). "Priority" should only be set on the image expected to be the page's LCP element.`));
}
} else {
IMGS_WITH_PRIORITY_ATTR_COUNT++;
}
});
}
function assertPlaceholderDimensions(dir, imgElement) {
const computedStyle = window.getComputedStyle(imgElement);
let renderedWidth = parseFloat(computedStyle.getPropertyValue("width"));
let renderedHeight = parseFloat(computedStyle.getPropertyValue("height"));
if (renderedWidth > PLACEHOLDER_DIMENSION_LIMIT || renderedHeight > PLACEHOLDER_DIMENSION_LIMIT) {
console.warn(formatRuntimeError(2967, `${imgDirectiveDetails(dir.ngSrc)} it uses a placeholder image, but at least one of the dimensions attribute (height or width) exceeds the limit of ${PLACEHOLDER_DIMENSION_LIMIT}px. To fix this, use a smaller image as a placeholder.`));
}
}
function callOnLoadIfImageIsLoaded(img, callback) {
if (img.complete && img.naturalWidth) {
callback();
}
}
function round(input2) {
return Number.isInteger(input2) ? input2 : input2.toFixed(2);
}
function unwrapSafeUrl(value) {
if (typeof value === "string") {
return value;
}
return unwrapSafeValue(value);
}
function booleanOrUrlAttribute(value) {
if (typeof value === "string" && value !== "true" && value !== "false" && value !== "") {
return value;
}
return booleanAttribute(value);
}
// node_modules/@angular/platform-browser/fesm2022/dom_renderer.mjs
var EventManagerPlugin = class {
_doc;
// TODO: remove (has some usage in G3)
constructor(_doc) {
this._doc = _doc;
}
// Using non-null assertion because it's set by EventManager's constructor
manager;
};
var DomEventsPlugin = class _DomEventsPlugin extends EventManagerPlugin {
constructor(doc) {
super(doc);
}
// This plugin should come last in the list of plugins, because it accepts all
// events.
supports(eventName) {
return true;
}
addEventListener(element, eventName, handler, options) {
element.addEventListener(eventName, handler, options);
return () => this.removeEventListener(element, eventName, handler, options);
}
removeEventListener(target, eventName, callback, options) {
return target.removeEventListener(eventName, callback, options);
}
static \u0275fac = function DomEventsPlugin_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DomEventsPlugin)(\u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DomEventsPlugin,
factory: _DomEventsPlugin.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomEventsPlugin, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
var EVENT_MANAGER_PLUGINS = new InjectionToken(ngDevMode ? "EventManagerPlugins" : "");
var EventManager = class _EventManager {
_zone;
_plugins;
_eventNameToPlugin = /* @__PURE__ */ new Map();
/**
* Initializes an instance of the event-manager service.
*/
constructor(plugins, _zone) {
this._zone = _zone;
plugins.forEach((plugin) => {
plugin.manager = this;
});
const otherPlugins = plugins.filter((p) => !(p instanceof DomEventsPlugin));
this._plugins = otherPlugins.slice().reverse();
const domEventPlugin = plugins.find((p) => p instanceof DomEventsPlugin);
if (domEventPlugin) {
this._plugins.push(domEventPlugin);
}
}
/**
* Registers a handler for a specific element and event.
*
* @param element The HTML element to receive event notifications.
* @param eventName The name of the event to listen for.
* @param handler A function to call when the notification occurs. Receives the
* event object as an argument.
* @param options Options that configure how the event listener is bound.
* @returns A callback function that can be used to remove the handler.
*/
addEventListener(element, eventName, handler, options) {
const plugin = this._findPluginFor(eventName);
return plugin.addEventListener(element, eventName, handler, options);
}
/**
* Retrieves the compilation zone in which event listeners are registered.
*/
getZone() {
return this._zone;
}
/** @internal */
_findPluginFor(eventName) {
let plugin = this._eventNameToPlugin.get(eventName);
if (plugin) {
return plugin;
}
const plugins = this._plugins;
plugin = plugins.find((plugin2) => plugin2.supports(eventName));
if (!plugin) {
throw new RuntimeError(5101, (typeof ngDevMode === "undefined" || ngDevMode) && `No event manager plugin found for event ${eventName}`);
}
this._eventNameToPlugin.set(eventName, plugin);
return plugin;
}
static \u0275fac = function EventManager_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _EventManager)(\u0275\u0275inject(EVENT_MANAGER_PLUGINS), \u0275\u0275inject(NgZone));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _EventManager,
factory: _EventManager.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(EventManager, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [EVENT_MANAGER_PLUGINS]
}]
}, {
type: NgZone
}], null);
})();
var APP_ID_ATTRIBUTE_NAME = "ng-app-id";
function removeElements(elements) {
for (const element of elements) {
element.remove();
}
}
function createStyleElement(style, doc) {
const styleElement = doc.createElement("style");
styleElement.textContent = style;
return styleElement;
}
function addServerStyles(doc, appId, inline, external) {
const elements = doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${appId}"],link[${APP_ID_ATTRIBUTE_NAME}="${appId}"]`);
if (elements) {
for (const styleElement of elements) {
styleElement.removeAttribute(APP_ID_ATTRIBUTE_NAME);
if (styleElement instanceof HTMLLinkElement) {
external.set(styleElement.href.slice(styleElement.href.lastIndexOf("/") + 1), {
usage: 0,
elements: [styleElement]
});
} else if (styleElement.textContent) {
inline.set(styleElement.textContent, {
usage: 0,
elements: [styleElement]
});
}
}
}
}
function createLinkElement(url, doc) {
const linkElement = doc.createElement("link");
linkElement.setAttribute("rel", "stylesheet");
linkElement.setAttribute("href", url);
return linkElement;
}
var SharedStylesHost = class _SharedStylesHost {
doc;
appId;
nonce;
/**
* Provides usage information for active inline style content and associated HTML <style> elements.
* Embedded styles typically originate from the `styles` metadata of a rendered component.
*/
inline = /* @__PURE__ */ new Map();
/**
* Provides usage information for active external style URLs and the associated HTML <link> elements.
* External styles typically originate from the `ɵɵExternalStylesFeature` of a rendered component.
*/
external = /* @__PURE__ */ new Map();
/**
* Set of host DOM nodes that will have styles attached.
*/
hosts = /* @__PURE__ */ new Set();
constructor(doc, appId, nonce, platformId = {}) {
this.doc = doc;
this.appId = appId;
this.nonce = nonce;
addServerStyles(doc, appId, this.inline, this.external);
this.hosts.add(doc.head);
}
/**
* Adds embedded styles to the DOM via HTML `style` elements.
* @param styles An array of style content strings.
*/
addStyles(styles, urls) {
for (const value of styles) {
this.addUsage(value, this.inline, createStyleElement);
}
urls?.forEach((value) => this.addUsage(value, this.external, createLinkElement));
}
/**
* Removes embedded styles from the DOM that were added as HTML `style` elements.
* @param styles An array of style content strings.
*/
removeStyles(styles, urls) {
for (const value of styles) {
this.removeUsage(value, this.inline);
}
urls?.forEach((value) => this.removeUsage(value, this.external));
}
addUsage(value, usages, creator) {
const record2 = usages.get(value);
if (record2) {
if ((typeof ngDevMode === "undefined" || ngDevMode) && record2.usage === 0) {
record2.elements.forEach((element) => element.setAttribute("ng-style-reused", ""));
}
record2.usage++;
} else {
usages.set(value, {
usage: 1,
elements: [...this.hosts].map((host) => this.addElement(host, creator(value, this.doc)))
});
}
}
removeUsage(value, usages) {
const record2 = usages.get(value);
if (record2) {
record2.usage--;
if (record2.usage <= 0) {
removeElements(record2.elements);
usages.delete(value);
}
}
}
ngOnDestroy() {
for (const [, {
elements
}] of [...this.inline, ...this.external]) {
removeElements(elements);
}
this.hosts.clear();
}
/**
* Adds a host node to the set of style hosts and adds all existing style usage to
* the newly added host node.
*
* This is currently only used for Shadow DOM encapsulation mode.
*/
addHost(hostNode) {
this.hosts.add(hostNode);
for (const [style, {
elements
}] of this.inline) {
elements.push(this.addElement(hostNode, createStyleElement(style, this.doc)));
}
for (const [url, {
elements
}] of this.external) {
elements.push(this.addElement(hostNode, createLinkElement(url, this.doc)));
}
}
removeHost(hostNode) {
this.hosts.delete(hostNode);
}
addElement(host, element) {
if (this.nonce) {
element.setAttribute("nonce", this.nonce);
}
if (false) {
element.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
}
return host.appendChild(element);
}
static \u0275fac = function SharedStylesHost_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _SharedStylesHost)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(APP_ID), \u0275\u0275inject(CSP_NONCE, 8), \u0275\u0275inject(PLATFORM_ID));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _SharedStylesHost,
factory: _SharedStylesHost.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SharedStylesHost, [{
type: Injectable
}], () => [{
type: Document,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [APP_ID]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [CSP_NONCE]
}, {
type: Optional
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [PLATFORM_ID]
}]
}], null);
})();
var NAMESPACE_URIS = {
"svg": "http://www.w3.org/2000/svg",
"xhtml": "http://www.w3.org/1999/xhtml",
"xlink": "http://www.w3.org/1999/xlink",
"xml": "http://www.w3.org/XML/1998/namespace",
"xmlns": "http://www.w3.org/2000/xmlns/",
"math": "http://www.w3.org/1998/Math/MathML"
};
var COMPONENT_REGEX = /%COMP%/g;
var SOURCEMAP_URL_REGEXP = /\/\*#\s*sourceMappingURL=(.+?)\s*\*\//;
var PROTOCOL_REGEXP = /^https?:/;
var COMPONENT_VARIABLE = "%COMP%";
var HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
var CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
var REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
var REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(ngDevMode ? "RemoveStylesOnCompDestroy" : "", {
providedIn: "root",
factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT
});
function shimContentAttribute(componentShortId) {
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function shimHostAttribute(componentShortId) {
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function shimStylesContent(compId, styles) {
return styles.map((s) => s.replace(COMPONENT_REGEX, compId));
}
function addBaseHrefToCssSourceMap(baseHref, styles) {
if (!baseHref) {
return styles;
}
const absoluteBaseHrefUrl = new URL(baseHref, "http://localhost");
return styles.map((cssContent) => {
if (!cssContent.includes("sourceMappingURL=")) {
return cssContent;
}
return cssContent.replace(SOURCEMAP_URL_REGEXP, (_, sourceMapUrl) => {
if (sourceMapUrl[0] === "/" || sourceMapUrl.startsWith("data:") || PROTOCOL_REGEXP.test(sourceMapUrl)) {
return `/*# sourceMappingURL=${sourceMapUrl} */`;
}
const {
pathname: resolvedSourceMapUrl
} = new URL(sourceMapUrl, absoluteBaseHrefUrl);
return `/*# sourceMappingURL=${resolvedSourceMapUrl} */`;
});
});
}
var DomRendererFactory2 = class _DomRendererFactory2 {
eventManager;
sharedStylesHost;
appId;
removeStylesOnCompDestroy;
doc;
ngZone;
nonce;
tracingService;
rendererByCompId = /* @__PURE__ */ new Map();
defaultRenderer;
platformIsServer;
constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, ngZone, nonce = null, tracingService = null) {
this.eventManager = eventManager;
this.sharedStylesHost = sharedStylesHost;
this.appId = appId;
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
this.doc = doc;
this.ngZone = ngZone;
this.nonce = nonce;
this.tracingService = tracingService;
this.platformIsServer = false;
this.defaultRenderer = new DefaultDomRenderer2(eventManager, doc, ngZone, this.platformIsServer, this.tracingService);
}
createRenderer(element, type) {
if (!element || !type) {
return this.defaultRenderer;
}
if (false) {
type = __spreadProps(__spreadValues({}, type), {
encapsulation: ViewEncapsulation.Emulated
});
}
const renderer = this.getOrCreateRenderer(element, type);
if (renderer instanceof EmulatedEncapsulationDomRenderer2) {
renderer.applyToHost(element);
} else if (renderer instanceof NoneEncapsulationDomRenderer) {
renderer.applyStyles();
}
return renderer;
}
getOrCreateRenderer(element, type) {
const rendererByCompId = this.rendererByCompId;
let renderer = rendererByCompId.get(type.id);
if (!renderer) {
const doc = this.doc;
const ngZone = this.ngZone;
const eventManager = this.eventManager;
const sharedStylesHost = this.sharedStylesHost;
const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;
const platformIsServer = this.platformIsServer;
const tracingService = this.tracingService;
switch (type.encapsulation) {
case ViewEncapsulation.Emulated:
renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
break;
case ViewEncapsulation.ShadowDom:
return new ShadowDomRenderer(eventManager, sharedStylesHost, element, type, doc, ngZone, this.nonce, platformIsServer, tracingService);
default:
renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService);
break;
}
rendererByCompId.set(type.id, renderer);
}
return renderer;
}
ngOnDestroy() {
this.rendererByCompId.clear();
}
/**
* Used during HMR to clear any cached data about a component.
* @param componentId ID of the component that is being replaced.
*/
componentReplaced(componentId) {
this.rendererByCompId.delete(componentId);
}
static \u0275fac = function DomRendererFactory2_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DomRendererFactory2)(\u0275\u0275inject(EventManager), \u0275\u0275inject(SharedStylesHost), \u0275\u0275inject(APP_ID), \u0275\u0275inject(REMOVE_STYLES_ON_COMPONENT_DESTROY), \u0275\u0275inject(DOCUMENT), \u0275\u0275inject(NgZone), \u0275\u0275inject(CSP_NONCE), \u0275\u0275inject(TracingService, 8));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DomRendererFactory2,
factory: _DomRendererFactory2.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomRendererFactory2, [{
type: Injectable
}], () => [{
type: EventManager
}, {
type: SharedStylesHost
}, {
type: void 0,
decorators: [{
type: Inject,
args: [APP_ID]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [REMOVE_STYLES_ON_COMPONENT_DESTROY]
}]
}, {
type: Document,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}, {
type: NgZone
}, {
type: void 0,
decorators: [{
type: Inject,
args: [CSP_NONCE]
}]
}, {
type: TracingService,
decorators: [{
type: Inject,
args: [TracingService]
}, {
type: Optional
}]
}], null);
})();
var DefaultDomRenderer2 = class {
eventManager;
doc;
ngZone;
platformIsServer;
tracingService;
data = /* @__PURE__ */ Object.create(null);
/**
* By default this renderer throws when encountering synthetic properties
* This can be disabled for example by the AsyncAnimationRendererFactory
*/
throwOnSyntheticProps = true;
constructor(eventManager, doc, ngZone, platformIsServer, tracingService) {
this.eventManager = eventManager;
this.doc = doc;
this.ngZone = ngZone;
this.platformIsServer = platformIsServer;
this.tracingService = tracingService;
}
destroy() {
}
destroyNode = null;
createElement(name2, namespace) {
if (namespace) {
return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name2);
}
return this.doc.createElement(name2);
}
createComment(value) {
return this.doc.createComment(value);
}
createText(value) {
return this.doc.createTextNode(value);
}
appendChild(parent, newChild) {
const targetParent = isTemplateNode(parent) ? parent.content : parent;
targetParent.appendChild(newChild);
}
insertBefore(parent, newChild, refChild) {
if (parent) {
const targetParent = isTemplateNode(parent) ? parent.content : parent;
targetParent.insertBefore(newChild, refChild);
}
}
removeChild(_parent, oldChild) {
oldChild.remove();
}
selectRootElement(selectorOrNode, preserveContent) {
let el = typeof selectorOrNode === "string" ? this.doc.querySelector(selectorOrNode) : selectorOrNode;
if (!el) {
throw new RuntimeError(-5104, (typeof ngDevMode === "undefined" || ngDevMode) && `The selector "${selectorOrNode}" did not match any elements`);
}
if (!preserveContent) {
el.textContent = "";
}
return el;
}
parentNode(node) {
return node.parentNode;
}
nextSibling(node) {
return node.nextSibling;
}
setAttribute(el, name2, value, namespace) {
if (namespace) {
name2 = namespace + ":" + name2;
const namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.setAttributeNS(namespaceUri, name2, value);
} else {
el.setAttribute(name2, value);
}
} else {
el.setAttribute(name2, value);
}
}
removeAttribute(el, name2, namespace) {
if (namespace) {
const namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.removeAttributeNS(namespaceUri, name2);
} else {
el.removeAttribute(`${namespace}:${name2}`);
}
} else {
el.removeAttribute(name2);
}
}
addClass(el, name2) {
el.classList.add(name2);
}
removeClass(el, name2) {
el.classList.remove(name2);
}
setStyle(el, style, value, flags) {
if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? "important" : "");
} else {
el.style[style] = value;
}
}
removeStyle(el, style, flags) {
if (flags & RendererStyleFlags2.DashCase) {
el.style.removeProperty(style);
} else {
el.style[style] = "";
}
}
setProperty(el, name2, value) {
if (el == null) {
return;
}
(typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(name2, "property");
el[name2] = value;
}
setValue(node, value) {
node.nodeValue = value;
}
listen(target, event, callback, options) {
(typeof ngDevMode === "undefined" || ngDevMode) && this.throwOnSyntheticProps && checkNoSyntheticProp(event, "listener");
if (typeof target === "string") {
target = getDOM().getGlobalEventTarget(this.doc, target);
if (!target) {
throw new RuntimeError(5102, (typeof ngDevMode === "undefined" || ngDevMode) && `Unsupported event target ${target} for event ${event}`);
}
}
let wrappedCallback = this.decoratePreventDefault(callback);
if (this.tracingService?.wrapEventListener) {
wrappedCallback = this.tracingService.wrapEventListener(target, event, wrappedCallback);
}
return this.eventManager.addEventListener(target, event, wrappedCallback, options);
}
decoratePreventDefault(eventHandler) {
return (event) => {
if (event === "__ngUnwrap__") {
return eventHandler;
}
const allowDefaultBehavior = false ? this.ngZone.runGuarded(() => eventHandler(event)) : eventHandler(event);
if (allowDefaultBehavior === false) {
event.preventDefault();
}
return void 0;
};
}
};
var AT_CHARCODE = (() => "@".charCodeAt(0))();
function checkNoSyntheticProp(name2, nameKind) {
if (name2.charCodeAt(0) === AT_CHARCODE) {
throw new RuntimeError(5105, `Unexpected synthetic ${nameKind} ${name2} found. Please make sure that:
- Make sure \`provideAnimationsAsync()\`, \`provideAnimations()\` or \`provideNoopAnimations()\` call was added to a list of providers used to bootstrap an application.
- There is a corresponding animation configuration named \`${name2}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.dev/api/core/Component#animations).`);
}
}
function isTemplateNode(node) {
return node.tagName === "TEMPLATE" && node.content !== void 0;
}
var ShadowDomRenderer = class extends DefaultDomRenderer2 {
sharedStylesHost;
hostEl;
shadowRoot;
constructor(eventManager, sharedStylesHost, hostEl, component, doc, ngZone, nonce, platformIsServer, tracingService) {
super(eventManager, doc, ngZone, platformIsServer, tracingService);
this.sharedStylesHost = sharedStylesHost;
this.hostEl = hostEl;
this.shadowRoot = hostEl.attachShadow({
mode: "open"
});
this.sharedStylesHost.addHost(this.shadowRoot);
let styles = component.styles;
if (ngDevMode) {
const baseHref = getDOM().getBaseHref(doc) ?? "";
styles = addBaseHrefToCssSourceMap(baseHref, styles);
}
styles = shimStylesContent(component.id, styles);
for (const style of styles) {
const styleEl = document.createElement("style");
if (nonce) {
styleEl.setAttribute("nonce", nonce);
}
styleEl.textContent = style;
this.shadowRoot.appendChild(styleEl);
}
const styleUrls = component.getExternalStyles?.();
if (styleUrls) {
for (const styleUrl of styleUrls) {
const linkEl = createLinkElement(styleUrl, doc);
if (nonce) {
linkEl.setAttribute("nonce", nonce);
}
this.shadowRoot.appendChild(linkEl);
}
}
}
nodeOrShadowRoot(node) {
return node === this.hostEl ? this.shadowRoot : node;
}
appendChild(parent, newChild) {
return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
}
insertBefore(parent, newChild, refChild) {
return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
}
removeChild(_parent, oldChild) {
return super.removeChild(null, oldChild);
}
parentNode(node) {
return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
}
destroy() {
this.sharedStylesHost.removeHost(this.shadowRoot);
}
};
var NoneEncapsulationDomRenderer = class extends DefaultDomRenderer2 {
sharedStylesHost;
removeStylesOnCompDestroy;
styles;
styleUrls;
constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId) {
super(eventManager, doc, ngZone, platformIsServer, tracingService);
this.sharedStylesHost = sharedStylesHost;
this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
let styles = component.styles;
if (ngDevMode) {
const baseHref = getDOM().getBaseHref(doc) ?? "";
styles = addBaseHrefToCssSourceMap(baseHref, styles);
}
this.styles = compId ? shimStylesContent(compId, styles) : styles;
this.styleUrls = component.getExternalStyles?.(compId);
}
applyStyles() {
this.sharedStylesHost.addStyles(this.styles, this.styleUrls);
}
destroy() {
if (!this.removeStylesOnCompDestroy) {
return;
}
if (allLeavingAnimations.size === 0) {
this.sharedStylesHost.removeStyles(this.styles, this.styleUrls);
}
}
};
var EmulatedEncapsulationDomRenderer2 = class extends NoneEncapsulationDomRenderer {
contentAttr;
hostAttr;
constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService) {
const compId = appId + "-" + component.id;
super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, tracingService, compId);
this.contentAttr = shimContentAttribute(compId);
this.hostAttr = shimHostAttribute(compId);
}
applyToHost(element) {
this.applyStyles();
this.setAttribute(element, this.hostAttr, "");
}
createElement(parent, name2) {
const el = super.createElement(parent, name2);
super.setAttribute(el, this.contentAttr, "");
return el;
}
};
// node_modules/@angular/platform-browser/fesm2022/browser.mjs
var BrowserDomAdapter = class _BrowserDomAdapter extends DomAdapter {
supportsDOMEvents = true;
static makeCurrent() {
setRootDomAdapter(new _BrowserDomAdapter());
}
onAndCancel(el, evt, listener, options) {
el.addEventListener(evt, listener, options);
return () => {
el.removeEventListener(evt, listener, options);
};
}
dispatchEvent(el, evt) {
el.dispatchEvent(evt);
}
remove(node) {
node.remove();
}
createElement(tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElement(tagName);
}
createHtmlDocument() {
return document.implementation.createHTMLDocument("fakeTitle");
}
getDefaultDocument() {
return document;
}
isElementNode(node) {
return node.nodeType === Node.ELEMENT_NODE;
}
isShadowRoot(node) {
return node instanceof DocumentFragment;
}
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
getGlobalEventTarget(doc, target) {
if (target === "window") {
return window;
}
if (target === "document") {
return doc;
}
if (target === "body") {
return doc.body;
}
return null;
}
getBaseHref(doc) {
const href = getBaseElementHref();
return href == null ? null : relativePath(href);
}
resetBaseElement() {
baseElement = null;
}
getUserAgent() {
return window.navigator.userAgent;
}
getCookie(name2) {
return parseCookieValue(document.cookie, name2);
}
};
var baseElement = null;
function getBaseElementHref() {
baseElement = baseElement || document.head.querySelector("base");
return baseElement ? baseElement.getAttribute("href") : null;
}
function relativePath(url) {
return new URL(url, document.baseURI).pathname;
}
var BrowserGetTestability = class {
addToWindow(registry) {
_global["getAngularTestability"] = (elem, findInAncestors = true) => {
const testability = registry.findTestabilityInTree(elem, findInAncestors);
if (testability == null) {
throw new RuntimeError(5103, (typeof ngDevMode === "undefined" || ngDevMode) && "Could not find testability for element.");
}
return testability;
};
_global["getAllAngularTestabilities"] = () => registry.getAllTestabilities();
_global["getAllAngularRootElements"] = () => registry.getAllRootElements();
const whenAllStable = (callback) => {
const testabilities = _global["getAllAngularTestabilities"]();
let count = testabilities.length;
const decrement = function() {
count--;
if (count == 0) {
callback();
}
};
testabilities.forEach((testability) => {
testability.whenStable(decrement);
});
};
if (!_global["frameworkStabilizers"]) {
_global["frameworkStabilizers"] = [];
}
_global["frameworkStabilizers"].push(whenAllStable);
}
findTestabilityInTree(registry, elem, findInAncestors) {
if (elem == null) {
return null;
}
const t = registry.getTestability(elem);
if (t != null) {
return t;
} else if (!findInAncestors) {
return null;
}
if (getDOM().isShadowRoot(elem)) {
return this.findTestabilityInTree(registry, elem.host, true);
}
return this.findTestabilityInTree(registry, elem.parentElement, true);
}
};
var BrowserXhr = class _BrowserXhr {
build() {
return new XMLHttpRequest();
}
static \u0275fac = function BrowserXhr_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _BrowserXhr)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _BrowserXhr,
factory: _BrowserXhr.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserXhr, [{
type: Injectable
}], null, null);
})();
var MODIFIER_KEYS = ["alt", "control", "meta", "shift"];
var _keyMap = {
"\b": "Backspace",
" ": "Tab",
"\x7F": "Delete",
"\x1B": "Escape",
"Del": "Delete",
"Esc": "Escape",
"Left": "ArrowLeft",
"Right": "ArrowRight",
"Up": "ArrowUp",
"Down": "ArrowDown",
"Menu": "ContextMenu",
"Scroll": "ScrollLock",
"Win": "OS"
};
var MODIFIER_KEY_GETTERS = {
"alt": (event) => event.altKey,
"control": (event) => event.ctrlKey,
"meta": (event) => event.metaKey,
"shift": (event) => event.shiftKey
};
var KeyEventsPlugin = class _KeyEventsPlugin extends EventManagerPlugin {
/**
* Initializes an instance of the browser plug-in.
* @param doc The document in which key events will be detected.
*/
constructor(doc) {
super(doc);
}
/**
* Reports whether a named key event is supported.
* @param eventName The event name to query.
* @return True if the named key event is supported.
*/
supports(eventName) {
return _KeyEventsPlugin.parseEventName(eventName) != null;
}
/**
* Registers a handler for a specific element and key event.
* @param element The HTML element to receive event notifications.
* @param eventName The name of the key event to listen for.
* @param handler A function to call when the notification occurs. Receives the
* event object as an argument.
* @returns The key event that was registered.
*/
addEventListener(element, eventName, handler, options) {
const parsedEvent = _KeyEventsPlugin.parseEventName(eventName);
const outsideHandler = _KeyEventsPlugin.eventCallback(parsedEvent["fullKey"], handler, this.manager.getZone());
return this.manager.getZone().runOutsideAngular(() => {
return getDOM().onAndCancel(element, parsedEvent["domEventName"], outsideHandler, options);
});
}
/**
* Parses the user provided full keyboard event definition and normalizes it for
* later internal use. It ensures the string is all lowercase, converts special
* characters to a standard spelling, and orders all the values consistently.
*
* @param eventName The name of the key event to listen for.
* @returns an object with the full, normalized string, and the dom event name
* or null in the case when the event doesn't match a keyboard event.
*/
static parseEventName(eventName) {
const parts = eventName.toLowerCase().split(".");
const domEventName = parts.shift();
if (parts.length === 0 || !(domEventName === "keydown" || domEventName === "keyup")) {
return null;
}
const key = _KeyEventsPlugin._normalizeKey(parts.pop());
let fullKey = "";
let codeIX = parts.indexOf("code");
if (codeIX > -1) {
parts.splice(codeIX, 1);
fullKey = "code.";
}
MODIFIER_KEYS.forEach((modifierName) => {
const index = parts.indexOf(modifierName);
if (index > -1) {
parts.splice(index, 1);
fullKey += modifierName + ".";
}
});
fullKey += key;
if (parts.length != 0 || key.length === 0) {
return null;
}
const result = {};
result["domEventName"] = domEventName;
result["fullKey"] = fullKey;
return result;
}
/**
* Determines whether the actual keys pressed match the configured key code string.
* The `fullKeyCode` event is normalized in the `parseEventName` method when the
* event is attached to the DOM during the `addEventListener` call. This is unseen
* by the end user and is normalized for internal consistency and parsing.
*
* @param event The keyboard event.
* @param fullKeyCode The normalized user defined expected key event string
* @returns boolean.
*/
static matchEventFullKeyCode(event, fullKeyCode) {
let keycode = _keyMap[event.key] || event.key;
let key = "";
if (fullKeyCode.indexOf("code.") > -1) {
keycode = event.code;
key = "code.";
}
if (keycode == null || !keycode) return false;
keycode = keycode.toLowerCase();
if (keycode === " ") {
keycode = "space";
} else if (keycode === ".") {
keycode = "dot";
}
MODIFIER_KEYS.forEach((modifierName) => {
if (modifierName !== keycode) {
const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
if (modifierGetter(event)) {
key += modifierName + ".";
}
}
});
key += keycode;
return key === fullKeyCode;
}
/**
* Configures a handler callback for a key event.
* @param fullKey The event name that combines all simultaneous keystrokes.
* @param handler The function that responds to the key event.
* @param zone The zone in which the event occurred.
* @returns A callback function.
*/
static eventCallback(fullKey, handler, zone) {
return (event) => {
if (_KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
zone.runGuarded(() => handler(event));
}
};
}
/** @internal */
static _normalizeKey(keyName) {
return keyName === "esc" ? "escape" : keyName;
}
static \u0275fac = function KeyEventsPlugin_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _KeyEventsPlugin)(\u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _KeyEventsPlugin,
factory: _KeyEventsPlugin.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(KeyEventsPlugin, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
function bootstrapApplication(rootComponent, options, context) {
const config = __spreadValues({
rootComponent,
platformRef: context?.platformRef
}, createProvidersConfig(options));
if (false) {
return resolveComponentResources(fetch).catch((error2) => {
console.error(error2);
return Promise.resolve();
}).then(() => internalCreateApplication(config));
}
return internalCreateApplication(config);
}
function createProvidersConfig(options) {
return {
appProviders: [...BROWSER_MODULE_PROVIDERS, ...options?.providers ?? []],
platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
};
}
function initDomAdapter() {
BrowserDomAdapter.makeCurrent();
}
function errorHandler() {
return new ErrorHandler();
}
function _document() {
setDocument(document);
return document;
}
var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{
provide: PLATFORM_ID,
useValue: PLATFORM_BROWSER_ID
}, {
provide: PLATFORM_INITIALIZER,
useValue: initDomAdapter,
multi: true
}, {
provide: DOCUMENT,
useFactory: _document
}];
var platformBrowser = createPlatformFactory(platformCore, "browser", INTERNAL_BROWSER_PLATFORM_PROVIDERS);
var BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "BrowserModule Providers Marker" : "");
var TESTABILITY_PROVIDERS = [{
provide: TESTABILITY_GETTER,
useClass: BrowserGetTestability
}, {
provide: TESTABILITY,
useClass: Testability,
deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER]
}, {
provide: Testability,
// Also provide as `Testability` for backwards-compatibility.
useClass: Testability,
deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER]
}];
var BROWSER_MODULE_PROVIDERS = [{
provide: INJECTOR_SCOPE,
useValue: "root"
}, {
provide: ErrorHandler,
useFactory: errorHandler
}, {
provide: EVENT_MANAGER_PLUGINS,
useClass: DomEventsPlugin,
multi: true,
deps: [DOCUMENT]
}, {
provide: EVENT_MANAGER_PLUGINS,
useClass: KeyEventsPlugin,
multi: true,
deps: [DOCUMENT]
}, DomRendererFactory2, SharedStylesHost, EventManager, {
provide: RendererFactory2,
useExisting: DomRendererFactory2
}, {
provide: XhrFactory,
useClass: BrowserXhr
}, typeof ngDevMode === "undefined" || ngDevMode ? {
provide: BROWSER_MODULE_PROVIDERS_MARKER,
useValue: true
} : []];
var BrowserModule = class _BrowserModule {
constructor() {
if (typeof ngDevMode === "undefined" || ngDevMode) {
const providersAlreadyPresent = inject(BROWSER_MODULE_PROVIDERS_MARKER, {
optional: true,
skipSelf: true
});
if (providersAlreadyPresent) {
throw new RuntimeError(5100, `Providers from the \`BrowserModule\` have already been loaded. If you need access to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
}
}
}
static \u0275fac = function BrowserModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _BrowserModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _BrowserModule,
exports: [CommonModule, ApplicationModule]
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
imports: [CommonModule, ApplicationModule]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BrowserModule, [{
type: NgModule,
args: [{
providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
exports: [CommonModule, ApplicationModule]
}]
}], () => [], null);
})();
// node_modules/@angular/common/fesm2022/module.mjs
var HttpHandler = class {
};
var HttpBackend = class {
};
var HttpHeaders = class _HttpHeaders {
/**
* Internal map of lowercase header names to values.
*/
headers;
/**
* Internal map of lowercased header names to the normalized
* form of the name (the form seen first).
*/
normalizedNames = /* @__PURE__ */ new Map();
/**
* Complete the lazy initialization of this object (needed before reading).
*/
lazyInit;
/**
* Queued updates to be materialized the next initialization.
*/
lazyUpdate = null;
/** Constructs a new HTTP header object with the given values.*/
constructor(headers) {
if (!headers) {
this.headers = /* @__PURE__ */ new Map();
} else if (typeof headers === "string") {
this.lazyInit = () => {
this.headers = /* @__PURE__ */ new Map();
headers.split("\n").forEach((line) => {
const index = line.indexOf(":");
if (index > 0) {
const name2 = line.slice(0, index);
const value = line.slice(index + 1).trim();
this.addHeaderEntry(name2, value);
}
});
};
} else if (typeof Headers !== "undefined" && headers instanceof Headers) {
this.headers = /* @__PURE__ */ new Map();
headers.forEach((value, name2) => {
this.addHeaderEntry(name2, value);
});
} else {
this.lazyInit = () => {
if (typeof ngDevMode === "undefined" || ngDevMode) {
assertValidHeaders(headers);
}
this.headers = /* @__PURE__ */ new Map();
Object.entries(headers).forEach(([name2, values]) => {
this.setHeaderEntries(name2, values);
});
};
}
}
/**
* Checks for existence of a given header.
*
* @param name The header name to check for existence.
*
* @returns True if the header exists, false otherwise.
*/
has(name2) {
this.init();
return this.headers.has(name2.toLowerCase());
}
/**
* Retrieves the first value of a given header.
*
* @param name The header name.
*
* @returns The value string if the header exists, null otherwise
*/
get(name2) {
this.init();
const values = this.headers.get(name2.toLowerCase());
return values && values.length > 0 ? values[0] : null;
}
/**
* Retrieves the names of the headers.
*
* @returns A list of header names.
*/
keys() {
this.init();
return Array.from(this.normalizedNames.values());
}
/**
* Retrieves a list of values for a given header.
*
* @param name The header name from which to retrieve values.
*
* @returns A string of values if the header exists, null otherwise.
*/
getAll(name2) {
this.init();
return this.headers.get(name2.toLowerCase()) || null;
}
/**
* Appends a new value to the existing set of values for a header
* and returns them in a clone of the original instance.
*
* @param name The header name for which to append the values.
* @param value The value to append.
*
* @returns A clone of the HTTP headers object with the value appended to the given header.
*/
append(name2, value) {
return this.clone({
name: name2,
value,
op: "a"
});
}
/**
* Sets or modifies a value for a given header in a clone of the original instance.
* If the header already exists, its value is replaced with the given value
* in the returned object.
*
* @param name The header name.
* @param value The value or values to set or override for the given header.
*
* @returns A clone of the HTTP headers object with the newly set header value.
*/
set(name2, value) {
return this.clone({
name: name2,
value,
op: "s"
});
}
/**
* Deletes values for a given header in a clone of the original instance.
*
* @param name The header name.
* @param value The value or values to delete for the given header.
*
* @returns A clone of the HTTP headers object with the given value deleted.
*/
delete(name2, value) {
return this.clone({
name: name2,
value,
op: "d"
});
}
maybeSetNormalizedName(name2, lcName) {
if (!this.normalizedNames.has(lcName)) {
this.normalizedNames.set(lcName, name2);
}
}
init() {
if (!!this.lazyInit) {
if (this.lazyInit instanceof _HttpHeaders) {
this.copyFrom(this.lazyInit);
} else {
this.lazyInit();
}
this.lazyInit = null;
if (!!this.lazyUpdate) {
this.lazyUpdate.forEach((update) => this.applyUpdate(update));
this.lazyUpdate = null;
}
}
}
copyFrom(other) {
other.init();
Array.from(other.headers.keys()).forEach((key) => {
this.headers.set(key, other.headers.get(key));
this.normalizedNames.set(key, other.normalizedNames.get(key));
});
}
clone(update) {
const clone = new _HttpHeaders();
clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof _HttpHeaders ? this.lazyInit : this;
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
return clone;
}
applyUpdate(update) {
const key = update.name.toLowerCase();
switch (update.op) {
case "a":
case "s":
let value = update.value;
if (typeof value === "string") {
value = [value];
}
if (value.length === 0) {
return;
}
this.maybeSetNormalizedName(update.name, key);
const base = (update.op === "a" ? this.headers.get(key) : void 0) || [];
base.push(...value);
this.headers.set(key, base);
break;
case "d":
const toDelete = update.value;
if (!toDelete) {
this.headers.delete(key);
this.normalizedNames.delete(key);
} else {
let existing = this.headers.get(key);
if (!existing) {
return;
}
existing = existing.filter((value2) => toDelete.indexOf(value2) === -1);
if (existing.length === 0) {
this.headers.delete(key);
this.normalizedNames.delete(key);
} else {
this.headers.set(key, existing);
}
}
break;
}
}
addHeaderEntry(name2, value) {
const key = name2.toLowerCase();
this.maybeSetNormalizedName(name2, key);
if (this.headers.has(key)) {
this.headers.get(key).push(value);
} else {
this.headers.set(key, [value]);
}
}
setHeaderEntries(name2, values) {
const headerValues = (Array.isArray(values) ? values : [values]).map((value) => value.toString());
const key = name2.toLowerCase();
this.headers.set(key, headerValues);
this.maybeSetNormalizedName(name2, key);
}
/**
* @internal
*/
forEach(fn) {
this.init();
Array.from(this.normalizedNames.keys()).forEach((key) => fn(this.normalizedNames.get(key), this.headers.get(key)));
}
};
function assertValidHeaders(headers) {
for (const [key, value] of Object.entries(headers)) {
if (!(typeof value === "string" || typeof value === "number") && !Array.isArray(value)) {
throw new Error(`Unexpected value of the \`${key}\` header provided. Expecting either a string, a number or an array, but got: \`${value}\`.`);
}
}
}
var HttpUrlEncodingCodec = class {
/**
* Encodes a key name for a URL parameter or query-string.
* @param key The key name.
* @returns The encoded key name.
*/
encodeKey(key) {
return standardEncoding(key);
}
/**
* Encodes the value of a URL parameter or query-string.
* @param value The value.
* @returns The encoded value.
*/
encodeValue(value) {
return standardEncoding(value);
}
/**
* Decodes an encoded URL parameter or query-string key.
* @param key The encoded key name.
* @returns The decoded key name.
*/
decodeKey(key) {
return decodeURIComponent(key);
}
/**
* Decodes an encoded URL parameter or query-string value.
* @param value The encoded value.
* @returns The decoded value.
*/
decodeValue(value) {
return decodeURIComponent(value);
}
};
function paramParser(rawParams, codec) {
const map2 = /* @__PURE__ */ new Map();
if (rawParams.length > 0) {
const params = rawParams.replace(/^\?/, "").split("&");
params.forEach((param) => {
const eqIdx = param.indexOf("=");
const [key, val] = eqIdx == -1 ? [codec.decodeKey(param), ""] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))];
const list = map2.get(key) || [];
list.push(val);
map2.set(key, list);
});
}
return map2;
}
var STANDARD_ENCODING_REGEX = /%(\d[a-f0-9])/gi;
var STANDARD_ENCODING_REPLACEMENTS = {
"40": "@",
"3A": ":",
"24": "$",
"2C": ",",
"3B": ";",
"3D": "=",
"3F": "?",
"2F": "/"
};
function standardEncoding(v) {
return encodeURIComponent(v).replace(STANDARD_ENCODING_REGEX, (s, t) => STANDARD_ENCODING_REPLACEMENTS[t] ?? s);
}
function valueToString(value) {
return `${value}`;
}
var HttpParams = class _HttpParams {
map;
encoder;
updates = null;
cloneFrom = null;
constructor(options = {}) {
this.encoder = options.encoder || new HttpUrlEncodingCodec();
if (options.fromString) {
if (options.fromObject) {
throw new RuntimeError(2805, ngDevMode && "Cannot specify both fromString and fromObject.");
}
this.map = paramParser(options.fromString, this.encoder);
} else if (!!options.fromObject) {
this.map = /* @__PURE__ */ new Map();
Object.keys(options.fromObject).forEach((key) => {
const value = options.fromObject[key];
const values = Array.isArray(value) ? value.map(valueToString) : [valueToString(value)];
this.map.set(key, values);
});
} else {
this.map = null;
}
}
/**
* Reports whether the body includes one or more values for a given parameter.
* @param param The parameter name.
* @returns True if the parameter has one or more values,
* false if it has no value or is not present.
*/
has(param) {
this.init();
return this.map.has(param);
}
/**
* Retrieves the first value for a parameter.
* @param param The parameter name.
* @returns The first value of the given parameter,
* or `null` if the parameter is not present.
*/
get(param) {
this.init();
const res = this.map.get(param);
return !!res ? res[0] : null;
}
/**
* Retrieves all values for a parameter.
* @param param The parameter name.
* @returns All values in a string array,
* or `null` if the parameter not present.
*/
getAll(param) {
this.init();
return this.map.get(param) || null;
}
/**
* Retrieves all the parameters for this body.
* @returns The parameter names in a string array.
*/
keys() {
this.init();
return Array.from(this.map.keys());
}
/**
* Appends a new value to existing values for a parameter.
* @param param The parameter name.
* @param value The new value to add.
* @return A new body with the appended value.
*/
append(param, value) {
return this.clone({
param,
value,
op: "a"
});
}
/**
* Constructs a new body with appended values for the given parameter name.
* @param params parameters and values
* @return A new body with the new value.
*/
appendAll(params) {
const updates = [];
Object.keys(params).forEach((param) => {
const value = params[param];
if (Array.isArray(value)) {
value.forEach((_value) => {
updates.push({
param,
value: _value,
op: "a"
});
});
} else {
updates.push({
param,
value,
op: "a"
});
}
});
return this.clone(updates);
}
/**
* Replaces the value for a parameter.
* @param param The parameter name.
* @param value The new value.
* @return A new body with the new value.
*/
set(param, value) {
return this.clone({
param,
value,
op: "s"
});
}
/**
* Removes a given value or all values from a parameter.
* @param param The parameter name.
* @param value The value to remove, if provided.
* @return A new body with the given value removed, or with all values
* removed if no value is specified.
*/
delete(param, value) {
return this.clone({
param,
value,
op: "d"
});
}
/**
* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
* separated by `&`s.
*/
toString() {
this.init();
return this.keys().map((key) => {
const eKey = this.encoder.encodeKey(key);
return this.map.get(key).map((value) => eKey + "=" + this.encoder.encodeValue(value)).join("&");
}).filter((param) => param !== "").join("&");
}
clone(update) {
const clone = new _HttpParams({
encoder: this.encoder
});
clone.cloneFrom = this.cloneFrom || this;
clone.updates = (this.updates || []).concat(update);
return clone;
}
init() {
if (this.map === null) {
this.map = /* @__PURE__ */ new Map();
}
if (this.cloneFrom !== null) {
this.cloneFrom.init();
this.cloneFrom.keys().forEach((key) => this.map.set(key, this.cloneFrom.map.get(key)));
this.updates.forEach((update) => {
switch (update.op) {
case "a":
case "s":
const base = (update.op === "a" ? this.map.get(update.param) : void 0) || [];
base.push(valueToString(update.value));
this.map.set(update.param, base);
break;
case "d":
if (update.value !== void 0) {
let base2 = this.map.get(update.param) || [];
const idx = base2.indexOf(valueToString(update.value));
if (idx !== -1) {
base2.splice(idx, 1);
}
if (base2.length > 0) {
this.map.set(update.param, base2);
} else {
this.map.delete(update.param);
}
} else {
this.map.delete(update.param);
break;
}
}
});
this.cloneFrom = this.updates = null;
}
}
};
var HttpContext = class {
map = /* @__PURE__ */ new Map();
/**
* Store a value in the context. If a value is already present it will be overwritten.
*
* @param token The reference to an instance of `HttpContextToken`.
* @param value The value to store.
*
* @returns A reference to itself for easy chaining.
*/
set(token, value) {
this.map.set(token, value);
return this;
}
/**
* Retrieve the value associated with the given token.
*
* @param token The reference to an instance of `HttpContextToken`.
*
* @returns The stored value or default if one is defined.
*/
get(token) {
if (!this.map.has(token)) {
this.map.set(token, token.defaultValue());
}
return this.map.get(token);
}
/**
* Delete the value associated with the given token.
*
* @param token The reference to an instance of `HttpContextToken`.
*
* @returns A reference to itself for easy chaining.
*/
delete(token) {
this.map.delete(token);
return this;
}
/**
* Checks for existence of a given token.
*
* @param token The reference to an instance of `HttpContextToken`.
*
* @returns True if the token exists, false otherwise.
*/
has(token) {
return this.map.has(token);
}
/**
* @returns a list of tokens currently stored in the context.
*/
keys() {
return this.map.keys();
}
};
function mightHaveBody(method) {
switch (method) {
case "DELETE":
case "GET":
case "HEAD":
case "OPTIONS":
case "JSONP":
return false;
default:
return true;
}
}
function isArrayBuffer(value) {
return typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer;
}
function isBlob(value) {
return typeof Blob !== "undefined" && value instanceof Blob;
}
function isFormData(value) {
return typeof FormData !== "undefined" && value instanceof FormData;
}
function isUrlSearchParams(value) {
return typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams;
}
var CONTENT_TYPE_HEADER = "Content-Type";
var ACCEPT_HEADER = "Accept";
var X_REQUEST_URL_HEADER = "X-Request-URL";
var TEXT_CONTENT_TYPE = "text/plain";
var JSON_CONTENT_TYPE = "application/json";
var ACCEPT_HEADER_VALUE = `${JSON_CONTENT_TYPE}, ${TEXT_CONTENT_TYPE}, */*`;
var HttpRequest = class _HttpRequest {
url;
/**
* The request body, or `null` if one isn't set.
*
* Bodies are not enforced to be immutable, as they can include a reference to any
* user-defined data type. However, interceptors should take care to preserve
* idempotence by treating them as such.
*/
body = null;
/**
* Outgoing headers for this request.
*/
headers;
/**
* Shared and mutable context that can be used by interceptors
*/
context;
/**
* Whether this request should be made in a way that exposes progress events.
*
* Progress events are expensive (change detection runs on each event) and so
* they should only be requested if the consumer intends to monitor them.
*
* Note: The `FetchBackend` doesn't support progress report on uploads.
*/
reportProgress = false;
/**
* Whether this request should be sent with outgoing credentials (cookies).
*/
withCredentials = false;
/**
* The credentials mode of the request, which determines how cookies and HTTP authentication are handled.
* This can affect whether cookies are sent with the request, and how authentication is handled.
*/
credentials;
/**
* When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
*/
keepalive = false;
/**
* Controls how the request will interact with the browser's HTTP cache.
* This affects whether a response is retrieved from the cache, how it is stored, or if it bypasses the cache altogether.
*/
cache;
/**
* Indicates the relative priority of the request. This may be used by the browser to decide the order in which requests are dispatched and resources fetched.
*/
priority;
/**
* The mode of the request, which determines how the request will interact with the browser's security model.
* This can affect things like CORS (Cross-Origin Resource Sharing) and same-origin policies.
*/
mode;
/**
* The redirect mode of the request, which determines how redirects are handled.
* This can affect whether the request follows redirects automatically, or if it fails when a redirect occurs.
*/
redirect;
/**
* The referrer of the request, which can be used to indicate the origin of the request.
* This is useful for security and analytics purposes.
* Value is a same-origin URL, "about:client", or the empty string, to set request's referrer.
*/
referrer;
/**
* The integrity metadata of the request, which can be used to ensure the request is made with the expected content.
* A cryptographic hash of the resource to be fetched by request
*/
integrity;
/**
* The expected response type of the server.
*
* This is used to parse the response appropriately before returning it to
* the requestee.
*/
responseType = "json";
/**
* The outgoing HTTP request method.
*/
method;
/**
* Outgoing URL parameters.
*
* To pass a string representation of HTTP parameters in the URL-query-string format,
* the `HttpParamsOptions`' `fromString` may be used. For example:
*
* ```ts
* new HttpParams({fromString: 'angular=awesome'})
* ```
*/
params;
/**
* The outgoing URL with all URL parameters set.
*/
urlWithParams;
/**
* The HttpTransferCache option for the request
*/
transferCache;
/**
* The timeout for the backend HTTP request in ms.
*/
timeout;
constructor(method, url, third, fourth) {
this.url = url;
this.method = method.toUpperCase();
let options;
if (mightHaveBody(this.method) || !!fourth) {
this.body = third !== void 0 ? third : null;
options = fourth;
} else {
options = third;
}
if (options) {
this.reportProgress = !!options.reportProgress;
this.withCredentials = !!options.withCredentials;
this.keepalive = !!options.keepalive;
if (!!options.responseType) {
this.responseType = options.responseType;
}
if (options.headers) {
this.headers = options.headers;
}
if (options.context) {
this.context = options.context;
}
if (options.params) {
this.params = options.params;
}
if (options.priority) {
this.priority = options.priority;
}
if (options.cache) {
this.cache = options.cache;
}
if (options.credentials) {
this.credentials = options.credentials;
}
if (typeof options.timeout === "number") {
if (options.timeout < 1 || !Number.isInteger(options.timeout)) {
throw new RuntimeError(2822, ngDevMode ? "`timeout` must be a positive integer value" : "");
}
this.timeout = options.timeout;
}
if (options.mode) {
this.mode = options.mode;
}
if (options.redirect) {
this.redirect = options.redirect;
}
if (options.integrity) {
this.integrity = options.integrity;
}
if (options.referrer) {
this.referrer = options.referrer;
}
this.transferCache = options.transferCache;
}
this.headers ??= new HttpHeaders();
this.context ??= new HttpContext();
if (!this.params) {
this.params = new HttpParams();
this.urlWithParams = url;
} else {
const params = this.params.toString();
if (params.length === 0) {
this.urlWithParams = url;
} else {
const qIdx = url.indexOf("?");
const sep = qIdx === -1 ? "?" : qIdx < url.length - 1 ? "&" : "";
this.urlWithParams = url + sep + params;
}
}
}
/**
* Transform the free-form body into a serialized format suitable for
* transmission to the server.
*/
serializeBody() {
if (this.body === null) {
return null;
}
if (typeof this.body === "string" || isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || isUrlSearchParams(this.body)) {
return this.body;
}
if (this.body instanceof HttpParams) {
return this.body.toString();
}
if (typeof this.body === "object" || typeof this.body === "boolean" || Array.isArray(this.body)) {
return JSON.stringify(this.body);
}
return this.body.toString();
}
/**
* Examine the body and attempt to infer an appropriate MIME type
* for it.
*
* If no such type can be inferred, this method will return `null`.
*/
detectContentTypeHeader() {
if (this.body === null) {
return null;
}
if (isFormData(this.body)) {
return null;
}
if (isBlob(this.body)) {
return this.body.type || null;
}
if (isArrayBuffer(this.body)) {
return null;
}
if (typeof this.body === "string") {
return TEXT_CONTENT_TYPE;
}
if (this.body instanceof HttpParams) {
return "application/x-www-form-urlencoded;charset=UTF-8";
}
if (typeof this.body === "object" || typeof this.body === "number" || typeof this.body === "boolean") {
return JSON_CONTENT_TYPE;
}
return null;
}
clone(update = {}) {
const method = update.method || this.method;
const url = update.url || this.url;
const responseType = update.responseType || this.responseType;
const keepalive = update.keepalive ?? this.keepalive;
const priority = update.priority || this.priority;
const cache = update.cache || this.cache;
const mode = update.mode || this.mode;
const redirect = update.redirect || this.redirect;
const credentials = update.credentials || this.credentials;
const referrer = update.referrer || this.referrer;
const integrity = update.integrity || this.integrity;
const transferCache = update.transferCache ?? this.transferCache;
const timeout = update.timeout ?? this.timeout;
const body = update.body !== void 0 ? update.body : this.body;
const withCredentials = update.withCredentials ?? this.withCredentials;
const reportProgress = update.reportProgress ?? this.reportProgress;
let headers = update.headers || this.headers;
let params = update.params || this.params;
const context = update.context ?? this.context;
if (update.setHeaders !== void 0) {
headers = Object.keys(update.setHeaders).reduce((headers2, name2) => headers2.set(name2, update.setHeaders[name2]), headers);
}
if (update.setParams) {
params = Object.keys(update.setParams).reduce((params2, param) => params2.set(param, update.setParams[param]), params);
}
return new _HttpRequest(method, url, body, {
params,
headers,
context,
reportProgress,
responseType,
withCredentials,
transferCache,
keepalive,
cache,
priority,
timeout,
mode,
redirect,
credentials,
referrer,
integrity
});
}
};
var HttpEventType;
(function(HttpEventType2) {
HttpEventType2[HttpEventType2["Sent"] = 0] = "Sent";
HttpEventType2[HttpEventType2["UploadProgress"] = 1] = "UploadProgress";
HttpEventType2[HttpEventType2["ResponseHeader"] = 2] = "ResponseHeader";
HttpEventType2[HttpEventType2["DownloadProgress"] = 3] = "DownloadProgress";
HttpEventType2[HttpEventType2["Response"] = 4] = "Response";
HttpEventType2[HttpEventType2["User"] = 5] = "User";
})(HttpEventType || (HttpEventType = {}));
var HttpResponseBase = class {
/**
* All response headers.
*/
headers;
/**
* Response status code.
*/
status;
/**
* Textual description of response status code, defaults to OK.
*
* Do not depend on this.
*/
statusText;
/**
* URL of the resource retrieved, or null if not available.
*/
url;
/**
* Whether the status code falls in the 2xx range.
*/
ok;
/**
* Type of the response, narrowed to either the full response or the header.
*/
type;
/**
* Indicates whether the HTTP response was redirected during the request.
* This property is only available when using the Fetch API using `withFetch()`
* When using the default XHR Request this property will be `undefined`
*/
redirected;
/**
* Super-constructor for all responses.
*
* The single parameter accepted is an initialization hash. Any properties
* of the response passed there will override the default values.
*/
constructor(init, defaultStatus = 200, defaultStatusText = "OK") {
this.headers = init.headers || new HttpHeaders();
this.status = init.status !== void 0 ? init.status : defaultStatus;
this.statusText = init.statusText || defaultStatusText;
this.url = init.url || null;
this.redirected = init.redirected;
this.ok = this.status >= 200 && this.status < 300;
}
};
var HttpHeaderResponse = class _HttpHeaderResponse extends HttpResponseBase {
/**
* Create a new `HttpHeaderResponse` with the given parameters.
*/
constructor(init = {}) {
super(init);
}
type = HttpEventType.ResponseHeader;
/**
* Copy this `HttpHeaderResponse`, overriding its contents with the
* given parameter hash.
*/
clone(update = {}) {
return new _HttpHeaderResponse({
headers: update.headers || this.headers,
status: update.status !== void 0 ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || void 0
});
}
};
var HttpResponse = class _HttpResponse extends HttpResponseBase {
/**
* The response body, or `null` if one was not returned.
*/
body;
/**
* Construct a new `HttpResponse`.
*/
constructor(init = {}) {
super(init);
this.body = init.body !== void 0 ? init.body : null;
}
type = HttpEventType.Response;
clone(update = {}) {
return new _HttpResponse({
body: update.body !== void 0 ? update.body : this.body,
headers: update.headers || this.headers,
status: update.status !== void 0 ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || void 0,
redirected: update.redirected ?? this.redirected
});
}
};
var HttpErrorResponse = class extends HttpResponseBase {
name = "HttpErrorResponse";
message;
error;
/**
* Errors are never okay, even when the status code is in the 2xx success range.
*/
ok = false;
constructor(init) {
super(init, 0, "Unknown Error");
if (this.status >= 200 && this.status < 300) {
this.message = `Http failure during parsing for ${init.url || "(unknown url)"}`;
} else {
this.message = `Http failure response for ${init.url || "(unknown url)"}: ${init.status} ${init.statusText}`;
}
this.error = init.error || null;
}
};
var HTTP_STATUS_CODE_OK = 200;
var HTTP_STATUS_CODE_NO_CONTENT = 204;
var HttpStatusCode;
(function(HttpStatusCode2) {
HttpStatusCode2[HttpStatusCode2["Continue"] = 100] = "Continue";
HttpStatusCode2[HttpStatusCode2["SwitchingProtocols"] = 101] = "SwitchingProtocols";
HttpStatusCode2[HttpStatusCode2["Processing"] = 102] = "Processing";
HttpStatusCode2[HttpStatusCode2["EarlyHints"] = 103] = "EarlyHints";
HttpStatusCode2[HttpStatusCode2["Ok"] = 200] = "Ok";
HttpStatusCode2[HttpStatusCode2["Created"] = 201] = "Created";
HttpStatusCode2[HttpStatusCode2["Accepted"] = 202] = "Accepted";
HttpStatusCode2[HttpStatusCode2["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
HttpStatusCode2[HttpStatusCode2["NoContent"] = 204] = "NoContent";
HttpStatusCode2[HttpStatusCode2["ResetContent"] = 205] = "ResetContent";
HttpStatusCode2[HttpStatusCode2["PartialContent"] = 206] = "PartialContent";
HttpStatusCode2[HttpStatusCode2["MultiStatus"] = 207] = "MultiStatus";
HttpStatusCode2[HttpStatusCode2["AlreadyReported"] = 208] = "AlreadyReported";
HttpStatusCode2[HttpStatusCode2["ImUsed"] = 226] = "ImUsed";
HttpStatusCode2[HttpStatusCode2["MultipleChoices"] = 300] = "MultipleChoices";
HttpStatusCode2[HttpStatusCode2["MovedPermanently"] = 301] = "MovedPermanently";
HttpStatusCode2[HttpStatusCode2["Found"] = 302] = "Found";
HttpStatusCode2[HttpStatusCode2["SeeOther"] = 303] = "SeeOther";
HttpStatusCode2[HttpStatusCode2["NotModified"] = 304] = "NotModified";
HttpStatusCode2[HttpStatusCode2["UseProxy"] = 305] = "UseProxy";
HttpStatusCode2[HttpStatusCode2["Unused"] = 306] = "Unused";
HttpStatusCode2[HttpStatusCode2["TemporaryRedirect"] = 307] = "TemporaryRedirect";
HttpStatusCode2[HttpStatusCode2["PermanentRedirect"] = 308] = "PermanentRedirect";
HttpStatusCode2[HttpStatusCode2["BadRequest"] = 400] = "BadRequest";
HttpStatusCode2[HttpStatusCode2["Unauthorized"] = 401] = "Unauthorized";
HttpStatusCode2[HttpStatusCode2["PaymentRequired"] = 402] = "PaymentRequired";
HttpStatusCode2[HttpStatusCode2["Forbidden"] = 403] = "Forbidden";
HttpStatusCode2[HttpStatusCode2["NotFound"] = 404] = "NotFound";
HttpStatusCode2[HttpStatusCode2["MethodNotAllowed"] = 405] = "MethodNotAllowed";
HttpStatusCode2[HttpStatusCode2["NotAcceptable"] = 406] = "NotAcceptable";
HttpStatusCode2[HttpStatusCode2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
HttpStatusCode2[HttpStatusCode2["RequestTimeout"] = 408] = "RequestTimeout";
HttpStatusCode2[HttpStatusCode2["Conflict"] = 409] = "Conflict";
HttpStatusCode2[HttpStatusCode2["Gone"] = 410] = "Gone";
HttpStatusCode2[HttpStatusCode2["LengthRequired"] = 411] = "LengthRequired";
HttpStatusCode2[HttpStatusCode2["PreconditionFailed"] = 412] = "PreconditionFailed";
HttpStatusCode2[HttpStatusCode2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
HttpStatusCode2[HttpStatusCode2["UriTooLong"] = 414] = "UriTooLong";
HttpStatusCode2[HttpStatusCode2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
HttpStatusCode2[HttpStatusCode2["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
HttpStatusCode2[HttpStatusCode2["ExpectationFailed"] = 417] = "ExpectationFailed";
HttpStatusCode2[HttpStatusCode2["ImATeapot"] = 418] = "ImATeapot";
HttpStatusCode2[HttpStatusCode2["MisdirectedRequest"] = 421] = "MisdirectedRequest";
HttpStatusCode2[HttpStatusCode2["UnprocessableEntity"] = 422] = "UnprocessableEntity";
HttpStatusCode2[HttpStatusCode2["Locked"] = 423] = "Locked";
HttpStatusCode2[HttpStatusCode2["FailedDependency"] = 424] = "FailedDependency";
HttpStatusCode2[HttpStatusCode2["TooEarly"] = 425] = "TooEarly";
HttpStatusCode2[HttpStatusCode2["UpgradeRequired"] = 426] = "UpgradeRequired";
HttpStatusCode2[HttpStatusCode2["PreconditionRequired"] = 428] = "PreconditionRequired";
HttpStatusCode2[HttpStatusCode2["TooManyRequests"] = 429] = "TooManyRequests";
HttpStatusCode2[HttpStatusCode2["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
HttpStatusCode2[HttpStatusCode2["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
HttpStatusCode2[HttpStatusCode2["InternalServerError"] = 500] = "InternalServerError";
HttpStatusCode2[HttpStatusCode2["NotImplemented"] = 501] = "NotImplemented";
HttpStatusCode2[HttpStatusCode2["BadGateway"] = 502] = "BadGateway";
HttpStatusCode2[HttpStatusCode2["ServiceUnavailable"] = 503] = "ServiceUnavailable";
HttpStatusCode2[HttpStatusCode2["GatewayTimeout"] = 504] = "GatewayTimeout";
HttpStatusCode2[HttpStatusCode2["HttpVersionNotSupported"] = 505] = "HttpVersionNotSupported";
HttpStatusCode2[HttpStatusCode2["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
HttpStatusCode2[HttpStatusCode2["InsufficientStorage"] = 507] = "InsufficientStorage";
HttpStatusCode2[HttpStatusCode2["LoopDetected"] = 508] = "LoopDetected";
HttpStatusCode2[HttpStatusCode2["NotExtended"] = 510] = "NotExtended";
HttpStatusCode2[HttpStatusCode2["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
})(HttpStatusCode || (HttpStatusCode = {}));
function addBody(options, body) {
return {
body,
headers: options.headers,
context: options.context,
observe: options.observe,
params: options.params,
reportProgress: options.reportProgress,
responseType: options.responseType,
withCredentials: options.withCredentials,
credentials: options.credentials,
transferCache: options.transferCache,
timeout: options.timeout,
keepalive: options.keepalive,
priority: options.priority,
cache: options.cache,
mode: options.mode,
redirect: options.redirect,
integrity: options.integrity,
referrer: options.referrer
};
}
var HttpClient = class _HttpClient {
handler;
constructor(handler) {
this.handler = handler;
}
/**
* Constructs an observable for a generic HTTP request that, when subscribed,
* fires the request through the chain of registered interceptors and on to the
* server.
*
* You can pass an `HttpRequest` directly as the only parameter. In this case,
* the call returns an observable of the raw `HttpEvent` stream.
*
* Alternatively you can pass an HTTP method as the first parameter,
* a URL string as the second, and an options hash containing the request body as the third.
* See `addBody()`. In this case, the specified `responseType` and `observe` options determine the
* type of returned observable.
* * The `responseType` value determines how a successful response body is parsed.
* * If `responseType` is the default `json`, you can pass a type interface for the resulting
* object as a type parameter to the call.
*
* The `observe` value determines the return type, according to what you are interested in
* observing.
* * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including
* progress events by default.
* * An `observe` value of response returns an observable of `HttpResponse<T>`,
* where the `T` parameter depends on the `responseType` and any optionally provided type
* parameter.
* * An `observe` value of body returns an observable of `<T>` with the same `T` body type.
*
*/
request(first2, url, options = {}) {
let req;
if (first2 instanceof HttpRequest) {
req = first2;
} else {
let headers = void 0;
if (options.headers instanceof HttpHeaders) {
headers = options.headers;
} else {
headers = new HttpHeaders(options.headers);
}
let params = void 0;
if (!!options.params) {
if (options.params instanceof HttpParams) {
params = options.params;
} else {
params = new HttpParams({
fromObject: options.params
});
}
}
req = new HttpRequest(first2, url, options.body !== void 0 ? options.body : null, {
headers,
context: options.context,
params,
reportProgress: options.reportProgress,
// By default, JSON is assumed to be returned for all calls.
responseType: options.responseType || "json",
withCredentials: options.withCredentials,
transferCache: options.transferCache,
keepalive: options.keepalive,
priority: options.priority,
cache: options.cache,
mode: options.mode,
redirect: options.redirect,
credentials: options.credentials,
referrer: options.referrer,
integrity: options.integrity,
timeout: options.timeout
});
}
const events$ = of(req).pipe(concatMap((req2) => this.handler.handle(req2)));
if (first2 instanceof HttpRequest || options.observe === "events") {
return events$;
}
const res$ = events$.pipe(filter((event) => event instanceof HttpResponse));
switch (options.observe || "body") {
case "body":
switch (req.responseType) {
case "arraybuffer":
return res$.pipe(map((res) => {
if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
throw new RuntimeError(2806, ngDevMode && "Response is not an ArrayBuffer.");
}
return res.body;
}));
case "blob":
return res$.pipe(map((res) => {
if (res.body !== null && !(res.body instanceof Blob)) {
throw new RuntimeError(2807, ngDevMode && "Response is not a Blob.");
}
return res.body;
}));
case "text":
return res$.pipe(map((res) => {
if (res.body !== null && typeof res.body !== "string") {
throw new RuntimeError(2808, ngDevMode && "Response is not a string.");
}
return res.body;
}));
case "json":
default:
return res$.pipe(map((res) => res.body));
}
case "response":
return res$;
default:
throw new RuntimeError(2809, ngDevMode && `Unreachable: unhandled observe type ${options.observe}}`);
}
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `DELETE` request to execute on the server. See the individual overloads for
* details on the return type.
*
* @param url The endpoint URL.
* @param options The HTTP options to send with the request.
*
*/
delete(url, options = {}) {
return this.request("DELETE", url, options);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `GET` request to execute on the server. See the individual overloads for
* details on the return type.
*/
get(url, options = {}) {
return this.request("GET", url, options);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `HEAD` request to execute on the server. The `HEAD` method returns
* meta information about the resource without transferring the
* resource itself. See the individual overloads for
* details on the return type.
*/
head(url, options = {}) {
return this.request("HEAD", url, options);
}
/**
* Constructs an `Observable` that, when subscribed, causes a request with the special method
* `JSONP` to be dispatched via the interceptor pipeline.
* The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain
* API endpoints that don't support newer,
* and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.
* JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the
* requests even if the API endpoint is not located on the same domain (origin) as the client-side
* application making the request.
* The endpoint API must support JSONP callback for JSONP requests to work.
* The resource API returns the JSON response wrapped in a callback function.
* You can pass the callback function name as one of the query parameters.
* Note that JSONP requests can only be used with `GET` requests.
*
* @param url The resource URL.
* @param callbackParam The callback function name.
*
*/
jsonp(url, callbackParam) {
return this.request("JSONP", url, {
params: new HttpParams().append(callbackParam, "JSONP_CALLBACK"),
observe: "body",
responseType: "json"
});
}
/**
* Constructs an `Observable` that, when subscribed, causes the configured
* `OPTIONS` request to execute on the server. This method allows the client
* to determine the supported HTTP methods and other capabilities of an endpoint,
* without implying a resource action. See the individual overloads for
* details on the return type.
*/
options(url, options = {}) {
return this.request("OPTIONS", url, options);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `PATCH` request to execute on the server. See the individual overloads for
* details on the return type.
*/
patch(url, body, options = {}) {
return this.request("PATCH", url, addBody(options, body));
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `POST` request to execute on the server. The server responds with the location of
* the replaced resource. See the individual overloads for
* details on the return type.
*/
post(url, body, options = {}) {
return this.request("POST", url, addBody(options, body));
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `PUT` request to execute on the server. The `PUT` method replaces an existing resource
* with a new set of values.
* See the individual overloads for details on the return type.
*/
put(url, body, options = {}) {
return this.request("PUT", url, addBody(options, body));
}
static \u0275fac = function HttpClient_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpClient)(\u0275\u0275inject(HttpHandler));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HttpClient,
factory: _HttpClient.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClient, [{
type: Injectable
}], () => [{
type: HttpHandler
}], null);
})();
var XSSI_PREFIX$1 = /^\)\]\}',?\n/;
function getResponseUrl$1(response) {
if (response.url) {
return response.url;
}
const xRequestUrl = X_REQUEST_URL_HEADER.toLocaleLowerCase();
return response.headers.get(xRequestUrl);
}
var FETCH_BACKEND = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "FETCH_BACKEND" : "");
var FetchBackend = class _FetchBackend {
// We use an arrow function to always reference the current global implementation of `fetch`.
// This is helpful for cases when the global `fetch` implementation is modified by external code,
// see https://github.com/angular/angular/issues/57527.
fetchImpl = inject(FetchFactory, {
optional: true
})?.fetch ?? ((...args) => globalThis.fetch(...args));
ngZone = inject(NgZone);
destroyRef = inject(DestroyRef);
handle(request) {
return new Observable((observer) => {
const aborter = new AbortController();
this.doRequest(request, aborter.signal, observer).then(noop, (error2) => observer.error(new HttpErrorResponse({
error: error2
})));
let timeoutId;
if (request.timeout) {
timeoutId = this.ngZone.runOutsideAngular(() => setTimeout(() => {
if (!aborter.signal.aborted) {
aborter.abort(new DOMException("signal timed out", "TimeoutError"));
}
}, request.timeout));
}
return () => {
if (timeoutId !== void 0) {
clearTimeout(timeoutId);
}
aborter.abort();
};
});
}
doRequest(request, signal2, observer) {
return __async(this, null, function* () {
const init = this.createRequestInit(request);
let response;
try {
const fetchPromise = this.ngZone.runOutsideAngular(() => this.fetchImpl(request.urlWithParams, __spreadValues({
signal: signal2
}, init)));
silenceSuperfluousUnhandledPromiseRejection(fetchPromise);
observer.next({
type: HttpEventType.Sent
});
response = yield fetchPromise;
} catch (error2) {
observer.error(new HttpErrorResponse({
error: error2,
status: error2.status ?? 0,
statusText: error2.statusText,
url: request.urlWithParams,
headers: error2.headers
}));
return;
}
const headers = new HttpHeaders(response.headers);
const statusText = response.statusText;
const url = getResponseUrl$1(response) ?? request.urlWithParams;
let status = response.status;
let body = null;
if (request.reportProgress) {
observer.next(new HttpHeaderResponse({
headers,
status,
statusText,
url
}));
}
if (response.body) {
const contentLength = response.headers.get("content-length");
const chunks = [];
const reader = response.body.getReader();
let receivedLength = 0;
let decoder;
let partialText;
const reqZone = typeof Zone !== "undefined" && Zone.current;
let canceled = false;
yield this.ngZone.runOutsideAngular(() => __async(this, null, function* () {
while (true) {
if (this.destroyRef.destroyed) {
yield reader.cancel();
canceled = true;
break;
}
const {
done,
value
} = yield reader.read();
if (done) {
break;
}
chunks.push(value);
receivedLength += value.length;
if (request.reportProgress) {
partialText = request.responseType === "text" ? (partialText ?? "") + (decoder ??= new TextDecoder()).decode(value, {
stream: true
}) : void 0;
const reportProgress = () => observer.next({
type: HttpEventType.DownloadProgress,
total: contentLength ? +contentLength : void 0,
loaded: receivedLength,
partialText
});
reqZone ? reqZone.run(reportProgress) : reportProgress();
}
}
}));
if (canceled) {
observer.complete();
return;
}
const chunksAll = this.concatChunks(chunks, receivedLength);
try {
const contentType = response.headers.get(CONTENT_TYPE_HEADER) ?? "";
body = this.parseBody(request, chunksAll, contentType, status);
} catch (error2) {
observer.error(new HttpErrorResponse({
error: error2,
headers: new HttpHeaders(response.headers),
status: response.status,
statusText: response.statusText,
url: getResponseUrl$1(response) ?? request.urlWithParams
}));
return;
}
}
if (status === 0) {
status = body ? HTTP_STATUS_CODE_OK : 0;
}
const ok = status >= 200 && status < 300;
const redirected = response.redirected;
if (ok) {
observer.next(new HttpResponse({
body,
headers,
status,
statusText,
url,
redirected
}));
observer.complete();
} else {
observer.error(new HttpErrorResponse({
error: body,
headers,
status,
statusText,
url,
redirected
}));
}
});
}
parseBody(request, binContent, contentType, status) {
switch (request.responseType) {
case "json":
const text = new TextDecoder().decode(binContent).replace(XSSI_PREFIX$1, "");
if (text === "") {
return null;
}
try {
return JSON.parse(text);
} catch (e) {
if (status < 200 || status >= 300) {
return text;
}
throw e;
}
case "text":
return new TextDecoder().decode(binContent);
case "blob":
return new Blob([binContent], {
type: contentType
});
case "arraybuffer":
return binContent.buffer;
}
}
createRequestInit(req) {
const headers = {};
let credentials;
credentials = req.credentials;
if (req.withCredentials) {
(typeof ngDevMode === "undefined" || ngDevMode) && warningOptionsMessage(req);
credentials = "include";
}
req.headers.forEach((name2, values) => headers[name2] = values.join(","));
if (!req.headers.has(ACCEPT_HEADER)) {
headers[ACCEPT_HEADER] = ACCEPT_HEADER_VALUE;
}
if (!req.headers.has(CONTENT_TYPE_HEADER)) {
const detectedType = req.detectContentTypeHeader();
if (detectedType !== null) {
headers[CONTENT_TYPE_HEADER] = detectedType;
}
}
return {
body: req.serializeBody(),
method: req.method,
headers,
credentials,
keepalive: req.keepalive,
cache: req.cache,
priority: req.priority,
mode: req.mode,
redirect: req.redirect,
referrer: req.referrer,
integrity: req.integrity
};
}
concatChunks(chunks, totalLength) {
const chunksAll = new Uint8Array(totalLength);
let position = 0;
for (const chunk of chunks) {
chunksAll.set(chunk, position);
position += chunk.length;
}
return chunksAll;
}
static \u0275fac = function FetchBackend_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _FetchBackend)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _FetchBackend,
factory: _FetchBackend.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FetchBackend, [{
type: Injectable
}], null, null);
})();
var FetchFactory = class {
};
function noop() {
}
function warningOptionsMessage(req) {
if (req.credentials && req.withCredentials) {
console.warn(formatRuntimeError(2819, `Angular detected that a \`HttpClient\` request has both \`withCredentials: true\` and \`credentials: '${req.credentials}'\` options. The \`withCredentials\` option is overriding the explicit \`credentials\` setting to 'include'. Consider removing \`withCredentials\` and using \`credentials: '${req.credentials}'\` directly for clarity.`));
}
}
function silenceSuperfluousUnhandledPromiseRejection(promise) {
promise.then(noop, noop);
}
function interceptorChainEndFn(req, finalHandlerFn) {
return finalHandlerFn(req);
}
function adaptLegacyInterceptorToChain(chainTailFn, interceptor) {
return (initialRequest, finalHandlerFn) => interceptor.intercept(initialRequest, {
handle: (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)
});
}
function chainedInterceptorFn(chainTailFn, interceptorFn, injector) {
return (initialRequest, finalHandlerFn) => runInInjectionContext(injector, () => interceptorFn(initialRequest, (downstreamRequest) => chainTailFn(downstreamRequest, finalHandlerFn)));
}
var HTTP_INTERCEPTORS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTORS" : "");
var HTTP_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_INTERCEPTOR_FNS" : "");
var HTTP_ROOT_INTERCEPTOR_FNS = new InjectionToken(ngDevMode ? "HTTP_ROOT_INTERCEPTOR_FNS" : "");
var REQUESTS_CONTRIBUTE_TO_STABILITY = new InjectionToken(ngDevMode ? "REQUESTS_CONTRIBUTE_TO_STABILITY" : "", {
providedIn: "root",
factory: () => true
});
function legacyInterceptorFnFactory() {
let chain = null;
return (req, handler) => {
if (chain === null) {
const interceptors = inject(HTTP_INTERCEPTORS, {
optional: true
}) ?? [];
chain = interceptors.reduceRight(adaptLegacyInterceptorToChain, interceptorChainEndFn);
}
const pendingTasks = inject(PendingTasks);
const contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
if (contributeToStability) {
const removeTask = pendingTasks.add();
return chain(req, handler).pipe(finalize(removeTask));
} else {
return chain(req, handler);
}
};
}
var fetchBackendWarningDisplayed = false;
var HttpInterceptorHandler = class _HttpInterceptorHandler extends HttpHandler {
backend;
injector;
chain = null;
pendingTasks = inject(PendingTasks);
contributeToStability = inject(REQUESTS_CONTRIBUTE_TO_STABILITY);
constructor(backend, injector) {
super();
this.backend = backend;
this.injector = injector;
if ((typeof ngDevMode === "undefined" || ngDevMode) && !fetchBackendWarningDisplayed) {
const isTestingBackend = this.backend.isTestingBackend;
if (false) {
fetchBackendWarningDisplayed = true;
injector.get(Console).warn(formatRuntimeError(2801, "Angular detected that `HttpClient` is not configured to use `fetch` APIs. It's strongly recommended to enable `fetch` for applications that use Server-Side Rendering for better performance and compatibility. To enable `fetch`, add the `withFetch()` to the `provideHttpClient()` call at the root of the application."));
}
}
}
handle(initialRequest) {
if (this.chain === null) {
const dedupedInterceptorFns = Array.from(/* @__PURE__ */ new Set([...this.injector.get(HTTP_INTERCEPTOR_FNS), ...this.injector.get(HTTP_ROOT_INTERCEPTOR_FNS, [])]));
this.chain = dedupedInterceptorFns.reduceRight((nextSequencedFn, interceptorFn) => chainedInterceptorFn(nextSequencedFn, interceptorFn, this.injector), interceptorChainEndFn);
}
if (this.contributeToStability) {
const removeTask = this.pendingTasks.add();
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest)).pipe(finalize(removeTask));
} else {
return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
}
}
static \u0275fac = function HttpInterceptorHandler_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpInterceptorHandler)(\u0275\u0275inject(HttpBackend), \u0275\u0275inject(EnvironmentInjector));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HttpInterceptorHandler,
factory: _HttpInterceptorHandler.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpInterceptorHandler, [{
type: Injectable
}], () => [{
type: HttpBackend
}, {
type: EnvironmentInjector
}], null);
})();
var nextRequestId = 0;
var foreignDocument;
var JSONP_ERR_NO_CALLBACK = "JSONP injected script did not invoke callback.";
var JSONP_ERR_WRONG_METHOD = "JSONP requests must use JSONP request method.";
var JSONP_ERR_WRONG_RESPONSE_TYPE = "JSONP requests must use Json response type.";
var JSONP_ERR_HEADERS_NOT_SUPPORTED = "JSONP requests do not support headers.";
var JsonpCallbackContext = class {
};
function jsonpCallbackContext() {
if (typeof window === "object") {
return window;
}
return {};
}
var JsonpClientBackend = class _JsonpClientBackend {
callbackMap;
document;
/**
* A resolved promise that can be used to schedule microtasks in the event handlers.
*/
resolvedPromise = Promise.resolve();
constructor(callbackMap, document2) {
this.callbackMap = callbackMap;
this.document = document2;
}
/**
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
*/
nextCallback() {
return `ng_jsonp_callback_${nextRequestId++}`;
}
/**
* Processes a JSONP request and returns an event stream of the results.
* @param req The request object.
* @returns An observable of the response events.
*
*/
handle(req) {
if (req.method !== "JSONP") {
throw new RuntimeError(2810, ngDevMode && JSONP_ERR_WRONG_METHOD);
} else if (req.responseType !== "json") {
throw new RuntimeError(2811, ngDevMode && JSONP_ERR_WRONG_RESPONSE_TYPE);
}
if (req.headers.keys().length > 0) {
throw new RuntimeError(2812, ngDevMode && JSONP_ERR_HEADERS_NOT_SUPPORTED);
}
return new Observable((observer) => {
const callback = this.nextCallback();
const url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, `=${callback}$1`);
const node = this.document.createElement("script");
node.src = url;
let body = null;
let finished = false;
this.callbackMap[callback] = (data) => {
delete this.callbackMap[callback];
body = data;
finished = true;
};
const cleanup = () => {
node.removeEventListener("load", onLoad);
node.removeEventListener("error", onError);
node.remove();
delete this.callbackMap[callback];
};
const onLoad = () => {
this.resolvedPromise.then(() => {
cleanup();
if (!finished) {
observer.error(new HttpErrorResponse({
url,
status: 0,
statusText: "JSONP Error",
error: new Error(JSONP_ERR_NO_CALLBACK)
}));
return;
}
observer.next(new HttpResponse({
body,
status: HTTP_STATUS_CODE_OK,
statusText: "OK",
url
}));
observer.complete();
});
};
const onError = (error2) => {
cleanup();
observer.error(new HttpErrorResponse({
error: error2,
status: 0,
statusText: "JSONP Error",
url
}));
};
node.addEventListener("load", onLoad);
node.addEventListener("error", onError);
this.document.body.appendChild(node);
observer.next({
type: HttpEventType.Sent
});
return () => {
if (!finished) {
this.removeListeners(node);
}
cleanup();
};
});
}
removeListeners(script) {
foreignDocument ??= this.document.implementation.createHTMLDocument();
foreignDocument.adoptNode(script);
}
static \u0275fac = function JsonpClientBackend_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _JsonpClientBackend)(\u0275\u0275inject(JsonpCallbackContext), \u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _JsonpClientBackend,
factory: _JsonpClientBackend.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpClientBackend, [{
type: Injectable
}], () => [{
type: JsonpCallbackContext
}, {
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
function jsonpInterceptorFn(req, next) {
if (req.method === "JSONP") {
return inject(JsonpClientBackend).handle(req);
}
return next(req);
}
var JsonpInterceptor = class _JsonpInterceptor {
injector;
constructor(injector) {
this.injector = injector;
}
/**
* Identifies and handles a given JSONP request.
* @param initialRequest The outgoing request object to handle.
* @param next The next interceptor in the chain, or the backend
* if no interceptors remain in the chain.
* @returns An observable of the event stream.
*/
intercept(initialRequest, next) {
return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
}
static \u0275fac = function JsonpInterceptor_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _JsonpInterceptor)(\u0275\u0275inject(EnvironmentInjector));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _JsonpInterceptor,
factory: _JsonpInterceptor.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(JsonpInterceptor, [{
type: Injectable
}], () => [{
type: EnvironmentInjector
}], null);
})();
var XSSI_PREFIX = /^\)\]\}',?\n/;
var X_REQUEST_URL_REGEXP = RegExp(`^${X_REQUEST_URL_HEADER}:`, "m");
function getResponseUrl(xhr) {
if ("responseURL" in xhr && xhr.responseURL) {
return xhr.responseURL;
}
if (X_REQUEST_URL_REGEXP.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader(X_REQUEST_URL_HEADER);
}
return null;
}
function validateXhrCompatibility(req) {
const unsupportedOptions = [{
property: "keepalive",
errorCode: 2813
/* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */
}, {
property: "cache",
errorCode: 2814
/* RuntimeErrorCode.CACHE_NOT_SUPPORTED_WITH_XHR */
}, {
property: "priority",
errorCode: 2815
/* RuntimeErrorCode.PRIORITY_NOT_SUPPORTED_WITH_XHR */
}, {
property: "mode",
errorCode: 2816
/* RuntimeErrorCode.MODE_NOT_SUPPORTED_WITH_XHR */
}, {
property: "redirect",
errorCode: 2817
/* RuntimeErrorCode.REDIRECT_NOT_SUPPORTED_WITH_XHR */
}, {
property: "credentials",
errorCode: 2818
/* RuntimeErrorCode.CREDENTIALS_NOT_SUPPORTED_WITH_XHR */
}, {
property: "integrity",
errorCode: 2820
/* RuntimeErrorCode.INTEGRITY_NOT_SUPPORTED_WITH_XHR */
}, {
property: "referrer",
errorCode: 2821
/* RuntimeErrorCode.REFERRER_NOT_SUPPORTED_WITH_XHR */
}];
for (const {
property,
errorCode
} of unsupportedOptions) {
if (req[property]) {
console.warn(formatRuntimeError(errorCode, `Angular detected that a \`HttpClient\` request with the \`${property}\` option was sent using XHR, which does not support it. To use the \`${property}\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
}
}
}
var HttpXhrBackend = class _HttpXhrBackend {
xhrFactory;
constructor(xhrFactory) {
this.xhrFactory = xhrFactory;
}
/**
* Processes a request and returns a stream of response events.
* @param req The request object.
* @returns An observable of the response events.
*/
handle(req) {
if (req.method === "JSONP") {
throw new RuntimeError(-2800, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot make a JSONP request without JSONP support. To fix the problem, either add the \`withJsonpSupport()\` call (if \`provideHttpClient()\` is used) or import the \`HttpClientJsonpModule\` in the root NgModule.`);
}
ngDevMode && validateXhrCompatibility(req);
const xhrFactory = this.xhrFactory;
const source = (
// Note that `ɵloadImpl` is never defined in client bundles and can be
// safely dropped whenever we're running in the browser.
// This branching is redundant.
// The `ngServerMode` guard also enables tree-shaking of the `from()`
// function from the common bundle, as it's only used in server code.
false ? from(xhrFactory.\u0275loadImpl()) : of(null)
);
return source.pipe(switchMap(() => {
return new Observable((observer) => {
const xhr = xhrFactory.build();
xhr.open(req.method, req.urlWithParams);
if (req.withCredentials) {
xhr.withCredentials = true;
}
req.headers.forEach((name2, values) => xhr.setRequestHeader(name2, values.join(",")));
if (!req.headers.has(ACCEPT_HEADER)) {
xhr.setRequestHeader(ACCEPT_HEADER, ACCEPT_HEADER_VALUE);
}
if (!req.headers.has(CONTENT_TYPE_HEADER)) {
const detectedType = req.detectContentTypeHeader();
if (detectedType !== null) {
xhr.setRequestHeader(CONTENT_TYPE_HEADER, detectedType);
}
}
if (req.timeout) {
xhr.timeout = req.timeout;
}
if (req.responseType) {
const responseType = req.responseType.toLowerCase();
xhr.responseType = responseType !== "json" ? responseType : "text";
}
const reqBody = req.serializeBody();
let headerResponse = null;
const partialFromXhr = () => {
if (headerResponse !== null) {
return headerResponse;
}
const statusText = xhr.statusText || "OK";
const headers = new HttpHeaders(xhr.getAllResponseHeaders());
const url = getResponseUrl(xhr) || req.url;
headerResponse = new HttpHeaderResponse({
headers,
status: xhr.status,
statusText,
url
});
return headerResponse;
};
const onLoad = () => {
let {
headers,
status,
statusText,
url
} = partialFromXhr();
let body = null;
if (status !== HTTP_STATUS_CODE_NO_CONTENT) {
body = typeof xhr.response === "undefined" ? xhr.responseText : xhr.response;
}
if (status === 0) {
status = !!body ? HTTP_STATUS_CODE_OK : 0;
}
let ok = status >= 200 && status < 300;
if (req.responseType === "json" && typeof body === "string") {
const originalBody = body;
body = body.replace(XSSI_PREFIX, "");
try {
body = body !== "" ? JSON.parse(body) : null;
} catch (error2) {
body = originalBody;
if (ok) {
ok = false;
body = {
error: error2,
text: body
};
}
}
}
if (ok) {
observer.next(new HttpResponse({
body,
headers,
status,
statusText,
url: url || void 0
}));
observer.complete();
} else {
observer.error(new HttpErrorResponse({
// The error in this case is the response body (error from the server).
error: body,
headers,
status,
statusText,
url: url || void 0
}));
}
};
const onError = (error2) => {
const {
url
} = partialFromXhr();
const res = new HttpErrorResponse({
error: error2,
status: xhr.status || 0,
statusText: xhr.statusText || "Unknown Error",
url: url || void 0
});
observer.error(res);
};
let onTimeout = onError;
if (req.timeout) {
onTimeout = (_) => {
const {
url
} = partialFromXhr();
const res = new HttpErrorResponse({
error: new DOMException("Request timed out", "TimeoutError"),
status: xhr.status || 0,
statusText: xhr.statusText || "Request timeout",
url: url || void 0
});
observer.error(res);
};
}
let sentHeaders = false;
const onDownProgress = (event) => {
if (!sentHeaders) {
observer.next(partialFromXhr());
sentHeaders = true;
}
let progressEvent = {
type: HttpEventType.DownloadProgress,
loaded: event.loaded
};
if (event.lengthComputable) {
progressEvent.total = event.total;
}
if (req.responseType === "text" && !!xhr.responseText) {
progressEvent.partialText = xhr.responseText;
}
observer.next(progressEvent);
};
const onUpProgress = (event) => {
let progress = {
type: HttpEventType.UploadProgress,
loaded: event.loaded
};
if (event.lengthComputable) {
progress.total = event.total;
}
observer.next(progress);
};
xhr.addEventListener("load", onLoad);
xhr.addEventListener("error", onError);
xhr.addEventListener("timeout", onTimeout);
xhr.addEventListener("abort", onError);
if (req.reportProgress) {
xhr.addEventListener("progress", onDownProgress);
if (reqBody !== null && xhr.upload) {
xhr.upload.addEventListener("progress", onUpProgress);
}
}
xhr.send(reqBody);
observer.next({
type: HttpEventType.Sent
});
return () => {
xhr.removeEventListener("error", onError);
xhr.removeEventListener("abort", onError);
xhr.removeEventListener("load", onLoad);
xhr.removeEventListener("timeout", onTimeout);
if (req.reportProgress) {
xhr.removeEventListener("progress", onDownProgress);
if (reqBody !== null && xhr.upload) {
xhr.upload.removeEventListener("progress", onUpProgress);
}
}
if (xhr.readyState !== xhr.DONE) {
xhr.abort();
}
};
});
}));
}
static \u0275fac = function HttpXhrBackend_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpXhrBackend)(\u0275\u0275inject(XhrFactory));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HttpXhrBackend,
factory: _HttpXhrBackend.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXhrBackend, [{
type: Injectable
}], () => [{
type: XhrFactory
}], null);
})();
var XSRF_ENABLED = new InjectionToken(ngDevMode ? "XSRF_ENABLED" : "");
var XSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN";
var XSRF_COOKIE_NAME = new InjectionToken(ngDevMode ? "XSRF_COOKIE_NAME" : "", {
providedIn: "root",
factory: () => XSRF_DEFAULT_COOKIE_NAME
});
var XSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN";
var XSRF_HEADER_NAME = new InjectionToken(ngDevMode ? "XSRF_HEADER_NAME" : "", {
providedIn: "root",
factory: () => XSRF_DEFAULT_HEADER_NAME
});
var HttpXsrfTokenExtractor = class {
};
var HttpXsrfCookieExtractor = class _HttpXsrfCookieExtractor {
doc;
cookieName;
lastCookieString = "";
lastToken = null;
/**
* @internal for testing
*/
parseCount = 0;
constructor(doc, cookieName) {
this.doc = doc;
this.cookieName = cookieName;
}
getToken() {
if (false) {
return null;
}
const cookieString = this.doc.cookie || "";
if (cookieString !== this.lastCookieString) {
this.parseCount++;
this.lastToken = parseCookieValue(cookieString, this.cookieName);
this.lastCookieString = cookieString;
}
return this.lastToken;
}
static \u0275fac = function HttpXsrfCookieExtractor_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpXsrfCookieExtractor)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(XSRF_COOKIE_NAME));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HttpXsrfCookieExtractor,
factory: _HttpXsrfCookieExtractor.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfCookieExtractor, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}, {
type: void 0,
decorators: [{
type: Inject,
args: [XSRF_COOKIE_NAME]
}]
}], null);
})();
var ABSOLUTE_URL_REGEX = /^(?:https?:)?\/\//i;
function xsrfInterceptorFn(req, next) {
if (!inject(XSRF_ENABLED) || req.method === "GET" || req.method === "HEAD" || ABSOLUTE_URL_REGEX.test(req.url)) {
return next(req);
}
const token = inject(HttpXsrfTokenExtractor).getToken();
const headerName = inject(XSRF_HEADER_NAME);
if (token != null && !req.headers.has(headerName)) {
req = req.clone({
headers: req.headers.set(headerName, token)
});
}
return next(req);
}
var HttpXsrfInterceptor = class _HttpXsrfInterceptor {
injector;
constructor(injector) {
this.injector = injector;
}
intercept(initialRequest, next) {
return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
}
static \u0275fac = function HttpXsrfInterceptor_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpXsrfInterceptor)(\u0275\u0275inject(EnvironmentInjector));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HttpXsrfInterceptor,
factory: _HttpXsrfInterceptor.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpXsrfInterceptor, [{
type: Injectable
}], () => [{
type: EnvironmentInjector
}], null);
})();
var HttpFeatureKind;
(function(HttpFeatureKind2) {
HttpFeatureKind2[HttpFeatureKind2["Interceptors"] = 0] = "Interceptors";
HttpFeatureKind2[HttpFeatureKind2["LegacyInterceptors"] = 1] = "LegacyInterceptors";
HttpFeatureKind2[HttpFeatureKind2["CustomXsrfConfiguration"] = 2] = "CustomXsrfConfiguration";
HttpFeatureKind2[HttpFeatureKind2["NoXsrfProtection"] = 3] = "NoXsrfProtection";
HttpFeatureKind2[HttpFeatureKind2["JsonpSupport"] = 4] = "JsonpSupport";
HttpFeatureKind2[HttpFeatureKind2["RequestsMadeViaParent"] = 5] = "RequestsMadeViaParent";
HttpFeatureKind2[HttpFeatureKind2["Fetch"] = 6] = "Fetch";
})(HttpFeatureKind || (HttpFeatureKind = {}));
function makeHttpFeature(kind, providers) {
return {
\u0275kind: kind,
\u0275providers: providers
};
}
function provideHttpClient(...features) {
if (ngDevMode) {
const featureKinds = new Set(features.map((f) => f.\u0275kind));
if (featureKinds.has(HttpFeatureKind.NoXsrfProtection) && featureKinds.has(HttpFeatureKind.CustomXsrfConfiguration)) {
throw new Error(ngDevMode ? `Configuration error: found both withXsrfConfiguration() and withNoXsrfProtection() in the same call to provideHttpClient(), which is a contradiction.` : "");
}
}
const providers = [HttpClient, HttpXhrBackend, HttpInterceptorHandler, {
provide: HttpHandler,
useExisting: HttpInterceptorHandler
}, {
provide: HttpBackend,
useFactory: () => {
return inject(FETCH_BACKEND, {
optional: true
}) ?? inject(HttpXhrBackend);
}
}, {
provide: HTTP_INTERCEPTOR_FNS,
useValue: xsrfInterceptorFn,
multi: true
}, {
provide: XSRF_ENABLED,
useValue: true
}, {
provide: HttpXsrfTokenExtractor,
useClass: HttpXsrfCookieExtractor
}];
for (const feature of features) {
providers.push(...feature.\u0275providers);
}
return makeEnvironmentProviders(providers);
}
var LEGACY_INTERCEPTOR_FN = new InjectionToken(ngDevMode ? "LEGACY_INTERCEPTOR_FN" : "");
function withInterceptorsFromDi() {
return makeHttpFeature(HttpFeatureKind.LegacyInterceptors, [{
provide: LEGACY_INTERCEPTOR_FN,
useFactory: legacyInterceptorFnFactory
}, {
provide: HTTP_INTERCEPTOR_FNS,
useExisting: LEGACY_INTERCEPTOR_FN,
multi: true
}]);
}
function withXsrfConfiguration({
cookieName,
headerName
}) {
const providers = [];
if (cookieName !== void 0) {
providers.push({
provide: XSRF_COOKIE_NAME,
useValue: cookieName
});
}
if (headerName !== void 0) {
providers.push({
provide: XSRF_HEADER_NAME,
useValue: headerName
});
}
return makeHttpFeature(HttpFeatureKind.CustomXsrfConfiguration, providers);
}
function withNoXsrfProtection() {
return makeHttpFeature(HttpFeatureKind.NoXsrfProtection, [{
provide: XSRF_ENABLED,
useValue: false
}]);
}
function withJsonpSupport() {
return makeHttpFeature(HttpFeatureKind.JsonpSupport, [JsonpClientBackend, {
provide: JsonpCallbackContext,
useFactory: jsonpCallbackContext
}, {
provide: HTTP_INTERCEPTOR_FNS,
useValue: jsonpInterceptorFn,
multi: true
}]);
}
var HttpClientXsrfModule = class _HttpClientXsrfModule {
/**
* Disable the default XSRF protection.
*/
static disable() {
return {
ngModule: _HttpClientXsrfModule,
providers: [withNoXsrfProtection().\u0275providers]
};
}
/**
* Configure XSRF protection.
* @param options An object that can specify either or both
* cookie name or header name.
* - Cookie name default is `XSRF-TOKEN`.
* - Header name default is `X-XSRF-TOKEN`.
*
*/
static withOptions(options = {}) {
return {
ngModule: _HttpClientXsrfModule,
providers: withXsrfConfiguration(options).\u0275providers
};
}
static \u0275fac = function HttpClientXsrfModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpClientXsrfModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _HttpClientXsrfModule
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
providers: [HttpXsrfInterceptor, {
provide: HTTP_INTERCEPTORS,
useExisting: HttpXsrfInterceptor,
multi: true
}, {
provide: HttpXsrfTokenExtractor,
useClass: HttpXsrfCookieExtractor
}, withXsrfConfiguration({
cookieName: XSRF_DEFAULT_COOKIE_NAME,
headerName: XSRF_DEFAULT_HEADER_NAME
}).\u0275providers, {
provide: XSRF_ENABLED,
useValue: true
}]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientXsrfModule, [{
type: NgModule,
args: [{
providers: [HttpXsrfInterceptor, {
provide: HTTP_INTERCEPTORS,
useExisting: HttpXsrfInterceptor,
multi: true
}, {
provide: HttpXsrfTokenExtractor,
useClass: HttpXsrfCookieExtractor
}, withXsrfConfiguration({
cookieName: XSRF_DEFAULT_COOKIE_NAME,
headerName: XSRF_DEFAULT_HEADER_NAME
}).\u0275providers, {
provide: XSRF_ENABLED,
useValue: true
}]
}]
}], null, null);
})();
var HttpClientModule = class _HttpClientModule {
static \u0275fac = function HttpClientModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpClientModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _HttpClientModule
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
providers: [provideHttpClient(withInterceptorsFromDi())]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientModule, [{
type: NgModule,
args: [{
/**
* Configures the dependency injector where it is imported
* with supporting services for HTTP communications.
*/
providers: [provideHttpClient(withInterceptorsFromDi())]
}]
}], null, null);
})();
var HttpClientJsonpModule = class _HttpClientJsonpModule {
static \u0275fac = function HttpClientJsonpModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HttpClientJsonpModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _HttpClientJsonpModule
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
providers: [withJsonpSupport().\u0275providers]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HttpClientJsonpModule, [{
type: NgModule,
args: [{
providers: [withJsonpSupport().\u0275providers]
}]
}], null, null);
})();
// node_modules/@angular/common/fesm2022/http.mjs
var httpResource = (() => {
const jsonFn = makeHttpResourceFn("json");
jsonFn.arrayBuffer = makeHttpResourceFn("arraybuffer");
jsonFn.blob = makeHttpResourceFn("blob");
jsonFn.text = makeHttpResourceFn("text");
return jsonFn;
})();
function makeHttpResourceFn(responseType) {
return function httpResource2(request, options) {
if (ngDevMode && !options?.injector) {
assertInInjectionContext(httpResource2);
}
const injector = options?.injector ?? inject(Injector);
return new HttpResourceImpl(injector, () => normalizeRequest(request, responseType), options?.defaultValue, options?.parse, options?.equal);
};
}
function normalizeRequest(request, responseType) {
let unwrappedRequest = typeof request === "function" ? request() : request;
if (unwrappedRequest === void 0) {
return void 0;
} else if (typeof unwrappedRequest === "string") {
unwrappedRequest = { url: unwrappedRequest };
}
const headers = unwrappedRequest.headers instanceof HttpHeaders ? unwrappedRequest.headers : new HttpHeaders(unwrappedRequest.headers);
const params = unwrappedRequest.params instanceof HttpParams ? unwrappedRequest.params : new HttpParams({ fromObject: unwrappedRequest.params });
return new HttpRequest(unwrappedRequest.method ?? "GET", unwrappedRequest.url, unwrappedRequest.body ?? null, {
headers,
params,
reportProgress: unwrappedRequest.reportProgress,
withCredentials: unwrappedRequest.withCredentials,
keepalive: unwrappedRequest.keepalive,
cache: unwrappedRequest.cache,
priority: unwrappedRequest.priority,
mode: unwrappedRequest.mode,
redirect: unwrappedRequest.redirect,
responseType,
context: unwrappedRequest.context,
transferCache: unwrappedRequest.transferCache,
credentials: unwrappedRequest.credentials,
referrer: unwrappedRequest.referrer,
integrity: unwrappedRequest.integrity,
timeout: unwrappedRequest.timeout
});
}
var HttpResourceImpl = class extends ResourceImpl {
client;
_headers = linkedSignal(...ngDevMode ? [{
debugName: "_headers",
source: this.extRequest,
computation: () => void 0
}] : [{
source: this.extRequest,
computation: () => void 0
}]);
_progress = linkedSignal(...ngDevMode ? [{
debugName: "_progress",
source: this.extRequest,
computation: () => void 0
}] : [{
source: this.extRequest,
computation: () => void 0
}]);
_statusCode = linkedSignal(...ngDevMode ? [{
debugName: "_statusCode",
source: this.extRequest,
computation: () => void 0
}] : [{
source: this.extRequest,
computation: () => void 0
}]);
headers = computed(() => this.status() === "resolved" || this.status() === "error" ? this._headers() : void 0, ...ngDevMode ? [{ debugName: "headers" }] : []);
progress = this._progress.asReadonly();
statusCode = this._statusCode.asReadonly();
constructor(injector, request, defaultValue, parse, equal) {
super(request, ({ params: request2, abortSignal }) => {
let sub;
const onAbort = () => sub.unsubscribe();
abortSignal.addEventListener("abort", onAbort);
const stream = signal({ value: void 0 }, ...ngDevMode ? [{ debugName: "stream" }] : []);
let resolve;
const promise = new Promise((r) => resolve = r);
const send = (value) => {
stream.set(value);
resolve?.(stream);
resolve = void 0;
};
sub = this.client.request(request2).subscribe({
next: (event) => {
switch (event.type) {
case HttpEventType.Response:
this._headers.set(event.headers);
this._statusCode.set(event.status);
try {
send({ value: parse ? parse(event.body) : event.body });
} catch (error2) {
send({ error: encapsulateResourceError(error2) });
}
break;
case HttpEventType.DownloadProgress:
this._progress.set(event);
break;
}
},
error: (error2) => {
if (error2 instanceof HttpErrorResponse) {
this._headers.set(error2.headers);
this._statusCode.set(error2.status);
}
send({ error: error2 });
abortSignal.removeEventListener("abort", onAbort);
},
complete: () => {
if (resolve) {
send({
error: new RuntimeError(991, ngDevMode && "Resource completed before producing a value")
});
}
abortSignal.removeEventListener("abort", onAbort);
}
});
return promise;
}, defaultValue, equal, injector);
this.client = injector.get(HttpClient);
}
set(value) {
super.set(value);
this._headers.set(void 0);
this._progress.set(void 0);
this._statusCode.set(void 0);
}
};
var HTTP_TRANSFER_CACHE_ORIGIN_MAP = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_CACHE_ORIGIN_MAP" : "");
var CACHE_OPTIONS = new InjectionToken(ngDevMode ? "HTTP_TRANSFER_STATE_CACHE_OPTIONS" : "");
// node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs
var Meta = class _Meta {
_doc;
_dom;
constructor(_doc) {
this._doc = _doc;
this._dom = getDOM();
}
/**
* Retrieves or creates a specific `<meta>` tag element in the current HTML document.
* In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
* values in the provided tag definition, and verifies that all other attribute values are equal.
* If an existing element is found, it is returned and is not modified in any way.
* @param tag The definition of a `<meta>` element to match or create.
* @param forceCreation True to create a new element without checking whether one already exists.
* @returns The existing element with the same attributes and values if found,
* the new element if no match is found, or `null` if the tag parameter is not defined.
*/
addTag(tag, forceCreation = false) {
if (!tag) return null;
return this._getOrCreateElement(tag, forceCreation);
}
/**
* Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
* In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
* values in the provided tag definition, and verifies that all other attribute values are equal.
* @param tags An array of tag definitions to match or create.
* @param forceCreation True to create new elements without checking whether they already exist.
* @returns The matching elements if found, or the new elements.
*/
addTags(tags, forceCreation = false) {
if (!tags) return [];
return tags.reduce((result, tag) => {
if (tag) {
result.push(this._getOrCreateElement(tag, forceCreation));
}
return result;
}, []);
}
/**
* Retrieves a `<meta>` tag element in the current HTML document.
* @param attrSelector The tag attribute and value to match against, in the format
* `"tag_attribute='value string'"`.
* @returns The matching element, if any.
*/
getTag(attrSelector) {
if (!attrSelector) return null;
return this._doc.querySelector(`meta[${attrSelector}]`) || null;
}
/**
* Retrieves a set of `<meta>` tag elements in the current HTML document.
* @param attrSelector The tag attribute and value to match against, in the format
* `"tag_attribute='value string'"`.
* @returns The matching elements, if any.
*/
getTags(attrSelector) {
if (!attrSelector) return [];
const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
return list ? [].slice.call(list) : [];
}
/**
* Modifies an existing `<meta>` tag element in the current HTML document.
* @param tag The tag description with which to replace the existing tag content.
* @param selector A tag attribute and value to match against, to identify
* an existing tag. A string in the format `"tag_attribute=`value string`"`.
* If not supplied, matches a tag with the same `name` or `property` attribute value as the
* replacement tag.
* @return The modified element.
*/
updateTag(tag, selector) {
if (!tag) return null;
selector = selector || this._parseSelector(tag);
const meta = this.getTag(selector);
if (meta) {
return this._setMetaElementAttributes(tag, meta);
}
return this._getOrCreateElement(tag, true);
}
/**
* Removes an existing `<meta>` tag element from the current HTML document.
* @param attrSelector A tag attribute and value to match against, to identify
* an existing tag. A string in the format `"tag_attribute=`value string`"`.
*/
removeTag(attrSelector) {
this.removeTagElement(this.getTag(attrSelector));
}
/**
* Removes an existing `<meta>` tag element from the current HTML document.
* @param meta The tag definition to match against to identify an existing tag.
*/
removeTagElement(meta) {
if (meta) {
this._dom.remove(meta);
}
}
_getOrCreateElement(meta, forceCreation = false) {
if (!forceCreation) {
const selector = this._parseSelector(meta);
const elem = this.getTags(selector).filter((elem2) => this._containsAttributes(meta, elem2))[0];
if (elem !== void 0) return elem;
}
const element = this._dom.createElement("meta");
this._setMetaElementAttributes(meta, element);
const head = this._doc.getElementsByTagName("head")[0];
head.appendChild(element);
return element;
}
_setMetaElementAttributes(tag, el) {
Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
return el;
}
_parseSelector(tag) {
const attr = tag.name ? "name" : "property";
return `${attr}="${tag[attr]}"`;
}
_containsAttributes(tag, elem) {
return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
}
_getMetaKeyMap(prop) {
return META_KEYS_MAP[prop] || prop;
}
static \u0275fac = function Meta_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _Meta)(\u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _Meta,
factory: _Meta.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Meta, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
var META_KEYS_MAP = {
httpEquiv: "http-equiv"
};
var Title = class _Title {
_doc;
constructor(_doc) {
this._doc = _doc;
}
/**
* Get the title of the current HTML document.
*/
getTitle() {
return this._doc.title;
}
/**
* Set the title of the current HTML document.
* @param newTitle
*/
setTitle(newTitle) {
this._doc.title = newTitle || "";
}
static \u0275fac = function Title_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _Title)(\u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _Title,
factory: _Title.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Title, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
var EVENT_NAMES = {
// pan
"pan": true,
"panstart": true,
"panmove": true,
"panend": true,
"pancancel": true,
"panleft": true,
"panright": true,
"panup": true,
"pandown": true,
// pinch
"pinch": true,
"pinchstart": true,
"pinchmove": true,
"pinchend": true,
"pinchcancel": true,
"pinchin": true,
"pinchout": true,
// press
"press": true,
"pressup": true,
// rotate
"rotate": true,
"rotatestart": true,
"rotatemove": true,
"rotateend": true,
"rotatecancel": true,
// swipe
"swipe": true,
"swipeleft": true,
"swiperight": true,
"swipeup": true,
"swipedown": true,
// tap
"tap": true,
"doubletap": true
};
var HAMMER_GESTURE_CONFIG = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerGestureConfig" : "");
var HAMMER_LOADER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "HammerLoader" : "");
var HammerGestureConfig = class _HammerGestureConfig {
/**
* A set of supported event names for gestures to be used in Angular.
* Angular supports all built-in recognizers, as listed in
* [HammerJS documentation](https://hammerjs.github.io/).
*/
events = [];
/**
* Maps gesture event names to a set of configuration options
* that specify overrides to the default values for specific properties.
*
* The key is a supported event name to be configured,
* and the options object contains a set of properties, with override values
* to be applied to the named recognizer event.
* For example, to disable recognition of the rotate event, specify
* `{"rotate": {"enable": false}}`.
*
* Properties that are not present take the HammerJS default values.
* For information about which properties are supported for which events,
* and their allowed and default values, see
* [HammerJS documentation](https://hammerjs.github.io/).
*
*/
overrides = {};
/**
* Properties whose default values can be overridden for a given event.
* Different sets of properties apply to different events.
* For information about which properties are supported for which events,
* and their allowed and default values, see
* [HammerJS documentation](https://hammerjs.github.io/).
*/
options;
/**
* Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
* and attaches it to a given HTML element.
* @param element The element that will recognize gestures.
* @returns A HammerJS event-manager object.
*/
buildHammer(element) {
const mc = new Hammer(element, this.options);
mc.get("pinch").set({
enable: true
});
mc.get("rotate").set({
enable: true
});
for (const eventName in this.overrides) {
mc.get(eventName).set(this.overrides[eventName]);
}
return mc;
}
static \u0275fac = function HammerGestureConfig_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HammerGestureConfig)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HammerGestureConfig,
factory: _HammerGestureConfig.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGestureConfig, [{
type: Injectable
}], null, null);
})();
var HammerGesturesPlugin = class _HammerGesturesPlugin extends EventManagerPlugin {
_config;
_injector;
loader;
_loaderPromise = null;
constructor(doc, _config, _injector, loader) {
super(doc);
this._config = _config;
this._injector = _injector;
this.loader = loader;
}
supports(eventName) {
if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
return false;
}
if (!window.Hammer && !this.loader) {
if (typeof ngDevMode === "undefined" || ngDevMode) {
const _console = this._injector.get(Console);
_console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not loaded and no custom loader has been specified.`);
}
return false;
}
return true;
}
addEventListener(element, eventName, handler) {
const zone = this.manager.getZone();
eventName = eventName.toLowerCase();
if (!window.Hammer && this.loader) {
this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
let cancelRegistration = false;
let deregister = () => {
cancelRegistration = true;
};
zone.runOutsideAngular(() => this._loaderPromise.then(() => {
if (!window.Hammer) {
if (typeof ngDevMode === "undefined" || ngDevMode) {
const _console = this._injector.get(Console);
_console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
}
deregister = () => {
};
return;
}
if (!cancelRegistration) {
deregister = this.addEventListener(element, eventName, handler);
}
}).catch(() => {
if (typeof ngDevMode === "undefined" || ngDevMode) {
const _console = this._injector.get(Console);
_console.warn(`The "${eventName}" event cannot be bound because the custom Hammer.JS loader failed.`);
}
deregister = () => {
};
}));
return () => {
deregister();
};
}
return zone.runOutsideAngular(() => {
const mc = this._config.buildHammer(element);
const callback = function(eventObj) {
zone.runGuarded(function() {
handler(eventObj);
});
};
mc.on(eventName, callback);
return () => {
mc.off(eventName, callback);
if (typeof mc.destroy === "function") {
mc.destroy();
}
};
});
}
isCustomEvent(eventName) {
return this._config.events.indexOf(eventName) > -1;
}
static \u0275fac = function HammerGesturesPlugin_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HammerGesturesPlugin)(\u0275\u0275inject(DOCUMENT), \u0275\u0275inject(HAMMER_GESTURE_CONFIG), \u0275\u0275inject(Injector), \u0275\u0275inject(HAMMER_LOADER, 8));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HammerGesturesPlugin,
factory: _HammerGesturesPlugin.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerGesturesPlugin, [{
type: Injectable
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}, {
type: HammerGestureConfig,
decorators: [{
type: Inject,
args: [HAMMER_GESTURE_CONFIG]
}]
}, {
type: Injector
}, {
type: void 0,
decorators: [{
type: Optional
}, {
type: Inject,
args: [HAMMER_LOADER]
}]
}], null);
})();
var HammerModule = class _HammerModule {
static \u0275fac = function HammerModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _HammerModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _HammerModule
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({
providers: [{
provide: EVENT_MANAGER_PLUGINS,
useClass: HammerGesturesPlugin,
multi: true,
deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
}, {
provide: HAMMER_GESTURE_CONFIG,
useClass: HammerGestureConfig
}]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HammerModule, [{
type: NgModule,
args: [{
providers: [{
provide: EVENT_MANAGER_PLUGINS,
useClass: HammerGesturesPlugin,
multi: true,
deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Injector, [new Optional(), HAMMER_LOADER]]
}, {
provide: HAMMER_GESTURE_CONFIG,
useClass: HammerGestureConfig
}]
}]
}], null, null);
})();
var DomSanitizer = class _DomSanitizer {
static \u0275fac = function DomSanitizer_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DomSanitizer)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DomSanitizer,
factory: function DomSanitizer_Factory(__ngFactoryType__) {
let __ngConditionalFactory__ = null;
if (__ngFactoryType__) {
__ngConditionalFactory__ = new (__ngFactoryType__ || _DomSanitizer)();
} else {
__ngConditionalFactory__ = \u0275\u0275inject(DomSanitizerImpl);
}
return __ngConditionalFactory__;
},
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizer, [{
type: Injectable,
args: [{
providedIn: "root",
useExisting: forwardRef(() => DomSanitizerImpl)
}]
}], null, null);
})();
var DomSanitizerImpl = class _DomSanitizerImpl extends DomSanitizer {
_doc;
constructor(_doc) {
super();
this._doc = _doc;
}
sanitize(ctx, value) {
if (value == null) return null;
switch (ctx) {
case SecurityContext.NONE:
return value;
case SecurityContext.HTML:
if (allowSanitizationBypassAndThrow(
value,
"HTML"
/* BypassType.Html */
)) {
return unwrapSafeValue(value);
}
return _sanitizeHtml(this._doc, String(value)).toString();
case SecurityContext.STYLE:
if (allowSanitizationBypassAndThrow(
value,
"Style"
/* BypassType.Style */
)) {
return unwrapSafeValue(value);
}
return value;
case SecurityContext.SCRIPT:
if (allowSanitizationBypassAndThrow(
value,
"Script"
/* BypassType.Script */
)) {
return unwrapSafeValue(value);
}
throw new RuntimeError(5200, (typeof ngDevMode === "undefined" || ngDevMode) && "unsafe value used in a script context");
case SecurityContext.URL:
if (allowSanitizationBypassAndThrow(
value,
"URL"
/* BypassType.Url */
)) {
return unwrapSafeValue(value);
}
return _sanitizeUrl(String(value));
case SecurityContext.RESOURCE_URL:
if (allowSanitizationBypassAndThrow(
value,
"ResourceURL"
/* BypassType.ResourceUrl */
)) {
return unwrapSafeValue(value);
}
throw new RuntimeError(5201, (typeof ngDevMode === "undefined" || ngDevMode) && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
default:
throw new RuntimeError(5202, (typeof ngDevMode === "undefined" || ngDevMode) && `Unexpected SecurityContext ${ctx} (see ${XSS_SECURITY_URL})`);
}
}
bypassSecurityTrustHtml(value) {
return bypassSanitizationTrustHtml(value);
}
bypassSecurityTrustStyle(value) {
return bypassSanitizationTrustStyle(value);
}
bypassSecurityTrustScript(value) {
return bypassSanitizationTrustScript(value);
}
bypassSecurityTrustUrl(value) {
return bypassSanitizationTrustUrl(value);
}
bypassSecurityTrustResourceUrl(value) {
return bypassSanitizationTrustResourceUrl(value);
}
static \u0275fac = function DomSanitizerImpl_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DomSanitizerImpl)(\u0275\u0275inject(DOCUMENT));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DomSanitizerImpl,
factory: _DomSanitizerImpl.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DomSanitizerImpl, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: void 0,
decorators: [{
type: Inject,
args: [DOCUMENT]
}]
}], null);
})();
var HydrationFeatureKind;
(function(HydrationFeatureKind2) {
HydrationFeatureKind2[HydrationFeatureKind2["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
HydrationFeatureKind2[HydrationFeatureKind2["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
HydrationFeatureKind2[HydrationFeatureKind2["I18nSupport"] = 2] = "I18nSupport";
HydrationFeatureKind2[HydrationFeatureKind2["EventReplay"] = 3] = "EventReplay";
HydrationFeatureKind2[HydrationFeatureKind2["IncrementalHydration"] = 4] = "IncrementalHydration";
})(HydrationFeatureKind || (HydrationFeatureKind = {}));
// node_modules/@angular/router/fesm2022/router2.mjs
var PRIMARY_OUTLET = "primary";
var RouteTitleKey = /* @__PURE__ */ Symbol("RouteTitle");
var ParamsAsMap = class {
params;
constructor(params) {
this.params = params || {};
}
has(name2) {
return Object.prototype.hasOwnProperty.call(this.params, name2);
}
get(name2) {
if (this.has(name2)) {
const v = this.params[name2];
return Array.isArray(v) ? v[0] : v;
}
return null;
}
getAll(name2) {
if (this.has(name2)) {
const v = this.params[name2];
return Array.isArray(v) ? v : [v];
}
return [];
}
get keys() {
return Object.keys(this.params);
}
};
function convertToParamMap(params) {
return new ParamsAsMap(params);
}
function defaultUrlMatcher(segments, segmentGroup, route) {
const parts = route.path.split("/");
if (parts.length > segments.length) {
return null;
}
if (route.pathMatch === "full" && (segmentGroup.hasChildren() || parts.length < segments.length)) {
return null;
}
const posParams = {};
for (let index = 0; index < parts.length; index++) {
const part = parts[index];
const segment = segments[index];
const isParameter = part[0] === ":";
if (isParameter) {
posParams[part.substring(1)] = segment;
} else if (part !== segment.path) {
return null;
}
}
return {
consumed: segments.slice(0, parts.length),
posParams
};
}
function shallowEqualArrays(a, b) {
if (a.length !== b.length) return false;
for (let i = 0; i < a.length; ++i) {
if (!shallowEqual(a[i], b[i])) return false;
}
return true;
}
function shallowEqual(a, b) {
const k1 = a ? getDataKeys(a) : void 0;
const k2 = b ? getDataKeys(b) : void 0;
if (!k1 || !k2 || k1.length != k2.length) {
return false;
}
let key;
for (let i = 0; i < k1.length; i++) {
key = k1[i];
if (!equalArraysOrString(a[key], b[key])) {
return false;
}
}
return true;
}
function getDataKeys(obj) {
return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
}
function equalArraysOrString(a, b) {
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) return false;
const aSorted = [...a].sort();
const bSorted = [...b].sort();
return aSorted.every((val, index) => bSorted[index] === val);
} else {
return a === b;
}
}
function last2(a) {
return a.length > 0 ? a[a.length - 1] : null;
}
function wrapIntoObservable(value) {
if (isObservable(value)) {
return value;
}
if (isPromise(value)) {
return from(Promise.resolve(value));
}
return of(value);
}
var pathCompareMap = {
"exact": equalSegmentGroups,
"subset": containsSegmentGroup
};
var paramCompareMap = {
"exact": equalParams,
"subset": containsParams,
"ignored": () => true
};
function containsTree(container, containee, options) {
return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) && paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) && !(options.fragment === "exact" && container.fragment !== containee.fragment);
}
function equalParams(container, containee) {
return shallowEqual(container, containee);
}
function equalSegmentGroups(container, containee, matrixParams) {
if (!equalPath(container.segments, containee.segments)) return false;
if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {
return false;
}
if (container.numberOfChildren !== containee.numberOfChildren) return false;
for (const c in containee.children) {
if (!container.children[c]) return false;
if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams)) return false;
}
return true;
}
function containsParams(container, containee) {
return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every((key) => equalArraysOrString(container[key], containee[key]));
}
function containsSegmentGroup(container, containee, matrixParams) {
return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);
}
function containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {
if (container.segments.length > containeePaths.length) {
const current = container.segments.slice(0, containeePaths.length);
if (!equalPath(current, containeePaths)) return false;
if (containee.hasChildren()) return false;
if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false;
return true;
} else if (container.segments.length === containeePaths.length) {
if (!equalPath(container.segments, containeePaths)) return false;
if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false;
for (const c in containee.children) {
if (!container.children[c]) return false;
if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {
return false;
}
}
return true;
} else {
const current = containeePaths.slice(0, container.segments.length);
const next = containeePaths.slice(container.segments.length);
if (!equalPath(container.segments, current)) return false;
if (!matrixParamsMatch(container.segments, current, matrixParams)) return false;
if (!container.children[PRIMARY_OUTLET]) return false;
return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);
}
}
function matrixParamsMatch(containerPaths, containeePaths, options) {
return containeePaths.every((containeeSegment, i) => {
return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);
});
}
var UrlTree = class {
root;
queryParams;
fragment;
/** @internal */
_queryParamMap;
constructor(root = new UrlSegmentGroup([], {}), queryParams = {}, fragment = null) {
this.root = root;
this.queryParams = queryParams;
this.fragment = fragment;
if (typeof ngDevMode === "undefined" || ngDevMode) {
if (root.segments.length > 0) {
throw new RuntimeError(4015, "The root `UrlSegmentGroup` should not contain `segments`. Instead, these segments belong in the `children` so they can be associated with a named outlet.");
}
}
}
get queryParamMap() {
this._queryParamMap ??= convertToParamMap(this.queryParams);
return this._queryParamMap;
}
/** @docsNotRequired */
toString() {
return DEFAULT_SERIALIZER.serialize(this);
}
};
var UrlSegmentGroup = class {
segments;
children;
/** The parent node in the url tree */
parent = null;
constructor(segments, children) {
this.segments = segments;
this.children = children;
Object.values(children).forEach((v) => v.parent = this);
}
/** Whether the segment has child segments */
hasChildren() {
return this.numberOfChildren > 0;
}
/** Number of child segments */
get numberOfChildren() {
return Object.keys(this.children).length;
}
/** @docsNotRequired */
toString() {
return serializePaths(this);
}
};
var UrlSegment = class {
path;
parameters;
/** @internal */
_parameterMap;
constructor(path, parameters) {
this.path = path;
this.parameters = parameters;
}
get parameterMap() {
this._parameterMap ??= convertToParamMap(this.parameters);
return this._parameterMap;
}
/** @docsNotRequired */
toString() {
return serializePath(this);
}
};
function equalSegments(as, bs) {
return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));
}
function equalPath(as, bs) {
if (as.length !== bs.length) return false;
return as.every((a, i) => a.path === bs[i].path);
}
function mapChildrenIntoArray(segment, fn) {
let res = [];
Object.entries(segment.children).forEach(([childOutlet, child]) => {
if (childOutlet === PRIMARY_OUTLET) {
res = res.concat(fn(child, childOutlet));
}
});
Object.entries(segment.children).forEach(([childOutlet, child]) => {
if (childOutlet !== PRIMARY_OUTLET) {
res = res.concat(fn(child, childOutlet));
}
});
return res;
}
var UrlSerializer = class _UrlSerializer {
static \u0275fac = function UrlSerializer_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _UrlSerializer)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _UrlSerializer,
factory: () => (() => new DefaultUrlSerializer())(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlSerializer, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => new DefaultUrlSerializer()
}]
}], null, null);
})();
var DefaultUrlSerializer = class {
/** Parses a url into a `UrlTree` */
parse(url) {
const p = new UrlParser(url);
return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());
}
/** Converts a `UrlTree` into a url */
serialize(tree2) {
const segment = `/${serializeSegment(tree2.root, true)}`;
const query = serializeQueryParams(tree2.queryParams);
const fragment = typeof tree2.fragment === `string` ? `#${encodeUriFragment(tree2.fragment)}` : "";
return `${segment}${query}${fragment}`;
}
};
var DEFAULT_SERIALIZER = new DefaultUrlSerializer();
function serializePaths(segment) {
return segment.segments.map((p) => serializePath(p)).join("/");
}
function serializeSegment(segment, root) {
if (!segment.hasChildren()) {
return serializePaths(segment);
}
if (root) {
const primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : "";
const children = [];
Object.entries(segment.children).forEach(([k, v]) => {
if (k !== PRIMARY_OUTLET) {
children.push(`${k}:${serializeSegment(v, false)}`);
}
});
return children.length > 0 ? `${primary}(${children.join("//")})` : primary;
} else {
const children = mapChildrenIntoArray(segment, (v, k) => {
if (k === PRIMARY_OUTLET) {
return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];
}
return [`${k}:${serializeSegment(v, false)}`];
});
if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {
return `${serializePaths(segment)}/${children[0]}`;
}
return `${serializePaths(segment)}/(${children.join("//")})`;
}
}
function encodeUriString(s) {
return encodeURIComponent(s).replace(/%40/g, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",");
}
function encodeUriQuery(s) {
return encodeUriString(s).replace(/%3B/gi, ";");
}
function encodeUriFragment(s) {
return encodeURI(s);
}
function encodeUriSegment(s) {
return encodeUriString(s).replace(/\(/g, "%28").replace(/\)/g, "%29").replace(/%26/gi, "&");
}
function decode(s) {
return decodeURIComponent(s);
}
function decodeQuery(s) {
return decode(s.replace(/\+/g, "%20"));
}
function serializePath(path) {
return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;
}
function serializeMatrixParams(params) {
return Object.entries(params).map(([key, value]) => `;${encodeUriSegment(key)}=${encodeUriSegment(value)}`).join("");
}
function serializeQueryParams(params) {
const strParams = Object.entries(params).map(([name2, value]) => {
return Array.isArray(value) ? value.map((v) => `${encodeUriQuery(name2)}=${encodeUriQuery(v)}`).join("&") : `${encodeUriQuery(name2)}=${encodeUriQuery(value)}`;
}).filter((s) => s);
return strParams.length ? `?${strParams.join("&")}` : "";
}
var SEGMENT_RE = /^[^\/()?;#]+/;
function matchSegments(str) {
const match2 = str.match(SEGMENT_RE);
return match2 ? match2[0] : "";
}
var MATRIX_PARAM_SEGMENT_RE = /^[^\/()?;=#]+/;
function matchMatrixKeySegments(str) {
const match2 = str.match(MATRIX_PARAM_SEGMENT_RE);
return match2 ? match2[0] : "";
}
var QUERY_PARAM_RE = /^[^=?&#]+/;
function matchQueryParams(str) {
const match2 = str.match(QUERY_PARAM_RE);
return match2 ? match2[0] : "";
}
var QUERY_PARAM_VALUE_RE = /^[^&#]+/;
function matchUrlQueryParamValue(str) {
const match2 = str.match(QUERY_PARAM_VALUE_RE);
return match2 ? match2[0] : "";
}
var UrlParser = class {
url;
remaining;
constructor(url) {
this.url = url;
this.remaining = url;
}
parseRootSegment() {
this.consumeOptional("/");
if (this.remaining === "" || this.peekStartsWith("?") || this.peekStartsWith("#")) {
return new UrlSegmentGroup([], {});
}
return new UrlSegmentGroup([], this.parseChildren());
}
parseQueryParams() {
const params = {};
if (this.consumeOptional("?")) {
do {
this.parseQueryParam(params);
} while (this.consumeOptional("&"));
}
return params;
}
parseFragment() {
return this.consumeOptional("#") ? decodeURIComponent(this.remaining) : null;
}
parseChildren() {
if (this.remaining === "") {
return {};
}
this.consumeOptional("/");
const segments = [];
if (!this.peekStartsWith("(")) {
segments.push(this.parseSegment());
}
while (this.peekStartsWith("/") && !this.peekStartsWith("//") && !this.peekStartsWith("/(")) {
this.capture("/");
segments.push(this.parseSegment());
}
let children = {};
if (this.peekStartsWith("/(")) {
this.capture("/");
children = this.parseParens(true);
}
let res = {};
if (this.peekStartsWith("(")) {
res = this.parseParens(false);
}
if (segments.length > 0 || Object.keys(children).length > 0) {
res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
}
return res;
}
// parse a segment with its matrix parameters
// ie `name;k1=v1;k2`
parseSegment() {
const path = matchSegments(this.remaining);
if (path === "" && this.peekStartsWith(";")) {
throw new RuntimeError(4009, (typeof ngDevMode === "undefined" || ngDevMode) && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
}
this.capture(path);
return new UrlSegment(decode(path), this.parseMatrixParams());
}
parseMatrixParams() {
const params = {};
while (this.consumeOptional(";")) {
this.parseParam(params);
}
return params;
}
parseParam(params) {
const key = matchMatrixKeySegments(this.remaining);
if (!key) {
return;
}
this.capture(key);
let value = "";
if (this.consumeOptional("=")) {
const valueMatch = matchSegments(this.remaining);
if (valueMatch) {
value = valueMatch;
this.capture(value);
}
}
params[decode(key)] = decode(value);
}
// Parse a single query parameter `name[=value]`
parseQueryParam(params) {
const key = matchQueryParams(this.remaining);
if (!key) {
return;
}
this.capture(key);
let value = "";
if (this.consumeOptional("=")) {
const valueMatch = matchUrlQueryParamValue(this.remaining);
if (valueMatch) {
value = valueMatch;
this.capture(value);
}
}
const decodedKey = decodeQuery(key);
const decodedVal = decodeQuery(value);
if (params.hasOwnProperty(decodedKey)) {
let currentVal = params[decodedKey];
if (!Array.isArray(currentVal)) {
currentVal = [currentVal];
params[decodedKey] = currentVal;
}
currentVal.push(decodedVal);
} else {
params[decodedKey] = decodedVal;
}
}
// parse `(a/b//outlet_name:c/d)`
parseParens(allowPrimary) {
const segments = {};
this.capture("(");
while (!this.consumeOptional(")") && this.remaining.length > 0) {
const path = matchSegments(this.remaining);
const next = this.remaining[path.length];
if (next !== "/" && next !== ")" && next !== ";") {
throw new RuntimeError(4010, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot parse url '${this.url}'`);
}
let outletName;
if (path.indexOf(":") > -1) {
outletName = path.slice(0, path.indexOf(":"));
this.capture(outletName);
this.capture(":");
} else if (allowPrimary) {
outletName = PRIMARY_OUTLET;
}
const children = this.parseChildren();
segments[outletName ?? PRIMARY_OUTLET] = Object.keys(children).length === 1 && children[PRIMARY_OUTLET] ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children);
this.consumeOptional("//");
}
return segments;
}
peekStartsWith(str) {
return this.remaining.startsWith(str);
}
// Consumes the prefix when it is present and returns whether it has been consumed
consumeOptional(str) {
if (this.peekStartsWith(str)) {
this.remaining = this.remaining.substring(str.length);
return true;
}
return false;
}
capture(str) {
if (!this.consumeOptional(str)) {
throw new RuntimeError(4011, (typeof ngDevMode === "undefined" || ngDevMode) && `Expected "${str}".`);
}
}
};
function createRoot(rootCandidate) {
return rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {
[PRIMARY_OUTLET]: rootCandidate
}) : rootCandidate;
}
function squashSegmentGroup(segmentGroup) {
const newChildren = {};
for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {
const childCandidate = squashSegmentGroup(child);
if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 && childCandidate.hasChildren()) {
for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {
newChildren[grandChildOutlet] = grandChild;
}
} else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {
newChildren[childOutlet] = childCandidate;
}
}
const s = new UrlSegmentGroup(segmentGroup.segments, newChildren);
return mergeTrivialChildren(s);
}
function mergeTrivialChildren(s) {
if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {
const c = s.children[PRIMARY_OUTLET];
return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);
}
return s;
}
function isUrlTree(v) {
return v instanceof UrlTree;
}
function createUrlTreeFromSnapshot(relativeTo, commands, queryParams = null, fragment = null) {
const relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeTo);
return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);
}
function createSegmentGroupFromRoute(route) {
let targetGroup;
function createSegmentGroupFromRouteRecursive(currentRoute) {
const childOutlets = {};
for (const childSnapshot of currentRoute.children) {
const root = createSegmentGroupFromRouteRecursive(childSnapshot);
childOutlets[childSnapshot.outlet] = root;
}
const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);
if (currentRoute === route) {
targetGroup = segmentGroup;
}
return segmentGroup;
}
const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);
const rootSegmentGroup = createRoot(rootCandidate);
return targetGroup ?? rootSegmentGroup;
}
function createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragment) {
let root = relativeTo;
while (root.parent) {
root = root.parent;
}
if (commands.length === 0) {
return tree(root, root, root, queryParams, fragment);
}
const nav = computeNavigation(commands);
if (nav.toRoot()) {
return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);
}
const position = findStartingPositionForTargetGroup(nav, root, relativeTo);
const newSegmentGroup = position.processChildren ? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands) : updateSegmentGroup(position.segmentGroup, position.index, nav.commands);
return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);
}
function isMatrixParams(command) {
return typeof command === "object" && command != null && !command.outlets && !command.segmentPath;
}
function isCommandWithOutlets(command) {
return typeof command === "object" && command != null && command.outlets;
}
function tree(oldRoot, oldSegmentGroup, newSegmentGroup, queryParams, fragment) {
let qp = {};
if (queryParams) {
Object.entries(queryParams).forEach(([name2, value]) => {
qp[name2] = Array.isArray(value) ? value.map((v) => `${v}`) : `${value}`;
});
}
let rootCandidate;
if (oldRoot === oldSegmentGroup) {
rootCandidate = newSegmentGroup;
} else {
rootCandidate = replaceSegment(oldRoot, oldSegmentGroup, newSegmentGroup);
}
const newRoot = createRoot(squashSegmentGroup(rootCandidate));
return new UrlTree(newRoot, qp, fragment);
}
function replaceSegment(current, oldSegment, newSegment) {
const children = {};
Object.entries(current.children).forEach(([outletName, c]) => {
if (c === oldSegment) {
children[outletName] = newSegment;
} else {
children[outletName] = replaceSegment(c, oldSegment, newSegment);
}
});
return new UrlSegmentGroup(current.segments, children);
}
var Navigation = class {
isAbsolute;
numberOfDoubleDots;
commands;
constructor(isAbsolute, numberOfDoubleDots, commands) {
this.isAbsolute = isAbsolute;
this.numberOfDoubleDots = numberOfDoubleDots;
this.commands = commands;
if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
throw new RuntimeError(4003, (typeof ngDevMode === "undefined" || ngDevMode) && "Root segment cannot have matrix parameters");
}
const cmdWithOutlet = commands.find(isCommandWithOutlets);
if (cmdWithOutlet && cmdWithOutlet !== last2(commands)) {
throw new RuntimeError(4004, (typeof ngDevMode === "undefined" || ngDevMode) && "{outlets:{}} has to be the last command");
}
}
toRoot() {
return this.isAbsolute && this.commands.length === 1 && this.commands[0] == "/";
}
};
function computeNavigation(commands) {
if (typeof commands[0] === "string" && commands.length === 1 && commands[0] === "/") {
return new Navigation(true, 0, commands);
}
let numberOfDoubleDots = 0;
let isAbsolute = false;
const res = commands.reduce((res2, cmd, cmdIdx) => {
if (typeof cmd === "object" && cmd != null) {
if (cmd.outlets) {
const outlets = {};
Object.entries(cmd.outlets).forEach(([name2, commands2]) => {
outlets[name2] = typeof commands2 === "string" ? commands2.split("/") : commands2;
});
return [...res2, {
outlets
}];
}
if (cmd.segmentPath) {
return [...res2, cmd.segmentPath];
}
}
if (!(typeof cmd === "string")) {
return [...res2, cmd];
}
if (cmdIdx === 0) {
cmd.split("/").forEach((urlPart, partIndex) => {
if (partIndex == 0 && urlPart === ".") ;
else if (partIndex == 0 && urlPart === "") {
isAbsolute = true;
} else if (urlPart === "..") {
numberOfDoubleDots++;
} else if (urlPart != "") {
res2.push(urlPart);
}
});
return res2;
}
return [...res2, cmd];
}, []);
return new Navigation(isAbsolute, numberOfDoubleDots, res);
}
var Position = class {
segmentGroup;
processChildren;
index;
constructor(segmentGroup, processChildren, index) {
this.segmentGroup = segmentGroup;
this.processChildren = processChildren;
this.index = index;
}
};
function findStartingPositionForTargetGroup(nav, root, target) {
if (nav.isAbsolute) {
return new Position(root, true, 0);
}
if (!target) {
return new Position(root, false, NaN);
}
if (target.parent === null) {
return new Position(target, true, 0);
}
const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;
const index = target.segments.length - 1 + modifier;
return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);
}
function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
let g = group;
let ci = index;
let dd = numberOfDoubleDots;
while (dd > ci) {
dd -= ci;
g = g.parent;
if (!g) {
throw new RuntimeError(4005, (typeof ngDevMode === "undefined" || ngDevMode) && "Invalid number of '../'");
}
ci = g.segments.length;
}
return new Position(g, false, ci - dd);
}
function getOutlets(commands) {
if (isCommandWithOutlets(commands[0])) {
return commands[0].outlets;
}
return {
[PRIMARY_OUTLET]: commands
};
}
function updateSegmentGroup(segmentGroup, startIndex, commands) {
segmentGroup ??= new UrlSegmentGroup([], {});
if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
return updateSegmentGroupChildren(segmentGroup, startIndex, commands);
}
const m = prefixedWith(segmentGroup, startIndex, commands);
const slicedCommands = commands.slice(m.commandIndex);
if (m.match && m.pathIndex < segmentGroup.segments.length) {
const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});
g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
return updateSegmentGroupChildren(g, 0, slicedCommands);
} else if (m.match && slicedCommands.length === 0) {
return new UrlSegmentGroup(segmentGroup.segments, {});
} else if (m.match && !segmentGroup.hasChildren()) {
return createNewSegmentGroup(segmentGroup, startIndex, commands);
} else if (m.match) {
return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);
} else {
return createNewSegmentGroup(segmentGroup, startIndex, commands);
}
}
function updateSegmentGroupChildren(segmentGroup, startIndex, commands) {
if (commands.length === 0) {
return new UrlSegmentGroup(segmentGroup.segments, {});
} else {
const outlets = getOutlets(commands);
const children = {};
if (Object.keys(outlets).some((o) => o !== PRIMARY_OUTLET) && segmentGroup.children[PRIMARY_OUTLET] && segmentGroup.numberOfChildren === 1 && segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {
const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);
return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);
}
Object.entries(outlets).forEach(([outlet, commands2]) => {
if (typeof commands2 === "string") {
commands2 = [commands2];
}
if (commands2 !== null) {
children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands2);
}
});
Object.entries(segmentGroup.children).forEach(([childOutlet, child]) => {
if (outlets[childOutlet] === void 0) {
children[childOutlet] = child;
}
});
return new UrlSegmentGroup(segmentGroup.segments, children);
}
}
function prefixedWith(segmentGroup, startIndex, commands) {
let currentCommandIndex = 0;
let currentPathIndex = startIndex;
const noMatch2 = {
match: false,
pathIndex: 0,
commandIndex: 0
};
while (currentPathIndex < segmentGroup.segments.length) {
if (currentCommandIndex >= commands.length) return noMatch2;
const path = segmentGroup.segments[currentPathIndex];
const command = commands[currentCommandIndex];
if (isCommandWithOutlets(command)) {
break;
}
const curr = `${command}`;
const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;
if (currentPathIndex > 0 && curr === void 0) break;
if (curr && next && typeof next === "object" && next.outlets === void 0) {
if (!compare(curr, next, path)) return noMatch2;
currentCommandIndex += 2;
} else {
if (!compare(curr, {}, path)) return noMatch2;
currentCommandIndex++;
}
currentPathIndex++;
}
return {
match: true,
pathIndex: currentPathIndex,
commandIndex: currentCommandIndex
};
}
function createNewSegmentGroup(segmentGroup, startIndex, commands) {
const paths = segmentGroup.segments.slice(0, startIndex);
let i = 0;
while (i < commands.length) {
const command = commands[i];
if (isCommandWithOutlets(command)) {
const children = createNewSegmentChildren(command.outlets);
return new UrlSegmentGroup(paths, children);
}
if (i === 0 && isMatrixParams(commands[0])) {
const p = segmentGroup.segments[startIndex];
paths.push(new UrlSegment(p.path, stringify2(commands[0])));
i++;
continue;
}
const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;
const next = i < commands.length - 1 ? commands[i + 1] : null;
if (curr && next && isMatrixParams(next)) {
paths.push(new UrlSegment(curr, stringify2(next)));
i += 2;
} else {
paths.push(new UrlSegment(curr, {}));
i++;
}
}
return new UrlSegmentGroup(paths, {});
}
function createNewSegmentChildren(outlets) {
const children = {};
Object.entries(outlets).forEach(([outlet, commands]) => {
if (typeof commands === "string") {
commands = [commands];
}
if (commands !== null) {
children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);
}
});
return children;
}
function stringify2(params) {
const res = {};
Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);
return res;
}
function compare(path, params, segment) {
return path == segment.path && shallowEqual(params, segment.parameters);
}
var IMPERATIVE_NAVIGATION = "imperative";
var EventType;
(function(EventType2) {
EventType2[EventType2["NavigationStart"] = 0] = "NavigationStart";
EventType2[EventType2["NavigationEnd"] = 1] = "NavigationEnd";
EventType2[EventType2["NavigationCancel"] = 2] = "NavigationCancel";
EventType2[EventType2["NavigationError"] = 3] = "NavigationError";
EventType2[EventType2["RoutesRecognized"] = 4] = "RoutesRecognized";
EventType2[EventType2["ResolveStart"] = 5] = "ResolveStart";
EventType2[EventType2["ResolveEnd"] = 6] = "ResolveEnd";
EventType2[EventType2["GuardsCheckStart"] = 7] = "GuardsCheckStart";
EventType2[EventType2["GuardsCheckEnd"] = 8] = "GuardsCheckEnd";
EventType2[EventType2["RouteConfigLoadStart"] = 9] = "RouteConfigLoadStart";
EventType2[EventType2["RouteConfigLoadEnd"] = 10] = "RouteConfigLoadEnd";
EventType2[EventType2["ChildActivationStart"] = 11] = "ChildActivationStart";
EventType2[EventType2["ChildActivationEnd"] = 12] = "ChildActivationEnd";
EventType2[EventType2["ActivationStart"] = 13] = "ActivationStart";
EventType2[EventType2["ActivationEnd"] = 14] = "ActivationEnd";
EventType2[EventType2["Scroll"] = 15] = "Scroll";
EventType2[EventType2["NavigationSkipped"] = 16] = "NavigationSkipped";
})(EventType || (EventType = {}));
var RouterEvent = class {
id;
url;
constructor(id, url) {
this.id = id;
this.url = url;
}
};
var NavigationStart = class extends RouterEvent {
type = EventType.NavigationStart;
/**
* Identifies the call or event that triggered the navigation.
* An `imperative` trigger is a call to `router.navigateByUrl()` or `router.navigate()`.
*
* @see {@link NavigationEnd}
* @see {@link NavigationCancel}
* @see {@link NavigationError}
*/
navigationTrigger;
/**
* The navigation state that was previously supplied to the `pushState` call,
* when the navigation is triggered by a `popstate` event. Otherwise null.
*
* The state object is defined by `NavigationExtras`, and contains any
* developer-defined state value, as well as a unique ID that
* the router assigns to every router transition/navigation.
*
* From the perspective of the router, the router never "goes back".
* When the user clicks on the back button in the browser,
* a new navigation ID is created.
*
* Use the ID in this previous-state object to differentiate between a newly created
* state and one returned to by a `popstate` event, so that you can restore some
* remembered state, such as scroll position.
*
*/
restoredState;
constructor(id, url, navigationTrigger = "imperative", restoredState = null) {
super(id, url);
this.navigationTrigger = navigationTrigger;
this.restoredState = restoredState;
}
/** @docsNotRequired */
toString() {
return `NavigationStart(id: ${this.id}, url: '${this.url}')`;
}
};
var NavigationEnd = class extends RouterEvent {
urlAfterRedirects;
type = EventType.NavigationEnd;
constructor(id, url, urlAfterRedirects) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
}
/** @docsNotRequired */
toString() {
return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`;
}
};
var NavigationCancellationCode;
(function(NavigationCancellationCode2) {
NavigationCancellationCode2[NavigationCancellationCode2["Redirect"] = 0] = "Redirect";
NavigationCancellationCode2[NavigationCancellationCode2["SupersededByNewNavigation"] = 1] = "SupersededByNewNavigation";
NavigationCancellationCode2[NavigationCancellationCode2["NoDataFromResolver"] = 2] = "NoDataFromResolver";
NavigationCancellationCode2[NavigationCancellationCode2["GuardRejected"] = 3] = "GuardRejected";
NavigationCancellationCode2[NavigationCancellationCode2["Aborted"] = 4] = "Aborted";
})(NavigationCancellationCode || (NavigationCancellationCode = {}));
var NavigationSkippedCode;
(function(NavigationSkippedCode2) {
NavigationSkippedCode2[NavigationSkippedCode2["IgnoredSameUrlNavigation"] = 0] = "IgnoredSameUrlNavigation";
NavigationSkippedCode2[NavigationSkippedCode2["IgnoredByUrlHandlingStrategy"] = 1] = "IgnoredByUrlHandlingStrategy";
})(NavigationSkippedCode || (NavigationSkippedCode = {}));
var NavigationCancel = class extends RouterEvent {
reason;
code;
type = EventType.NavigationCancel;
constructor(id, url, reason, code) {
super(id, url);
this.reason = reason;
this.code = code;
}
/** @docsNotRequired */
toString() {
return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;
}
};
var NavigationSkipped = class extends RouterEvent {
reason;
code;
type = EventType.NavigationSkipped;
constructor(id, url, reason, code) {
super(id, url);
this.reason = reason;
this.code = code;
}
};
var NavigationError = class extends RouterEvent {
error;
target;
type = EventType.NavigationError;
constructor(id, url, error2, target) {
super(id, url);
this.error = error2;
this.target = target;
}
/** @docsNotRequired */
toString() {
return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`;
}
};
var RoutesRecognized = class extends RouterEvent {
urlAfterRedirects;
state;
type = EventType.RoutesRecognized;
constructor(id, url, urlAfterRedirects, state) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
this.state = state;
}
/** @docsNotRequired */
toString() {
return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
}
};
var GuardsCheckStart = class extends RouterEvent {
urlAfterRedirects;
state;
type = EventType.GuardsCheckStart;
constructor(id, url, urlAfterRedirects, state) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
this.state = state;
}
toString() {
return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
}
};
var GuardsCheckEnd = class extends RouterEvent {
urlAfterRedirects;
state;
shouldActivate;
type = EventType.GuardsCheckEnd;
constructor(id, url, urlAfterRedirects, state, shouldActivate) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
this.state = state;
this.shouldActivate = shouldActivate;
}
toString() {
return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`;
}
};
var ResolveStart = class extends RouterEvent {
urlAfterRedirects;
state;
type = EventType.ResolveStart;
constructor(id, url, urlAfterRedirects, state) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
this.state = state;
}
toString() {
return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
}
};
var ResolveEnd = class extends RouterEvent {
urlAfterRedirects;
state;
type = EventType.ResolveEnd;
constructor(id, url, urlAfterRedirects, state) {
super(id, url);
this.urlAfterRedirects = urlAfterRedirects;
this.state = state;
}
toString() {
return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;
}
};
var RouteConfigLoadStart = class {
route;
type = EventType.RouteConfigLoadStart;
constructor(route) {
this.route = route;
}
toString() {
return `RouteConfigLoadStart(path: ${this.route.path})`;
}
};
var RouteConfigLoadEnd = class {
route;
type = EventType.RouteConfigLoadEnd;
constructor(route) {
this.route = route;
}
toString() {
return `RouteConfigLoadEnd(path: ${this.route.path})`;
}
};
var ChildActivationStart = class {
snapshot;
type = EventType.ChildActivationStart;
constructor(snapshot) {
this.snapshot = snapshot;
}
toString() {
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
return `ChildActivationStart(path: '${path}')`;
}
};
var ChildActivationEnd = class {
snapshot;
type = EventType.ChildActivationEnd;
constructor(snapshot) {
this.snapshot = snapshot;
}
toString() {
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
return `ChildActivationEnd(path: '${path}')`;
}
};
var ActivationStart = class {
snapshot;
type = EventType.ActivationStart;
constructor(snapshot) {
this.snapshot = snapshot;
}
toString() {
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
return `ActivationStart(path: '${path}')`;
}
};
var ActivationEnd = class {
snapshot;
type = EventType.ActivationEnd;
constructor(snapshot) {
this.snapshot = snapshot;
}
toString() {
const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || "";
return `ActivationEnd(path: '${path}')`;
}
};
var Scroll = class {
routerEvent;
position;
anchor;
type = EventType.Scroll;
constructor(routerEvent, position, anchor) {
this.routerEvent = routerEvent;
this.position = position;
this.anchor = anchor;
}
toString() {
const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;
return `Scroll(anchor: '${this.anchor}', position: '${pos}')`;
}
};
var BeforeActivateRoutes = class {
};
var RedirectRequest = class {
url;
navigationBehaviorOptions;
constructor(url, navigationBehaviorOptions) {
this.url = url;
this.navigationBehaviorOptions = navigationBehaviorOptions;
}
};
function isPublicRouterEvent(e) {
return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);
}
function stringifyEvent(routerEvent) {
switch (routerEvent.type) {
case EventType.ActivationEnd:
return `ActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
case EventType.ActivationStart:
return `ActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
case EventType.ChildActivationEnd:
return `ChildActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
case EventType.ChildActivationStart:
return `ChildActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ""}')`;
case EventType.GuardsCheckEnd:
return `GuardsCheckEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state}, shouldActivate: ${routerEvent.shouldActivate})`;
case EventType.GuardsCheckStart:
return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
case EventType.NavigationCancel:
return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
case EventType.NavigationSkipped:
return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
case EventType.NavigationEnd:
return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;
case EventType.NavigationError:
return `NavigationError(id: ${routerEvent.id}, url: '${routerEvent.url}', error: ${routerEvent.error})`;
case EventType.NavigationStart:
return `NavigationStart(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
case EventType.ResolveEnd:
return `ResolveEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
case EventType.ResolveStart:
return `ResolveStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
case EventType.RouteConfigLoadEnd:
return `RouteConfigLoadEnd(path: ${routerEvent.route.path})`;
case EventType.RouteConfigLoadStart:
return `RouteConfigLoadStart(path: ${routerEvent.route.path})`;
case EventType.RoutesRecognized:
return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
case EventType.Scroll:
const pos = routerEvent.position ? `${routerEvent.position[0]}, ${routerEvent.position[1]}` : null;
return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;
}
}
function getOrCreateRouteInjectorIfNeeded(route, currentInjector) {
if (route.providers && !route._injector) {
route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);
}
return route._injector ?? currentInjector;
}
function validateConfig(config, parentPath = "", requireStandaloneComponents = false) {
for (let i = 0; i < config.length; i++) {
const route = config[i];
const fullPath = getFullPath(parentPath, route);
validateNode(route, fullPath, requireStandaloneComponents);
}
}
function assertStandalone(fullPath, component) {
if (component && isNgModule(component)) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, but it must be used with standalone components. Use 'loadChildren' instead.`);
} else if (component && !isStandalone(component)) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
}
}
function validateNode(route, fullPath, requireStandaloneComponents) {
if (typeof ngDevMode === "undefined" || ngDevMode) {
if (!route) {
throw new RuntimeError(4014, `
Invalid configuration of route '${fullPath}': Encountered undefined route.
The reason might be an extra comma.
Example:
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },, << two commas
{ path: 'detail/:id', component: HeroDetailComponent }
];
`);
}
if (Array.isArray(route)) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
}
if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
}
if (route.redirectTo && route.children) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
}
if (route.redirectTo && route.loadChildren) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
}
if (route.children && route.loadChildren) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
}
if (route.component && route.loadComponent) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
}
if (route.redirectTo) {
if (route.component || route.loadComponent) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
}
if (route.canMatch || route.canActivate) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': redirectTo and ${route.canMatch ? "canMatch" : "canActivate"} cannot be used together.Redirects happen before guards are executed.`);
}
}
if (route.path && route.matcher) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
}
if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
}
if (route.path === void 0 && route.matcher === void 0) {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
}
if (typeof route.path === "string" && route.path.charAt(0) === "/") {
throw new RuntimeError(4014, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
}
if (route.path === "" && route.redirectTo !== void 0 && route.pathMatch === void 0) {
const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
throw new RuntimeError(4014, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
}
if (requireStandaloneComponents) {
assertStandalone(fullPath, route.component);
}
}
if (route.children) {
validateConfig(route.children, fullPath, requireStandaloneComponents);
}
}
function getFullPath(parentPath, currentRoute) {
if (!currentRoute) {
return parentPath;
}
if (!parentPath && !currentRoute.path) {
return "";
} else if (parentPath && !currentRoute.path) {
return `${parentPath}/`;
} else if (!parentPath && currentRoute.path) {
return currentRoute.path;
} else {
return `${parentPath}/${currentRoute.path}`;
}
}
function getOutlet(route) {
return route.outlet || PRIMARY_OUTLET;
}
function sortByMatchingOutlets(routes, outletName) {
const sortedConfig = routes.filter((r) => getOutlet(r) === outletName);
sortedConfig.push(...routes.filter((r) => getOutlet(r) !== outletName));
return sortedConfig;
}
function getClosestRouteInjector(snapshot) {
if (!snapshot) return null;
if (snapshot.routeConfig?._injector) {
return snapshot.routeConfig._injector;
}
for (let s = snapshot.parent; s; s = s.parent) {
const route = s.routeConfig;
if (route?._loadedInjector) return route._loadedInjector;
if (route?._injector) return route._injector;
}
return null;
}
var OutletContext = class {
rootInjector;
outlet = null;
route = null;
children;
attachRef = null;
get injector() {
return getClosestRouteInjector(this.route?.snapshot) ?? this.rootInjector;
}
constructor(rootInjector) {
this.rootInjector = rootInjector;
this.children = new ChildrenOutletContexts(this.rootInjector);
}
};
var ChildrenOutletContexts = class _ChildrenOutletContexts {
rootInjector;
// contexts for child outlets, by name.
contexts = /* @__PURE__ */ new Map();
/** @docs-private */
constructor(rootInjector) {
this.rootInjector = rootInjector;
}
/** Called when a `RouterOutlet` directive is instantiated */
onChildOutletCreated(childName, outlet) {
const context = this.getOrCreateContext(childName);
context.outlet = outlet;
this.contexts.set(childName, context);
}
/**
* Called when a `RouterOutlet` directive is destroyed.
* We need to keep the context as the outlet could be destroyed inside a NgIf and might be
* re-created later.
*/
onChildOutletDestroyed(childName) {
const context = this.getContext(childName);
if (context) {
context.outlet = null;
context.attachRef = null;
}
}
/**
* Called when the corresponding route is deactivated during navigation.
* Because the component get destroyed, all children outlet are destroyed.
*/
onOutletDeactivated() {
const contexts = this.contexts;
this.contexts = /* @__PURE__ */ new Map();
return contexts;
}
onOutletReAttached(contexts) {
this.contexts = contexts;
}
getOrCreateContext(childName) {
let context = this.getContext(childName);
if (!context) {
context = new OutletContext(this.rootInjector);
this.contexts.set(childName, context);
}
return context;
}
getContext(childName) {
return this.contexts.get(childName) || null;
}
static \u0275fac = function ChildrenOutletContexts_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _ChildrenOutletContexts)(\u0275\u0275inject(EnvironmentInjector));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _ChildrenOutletContexts,
factory: _ChildrenOutletContexts.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ChildrenOutletContexts, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: EnvironmentInjector
}], null);
})();
var Tree = class {
/** @internal */
_root;
constructor(root) {
this._root = root;
}
get root() {
return this._root.value;
}
/**
* @internal
*/
parent(t) {
const p = this.pathFromRoot(t);
return p.length > 1 ? p[p.length - 2] : null;
}
/**
* @internal
*/
children(t) {
const n = findNode(t, this._root);
return n ? n.children.map((t2) => t2.value) : [];
}
/**
* @internal
*/
firstChild(t) {
const n = findNode(t, this._root);
return n && n.children.length > 0 ? n.children[0].value : null;
}
/**
* @internal
*/
siblings(t) {
const p = findPath(t, this._root);
if (p.length < 2) return [];
const c = p[p.length - 2].children.map((c2) => c2.value);
return c.filter((cc) => cc !== t);
}
/**
* @internal
*/
pathFromRoot(t) {
return findPath(t, this._root).map((s) => s.value);
}
};
function findNode(value, node) {
if (value === node.value) return node;
for (const child of node.children) {
const node2 = findNode(value, child);
if (node2) return node2;
}
return null;
}
function findPath(value, node) {
if (value === node.value) return [node];
for (const child of node.children) {
const path = findPath(value, child);
if (path.length) {
path.unshift(node);
return path;
}
}
return [];
}
var TreeNode = class {
value;
children;
constructor(value, children) {
this.value = value;
this.children = children;
}
toString() {
return `TreeNode(${this.value})`;
}
};
function nodeChildrenAsMap(node) {
const map2 = {};
if (node) {
node.children.forEach((child) => map2[child.value.outlet] = child);
}
return map2;
}
var RouterState = class extends Tree {
snapshot;
/** @internal */
constructor(root, snapshot) {
super(root);
this.snapshot = snapshot;
setRouterState(this, root);
}
toString() {
return this.snapshot.toString();
}
};
function createEmptyState(rootComponent) {
const snapshot = createEmptyStateSnapshot(rootComponent);
const emptyUrl = new BehaviorSubject([new UrlSegment("", {})]);
const emptyParams = new BehaviorSubject({});
const emptyData = new BehaviorSubject({});
const emptyQueryParams = new BehaviorSubject({});
const fragment = new BehaviorSubject("");
const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);
activated.snapshot = snapshot.root;
return new RouterState(new TreeNode(activated, []), snapshot);
}
function createEmptyStateSnapshot(rootComponent) {
const emptyParams = {};
const emptyData = {};
const emptyQueryParams = {};
const fragment = "";
const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});
return new RouterStateSnapshot("", new TreeNode(activated, []));
}
var ActivatedRoute = class {
urlSubject;
paramsSubject;
queryParamsSubject;
fragmentSubject;
dataSubject;
outlet;
component;
/** The current snapshot of this route */
snapshot;
/** @internal */
_futureSnapshot;
/** @internal */
_routerState;
/** @internal */
_paramMap;
/** @internal */
_queryParamMap;
/** An Observable of the resolved route title */
title;
/** An observable of the URL segments matched by this route. */
url;
/** An observable of the matrix parameters scoped to this route. */
params;
/** An observable of the query parameters shared by all the routes. */
queryParams;
/** An observable of the URL fragment shared by all the routes. */
fragment;
/** An observable of the static and resolved data of this route. */
data;
/** @internal */
constructor(urlSubject, paramsSubject, queryParamsSubject, fragmentSubject, dataSubject, outlet, component, futureSnapshot) {
this.urlSubject = urlSubject;
this.paramsSubject = paramsSubject;
this.queryParamsSubject = queryParamsSubject;
this.fragmentSubject = fragmentSubject;
this.dataSubject = dataSubject;
this.outlet = outlet;
this.component = component;
this._futureSnapshot = futureSnapshot;
this.title = this.dataSubject?.pipe(map((d) => d[RouteTitleKey])) ?? of(void 0);
this.url = urlSubject;
this.params = paramsSubject;
this.queryParams = queryParamsSubject;
this.fragment = fragmentSubject;
this.data = dataSubject;
}
/** The configuration used to match this route. */
get routeConfig() {
return this._futureSnapshot.routeConfig;
}
/** The root of the router state. */
get root() {
return this._routerState.root;
}
/** The parent of this route in the router state tree. */
get parent() {
return this._routerState.parent(this);
}
/** The first child of this route in the router state tree. */
get firstChild() {
return this._routerState.firstChild(this);
}
/** The children of this route in the router state tree. */
get children() {
return this._routerState.children(this);
}
/** The path from the root of the router state tree to this route. */
get pathFromRoot() {
return this._routerState.pathFromRoot(this);
}
/**
* An Observable that contains a map of the required and optional parameters
* specific to the route.
* The map supports retrieving single and multiple values from the same parameter.
*/
get paramMap() {
this._paramMap ??= this.params.pipe(map((p) => convertToParamMap(p)));
return this._paramMap;
}
/**
* An Observable that contains a map of the query parameters available to all routes.
* The map supports retrieving single and multiple values from the query parameter.
*/
get queryParamMap() {
this._queryParamMap ??= this.queryParams.pipe(map((p) => convertToParamMap(p)));
return this._queryParamMap;
}
toString() {
return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;
}
};
function getInherited(route, parent, paramsInheritanceStrategy = "emptyOnly") {
let inherited;
const {
routeConfig
} = route;
if (parent !== null && (paramsInheritanceStrategy === "always" || // inherit parent data if route is empty path
routeConfig?.path === "" || // inherit parent data if parent was componentless
!parent.component && !parent.routeConfig?.loadComponent)) {
inherited = {
params: __spreadValues(__spreadValues({}, parent.params), route.params),
data: __spreadValues(__spreadValues({}, parent.data), route.data),
resolve: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, route.data), parent.data), routeConfig?.data), route._resolvedData)
};
} else {
inherited = {
params: __spreadValues({}, route.params),
data: __spreadValues({}, route.data),
resolve: __spreadValues(__spreadValues({}, route.data), route._resolvedData ?? {})
};
}
if (routeConfig && hasStaticTitle(routeConfig)) {
inherited.resolve[RouteTitleKey] = routeConfig.title;
}
return inherited;
}
var ActivatedRouteSnapshot = class {
url;
params;
queryParams;
fragment;
data;
outlet;
component;
/** The configuration used to match this route **/
routeConfig;
/** @internal */
_resolve;
/** @internal */
_resolvedData;
/** @internal */
_routerState;
/** @internal */
_paramMap;
/** @internal */
_queryParamMap;
/** The resolved route title */
get title() {
return this.data?.[RouteTitleKey];
}
/** @internal */
constructor(url, params, queryParams, fragment, data, outlet, component, routeConfig, resolve) {
this.url = url;
this.params = params;
this.queryParams = queryParams;
this.fragment = fragment;
this.data = data;
this.outlet = outlet;
this.component = component;
this.routeConfig = routeConfig;
this._resolve = resolve;
}
/** The root of the router state */
get root() {
return this._routerState.root;
}
/** The parent of this route in the router state tree */
get parent() {
return this._routerState.parent(this);
}
/** The first child of this route in the router state tree */
get firstChild() {
return this._routerState.firstChild(this);
}
/** The children of this route in the router state tree */
get children() {
return this._routerState.children(this);
}
/** The path from the root of the router state tree to this route */
get pathFromRoot() {
return this._routerState.pathFromRoot(this);
}
get paramMap() {
this._paramMap ??= convertToParamMap(this.params);
return this._paramMap;
}
get queryParamMap() {
this._queryParamMap ??= convertToParamMap(this.queryParams);
return this._queryParamMap;
}
toString() {
const url = this.url.map((segment) => segment.toString()).join("/");
const matched = this.routeConfig ? this.routeConfig.path : "";
return `Route(url:'${url}', path:'${matched}')`;
}
};
var RouterStateSnapshot = class extends Tree {
url;
/** @internal */
constructor(url, root) {
super(root);
this.url = url;
setRouterState(this, root);
}
toString() {
return serializeNode(this._root);
}
};
function setRouterState(state, node) {
node.value._routerState = state;
node.children.forEach((c) => setRouterState(state, c));
}
function serializeNode(node) {
const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(", ")} } ` : "";
return `${node.value}${c}`;
}
function advanceActivatedRoute(route) {
if (route.snapshot) {
const currentSnapshot = route.snapshot;
const nextSnapshot = route._futureSnapshot;
route.snapshot = nextSnapshot;
if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
route.queryParamsSubject.next(nextSnapshot.queryParams);
}
if (currentSnapshot.fragment !== nextSnapshot.fragment) {
route.fragmentSubject.next(nextSnapshot.fragment);
}
if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
route.paramsSubject.next(nextSnapshot.params);
}
if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
route.urlSubject.next(nextSnapshot.url);
}
if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
route.dataSubject.next(nextSnapshot.data);
}
} else {
route.snapshot = route._futureSnapshot;
route.dataSubject.next(route._futureSnapshot.data);
}
}
function equalParamsAndUrlSegments(a, b) {
const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
const parentsMismatch = !a.parent !== !b.parent;
return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));
}
function hasStaticTitle(config) {
return typeof config.title === "string" || config.title === null;
}
var ROUTER_OUTLET_DATA = new InjectionToken(ngDevMode ? "RouterOutlet data" : "");
var RouterOutlet = class _RouterOutlet {
activated = null;
/** @internal */
get activatedComponentRef() {
return this.activated;
}
_activatedRoute = null;
/**
* The name of the outlet
*
*/
name = PRIMARY_OUTLET;
activateEvents = new EventEmitter();
deactivateEvents = new EventEmitter();
/**
* Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a
* previously detached subtree.
**/
attachEvents = new EventEmitter();
/**
* Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the
* subtree.
*/
detachEvents = new EventEmitter();
/**
* Data that will be provided to the child injector through the `ROUTER_OUTLET_DATA` token.
*
* When unset, the value of the token is `undefined` by default.
*/
routerOutletData = input(...ngDevMode ? [void 0, {
debugName: "routerOutletData"
}] : []);
parentContexts = inject(ChildrenOutletContexts);
location = inject(ViewContainerRef);
changeDetector = inject(ChangeDetectorRef);
inputBinder = inject(INPUT_BINDER, {
optional: true
});
/** @docs-private */
supportsBindingToComponentInputs = true;
/** @docs-private */
ngOnChanges(changes) {
if (changes["name"]) {
const {
firstChange,
previousValue
} = changes["name"];
if (firstChange) {
return;
}
if (this.isTrackedInParentContexts(previousValue)) {
this.deactivate();
this.parentContexts.onChildOutletDestroyed(previousValue);
}
this.initializeOutletWithName();
}
}
/** @docs-private */
ngOnDestroy() {
if (this.isTrackedInParentContexts(this.name)) {
this.parentContexts.onChildOutletDestroyed(this.name);
}
this.inputBinder?.unsubscribeFromRouteData(this);
}
isTrackedInParentContexts(outletName) {
return this.parentContexts.getContext(outletName)?.outlet === this;
}
/** @docs-private */
ngOnInit() {
this.initializeOutletWithName();
}
initializeOutletWithName() {
this.parentContexts.onChildOutletCreated(this.name, this);
if (this.activated) {
return;
}
const context = this.parentContexts.getContext(this.name);
if (context?.route) {
if (context.attachRef) {
this.attach(context.attachRef, context.route);
} else {
this.activateWith(context.route, context.injector);
}
}
}
get isActivated() {
return !!this.activated;
}
/**
* @returns The currently activated component instance.
* @throws An error if the outlet is not activated.
*/
get component() {
if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
return this.activated.instance;
}
get activatedRoute() {
if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
return this._activatedRoute;
}
get activatedRouteData() {
if (this._activatedRoute) {
return this._activatedRoute.snapshot.data;
}
return {};
}
/**
* Called when the `RouteReuseStrategy` instructs to detach the subtree
*/
detach() {
if (!this.activated) throw new RuntimeError(4012, (typeof ngDevMode === "undefined" || ngDevMode) && "Outlet is not activated");
this.location.detach();
const cmp = this.activated;
this.activated = null;
this._activatedRoute = null;
this.detachEvents.emit(cmp.instance);
return cmp;
}
/**
* Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
*/
attach(ref, activatedRoute) {
this.activated = ref;
this._activatedRoute = activatedRoute;
this.location.insert(ref.hostView);
this.inputBinder?.bindActivatedRouteToOutletComponent(this);
this.attachEvents.emit(ref.instance);
}
deactivate() {
if (this.activated) {
const c = this.component;
this.activated.destroy();
this.activated = null;
this._activatedRoute = null;
this.deactivateEvents.emit(c);
}
}
activateWith(activatedRoute, environmentInjector) {
if (this.isActivated) {
throw new RuntimeError(4013, (typeof ngDevMode === "undefined" || ngDevMode) && "Cannot activate an already activated outlet");
}
this._activatedRoute = activatedRoute;
const location = this.location;
const snapshot = activatedRoute.snapshot;
const component = snapshot.component;
const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
const injector = new OutletInjector(activatedRoute, childContexts, location.injector, this.routerOutletData);
this.activated = location.createComponent(component, {
index: location.length,
injector,
environmentInjector
});
this.changeDetector.markForCheck();
this.inputBinder?.bindActivatedRouteToOutletComponent(this);
this.activateEvents.emit(this.activated.instance);
}
static \u0275fac = function RouterOutlet_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterOutlet)();
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _RouterOutlet,
selectors: [["router-outlet"]],
inputs: {
name: "name",
routerOutletData: [1, "routerOutletData"]
},
outputs: {
activateEvents: "activate",
deactivateEvents: "deactivate",
attachEvents: "attach",
detachEvents: "detach"
},
exportAs: ["outlet"],
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterOutlet, [{
type: Directive,
args: [{
selector: "router-outlet",
exportAs: "outlet"
}]
}], null, {
name: [{
type: Input
}],
activateEvents: [{
type: Output,
args: ["activate"]
}],
deactivateEvents: [{
type: Output,
args: ["deactivate"]
}],
attachEvents: [{
type: Output,
args: ["attach"]
}],
detachEvents: [{
type: Output,
args: ["detach"]
}],
routerOutletData: [{
type: Input,
args: [{
isSignal: true,
alias: "routerOutletData",
required: false
}]
}]
});
})();
var OutletInjector = class {
route;
childContexts;
parent;
outletData;
constructor(route, childContexts, parent, outletData) {
this.route = route;
this.childContexts = childContexts;
this.parent = parent;
this.outletData = outletData;
}
get(token, notFoundValue) {
if (token === ActivatedRoute) {
return this.route;
}
if (token === ChildrenOutletContexts) {
return this.childContexts;
}
if (token === ROUTER_OUTLET_DATA) {
return this.outletData;
}
return this.parent.get(token, notFoundValue);
}
};
var INPUT_BINDER = new InjectionToken("");
var RoutedComponentInputBinder = class _RoutedComponentInputBinder {
outletDataSubscriptions = /* @__PURE__ */ new Map();
bindActivatedRouteToOutletComponent(outlet) {
this.unsubscribeFromRouteData(outlet);
this.subscribeToRouteData(outlet);
}
unsubscribeFromRouteData(outlet) {
this.outletDataSubscriptions.get(outlet)?.unsubscribe();
this.outletDataSubscriptions.delete(outlet);
}
subscribeToRouteData(outlet) {
const {
activatedRoute
} = outlet;
const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data]).pipe(switchMap(([queryParams, params, data], index) => {
data = __spreadValues(__spreadValues(__spreadValues({}, queryParams), params), data);
if (index === 0) {
return of(data);
}
return Promise.resolve(data);
})).subscribe((data) => {
if (!outlet.isActivated || !outlet.activatedComponentRef || outlet.activatedRoute !== activatedRoute || activatedRoute.component === null) {
this.unsubscribeFromRouteData(outlet);
return;
}
const mirror = reflectComponentType(activatedRoute.component);
if (!mirror) {
this.unsubscribeFromRouteData(outlet);
return;
}
for (const {
templateName
} of mirror.inputs) {
outlet.activatedComponentRef.setInput(templateName, data[templateName]);
}
});
this.outletDataSubscriptions.set(outlet, dataSubscription);
}
static \u0275fac = function RoutedComponentInputBinder_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RoutedComponentInputBinder)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _RoutedComponentInputBinder,
factory: _RoutedComponentInputBinder.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RoutedComponentInputBinder, [{
type: Injectable
}], null, null);
})();
var \u0275EmptyOutletComponent = class _\u0275EmptyOutletComponent {
static \u0275fac = function \u0275EmptyOutletComponent_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _\u0275EmptyOutletComponent)();
};
static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({
type: _\u0275EmptyOutletComponent,
selectors: [["ng-component"]],
exportAs: ["emptyRouterOutlet"],
decls: 1,
vars: 0,
template: function _EmptyOutletComponent_Template(rf, ctx) {
if (rf & 1) {
\u0275\u0275element(0, "router-outlet");
}
},
dependencies: [RouterOutlet],
encapsulation: 2
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(\u0275EmptyOutletComponent, [{
type: Component,
args: [{
template: `<router-outlet/>`,
imports: [RouterOutlet],
// Used to avoid component ID collisions with user code.
exportAs: "emptyRouterOutlet"
}]
}], null, null);
})();
function standardizeConfig(r) {
const children = r.children && r.children.map(standardizeConfig);
const c = children ? __spreadProps(__spreadValues({}, r), {
children
}) : __spreadValues({}, r);
if (!c.component && !c.loadComponent && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) {
c.component = \u0275EmptyOutletComponent;
}
return c;
}
function createRouterState(routeReuseStrategy, curr, prevState) {
const root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : void 0);
return new RouterState(root, curr);
}
function createNode(routeReuseStrategy, curr, prevState) {
if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {
const value = prevState.value;
value._futureSnapshot = curr.value;
const children = createOrReuseChildren(routeReuseStrategy, curr, prevState);
return new TreeNode(value, children);
} else {
if (routeReuseStrategy.shouldAttach(curr.value)) {
const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
if (detachedRouteHandle !== null) {
const tree2 = detachedRouteHandle.route;
tree2.value._futureSnapshot = curr.value;
tree2.children = curr.children.map((c) => createNode(routeReuseStrategy, c));
return tree2;
}
}
const value = createActivatedRoute(curr.value);
const children = curr.children.map((c) => createNode(routeReuseStrategy, c));
return new TreeNode(value, children);
}
}
function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
return curr.children.map((child) => {
for (const p of prevState.children) {
if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {
return createNode(routeReuseStrategy, child, p);
}
}
return createNode(routeReuseStrategy, child);
});
}
function createActivatedRoute(c) {
return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);
}
var RedirectCommand = class {
redirectTo;
navigationBehaviorOptions;
constructor(redirectTo, navigationBehaviorOptions) {
this.redirectTo = redirectTo;
this.navigationBehaviorOptions = navigationBehaviorOptions;
}
};
var NAVIGATION_CANCELING_ERROR = "ngNavigationCancelingError";
function redirectingNavigationError(urlSerializer, redirect) {
const {
redirectTo,
navigationBehaviorOptions
} = isUrlTree(redirect) ? {
redirectTo: redirect,
navigationBehaviorOptions: void 0
} : redirect;
const error2 = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, NavigationCancellationCode.Redirect);
error2.url = redirectTo;
error2.navigationBehaviorOptions = navigationBehaviorOptions;
return error2;
}
function navigationCancelingError(message, code) {
const error2 = new Error(`NavigationCancelingError: ${message || ""}`);
error2[NAVIGATION_CANCELING_ERROR] = true;
error2.cancellationCode = code;
return error2;
}
function isRedirectingNavigationCancelingError(error2) {
return isNavigationCancelingError(error2) && isUrlTree(error2.url);
}
function isNavigationCancelingError(error2) {
return !!error2 && error2[NAVIGATION_CANCELING_ERROR];
}
var warnedAboutUnsupportedInputBinding = false;
var activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map((t) => {
new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);
return t;
});
var ActivateRoutes = class {
routeReuseStrategy;
futureState;
currState;
forwardEvent;
inputBindingEnabled;
constructor(routeReuseStrategy, futureState, currState, forwardEvent, inputBindingEnabled) {
this.routeReuseStrategy = routeReuseStrategy;
this.futureState = futureState;
this.currState = currState;
this.forwardEvent = forwardEvent;
this.inputBindingEnabled = inputBindingEnabled;
}
activate(parentContexts) {
const futureRoot = this.futureState._root;
const currRoot = this.currState ? this.currState._root : null;
this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);
advanceActivatedRoute(this.futureState.root);
this.activateChildRoutes(futureRoot, currRoot, parentContexts);
}
// De-activate the child route that are not re-used for the future state
deactivateChildRoutes(futureNode, currNode, contexts) {
const children = nodeChildrenAsMap(currNode);
futureNode.children.forEach((futureChild) => {
const childOutletName = futureChild.value.outlet;
this.deactivateRoutes(futureChild, children[childOutletName], contexts);
delete children[childOutletName];
});
Object.values(children).forEach((v) => {
this.deactivateRouteAndItsChildren(v, contexts);
});
}
deactivateRoutes(futureNode, currNode, parentContext) {
const future = futureNode.value;
const curr = currNode ? currNode.value : null;
if (future === curr) {
if (future.component) {
const context = parentContext.getContext(future.outlet);
if (context) {
this.deactivateChildRoutes(futureNode, currNode, context.children);
}
} else {
this.deactivateChildRoutes(futureNode, currNode, parentContext);
}
} else {
if (curr) {
this.deactivateRouteAndItsChildren(currNode, parentContext);
}
}
}
deactivateRouteAndItsChildren(route, parentContexts) {
if (route.value.component && this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {
this.detachAndStoreRouteSubtree(route, parentContexts);
} else {
this.deactivateRouteAndOutlet(route, parentContexts);
}
}
detachAndStoreRouteSubtree(route, parentContexts) {
const context = parentContexts.getContext(route.value.outlet);
const contexts = context && route.value.component ? context.children : parentContexts;
const children = nodeChildrenAsMap(route);
for (const treeNode of Object.values(children)) {
this.deactivateRouteAndItsChildren(treeNode, contexts);
}
if (context && context.outlet) {
const componentRef = context.outlet.detach();
const contexts2 = context.children.onOutletDeactivated();
this.routeReuseStrategy.store(route.value.snapshot, {
componentRef,
route,
contexts: contexts2
});
}
}
deactivateRouteAndOutlet(route, parentContexts) {
const context = parentContexts.getContext(route.value.outlet);
const contexts = context && route.value.component ? context.children : parentContexts;
const children = nodeChildrenAsMap(route);
for (const treeNode of Object.values(children)) {
this.deactivateRouteAndItsChildren(treeNode, contexts);
}
if (context) {
if (context.outlet) {
context.outlet.deactivate();
context.children.onOutletDeactivated();
}
context.attachRef = null;
context.route = null;
}
}
activateChildRoutes(futureNode, currNode, contexts) {
const children = nodeChildrenAsMap(currNode);
futureNode.children.forEach((c) => {
this.activateRoutes(c, children[c.value.outlet], contexts);
this.forwardEvent(new ActivationEnd(c.value.snapshot));
});
if (futureNode.children.length) {
this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));
}
}
activateRoutes(futureNode, currNode, parentContexts) {
const future = futureNode.value;
const curr = currNode ? currNode.value : null;
advanceActivatedRoute(future);
if (future === curr) {
if (future.component) {
const context = parentContexts.getOrCreateContext(future.outlet);
this.activateChildRoutes(futureNode, currNode, context.children);
} else {
this.activateChildRoutes(futureNode, currNode, parentContexts);
}
} else {
if (future.component) {
const context = parentContexts.getOrCreateContext(future.outlet);
if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
const stored = this.routeReuseStrategy.retrieve(future.snapshot);
this.routeReuseStrategy.store(future.snapshot, null);
context.children.onOutletReAttached(stored.contexts);
context.attachRef = stored.componentRef;
context.route = stored.route.value;
if (context.outlet) {
context.outlet.attach(stored.componentRef, stored.route.value);
}
advanceActivatedRoute(stored.route.value);
this.activateChildRoutes(futureNode, null, context.children);
} else {
context.attachRef = null;
context.route = future;
if (context.outlet) {
context.outlet.activateWith(future, context.injector);
}
this.activateChildRoutes(futureNode, null, context.children);
}
} else {
this.activateChildRoutes(futureNode, null, parentContexts);
}
}
if (typeof ngDevMode === "undefined" || ngDevMode) {
const context = parentContexts.getOrCreateContext(future.outlet);
const outlet = context.outlet;
if (outlet && this.inputBindingEnabled && !outlet.supportsBindingToComponentInputs && !warnedAboutUnsupportedInputBinding) {
console.warn(`'withComponentInputBinding' feature is enabled but this application is using an outlet that may not support binding to component inputs.`);
warnedAboutUnsupportedInputBinding = true;
}
}
}
};
var CanActivate = class {
path;
route;
constructor(path) {
this.path = path;
this.route = this.path[this.path.length - 1];
}
};
var CanDeactivate = class {
component;
route;
constructor(component, route) {
this.component = component;
this.route = route;
}
};
function getAllRouteGuards(future, curr, parentContexts) {
const futureRoot = future._root;
const currRoot = curr ? curr._root : null;
return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
}
function getCanActivateChild(p) {
const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
if (!canActivateChild || canActivateChild.length === 0) return null;
return {
node: p,
guards: canActivateChild
};
}
function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
const NOT_FOUND = Symbol();
const result = injector.get(tokenOrFunction, NOT_FOUND);
if (result === NOT_FOUND) {
if (typeof tokenOrFunction === "function" && !isInjectable(tokenOrFunction)) {
return tokenOrFunction;
} else {
return injector.get(tokenOrFunction);
}
}
return result;
}
function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
canDeactivateChecks: [],
canActivateChecks: []
}) {
const prevChildren = nodeChildrenAsMap(currNode);
futureNode.children.forEach((c) => {
getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
delete prevChildren[c.value.outlet];
});
Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
return checks;
}
function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {
canDeactivateChecks: [],
canActivateChecks: []
}) {
const future = futureNode.value;
const curr = currNode ? currNode.value : null;
const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
if (curr && future.routeConfig === curr.routeConfig) {
const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
if (shouldRun) {
checks.canActivateChecks.push(new CanActivate(futurePath));
} else {
future.data = curr.data;
future._resolvedData = curr._resolvedData;
}
if (future.component) {
getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);
} else {
getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);
}
if (shouldRun && context && context.outlet && context.outlet.isActivated) {
checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));
}
} else {
if (curr) {
deactivateRouteAndItsChildren(currNode, context, checks);
}
checks.canActivateChecks.push(new CanActivate(futurePath));
if (future.component) {
getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);
} else {
getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);
}
}
return checks;
}
function shouldRunGuardsAndResolvers(curr, future, mode) {
if (typeof mode === "function") {
return mode(curr, future);
}
switch (mode) {
case "pathParamsChange":
return !equalPath(curr.url, future.url);
case "pathParamsOrQueryParamsChange":
return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams);
case "always":
return true;
case "paramsOrQueryParamsChange":
return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams);
case "paramsChange":
default:
return !equalParamsAndUrlSegments(curr, future);
}
}
function deactivateRouteAndItsChildren(route, context, checks) {
const children = nodeChildrenAsMap(route);
const r = route.value;
Object.entries(children).forEach(([childName, node]) => {
if (!r.component) {
deactivateRouteAndItsChildren(node, context, checks);
} else if (context) {
deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);
} else {
deactivateRouteAndItsChildren(node, null, checks);
}
});
if (!r.component) {
checks.canDeactivateChecks.push(new CanDeactivate(null, r));
} else if (context && context.outlet && context.outlet.isActivated) {
checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));
} else {
checks.canDeactivateChecks.push(new CanDeactivate(null, r));
}
}
function isFunction(v) {
return typeof v === "function";
}
function isBoolean(v) {
return typeof v === "boolean";
}
function isCanLoad(guard) {
return guard && isFunction(guard.canLoad);
}
function isCanActivate(guard) {
return guard && isFunction(guard.canActivate);
}
function isCanActivateChild(guard) {
return guard && isFunction(guard.canActivateChild);
}
function isCanDeactivate(guard) {
return guard && isFunction(guard.canDeactivate);
}
function isCanMatch(guard) {
return guard && isFunction(guard.canMatch);
}
function isEmptyError(e) {
return e instanceof EmptyError || e?.name === "EmptyError";
}
var INITIAL_VALUE = /* @__PURE__ */ Symbol("INITIAL_VALUE");
function prioritizedGuardValue() {
return switchMap((obs) => {
return combineLatest(obs.map((o) => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map((results) => {
for (const result of results) {
if (result === true) {
continue;
} else if (result === INITIAL_VALUE) {
return INITIAL_VALUE;
} else if (result === false || isRedirect(result)) {
return result;
}
}
return true;
}), filter((item) => item !== INITIAL_VALUE), take(1));
});
}
function isRedirect(val) {
return isUrlTree(val) || val instanceof RedirectCommand;
}
function checkGuards(injector, forwardEvent) {
return mergeMap((t) => {
const {
targetSnapshot,
currentSnapshot,
guards: {
canActivateChecks,
canDeactivateChecks
}
} = t;
if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
return of(__spreadProps(__spreadValues({}, t), {
guardsResult: true
}));
}
return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap((canDeactivate) => {
return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);
}), map((guardsResult) => __spreadProps(__spreadValues({}, t), {
guardsResult
})));
});
}
function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
return from(checks).pipe(mergeMap((check) => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first((result) => {
return result !== true;
}, true));
}
function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
return from(checks).pipe(concatMap((check) => {
return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
}), first((result) => {
return result !== true;
}, true));
}
function fireActivationStart(snapshot, forwardEvent) {
if (snapshot !== null && forwardEvent) {
forwardEvent(new ActivationStart(snapshot));
}
return of(true);
}
function fireChildActivationStart(snapshot, forwardEvent) {
if (snapshot !== null && forwardEvent) {
forwardEvent(new ChildActivationStart(snapshot));
}
return of(true);
}
function runCanActivate(futureRSS, futureARS, injector) {
const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
if (!canActivate || canActivate.length === 0) return of(true);
const canActivateObservables = canActivate.map((canActivate2) => {
return defer(() => {
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
const guard = getTokenOrFunctionIdentity(canActivate2, closestInjector);
const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
return wrapIntoObservable(guardVal).pipe(first());
});
});
return of(canActivateObservables).pipe(prioritizedGuardValue());
}
function runCanActivateChild(futureRSS, path, injector) {
const futureARS = path[path.length - 1];
const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map((p) => getCanActivateChild(p)).filter((_) => _ !== null);
const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
return defer(() => {
const guardsMapped = d.guards.map((canActivateChild) => {
const closestInjector = getClosestRouteInjector(d.node) ?? injector;
const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));
return wrapIntoObservable(guardVal).pipe(first());
});
return of(guardsMapped).pipe(prioritizedGuardValue());
});
});
return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
}
function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
if (!canDeactivate || canDeactivate.length === 0) return of(true);
const canDeactivateObservables = canDeactivate.map((c) => {
const closestInjector = getClosestRouteInjector(currARS) ?? injector;
const guard = getTokenOrFunctionIdentity(c, closestInjector);
const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));
return wrapIntoObservable(guardVal).pipe(first());
});
return of(canDeactivateObservables).pipe(prioritizedGuardValue());
}
function runCanLoadGuards(injector, route, segments, urlSerializer) {
const canLoad = route.canLoad;
if (canLoad === void 0 || canLoad.length === 0) {
return of(true);
}
const canLoadObservables = canLoad.map((injectionToken) => {
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : runInInjectionContext(injector, () => guard(route, segments));
return wrapIntoObservable(guardVal);
});
return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
}
function redirectIfUrlTree(urlSerializer) {
return pipe(tap((result) => {
if (typeof result === "boolean") return;
throw redirectingNavigationError(urlSerializer, result);
}), map((result) => result === true));
}
function runCanMatchGuards(injector, route, segments, urlSerializer) {
const canMatch = route.canMatch;
if (!canMatch || canMatch.length === 0) return of(true);
const canMatchObservables = canMatch.map((injectionToken) => {
const guard = getTokenOrFunctionIdentity(injectionToken, injector);
const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : runInInjectionContext(injector, () => guard(route, segments));
return wrapIntoObservable(guardVal);
});
return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
}
var NoMatch = class {
segmentGroup;
constructor(segmentGroup) {
this.segmentGroup = segmentGroup || null;
}
};
var AbsoluteRedirect = class extends Error {
urlTree;
constructor(urlTree) {
super();
this.urlTree = urlTree;
}
};
function noMatch$1(segmentGroup) {
return throwError(new NoMatch(segmentGroup));
}
function namedOutletsRedirect(redirectTo) {
return throwError(new RuntimeError(4e3, (typeof ngDevMode === "undefined" || ngDevMode) && `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
}
function canLoadFails(route) {
return throwError(navigationCancelingError((typeof ngDevMode === "undefined" || ngDevMode) && `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, NavigationCancellationCode.GuardRejected));
}
var ApplyRedirects = class {
urlSerializer;
urlTree;
constructor(urlSerializer, urlTree) {
this.urlSerializer = urlSerializer;
this.urlTree = urlTree;
}
lineralizeSegments(route, urlTree) {
let res = [];
let c = urlTree.root;
while (true) {
res = res.concat(c.segments);
if (c.numberOfChildren === 0) {
return of(res);
}
if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
return namedOutletsRedirect(`${route.redirectTo}`);
}
c = c.children[PRIMARY_OUTLET];
}
}
applyRedirectCommands(segments, redirectTo, posParams, currentSnapshot, injector) {
return getRedirectResult(redirectTo, currentSnapshot, injector).pipe(map((redirect) => {
if (redirect instanceof UrlTree) {
throw new AbsoluteRedirect(redirect);
}
const newTree = this.applyRedirectCreateUrlTree(redirect, this.urlSerializer.parse(redirect), segments, posParams);
if (redirect[0] === "/") {
throw new AbsoluteRedirect(newTree);
}
return newTree;
}));
}
applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
}
createQueryParams(redirectToParams, actualParams) {
const res = {};
Object.entries(redirectToParams).forEach(([k, v]) => {
const copySourceValue = typeof v === "string" && v[0] === ":";
if (copySourceValue) {
const sourceName = v.substring(1);
res[k] = actualParams[sourceName];
} else {
res[k] = v;
}
});
return res;
}
createSegmentGroup(redirectTo, group, segments, posParams) {
const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
let children = {};
Object.entries(group.children).forEach(([name2, child]) => {
children[name2] = this.createSegmentGroup(redirectTo, child, segments, posParams);
});
return new UrlSegmentGroup(updatedSegments, children);
}
createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
return redirectToSegments.map((s) => s.path[0] === ":" ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments));
}
findPosParam(redirectTo, redirectToUrlSegment, posParams) {
const pos = posParams[redirectToUrlSegment.path.substring(1)];
if (!pos) throw new RuntimeError(4001, (typeof ngDevMode === "undefined" || ngDevMode) && `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
return pos;
}
findOrReturn(redirectToUrlSegment, actualSegments) {
let idx = 0;
for (const s of actualSegments) {
if (s.path === redirectToUrlSegment.path) {
actualSegments.splice(idx);
return s;
}
idx++;
}
return redirectToUrlSegment;
}
};
function getRedirectResult(redirectTo, currentSnapshot, injector) {
if (typeof redirectTo === "string") {
return of(redirectTo);
}
const redirectToFn = redirectTo;
const {
queryParams,
fragment,
routeConfig,
url,
outlet,
params,
data,
title
} = currentSnapshot;
return wrapIntoObservable(runInInjectionContext(injector, () => redirectToFn({
params,
data,
queryParams,
fragment,
routeConfig,
url,
outlet,
title
})));
}
var noMatch = {
matched: false,
consumedSegments: [],
remainingSegments: [],
parameters: {},
positionalParamSegments: {}
};
function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {
const result = match(segmentGroup, route, segments);
if (!result.matched) {
return of(result);
}
injector = getOrCreateRouteInjectorIfNeeded(route, injector);
return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map((v) => v === true ? result : __spreadValues({}, noMatch)));
}
function match(segmentGroup, route, segments) {
if (route.path === "**") {
return createWildcardMatchResult(segments);
}
if (route.path === "") {
if (route.pathMatch === "full" && (segmentGroup.hasChildren() || segments.length > 0)) {
return __spreadValues({}, noMatch);
}
return {
matched: true,
consumedSegments: [],
remainingSegments: segments,
parameters: {},
positionalParamSegments: {}
};
}
const matcher = route.matcher || defaultUrlMatcher;
const res = matcher(segments, segmentGroup, route);
if (!res) return __spreadValues({}, noMatch);
const posParams = {};
Object.entries(res.posParams ?? {}).forEach(([k, v]) => {
posParams[k] = v.path;
});
const parameters = res.consumed.length > 0 ? __spreadValues(__spreadValues({}, posParams), res.consumed[res.consumed.length - 1].parameters) : posParams;
return {
matched: true,
consumedSegments: res.consumed,
remainingSegments: segments.slice(res.consumed.length),
// TODO(atscott): investigate combining parameters and positionalParamSegments
parameters,
positionalParamSegments: res.posParams ?? {}
};
}
function createWildcardMatchResult(segments) {
return {
matched: true,
parameters: segments.length > 0 ? last2(segments).parameters : {},
consumedSegments: segments,
remainingSegments: [],
positionalParamSegments: {}
};
}
function split(segmentGroup, consumedSegments, slicedSegments, config) {
if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
const s2 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
return {
segmentGroup: s2,
slicedSegments: []
};
}
if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {
const s2 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));
return {
segmentGroup: s2,
slicedSegments
};
}
const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);
return {
segmentGroup: s,
slicedSegments
};
}
function addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {
const res = {};
for (const r of routes) {
if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {
const s = new UrlSegmentGroup([], {});
res[getOutlet(r)] = s;
}
}
return __spreadValues(__spreadValues({}, children), res);
}
function createChildrenForEmptyPaths(routes, primarySegment) {
const res = {};
res[PRIMARY_OUTLET] = primarySegment;
for (const r of routes) {
if (r.path === "" && getOutlet(r) !== PRIMARY_OUTLET) {
const s = new UrlSegmentGroup([], {});
res[getOutlet(r)] = s;
}
}
return res;
}
function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {
return routes.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);
}
function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {
return routes.some((r) => emptyPathMatch(segmentGroup, slicedSegments, r));
}
function emptyPathMatch(segmentGroup, slicedSegments, r) {
if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === "full") {
return false;
}
return r.path === "";
}
function noLeftoversInUrl(segmentGroup, segments, outlet) {
return segments.length === 0 && !segmentGroup.children[outlet];
}
var NoLeftoversInUrl = class {
};
function recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = "emptyOnly") {
return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();
}
var MAX_ALLOWED_REDIRECTS = 31;
var Recognizer = class {
injector;
configLoader;
rootComponentType;
config;
urlTree;
paramsInheritanceStrategy;
urlSerializer;
applyRedirects;
absoluteRedirectCount = 0;
allowRedirects = true;
constructor(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer) {
this.injector = injector;
this.configLoader = configLoader;
this.rootComponentType = rootComponentType;
this.config = config;
this.urlTree = urlTree;
this.paramsInheritanceStrategy = paramsInheritanceStrategy;
this.urlSerializer = urlSerializer;
this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);
}
noMatchError(e) {
return new RuntimeError(4002, typeof ngDevMode === "undefined" || ngDevMode ? `Cannot match any routes. URL Segment: '${e.segmentGroup}'` : `'${e.segmentGroup}'`);
}
recognize() {
const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;
return this.match(rootSegmentGroup).pipe(map(({
children,
rootSnapshot
}) => {
const rootNode = new TreeNode(rootSnapshot, children);
const routeState = new RouterStateSnapshot("", rootNode);
const tree2 = createUrlTreeFromSnapshot(rootSnapshot, [], this.urlTree.queryParams, this.urlTree.fragment);
tree2.queryParams = this.urlTree.queryParams;
routeState.url = this.urlSerializer.serialize(tree2);
return {
state: routeState,
tree: tree2
};
}));
}
match(rootSegmentGroup) {
const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});
return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map((children) => {
return {
children,
rootSnapshot
};
}), catchError((e) => {
if (e instanceof AbsoluteRedirect) {
this.urlTree = e.urlTree;
return this.match(e.urlTree.root);
}
if (e instanceof NoMatch) {
throw this.noMatchError(e);
}
throw e;
}));
}
processSegmentGroup(injector, config, segmentGroup, outlet, parentRoute) {
if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
return this.processChildren(injector, config, segmentGroup, parentRoute);
}
return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true, parentRoute).pipe(map((child) => child instanceof TreeNode ? [child] : []));
}
/**
* Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
* we cannot find a match for _any_ of the children.
*
* @param config - The `Routes` to match against
* @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
* config.
*/
processChildren(injector, config, segmentGroup, parentRoute) {
const childOutlets = [];
for (const child of Object.keys(segmentGroup.children)) {
if (child === "primary") {
childOutlets.unshift(child);
} else {
childOutlets.push(child);
}
}
return from(childOutlets).pipe(concatMap((childOutlet) => {
const child = segmentGroup.children[childOutlet];
const sortedConfig = sortByMatchingOutlets(config, childOutlet);
return this.processSegmentGroup(injector, sortedConfig, child, childOutlet, parentRoute);
}), scan((children, outletChildren) => {
children.push(...outletChildren);
return children;
}), defaultIfEmpty(null), last(), mergeMap((children) => {
if (children === null) return noMatch$1(segmentGroup);
const mergedChildren = mergeEmptyPathMatches(children);
if (typeof ngDevMode === "undefined" || ngDevMode) {
checkOutletNameUniqueness(mergedChildren);
}
sortActivatedRouteSnapshots(mergedChildren);
return of(mergedChildren);
}));
}
processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects, parentRoute) {
return from(routes).pipe(concatMap((r) => {
return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects, parentRoute).pipe(catchError((e) => {
if (e instanceof NoMatch) {
return of(null);
}
throw e;
}));
}), first((x) => !!x), catchError((e) => {
if (isEmptyError(e)) {
if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
return of(new NoLeftoversInUrl());
}
return noMatch$1(segmentGroup);
}
throw e;
}));
}
processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects, parentRoute) {
if (getOutlet(route) !== outlet && (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route))) {
return noMatch$1(rawSegment);
}
if (route.redirectTo === void 0) {
return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute);
}
if (this.allowRedirects && allowRedirects) {
return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet, parentRoute);
}
return noMatch$1(rawSegment);
}
expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet, parentRoute) {
const {
matched,
parameters,
consumedSegments,
positionalParamSegments,
remainingSegments
} = match(segmentGroup, route, segments);
if (!matched) return noMatch$1(segmentGroup);
if (typeof route.redirectTo === "string" && route.redirectTo[0] === "/") {
this.absoluteRedirectCount++;
if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {
if (ngDevMode) {
throw new RuntimeError(4016, `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${route.redirectTo}'.
This is currently a dev mode only error but will become a call stack size exceeded error in production in a future major version.`);
}
this.allowRedirects = false;
}
}
const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);
currentSnapshot.params = Object.freeze(inherited.params);
currentSnapshot.data = Object.freeze(inherited.data);
const newTree$ = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments, currentSnapshot, injector);
return newTree$.pipe(switchMap((newTree) => this.applyRedirects.lineralizeSegments(route, newTree)), mergeMap((newSegments) => {
return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false, parentRoute);
}));
}
matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute) {
const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);
if (route.path === "**") {
rawSegment.children = {};
}
return matchResult.pipe(switchMap((result) => {
if (!result.matched) {
return noMatch$1(rawSegment);
}
injector = route._injector ?? injector;
return this.getChildConfig(injector, route, segments).pipe(switchMap(({
routes: childConfig
}) => {
const childInjector = route._loadedInjector ?? injector;
const {
parameters,
consumedSegments,
remainingSegments
} = result;
const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(__spreadValues({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));
const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);
snapshot.params = Object.freeze(inherited.params);
snapshot.data = Object.freeze(inherited.data);
const {
segmentGroup,
slicedSegments
} = split(rawSegment, consumedSegments, remainingSegments, childConfig);
if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
return this.processChildren(childInjector, childConfig, segmentGroup, snapshot).pipe(map((children) => {
return new TreeNode(snapshot, children);
}));
}
if (childConfig.length === 0 && slicedSegments.length === 0) {
return of(new TreeNode(snapshot, []));
}
const matchedOnOutlet = getOutlet(route) === outlet;
return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true, snapshot).pipe(map((child) => {
return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);
}));
}));
}));
}
getChildConfig(injector, route, segments) {
if (route.children) {
return of({
routes: route.children,
injector
});
}
if (route.loadChildren) {
if (route._loadedRoutes !== void 0) {
return of({
routes: route._loadedRoutes,
injector: route._loadedInjector
});
}
return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap((shouldLoadResult) => {
if (shouldLoadResult) {
return this.configLoader.loadChildren(injector, route).pipe(tap((cfg) => {
route._loadedRoutes = cfg.routes;
route._loadedInjector = cfg.injector;
}));
}
return canLoadFails(route);
}));
}
return of({
routes: [],
injector
});
}
};
function sortActivatedRouteSnapshots(nodes) {
nodes.sort((a, b) => {
if (a.value.outlet === PRIMARY_OUTLET) return -1;
if (b.value.outlet === PRIMARY_OUTLET) return 1;
return a.value.outlet.localeCompare(b.value.outlet);
});
}
function hasEmptyPathConfig(node) {
const config = node.value.routeConfig;
return config && config.path === "";
}
function mergeEmptyPathMatches(nodes) {
const result = [];
const mergedNodes = /* @__PURE__ */ new Set();
for (const node of nodes) {
if (!hasEmptyPathConfig(node)) {
result.push(node);
continue;
}
const duplicateEmptyPathNode = result.find((resultNode) => node.value.routeConfig === resultNode.value.routeConfig);
if (duplicateEmptyPathNode !== void 0) {
duplicateEmptyPathNode.children.push(...node.children);
mergedNodes.add(duplicateEmptyPathNode);
} else {
result.push(node);
}
}
for (const mergedNode of mergedNodes) {
const mergedChildren = mergeEmptyPathMatches(mergedNode.children);
result.push(new TreeNode(mergedNode.value, mergedChildren));
}
return result.filter((n) => !mergedNodes.has(n));
}
function checkOutletNameUniqueness(nodes) {
const names2 = {};
nodes.forEach((n) => {
const routeWithSameOutletName = names2[n.value.outlet];
if (routeWithSameOutletName) {
const p = routeWithSameOutletName.url.map((s) => s.toString()).join("/");
const c = n.value.url.map((s) => s.toString()).join("/");
throw new RuntimeError(4006, (typeof ngDevMode === "undefined" || ngDevMode) && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
}
names2[n.value.outlet] = n.value;
});
}
function getData(route) {
return route.data || {};
}
function getResolve(route) {
return route.resolve || {};
}
function recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {
return mergeMap((t) => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({
state: targetSnapshot,
tree: urlAfterRedirects
}) => {
return __spreadProps(__spreadValues({}, t), {
targetSnapshot,
urlAfterRedirects
});
})));
}
function resolveData(paramsInheritanceStrategy, injector) {
return mergeMap((t) => {
const {
targetSnapshot,
guards: {
canActivateChecks
}
} = t;
if (!canActivateChecks.length) {
return of(t);
}
const routesWithResolversToRun = new Set(canActivateChecks.map((check) => check.route));
const routesNeedingDataUpdates = /* @__PURE__ */ new Set();
for (const route of routesWithResolversToRun) {
if (routesNeedingDataUpdates.has(route)) {
continue;
}
for (const newRoute of flattenRouteTree(route)) {
routesNeedingDataUpdates.add(newRoute);
}
}
let routesProcessed = 0;
return from(routesNeedingDataUpdates).pipe(concatMap((route) => {
if (routesWithResolversToRun.has(route)) {
return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);
} else {
route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;
return of(void 0);
}
}), tap(() => routesProcessed++), takeLast(1), mergeMap((_) => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));
});
}
function flattenRouteTree(route) {
const descendants = route.children.map((child) => flattenRouteTree(child)).flat();
return [route, ...descendants];
}
function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
const config = futureARS.routeConfig;
const resolve = futureARS._resolve;
if (config?.title !== void 0 && !hasStaticTitle(config)) {
resolve[RouteTitleKey] = config.title;
}
return defer(() => {
futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;
return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
futureARS._resolvedData = resolvedData;
futureARS.data = __spreadValues(__spreadValues({}, futureARS.data), resolvedData);
return null;
}));
});
}
function resolveNode(resolve, futureARS, futureRSS, injector) {
const keys = getDataKeys(resolve);
if (keys.length === 0) {
return of({});
}
const data = {};
return from(keys).pipe(mergeMap((key) => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap((value) => {
if (value instanceof RedirectCommand) {
throw redirectingNavigationError(new DefaultUrlSerializer(), value);
}
data[key] = value;
}))), takeLast(1), map(() => data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
}
function getResolver(injectionToken, futureARS, futureRSS, injector) {
const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));
return wrapIntoObservable(resolverValue);
}
function switchTap(next) {
return switchMap((v) => {
const nextResult = next(v);
if (nextResult) {
return from(nextResult).pipe(map(() => v));
}
return of(v);
});
}
var TitleStrategy = class _TitleStrategy {
/**
* @returns The `title` of the deepest primary route.
*/
buildTitle(snapshot) {
let pageTitle;
let route = snapshot.root;
while (route !== void 0) {
pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;
route = route.children.find((child) => child.outlet === PRIMARY_OUTLET);
}
return pageTitle;
}
/**
* Given an `ActivatedRouteSnapshot`, returns the final value of the
* `Route.title` property, which can either be a static string or a resolved value.
*/
getResolvedTitleForRoute(snapshot) {
return snapshot.data[RouteTitleKey];
}
static \u0275fac = function TitleStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _TitleStrategy)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _TitleStrategy,
factory: () => (() => inject(DefaultTitleStrategy))(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TitleStrategy, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => inject(DefaultTitleStrategy)
}]
}], null, null);
})();
var DefaultTitleStrategy = class _DefaultTitleStrategy extends TitleStrategy {
title;
constructor(title) {
super();
this.title = title;
}
/**
* Sets the title of the browser to the given value.
*
* @param title The `pageTitle` from the deepest primary route.
*/
updateTitle(snapshot) {
const title = this.buildTitle(snapshot);
if (title !== void 0) {
this.title.setTitle(title);
}
}
static \u0275fac = function DefaultTitleStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DefaultTitleStrategy)(\u0275\u0275inject(Title));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DefaultTitleStrategy,
factory: _DefaultTitleStrategy.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultTitleStrategy, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: Title
}], null);
})();
var ROUTER_CONFIGURATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router config" : "", {
providedIn: "root",
factory: () => ({})
});
var ROUTES = new InjectionToken(ngDevMode ? "ROUTES" : "");
var RouterConfigLoader = class _RouterConfigLoader {
componentLoaders = /* @__PURE__ */ new WeakMap();
childrenLoaders = /* @__PURE__ */ new WeakMap();
onLoadStartListener;
onLoadEndListener;
compiler = inject(Compiler);
loadComponent(injector, route) {
if (this.componentLoaders.get(route)) {
return this.componentLoaders.get(route);
} else if (route._loadedComponent) {
return of(route._loadedComponent);
}
if (this.onLoadStartListener) {
this.onLoadStartListener(route);
}
const loadRunner = wrapIntoObservable(runInInjectionContext(injector, () => route.loadComponent())).pipe(map(maybeUnwrapDefaultExport), switchMap(maybeResolveResources), tap((component) => {
if (this.onLoadEndListener) {
this.onLoadEndListener(route);
}
(typeof ngDevMode === "undefined" || ngDevMode) && assertStandalone(route.path ?? "", component);
route._loadedComponent = component;
}), finalize(() => {
this.componentLoaders.delete(route);
}));
const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
this.componentLoaders.set(route, loader);
return loader;
}
loadChildren(parentInjector, route) {
if (this.childrenLoaders.get(route)) {
return this.childrenLoaders.get(route);
} else if (route._loadedRoutes) {
return of({
routes: route._loadedRoutes,
injector: route._loadedInjector
});
}
if (this.onLoadStartListener) {
this.onLoadStartListener(route);
}
const moduleFactoryOrRoutes$ = loadChildren(route, this.compiler, parentInjector, this.onLoadEndListener);
const loadRunner = moduleFactoryOrRoutes$.pipe(finalize(() => {
this.childrenLoaders.delete(route);
}));
const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
this.childrenLoaders.set(route, loader);
return loader;
}
static \u0275fac = function RouterConfigLoader_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterConfigLoader)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _RouterConfigLoader,
factory: _RouterConfigLoader.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterConfigLoader, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
function loadChildren(route, compiler, parentInjector, onLoadEndListener) {
return wrapIntoObservable(runInInjectionContext(parentInjector, () => route.loadChildren())).pipe(map(maybeUnwrapDefaultExport), switchMap(maybeResolveResources), mergeMap((t) => {
if (t instanceof NgModuleFactory$1 || Array.isArray(t)) {
return of(t);
} else {
return from(compiler.compileModuleAsync(t));
}
}), map((factoryOrRoutes) => {
if (onLoadEndListener) {
onLoadEndListener(route);
}
let injector;
let rawRoutes;
let requireStandaloneComponents = false;
if (Array.isArray(factoryOrRoutes)) {
rawRoutes = factoryOrRoutes;
requireStandaloneComponents = true;
} else {
injector = factoryOrRoutes.create(parentInjector).injector;
rawRoutes = injector.get(ROUTES, [], {
optional: true,
self: true
}).flat();
}
const routes = rawRoutes.map(standardizeConfig);
(typeof ngDevMode === "undefined" || ngDevMode) && validateConfig(routes, route.path, requireStandaloneComponents);
return {
routes,
injector
};
}));
}
function isWrappedDefaultExport(value) {
return value && typeof value === "object" && "default" in value;
}
function maybeUnwrapDefaultExport(input2) {
return isWrappedDefaultExport(input2) ? input2["default"] : input2;
}
function maybeResolveResources(value) {
if (false) {
return resolveComponentResources(fetch).catch((error2) => {
console.error(error2);
return Promise.resolve();
}).then(() => value);
}
return of(value);
}
var UrlHandlingStrategy = class _UrlHandlingStrategy {
static \u0275fac = function UrlHandlingStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _UrlHandlingStrategy)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _UrlHandlingStrategy,
factory: () => (() => inject(DefaultUrlHandlingStrategy))(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlHandlingStrategy, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => inject(DefaultUrlHandlingStrategy)
}]
}], null, null);
})();
var DefaultUrlHandlingStrategy = class _DefaultUrlHandlingStrategy {
shouldProcessUrl(url) {
return true;
}
extract(url) {
return url;
}
merge(newUrlPart, wholeUrl) {
return newUrlPart;
}
static \u0275fac = function DefaultUrlHandlingStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _DefaultUrlHandlingStrategy)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DefaultUrlHandlingStrategy,
factory: _DefaultUrlHandlingStrategy.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultUrlHandlingStrategy, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
var CREATE_VIEW_TRANSITION = new InjectionToken(ngDevMode ? "view transition helper" : "");
var VIEW_TRANSITION_OPTIONS = new InjectionToken(ngDevMode ? "view transition options" : "");
function createViewTransition(injector, from2, to) {
const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);
const document2 = injector.get(DOCUMENT);
if (!document2.startViewTransition || transitionOptions.skipNextTransition) {
transitionOptions.skipNextTransition = false;
return new Promise((resolve) => setTimeout(resolve));
}
let resolveViewTransitionStarted;
const viewTransitionStarted = new Promise((resolve) => {
resolveViewTransitionStarted = resolve;
});
const transition = document2.startViewTransition(() => {
resolveViewTransitionStarted();
return createRenderPromise(injector);
});
transition.ready.catch((error2) => {
if (typeof ngDevMode === "undefined" || ngDevMode) {
console.error(error2);
}
});
const {
onViewTransitionCreated
} = transitionOptions;
if (onViewTransitionCreated) {
runInInjectionContext(injector, () => onViewTransitionCreated({
transition,
from: from2,
to
}));
}
return viewTransitionStarted;
}
function createRenderPromise(injector) {
return new Promise((resolve) => {
afterNextRender({
read: () => setTimeout(resolve)
}, {
injector
});
});
}
var NAVIGATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "navigation error handler" : "");
var NavigationTransitions = class _NavigationTransitions {
// Some G3 targets expect the navigation object to be mutated (and not getting a new reference on changes).
currentNavigation = signal(null, ...ngDevMode ? [{
debugName: "currentNavigation",
equal: () => false
}] : [{
equal: () => false
}]);
currentTransition = null;
lastSuccessfulNavigation = null;
/**
* These events are used to communicate back to the Router about the state of the transition. The
* Router wants to respond to these events in various ways. Because the `NavigationTransition`
* class is not public, this event subject is not publicly exposed.
*/
events = new Subject();
/**
* Used to abort the current transition with an error.
*/
transitionAbortWithErrorSubject = new Subject();
configLoader = inject(RouterConfigLoader);
environmentInjector = inject(EnvironmentInjector);
destroyRef = inject(DestroyRef);
urlSerializer = inject(UrlSerializer);
rootContexts = inject(ChildrenOutletContexts);
location = inject(Location);
inputBindingEnabled = inject(INPUT_BINDER, {
optional: true
}) !== null;
titleStrategy = inject(TitleStrategy);
options = inject(ROUTER_CONFIGURATION, {
optional: true
}) || {};
paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || "emptyOnly";
urlHandlingStrategy = inject(UrlHandlingStrategy);
createViewTransition = inject(CREATE_VIEW_TRANSITION, {
optional: true
});
navigationErrorHandler = inject(NAVIGATION_ERROR_HANDLER, {
optional: true
});
navigationId = 0;
get hasRequestedNavigation() {
return this.navigationId !== 0;
}
transitions;
/**
* Hook that enables you to pause navigation after the preactivation phase.
* Used by `RouterModule`.
*
* @internal
*/
afterPreactivation = () => of(void 0);
/** @internal */
rootComponentType = null;
destroyed = false;
constructor() {
const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
this.configLoader.onLoadEndListener = onLoadEnd;
this.configLoader.onLoadStartListener = onLoadStart;
this.destroyRef.onDestroy(() => {
this.destroyed = true;
});
}
complete() {
this.transitions?.complete();
}
handleNavigationRequest(request) {
const id = ++this.navigationId;
untracked(() => {
this.transitions?.next(__spreadProps(__spreadValues({}, request), {
extractedUrl: this.urlHandlingStrategy.extract(request.rawUrl),
targetSnapshot: null,
targetRouterState: null,
guards: {
canActivateChecks: [],
canDeactivateChecks: []
},
guardsResult: null,
abortController: new AbortController(),
id
}));
});
}
setupNavigations(router) {
this.transitions = new BehaviorSubject(null);
return this.transitions.pipe(
filter((t) => t !== null),
// Using switchMap so we cancel executing navigations when a new one comes in
switchMap((overallTransitionState) => {
let completedOrAborted = false;
return of(overallTransitionState).pipe(
switchMap((t) => {
if (this.navigationId > overallTransitionState.id) {
const cancellationReason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : "";
this.cancelNavigationTransition(overallTransitionState, cancellationReason, NavigationCancellationCode.SupersededByNewNavigation);
return EMPTY;
}
this.currentTransition = overallTransitionState;
this.currentNavigation.set({
id: t.id,
initialUrl: t.rawUrl,
extractedUrl: t.extractedUrl,
targetBrowserUrl: typeof t.extras.browserUrl === "string" ? this.urlSerializer.parse(t.extras.browserUrl) : t.extras.browserUrl,
trigger: t.source,
extras: t.extras,
previousNavigation: !this.lastSuccessfulNavigation ? null : __spreadProps(__spreadValues({}, this.lastSuccessfulNavigation), {
previousNavigation: null
}),
abort: () => t.abortController.abort()
});
const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();
const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;
if (!urlTransition && onSameUrlNavigation !== "reload") {
const reason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` : "";
this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));
t.resolve(false);
return EMPTY;
}
if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
return of(t).pipe(
// Fire NavigationStart event
switchMap((t2) => {
this.events.next(new NavigationStart(t2.id, this.urlSerializer.serialize(t2.extractedUrl), t2.source, t2.restoredState));
if (t2.id !== this.navigationId) {
return EMPTY;
}
return Promise.resolve(t2);
}),
// Recognize
recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),
// Update URL if in `eager` update mode
tap((t2) => {
overallTransitionState.targetSnapshot = t2.targetSnapshot;
overallTransitionState.urlAfterRedirects = t2.urlAfterRedirects;
this.currentNavigation.update((nav) => {
nav.finalUrl = t2.urlAfterRedirects;
return nav;
});
const routesRecognized = new RoutesRecognized(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
this.events.next(routesRecognized);
})
);
} else if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(t.currentRawUrl)) {
const {
id,
extractedUrl,
source,
restoredState,
extras
} = t;
const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
this.events.next(navStart);
const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;
this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
targetSnapshot,
urlAfterRedirects: extractedUrl,
extras: __spreadProps(__spreadValues({}, extras), {
skipLocationChange: false,
replaceUrl: false
})
});
this.currentNavigation.update((nav) => {
nav.finalUrl = extractedUrl;
return nav;
});
return of(overallTransitionState);
} else {
const reason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation was ignored because the UrlHandlingStrategy indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.` : "";
this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));
t.resolve(false);
return EMPTY;
}
}),
// --- GUARDS ---
tap((t) => {
const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
this.events.next(guardsStart);
}),
map((t) => {
this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
});
return overallTransitionState;
}),
checkGuards(this.environmentInjector, (evt) => this.events.next(evt)),
tap((t) => {
overallTransitionState.guardsResult = t.guardsResult;
if (t.guardsResult && typeof t.guardsResult !== "boolean") {
throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
}
const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
this.events.next(guardsEnd);
}),
filter((t) => {
if (!t.guardsResult) {
this.cancelNavigationTransition(t, "", NavigationCancellationCode.GuardRejected);
return false;
}
return true;
}),
// --- RESOLVE ---
switchTap((t) => {
if (t.guards.canActivateChecks.length === 0) {
return void 0;
}
return of(t).pipe(tap((t2) => {
const resolveStart = new ResolveStart(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
this.events.next(resolveStart);
}), switchMap((t2) => {
let dataResolved = false;
return of(t2).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({
next: () => dataResolved = true,
complete: () => {
if (!dataResolved) {
this.cancelNavigationTransition(t2, typeof ngDevMode === "undefined" || ngDevMode ? `At least one route resolver didn't emit any value.` : "", NavigationCancellationCode.NoDataFromResolver);
}
}
}));
}), tap((t2) => {
const resolveEnd = new ResolveEnd(t2.id, this.urlSerializer.serialize(t2.extractedUrl), this.urlSerializer.serialize(t2.urlAfterRedirects), t2.targetSnapshot);
this.events.next(resolveEnd);
}));
}),
// --- LOAD COMPONENTS ---
switchTap((t) => {
const loadComponents = (route) => {
const loaders = [];
if (route.routeConfig?.loadComponent) {
const injector = getClosestRouteInjector(route) ?? this.environmentInjector;
loaders.push(this.configLoader.loadComponent(injector, route.routeConfig).pipe(tap((loadedComponent) => {
route.component = loadedComponent;
}), map(() => void 0)));
}
for (const child of route.children) {
loaders.push(...loadComponents(child));
}
return loaders;
};
return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));
}),
switchTap(() => this.afterPreactivation()),
switchMap(() => {
const {
currentSnapshot,
targetSnapshot
} = overallTransitionState;
const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);
return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);
}),
map((t) => {
const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
this.currentTransition = overallTransitionState = __spreadProps(__spreadValues({}, t), {
targetRouterState
});
this.currentNavigation.update((nav) => {
nav.targetRouterState = targetRouterState;
return nav;
});
return overallTransitionState;
}),
tap(() => {
this.events.next(new BeforeActivateRoutes());
}),
activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt), this.inputBindingEnabled),
// Ensure that if some observable used to drive the transition doesn't
// complete, the navigation still finalizes This should never happen, but
// this is done as a safety measure to avoid surfacing this error (#49567).
take(1),
takeUntil(new Observable((subscriber) => {
const abortSignal = overallTransitionState.abortController.signal;
const handler = () => subscriber.next();
abortSignal.addEventListener("abort", handler);
return () => abortSignal.removeEventListener("abort", handler);
}).pipe(
// Ignore aborts if we are already completed, canceled, or are in the activation stage (we have targetRouterState)
filter(() => !completedOrAborted && !overallTransitionState.targetRouterState),
tap(() => {
this.cancelNavigationTransition(overallTransitionState, overallTransitionState.abortController.signal.reason + "", NavigationCancellationCode.Aborted);
})
)),
tap({
next: (t) => {
completedOrAborted = true;
this.lastSuccessfulNavigation = untracked(this.currentNavigation);
this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));
this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);
t.resolve(true);
},
complete: () => {
completedOrAborted = true;
}
}),
// There used to be a lot more logic happening directly within the
// transition Observable. Some of this logic has been refactored out to
// other places but there may still be errors that happen there. This gives
// us a way to cancel the transition from the outside. This may also be
// required in the future to support something like the abort signal of the
// Navigation API where the navigation gets aborted from outside the
// transition.
takeUntil(this.transitionAbortWithErrorSubject.pipe(tap((err) => {
throw err;
}))),
finalize(() => {
if (!completedOrAborted) {
const cancelationReason = typeof ngDevMode === "undefined" || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : "";
this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);
}
if (this.currentTransition?.id === overallTransitionState.id) {
this.currentNavigation.set(null);
this.currentTransition = null;
}
}),
catchError((e) => {
if (this.destroyed) {
overallTransitionState.resolve(false);
return EMPTY;
}
completedOrAborted = true;
if (isNavigationCancelingError(e)) {
this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));
if (!isRedirectingNavigationCancelingError(e)) {
overallTransitionState.resolve(false);
} else {
this.events.next(new RedirectRequest(e.url, e.navigationBehaviorOptions));
}
} else {
const navigationError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? void 0);
try {
const navigationErrorHandlerResult = runInInjectionContext(this.environmentInjector, () => this.navigationErrorHandler?.(navigationError));
if (navigationErrorHandlerResult instanceof RedirectCommand) {
const {
message,
cancellationCode
} = redirectingNavigationError(this.urlSerializer, navigationErrorHandlerResult);
this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), message, cancellationCode));
this.events.next(new RedirectRequest(navigationErrorHandlerResult.redirectTo, navigationErrorHandlerResult.navigationBehaviorOptions));
} else {
this.events.next(navigationError);
throw e;
}
} catch (ee) {
if (this.options.resolveNavigationPromiseOnError) {
overallTransitionState.resolve(false);
} else {
overallTransitionState.reject(ee);
}
}
}
return EMPTY;
})
);
})
);
}
cancelNavigationTransition(t, reason, code) {
const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
this.events.next(navCancel);
t.resolve(false);
}
/**
* @returns Whether we're navigating to somewhere that is not what the Router is
* currently set to.
*/
isUpdatingInternalState() {
return this.currentTransition?.extractedUrl.toString() !== this.currentTransition?.currentUrlTree.toString();
}
/**
* @returns Whether we're updating the browser URL to something new (navigation is going
* to somewhere not displayed in the URL bar and we will update the URL
* bar if navigation succeeds).
*/
isUpdatedBrowserUrl() {
const currentBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));
const currentNavigation = untracked(this.currentNavigation);
const targetBrowserUrl = currentNavigation?.targetBrowserUrl ?? currentNavigation?.extractedUrl;
return currentBrowserUrl.toString() !== targetBrowserUrl?.toString() && !currentNavigation?.extras.skipLocationChange;
}
static \u0275fac = function NavigationTransitions_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NavigationTransitions)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NavigationTransitions,
factory: _NavigationTransitions.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NavigationTransitions, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
function isBrowserTriggeredNavigation(source) {
return source !== IMPERATIVE_NAVIGATION;
}
var RouteReuseStrategy = class _RouteReuseStrategy {
static \u0275fac = function RouteReuseStrategy_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouteReuseStrategy)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _RouteReuseStrategy,
factory: () => (() => inject(DefaultRouteReuseStrategy))(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouteReuseStrategy, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => inject(DefaultRouteReuseStrategy)
}]
}], null, null);
})();
var BaseRouteReuseStrategy = class {
/**
* Whether the given route should detach for later reuse.
* Always returns false for `BaseRouteReuseStrategy`.
* */
shouldDetach(route) {
return false;
}
/**
* A no-op; the route is never stored since this strategy never detaches routes for later re-use.
*/
store(route, detachedTree) {
}
/** Returns `false`, meaning the route (and its subtree) is never reattached */
shouldAttach(route) {
return false;
}
/** Returns `null` because this strategy does not store routes for later re-use. */
retrieve(route) {
return null;
}
/**
* Determines if a route should be reused.
* This strategy returns `true` when the future route config and current route config are
* identical.
*/
shouldReuseRoute(future, curr) {
return future.routeConfig === curr.routeConfig;
}
};
var DefaultRouteReuseStrategy = class _DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
static \u0275fac = /* @__PURE__ */ (() => {
let \u0275DefaultRouteReuseStrategy_BaseFactory;
return function DefaultRouteReuseStrategy_Factory(__ngFactoryType__) {
return (\u0275DefaultRouteReuseStrategy_BaseFactory || (\u0275DefaultRouteReuseStrategy_BaseFactory = \u0275\u0275getInheritedFactory(_DefaultRouteReuseStrategy)))(__ngFactoryType__ || _DefaultRouteReuseStrategy);
};
})();
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _DefaultRouteReuseStrategy,
factory: _DefaultRouteReuseStrategy.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultRouteReuseStrategy, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
var StateManager = class _StateManager {
urlSerializer = inject(UrlSerializer);
options = inject(ROUTER_CONFIGURATION, {
optional: true
}) || {};
canceledNavigationResolution = this.options.canceledNavigationResolution || "replace";
location = inject(Location);
urlHandlingStrategy = inject(UrlHandlingStrategy);
urlUpdateStrategy = this.options.urlUpdateStrategy || "deferred";
currentUrlTree = new UrlTree();
/**
* Returns the currently activated `UrlTree`.
*
* This `UrlTree` shows only URLs that the `Router` is configured to handle (through
* `UrlHandlingStrategy`).
*
* The value is set after finding the route config tree to activate but before activating the
* route.
*/
getCurrentUrlTree() {
return this.currentUrlTree;
}
rawUrlTree = this.currentUrlTree;
/**
* Returns a `UrlTree` that is represents what the browser is actually showing.
*
* In the life of a navigation transition:
* 1. When a navigation begins, the raw `UrlTree` is updated to the full URL that's being
* navigated to.
* 2. During a navigation, redirects are applied, which might only apply to _part_ of the URL (due
* to `UrlHandlingStrategy`).
* 3. Just before activation, the raw `UrlTree` is updated to include the redirects on top of the
* original raw URL.
*
* Note that this is _only_ here to support `UrlHandlingStrategy.extract` and
* `UrlHandlingStrategy.shouldProcessUrl`. Without those APIs, the current `UrlTree` would not
* deviated from the raw `UrlTree`.
*
* For `extract`, a raw `UrlTree` is needed because `extract` may only return part
* of the navigation URL. Thus, the current `UrlTree` may only represent _part_ of the browser
* URL. When a navigation gets cancelled and the router needs to reset the URL or a new navigation
* occurs, it needs to know the _whole_ browser URL, not just the part handled by
* `UrlHandlingStrategy`.
* For `shouldProcessUrl`, when the return is `false`, the router ignores the navigation but
* still updates the raw `UrlTree` with the assumption that the navigation was caused by the
* location change listener due to a URL update by the AngularJS router. In this case, the router
* still need to know what the browser's URL is for future navigations.
*/
getRawUrlTree() {
return this.rawUrlTree;
}
createBrowserPath({
finalUrl,
initialUrl,
targetBrowserUrl
}) {
const rawUrl = finalUrl !== void 0 ? this.urlHandlingStrategy.merge(finalUrl, initialUrl) : initialUrl;
const url = targetBrowserUrl ?? rawUrl;
const path = url instanceof UrlTree ? this.urlSerializer.serialize(url) : url;
return path;
}
commitTransition({
targetRouterState,
finalUrl,
initialUrl
}) {
if (finalUrl && targetRouterState) {
this.currentUrlTree = finalUrl;
this.rawUrlTree = this.urlHandlingStrategy.merge(finalUrl, initialUrl);
this.routerState = targetRouterState;
} else {
this.rawUrlTree = initialUrl;
}
}
routerState = createEmptyState(null);
/** Returns the current RouterState. */
getRouterState() {
return this.routerState;
}
stateMemento = this.createStateMemento();
updateStateMemento() {
this.stateMemento = this.createStateMemento();
}
createStateMemento() {
return {
rawUrlTree: this.rawUrlTree,
currentUrlTree: this.currentUrlTree,
routerState: this.routerState
};
}
resetInternalState({
finalUrl
}) {
this.routerState = this.stateMemento.routerState;
this.currentUrlTree = this.stateMemento.currentUrlTree;
this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, finalUrl ?? this.rawUrlTree);
}
static \u0275fac = function StateManager_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _StateManager)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _StateManager,
factory: () => (() => inject(HistoryStateManager))(),
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(StateManager, [{
type: Injectable,
args: [{
providedIn: "root",
useFactory: () => inject(HistoryStateManager)
}]
}], null, null);
})();
var HistoryStateManager = class _HistoryStateManager extends StateManager {
/**
* The id of the currently active page in the router.
* Updated to the transition's target id on a successful navigation.
*
* This is used to track what page the router last activated. When an attempted navigation fails,
* the router can then use this to compute how to restore the state back to the previously active
* page.
*/
currentPageId = 0;
lastSuccessfulId = -1;
restoredState() {
return this.location.getState();
}
/**
* The ɵrouterPageId of whatever page is currently active in the browser history. This is
* important for computing the target page id for new navigations because we need to ensure each
* page id in the browser history is 1 more than the previous entry.
*/
get browserPageId() {
if (this.canceledNavigationResolution !== "computed") {
return this.currentPageId;
}
return this.restoredState()?.\u0275routerPageId ?? this.currentPageId;
}
registerNonRouterCurrentEntryChangeListener(listener) {
return this.location.subscribe((event) => {
if (event["type"] === "popstate") {
setTimeout(() => {
listener(event["url"], event.state, "popstate");
});
}
});
}
handleRouterEvent(e, currentTransition) {
if (e instanceof NavigationStart) {
this.updateStateMemento();
} else if (e instanceof NavigationSkipped) {
this.commitTransition(currentTransition);
} else if (e instanceof RoutesRecognized) {
if (this.urlUpdateStrategy === "eager") {
if (!currentTransition.extras.skipLocationChange) {
this.setBrowserUrl(this.createBrowserPath(currentTransition), currentTransition);
}
}
} else if (e instanceof BeforeActivateRoutes) {
this.commitTransition(currentTransition);
if (this.urlUpdateStrategy === "deferred" && !currentTransition.extras.skipLocationChange) {
this.setBrowserUrl(this.createBrowserPath(currentTransition), currentTransition);
}
} else if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.SupersededByNewNavigation && e.code !== NavigationCancellationCode.Redirect) {
this.restoreHistory(currentTransition);
} else if (e instanceof NavigationError) {
this.restoreHistory(currentTransition, true);
} else if (e instanceof NavigationEnd) {
this.lastSuccessfulId = e.id;
this.currentPageId = this.browserPageId;
}
}
setBrowserUrl(path, {
extras,
id
}) {
const {
replaceUrl,
state
} = extras;
if (this.location.isCurrentPathEqualTo(path) || !!replaceUrl) {
const currentBrowserPageId = this.browserPageId;
const newState = __spreadValues(__spreadValues({}, state), this.generateNgRouterState(id, currentBrowserPageId));
this.location.replaceState(path, "", newState);
} else {
const newState = __spreadValues(__spreadValues({}, state), this.generateNgRouterState(id, this.browserPageId + 1));
this.location.go(path, "", newState);
}
}
/**
* Performs the necessary rollback action to restore the browser URL to the
* state before the transition.
*/
restoreHistory(navigation, restoringFromCaughtError = false) {
if (this.canceledNavigationResolution === "computed") {
const currentBrowserPageId = this.browserPageId;
const targetPagePosition = this.currentPageId - currentBrowserPageId;
if (targetPagePosition !== 0) {
this.location.historyGo(targetPagePosition);
} else if (this.getCurrentUrlTree() === navigation.finalUrl && targetPagePosition === 0) {
this.resetInternalState(navigation);
this.resetUrlToCurrentUrlTree();
} else ;
} else if (this.canceledNavigationResolution === "replace") {
if (restoringFromCaughtError) {
this.resetInternalState(navigation);
}
this.resetUrlToCurrentUrlTree();
}
}
resetUrlToCurrentUrlTree() {
this.location.replaceState(this.urlSerializer.serialize(this.getRawUrlTree()), "", this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
}
generateNgRouterState(navigationId, routerPageId) {
if (this.canceledNavigationResolution === "computed") {
return {
navigationId,
\u0275routerPageId: routerPageId
};
}
return {
navigationId
};
}
static \u0275fac = /* @__PURE__ */ (() => {
let \u0275HistoryStateManager_BaseFactory;
return function HistoryStateManager_Factory(__ngFactoryType__) {
return (\u0275HistoryStateManager_BaseFactory || (\u0275HistoryStateManager_BaseFactory = \u0275\u0275getInheritedFactory(_HistoryStateManager)))(__ngFactoryType__ || _HistoryStateManager);
};
})();
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _HistoryStateManager,
factory: _HistoryStateManager.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(HistoryStateManager, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
function afterNextNavigation(router, action) {
router.events.pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped), map((e) => {
if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {
return 0;
}
const redirecting = e instanceof NavigationCancel ? e.code === NavigationCancellationCode.Redirect || e.code === NavigationCancellationCode.SupersededByNewNavigation : false;
return redirecting ? 2 : 1;
}), filter(
(result) => result !== 2
/* NavigationResult.REDIRECTING */
), take(1)).subscribe(() => {
action();
});
}
var exactMatchOptions = {
paths: "exact",
fragment: "ignored",
matrixParams: "ignored",
queryParams: "exact"
};
var subsetMatchOptions = {
paths: "subset",
fragment: "ignored",
matrixParams: "ignored",
queryParams: "subset"
};
var Router = class _Router {
get currentUrlTree() {
return this.stateManager.getCurrentUrlTree();
}
get rawUrlTree() {
return this.stateManager.getRawUrlTree();
}
disposed = false;
nonRouterCurrentEntryChangeSubscription;
console = inject(Console);
stateManager = inject(StateManager);
options = inject(ROUTER_CONFIGURATION, {
optional: true
}) || {};
pendingTasks = inject(PendingTasksInternal);
urlUpdateStrategy = this.options.urlUpdateStrategy || "deferred";
navigationTransitions = inject(NavigationTransitions);
urlSerializer = inject(UrlSerializer);
location = inject(Location);
urlHandlingStrategy = inject(UrlHandlingStrategy);
injector = inject(EnvironmentInjector);
/**
* The private `Subject` type for the public events exposed in the getter. This is used internally
* to push events to. The separate field allows us to expose separate types in the public API
* (i.e., an Observable rather than the Subject).
*/
_events = new Subject();
/**
* An event stream for routing events.
*/
get events() {
return this._events;
}
/**
* The current state of routing in this NgModule.
*/
get routerState() {
return this.stateManager.getRouterState();
}
/**
* True if at least one navigation event has occurred,
* false otherwise.
*/
navigated = false;
/**
* A strategy for re-using routes.
*
* @deprecated Configure using `providers` instead:
* `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
*/
routeReuseStrategy = inject(RouteReuseStrategy);
/**
* How to handle a navigation request to the current URL.
*
*
* @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
* @see {@link withRouterConfig}
* @see {@link provideRouter}
* @see {@link RouterModule}
*/
onSameUrlNavigation = this.options.onSameUrlNavigation || "ignore";
config = inject(ROUTES, {
optional: true
})?.flat() ?? [];
/**
* Indicates whether the application has opted in to binding Router data to component inputs.
*
* This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or
* `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.
*/
componentInputBindingEnabled = !!inject(INPUT_BINDER, {
optional: true
});
/**
* Signal of the current `Navigation` object when the router is navigating, and `null` when idle.
*
* Note: The current navigation becomes to null after the NavigationEnd event is emitted.
*/
currentNavigation = this.navigationTransitions.currentNavigation.asReadonly();
constructor() {
this.resetConfig(this.config);
this.navigationTransitions.setupNavigations(this).subscribe({
error: (e) => {
this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);
}
});
this.subscribeToNavigationEvents();
}
eventsSubscription = new Subscription();
subscribeToNavigationEvents() {
const subscription = this.navigationTransitions.events.subscribe((e) => {
try {
const currentTransition = this.navigationTransitions.currentTransition;
const currentNavigation = untracked(this.navigationTransitions.currentNavigation);
if (currentTransition !== null && currentNavigation !== null) {
this.stateManager.handleRouterEvent(e, currentNavigation);
if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.Redirect && e.code !== NavigationCancellationCode.SupersededByNewNavigation) {
this.navigated = true;
} else if (e instanceof NavigationEnd) {
this.navigated = true;
} else if (e instanceof RedirectRequest) {
const opts = e.navigationBehaviorOptions;
const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);
const extras = __spreadValues({
browserUrl: currentTransition.extras.browserUrl,
info: currentTransition.extras.info,
skipLocationChange: currentTransition.extras.skipLocationChange,
// The URL is already updated at this point if we have 'eager' URL
// updates or if the navigation was triggered by the browser (back
// button, URL bar, etc). We want to replace that item in history
// if the navigation is rejected.
replaceUrl: currentTransition.extras.replaceUrl || this.urlUpdateStrategy === "eager" || isBrowserTriggeredNavigation(currentTransition.source)
}, opts);
this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {
resolve: currentTransition.resolve,
reject: currentTransition.reject,
promise: currentTransition.promise
});
}
}
if (isPublicRouterEvent(e)) {
this._events.next(e);
}
} catch (e2) {
this.navigationTransitions.transitionAbortWithErrorSubject.next(e2);
}
});
this.eventsSubscription.add(subscription);
}
/** @internal */
resetRootComponentType(rootComponentType) {
this.routerState.root.component = rootComponentType;
this.navigationTransitions.rootComponentType = rootComponentType;
}
/**
* Sets up the location change listener and performs the initial navigation.
*/
initialNavigation() {
this.setUpLocationChangeListener();
if (!this.navigationTransitions.hasRequestedNavigation) {
this.navigateToSyncWithBrowser(this.location.path(true), IMPERATIVE_NAVIGATION, this.stateManager.restoredState());
}
}
/**
* Sets up the location change listener. This listener detects navigations triggered from outside
* the Router (the browser back/forward buttons, for example) and schedules a corresponding Router
* navigation so that the correct events, guards, etc. are triggered.
*/
setUpLocationChangeListener() {
this.nonRouterCurrentEntryChangeSubscription ??= this.stateManager.registerNonRouterCurrentEntryChangeListener((url, state, source) => {
this.navigateToSyncWithBrowser(url, source, state);
});
}
/**
* Schedules a router navigation to synchronize Router state with the browser state.
*
* This is done as a response to a popstate event and the initial navigation. These
* two scenarios represent times when the browser URL/state has been updated and
* the Router needs to respond to ensure its internal state matches.
*/
navigateToSyncWithBrowser(url, source, state) {
const extras = {
replaceUrl: true
};
const restoredState = state?.navigationId ? state : null;
if (state) {
const stateCopy = __spreadValues({}, state);
delete stateCopy.navigationId;
delete stateCopy.\u0275routerPageId;
if (Object.keys(stateCopy).length !== 0) {
extras.state = stateCopy;
}
}
const urlTree = this.parseUrl(url);
this.scheduleNavigation(urlTree, source, restoredState, extras).catch((e) => {
if (this.disposed) {
return;
}
this.injector.get(INTERNAL_APPLICATION_ERROR_HANDLER)(e);
});
}
/** The current URL. */
get url() {
return this.serializeUrl(this.currentUrlTree);
}
/**
* Returns the current `Navigation` object when the router is navigating,
* and `null` when idle.
*
* @deprecated 20.2 Use the `currentNavigation` signal instead.
*/
getCurrentNavigation() {
return untracked(this.navigationTransitions.currentNavigation);
}
/**
* The `Navigation` object of the most recent navigation to succeed and `null` if there
* has not been a successful navigation yet.
*/
get lastSuccessfulNavigation() {
return this.navigationTransitions.lastSuccessfulNavigation;
}
/**
* Resets the route configuration used for navigation and generating links.
*
* @param config The route array for the new configuration.
*
* @usageNotes
*
* ```ts
* router.resetConfig([
* { path: 'team/:id', component: TeamCmp, children: [
* { path: 'simple', component: SimpleCmp },
* { path: 'user/:name', component: UserCmp }
* ]}
* ]);
* ```
*/
resetConfig(config) {
(typeof ngDevMode === "undefined" || ngDevMode) && validateConfig(config);
this.config = config.map(standardizeConfig);
this.navigated = false;
}
/** @docs-private */
ngOnDestroy() {
this.dispose();
}
/** Disposes of the router. */
dispose() {
this._events.unsubscribe();
this.navigationTransitions.complete();
if (this.nonRouterCurrentEntryChangeSubscription) {
this.nonRouterCurrentEntryChangeSubscription.unsubscribe();
this.nonRouterCurrentEntryChangeSubscription = void 0;
}
this.disposed = true;
this.eventsSubscription.unsubscribe();
}
/**
* Appends URL segments to the current URL tree to create a new URL tree.
*
* @param commands An array of URL fragments with which to construct the new URL tree.
* If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
* segments, followed by the parameters for each segment.
* The fragments are applied to the current URL tree or the one provided in the `relativeTo`
* property of the options object, if supplied.
* @param navigationExtras Options that control the navigation strategy.
* @returns The new URL tree.
*
* @usageNotes
*
* ```
* // create /team/33/user/11
* router.createUrlTree(['/team', 33, 'user', 11]);
*
* // create /team/33;expand=true/user/11
* router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
*
* // you can collapse static segments like this (this works only with the first passed-in value):
* router.createUrlTree(['/team/33/user', userId]);
*
* // If the first segment can contain slashes, and you do not want the router to split it,
* // you can do the following:
* router.createUrlTree([{segmentPath: '/one/two'}]);
*
* // create /team/33/(user/11//right:chat)
* router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
*
* // remove the right secondary node
* router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
*
* // assuming the current url is `/team/33/user/11` and the route points to `user/11`
*
* // navigate to /team/33/user/11/details
* router.createUrlTree(['details'], {relativeTo: route});
*
* // navigate to /team/33/user/22
* router.createUrlTree(['../22'], {relativeTo: route});
*
* // navigate to /team/44/user/22
* router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
*
* Note that a value of `null` or `undefined` for `relativeTo` indicates that the
* tree should be created relative to the root.
* ```
*/
createUrlTree(commands, navigationExtras = {}) {
const {
relativeTo,
queryParams,
fragment,
queryParamsHandling,
preserveFragment
} = navigationExtras;
const f = preserveFragment ? this.currentUrlTree.fragment : fragment;
let q = null;
switch (queryParamsHandling ?? this.options.defaultQueryParamsHandling) {
case "merge":
q = __spreadValues(__spreadValues({}, this.currentUrlTree.queryParams), queryParams);
break;
case "preserve":
q = this.currentUrlTree.queryParams;
break;
default:
q = queryParams || null;
}
if (q !== null) {
q = this.removeEmptyProps(q);
}
let relativeToUrlSegmentGroup;
try {
const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;
relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);
} catch (e) {
if (typeof commands[0] !== "string" || commands[0][0] !== "/") {
commands = [];
}
relativeToUrlSegmentGroup = this.currentUrlTree.root;
}
return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);
}
/**
* Navigates to a view using an absolute route path.
*
* @param url An absolute path for a defined route. The function does not apply any delta to the
* current URL.
* @param extras An object containing properties that modify the navigation strategy.
*
* @returns A Promise that resolves to 'true' when navigation succeeds,
* to 'false' when navigation fails, or is rejected on error.
*
* @usageNotes
*
* The following calls request navigation to an absolute path.
*
* ```ts
* router.navigateByUrl("/team/33/user/11");
*
* // Navigate without updating the URL
* router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
* ```
*
* @see [Routing and Navigation guide](guide/routing/common-router-tasks)
*
*/
navigateByUrl(url, extras = {
skipLocationChange: false
}) {
const urlTree = isUrlTree(url) ? url : this.parseUrl(url);
const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);
return this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras);
}
/**
* Navigate based on the provided array of commands and a starting point.
* If no starting route is provided, the navigation is absolute.
*
* @param commands An array of URL fragments with which to construct the target URL.
* If the path is static, can be the literal URL string. For a dynamic path, pass an array of path
* segments, followed by the parameters for each segment.
* The fragments are applied to the current URL or the one provided in the `relativeTo` property
* of the options object, if supplied.
* @param extras An options object that determines how the URL should be constructed or
* interpreted.
*
* @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation
* fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is
* not `true`.
*
* @usageNotes
*
* The following calls request navigation to a dynamic route path relative to the current URL.
*
* ```ts
* router.navigate(['team', 33, 'user', 11], {relativeTo: route});
*
* // Navigate without updating the URL, overriding the default behavior
* router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
* ```
*
* @see [Routing and Navigation guide](guide/routing/common-router-tasks)
*
*/
navigate(commands, extras = {
skipLocationChange: false
}) {
validateCommands(commands);
return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
}
/** Serializes a `UrlTree` into a string */
serializeUrl(url) {
return this.urlSerializer.serialize(url);
}
/** Parses a string into a `UrlTree` */
parseUrl(url) {
try {
return this.urlSerializer.parse(url);
} catch (e) {
this.console.warn(formatRuntimeError(4018, ngDevMode && `Error parsing URL ${url}. Falling back to '/' instead.
` + e));
return this.urlSerializer.parse("/");
}
}
isActive(url, matchOptions) {
let options;
if (matchOptions === true) {
options = __spreadValues({}, exactMatchOptions);
} else if (matchOptions === false) {
options = __spreadValues({}, subsetMatchOptions);
} else {
options = matchOptions;
}
if (isUrlTree(url)) {
return containsTree(this.currentUrlTree, url, options);
}
const urlTree = this.parseUrl(url);
return containsTree(this.currentUrlTree, urlTree, options);
}
removeEmptyProps(params) {
return Object.entries(params).reduce((result, [key, value]) => {
if (value !== null && value !== void 0) {
result[key] = value;
}
return result;
}, {});
}
scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
if (this.disposed) {
return Promise.resolve(false);
}
let resolve;
let reject;
let promise;
if (priorPromise) {
resolve = priorPromise.resolve;
reject = priorPromise.reject;
promise = priorPromise.promise;
} else {
promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
}
const taskId = this.pendingTasks.add();
afterNextNavigation(this, () => {
queueMicrotask(() => this.pendingTasks.remove(taskId));
});
this.navigationTransitions.handleNavigationRequest({
source,
restoredState,
currentUrlTree: this.currentUrlTree,
currentRawUrl: this.currentUrlTree,
rawUrl,
extras,
resolve,
reject,
promise,
currentSnapshot: this.routerState.snapshot,
currentRouterState: this.routerState
});
return promise.catch((e) => {
return Promise.reject(e);
});
}
static \u0275fac = function Router_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _Router)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _Router,
factory: _Router.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Router, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
function validateCommands(commands) {
for (let i = 0; i < commands.length; i++) {
const cmd = commands[i];
if (cmd == null) {
throw new RuntimeError(4008, (typeof ngDevMode === "undefined" || ngDevMode) && `The requested path contains ${cmd} segment at index ${i}`);
}
}
}
// node_modules/@angular/router/fesm2022/router_module.mjs
var RouterLink = class _RouterLink {
router;
route;
tabIndexAttribute;
renderer;
el;
locationStrategy;
/** @nodoc */
reactiveHref = signal(null, ...ngDevMode ? [{
debugName: "reactiveHref"
}] : []);
/**
* Represents an `href` attribute value applied to a host element,
* when a host element is an `<a>`/`<area>` tag or a compatible custom element.
* For other tags, the value is `null`.
*/
get href() {
return untracked(this.reactiveHref);
}
/** @deprecated */
set href(value) {
this.reactiveHref.set(value);
}
/**
* Represents the `target` attribute on a host element.
* This is only used when the host element is
* an `<a>`/`<area>` tag or a compatible custom element.
*/
target;
/**
* Passed to {@link Router#createUrlTree} as part of the
* `UrlCreationOptions`.
* @see {@link UrlCreationOptions#queryParams}
* @see {@link Router#createUrlTree}
*/
queryParams;
/**
* Passed to {@link Router#createUrlTree} as part of the
* `UrlCreationOptions`.
* @see {@link UrlCreationOptions#fragment}
* @see {@link Router#createUrlTree}
*/
fragment;
/**
* Passed to {@link Router#createUrlTree} as part of the
* `UrlCreationOptions`.
* @see {@link UrlCreationOptions#queryParamsHandling}
* @see {@link Router#createUrlTree}
*/
queryParamsHandling;
/**
* Passed to {@link Router#navigateByUrl} as part of the
* `NavigationBehaviorOptions`.
* @see {@link NavigationBehaviorOptions#state}
* @see {@link Router#navigateByUrl}
*/
state;
/**
* Passed to {@link Router#navigateByUrl} as part of the
* `NavigationBehaviorOptions`.
* @see {@link NavigationBehaviorOptions#info}
* @see {@link Router#navigateByUrl}
*/
info;
/**
* Passed to {@link Router#createUrlTree} as part of the
* `UrlCreationOptions`.
* Specify a value here when you do not want to use the default value
* for `routerLink`, which is the current activated route.
* Note that a value of `undefined` here will use the `routerLink` default.
* @see {@link UrlCreationOptions#relativeTo}
* @see {@link Router#createUrlTree}
*/
relativeTo;
/** Whether a host element is an `<a>`/`<area>` tag or a compatible custom element. */
isAnchorElement;
subscription;
/** @internal */
onChanges = new Subject();
applicationErrorHandler = inject(INTERNAL_APPLICATION_ERROR_HANDLER);
options = inject(ROUTER_CONFIGURATION, {
optional: true
});
constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {
this.router = router;
this.route = route;
this.tabIndexAttribute = tabIndexAttribute;
this.renderer = renderer;
this.el = el;
this.locationStrategy = locationStrategy;
this.reactiveHref.set(inject(new HostAttributeToken("href"), {
optional: true
}));
const tagName = el.nativeElement.tagName?.toLowerCase();
this.isAnchorElement = tagName === "a" || tagName === "area" || !!// Avoid breaking in an SSR context where customElements might not be defined.
(typeof customElements === "object" && // observedAttributes is an optional static property/getter on a custom element.
// The spec states that this must be an array of strings.
customElements.get(tagName)?.observedAttributes?.includes?.("href"));
if (!this.isAnchorElement) {
this.subscribeToNavigationEventsIfNecessary();
} else {
this.setTabIndexIfNotOnNativeEl("0");
}
}
subscribeToNavigationEventsIfNecessary() {
if (this.subscription !== void 0 || !this.isAnchorElement) {
return;
}
let createSubcription = this.preserveFragment;
const dependsOnRouterState = (handling) => handling === "merge" || handling === "preserve";
createSubcription ||= dependsOnRouterState(this.queryParamsHandling);
createSubcription ||= !this.queryParamsHandling && !dependsOnRouterState(this.options?.defaultQueryParamsHandling);
if (!createSubcription) {
return;
}
this.subscription = this.router.events.subscribe((s) => {
if (s instanceof NavigationEnd) {
this.updateHref();
}
});
}
/**
* Passed to {@link Router#createUrlTree} as part of the
* `UrlCreationOptions`.
* @see {@link UrlCreationOptions#preserveFragment}
* @see {@link Router#createUrlTree}
*/
preserveFragment = false;
/**
* Passed to {@link Router#navigateByUrl} as part of the
* `NavigationBehaviorOptions`.
* @see {@link NavigationBehaviorOptions#skipLocationChange}
* @see {@link Router#navigateByUrl}
*/
skipLocationChange = false;
/**
* Passed to {@link Router#navigateByUrl} as part of the
* `NavigationBehaviorOptions`.
* @see {@link NavigationBehaviorOptions#replaceUrl}
* @see {@link Router#navigateByUrl}
*/
replaceUrl = false;
/**
* Modifies the tab index if there was not a tabindex attribute on the element during
* instantiation.
*/
setTabIndexIfNotOnNativeEl(newTabIndex) {
if (this.tabIndexAttribute != null || this.isAnchorElement) {
return;
}
this.applyAttributeValue("tabindex", newTabIndex);
}
/** @docs-private */
// TODO(atscott): Remove changes parameter in major version as a breaking change.
ngOnChanges(changes) {
if (ngDevMode && isUrlTree(this.routerLinkInput) && (this.fragment !== void 0 || this.queryParams || this.queryParamsHandling || this.preserveFragment || this.relativeTo)) {
throw new RuntimeError(4017, "Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.");
}
if (this.isAnchorElement) {
this.updateHref();
this.subscribeToNavigationEventsIfNecessary();
}
this.onChanges.next(this);
}
routerLinkInput = null;
/**
* Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.
* - **array**: commands to pass to {@link Router#createUrlTree}.
* - **string**: shorthand for array of commands with just the string, i.e. `['/route']`
* - **UrlTree**: a `UrlTree` for this link rather than creating one from the commands
* and other inputs that correspond to properties of `UrlCreationOptions`.
* - **null|undefined**: effectively disables the `routerLink`
* @see {@link Router#createUrlTree}
*/
set routerLink(commandsOrUrlTree) {
if (commandsOrUrlTree == null) {
this.routerLinkInput = null;
this.setTabIndexIfNotOnNativeEl(null);
} else {
if (isUrlTree(commandsOrUrlTree)) {
this.routerLinkInput = commandsOrUrlTree;
} else {
this.routerLinkInput = Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree];
}
this.setTabIndexIfNotOnNativeEl("0");
}
}
/** @docs-private */
onClick(button, ctrlKey, shiftKey, altKey, metaKey) {
const urlTree = this.urlTree;
if (urlTree === null) {
return true;
}
if (this.isAnchorElement) {
if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {
return true;
}
if (typeof this.target === "string" && this.target != "_self") {
return true;
}
}
const extras = {
skipLocationChange: this.skipLocationChange,
replaceUrl: this.replaceUrl,
state: this.state,
info: this.info
};
this.router.navigateByUrl(urlTree, extras)?.catch((e) => {
this.applicationErrorHandler(e);
});
return !this.isAnchorElement;
}
/** @docs-private */
ngOnDestroy() {
this.subscription?.unsubscribe();
}
updateHref() {
const urlTree = this.urlTree;
this.reactiveHref.set(urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) ?? "" : null);
}
applyAttributeValue(attrName, attrValue) {
const renderer = this.renderer;
const nativeElement = this.el.nativeElement;
if (attrValue !== null) {
renderer.setAttribute(nativeElement, attrName, attrValue);
} else {
renderer.removeAttribute(nativeElement, attrName);
}
}
get urlTree() {
if (this.routerLinkInput === null) {
return null;
} else if (isUrlTree(this.routerLinkInput)) {
return this.routerLinkInput;
}
return this.router.createUrlTree(this.routerLinkInput, {
// If the `relativeTo` input is not defined, we want to use `this.route` by default.
// Otherwise, we should use the value provided by the user in the input.
relativeTo: this.relativeTo !== void 0 ? this.relativeTo : this.route,
queryParams: this.queryParams,
fragment: this.fragment,
queryParamsHandling: this.queryParamsHandling,
preserveFragment: this.preserveFragment
});
}
static \u0275fac = function RouterLink_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterLink)(\u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(ActivatedRoute), \u0275\u0275injectAttribute("tabindex"), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(LocationStrategy));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _RouterLink,
selectors: [["", "routerLink", ""]],
hostVars: 2,
hostBindings: function RouterLink_HostBindings(rf, ctx) {
if (rf & 1) {
\u0275\u0275listener("click", function RouterLink_click_HostBindingHandler($event) {
return ctx.onClick($event.button, $event.ctrlKey, $event.shiftKey, $event.altKey, $event.metaKey);
});
}
if (rf & 2) {
\u0275\u0275attribute("href", ctx.reactiveHref(), \u0275\u0275sanitizeUrlOrResourceUrl)("target", ctx.target);
}
},
inputs: {
target: "target",
queryParams: "queryParams",
fragment: "fragment",
queryParamsHandling: "queryParamsHandling",
state: "state",
info: "info",
relativeTo: "relativeTo",
preserveFragment: [2, "preserveFragment", "preserveFragment", booleanAttribute],
skipLocationChange: [2, "skipLocationChange", "skipLocationChange", booleanAttribute],
replaceUrl: [2, "replaceUrl", "replaceUrl", booleanAttribute],
routerLink: "routerLink"
},
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterLink, [{
type: Directive,
args: [{
selector: "[routerLink]",
host: {
"[attr.href]": "reactiveHref()"
}
}]
}], () => [{
type: Router
}, {
type: ActivatedRoute
}, {
type: void 0,
decorators: [{
type: Attribute,
args: ["tabindex"]
}]
}, {
type: Renderer2
}, {
type: ElementRef
}, {
type: LocationStrategy
}], {
target: [{
type: HostBinding,
args: ["attr.target"]
}, {
type: Input
}],
queryParams: [{
type: Input
}],
fragment: [{
type: Input
}],
queryParamsHandling: [{
type: Input
}],
state: [{
type: Input
}],
info: [{
type: Input
}],
relativeTo: [{
type: Input
}],
preserveFragment: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
skipLocationChange: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
replaceUrl: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
routerLink: [{
type: Input
}],
onClick: [{
type: HostListener,
args: ["click", ["$event.button", "$event.ctrlKey", "$event.shiftKey", "$event.altKey", "$event.metaKey"]]
}]
});
})();
var RouterLinkActive = class _RouterLinkActive {
router;
element;
renderer;
cdr;
link;
links;
classes = [];
routerEventsSubscription;
linkInputChangesSubscription;
_isActive = false;
get isActive() {
return this._isActive;
}
/**
* Options to configure how to determine if the router link is active.
*
* These options are passed to the `Router.isActive()` function.
*
* @see {@link Router#isActive}
*/
routerLinkActiveOptions = {
exact: false
};
/**
* Aria-current attribute to apply when the router link is active.
*
* Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}
*/
ariaCurrentWhenActive;
/**
*
* You can use the output `isActiveChange` to get notified each time the link becomes
* active or inactive.
*
* Emits:
* true -> Route is active
* false -> Route is inactive
*
* ```html
* <a
* routerLink="/user/bob"
* routerLinkActive="active-link"
* (isActiveChange)="this.onRouterLinkActive($event)">Bob</a>
* ```
*/
isActiveChange = new EventEmitter();
constructor(router, element, renderer, cdr, link) {
this.router = router;
this.element = element;
this.renderer = renderer;
this.cdr = cdr;
this.link = link;
this.routerEventsSubscription = router.events.subscribe((s) => {
if (s instanceof NavigationEnd) {
this.update();
}
});
}
/** @docs-private */
ngAfterContentInit() {
of(this.links.changes, of(null)).pipe(mergeAll()).subscribe((_) => {
this.update();
this.subscribeToEachLinkOnChanges();
});
}
subscribeToEachLinkOnChanges() {
this.linkInputChangesSubscription?.unsubscribe();
const allLinkChanges = [...this.links.toArray(), this.link].filter((link) => !!link).map((link) => link.onChanges);
this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe((link) => {
if (this._isActive !== this.isLinkActive(this.router)(link)) {
this.update();
}
});
}
set routerLinkActive(data) {
const classes = Array.isArray(data) ? data : data.split(" ");
this.classes = classes.filter((c) => !!c);
}
/** @docs-private */
ngOnChanges(changes) {
this.update();
}
/** @docs-private */
ngOnDestroy() {
this.routerEventsSubscription.unsubscribe();
this.linkInputChangesSubscription?.unsubscribe();
}
update() {
if (!this.links || !this.router.navigated) return;
queueMicrotask(() => {
const hasActiveLinks = this.hasActiveLinks();
this.classes.forEach((c) => {
if (hasActiveLinks) {
this.renderer.addClass(this.element.nativeElement, c);
} else {
this.renderer.removeClass(this.element.nativeElement, c);
}
});
if (hasActiveLinks && this.ariaCurrentWhenActive !== void 0) {
this.renderer.setAttribute(this.element.nativeElement, "aria-current", this.ariaCurrentWhenActive.toString());
} else {
this.renderer.removeAttribute(this.element.nativeElement, "aria-current");
}
if (this._isActive !== hasActiveLinks) {
this._isActive = hasActiveLinks;
this.cdr.markForCheck();
this.isActiveChange.emit(hasActiveLinks);
}
});
}
isLinkActive(router) {
const options = isActiveMatchOptions(this.routerLinkActiveOptions) ? this.routerLinkActiveOptions : (
// While the types should disallow `undefined` here, it's possible without strict inputs
this.routerLinkActiveOptions.exact || false
);
return (link) => {
const urlTree = link.urlTree;
return urlTree ? router.isActive(urlTree, options) : false;
};
}
hasActiveLinks() {
const isActiveCheckFn = this.isLinkActive(this.router);
return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
}
static \u0275fac = function RouterLinkActive_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterLinkActive)(\u0275\u0275directiveInject(Router), \u0275\u0275directiveInject(ElementRef), \u0275\u0275directiveInject(Renderer2), \u0275\u0275directiveInject(ChangeDetectorRef), \u0275\u0275directiveInject(RouterLink, 8));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _RouterLinkActive,
selectors: [["", "routerLinkActive", ""]],
contentQueries: function RouterLinkActive_ContentQueries(rf, ctx, dirIndex) {
if (rf & 1) {
\u0275\u0275contentQuery(dirIndex, RouterLink, 5);
}
if (rf & 2) {
let _t;
\u0275\u0275queryRefresh(_t = \u0275\u0275loadQuery()) && (ctx.links = _t);
}
},
inputs: {
routerLinkActiveOptions: "routerLinkActiveOptions",
ariaCurrentWhenActive: "ariaCurrentWhenActive",
routerLinkActive: "routerLinkActive"
},
outputs: {
isActiveChange: "isActiveChange"
},
exportAs: ["routerLinkActive"],
features: [\u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterLinkActive, [{
type: Directive,
args: [{
selector: "[routerLinkActive]",
exportAs: "routerLinkActive"
}]
}], () => [{
type: Router
}, {
type: ElementRef
}, {
type: Renderer2
}, {
type: ChangeDetectorRef
}, {
type: RouterLink,
decorators: [{
type: Optional
}]
}], {
links: [{
type: ContentChildren,
args: [RouterLink, {
descendants: true
}]
}],
routerLinkActiveOptions: [{
type: Input
}],
ariaCurrentWhenActive: [{
type: Input
}],
isActiveChange: [{
type: Output
}],
routerLinkActive: [{
type: Input
}]
});
})();
function isActiveMatchOptions(options) {
return !!options.paths;
}
var PreloadingStrategy = class {
};
var PreloadAllModules = class _PreloadAllModules {
preload(route, fn) {
return fn().pipe(catchError(() => of(null)));
}
static \u0275fac = function PreloadAllModules_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PreloadAllModules)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _PreloadAllModules,
factory: _PreloadAllModules.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PreloadAllModules, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
var NoPreloading = class _NoPreloading {
preload(route, fn) {
return of(null);
}
static \u0275fac = function NoPreloading_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NoPreloading)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NoPreloading,
factory: _NoPreloading.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NoPreloading, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
var RouterPreloader = class _RouterPreloader {
router;
injector;
preloadingStrategy;
loader;
subscription;
constructor(router, injector, preloadingStrategy, loader) {
this.router = router;
this.injector = injector;
this.preloadingStrategy = preloadingStrategy;
this.loader = loader;
}
setUpPreloading() {
this.subscription = this.router.events.pipe(filter((e) => e instanceof NavigationEnd), concatMap(() => this.preload())).subscribe(() => {
});
}
preload() {
return this.processRoutes(this.injector, this.router.config);
}
/** @docs-private */
ngOnDestroy() {
if (this.subscription) {
this.subscription.unsubscribe();
}
}
processRoutes(injector, routes) {
const res = [];
for (const route of routes) {
if (route.providers && !route._injector) {
route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);
}
const injectorForCurrentRoute = route._injector ?? injector;
const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;
if (route.loadChildren && !route._loadedRoutes && route.canLoad === void 0 || route.loadComponent && !route._loadedComponent) {
res.push(this.preloadConfig(injectorForCurrentRoute, route));
}
if (route.children || route._loadedRoutes) {
res.push(this.processRoutes(injectorForChildren, route.children ?? route._loadedRoutes));
}
}
return from(res).pipe(mergeAll());
}
preloadConfig(injector, route) {
return this.preloadingStrategy.preload(route, () => {
let loadedChildren$;
if (route.loadChildren && route.canLoad === void 0) {
loadedChildren$ = this.loader.loadChildren(injector, route);
} else {
loadedChildren$ = of(null);
}
const recursiveLoadChildren$ = loadedChildren$.pipe(mergeMap((config) => {
if (config === null) {
return of(void 0);
}
route._loadedRoutes = config.routes;
route._loadedInjector = config.injector;
return this.processRoutes(config.injector ?? injector, config.routes);
}));
if (route.loadComponent && !route._loadedComponent) {
const loadComponent$ = this.loader.loadComponent(injector, route);
return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());
} else {
return recursiveLoadChildren$;
}
});
}
static \u0275fac = function RouterPreloader_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterPreloader)(\u0275\u0275inject(Router), \u0275\u0275inject(EnvironmentInjector), \u0275\u0275inject(PreloadingStrategy), \u0275\u0275inject(RouterConfigLoader));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _RouterPreloader,
factory: _RouterPreloader.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterPreloader, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: Router
}, {
type: EnvironmentInjector
}, {
type: PreloadingStrategy
}, {
type: RouterConfigLoader
}], null);
})();
var ROUTER_SCROLLER = new InjectionToken("");
var RouterScroller = class _RouterScroller {
urlSerializer;
transitions;
viewportScroller;
zone;
options;
routerEventsSubscription;
scrollEventsSubscription;
lastId = 0;
lastSource = IMPERATIVE_NAVIGATION;
restoredId = 0;
store = {};
/** @docs-private */
constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
this.urlSerializer = urlSerializer;
this.transitions = transitions;
this.viewportScroller = viewportScroller;
this.zone = zone;
this.options = options;
options.scrollPositionRestoration ||= "disabled";
options.anchorScrolling ||= "disabled";
}
init() {
if (this.options.scrollPositionRestoration !== "disabled") {
this.viewportScroller.setHistoryScrollRestoration("manual");
}
this.routerEventsSubscription = this.createScrollEvents();
this.scrollEventsSubscription = this.consumeScrollEvents();
}
createScrollEvents() {
return this.transitions.events.subscribe((e) => {
if (e instanceof NavigationStart) {
this.store[this.lastId] = this.viewportScroller.getScrollPosition();
this.lastSource = e.navigationTrigger;
this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;
} else if (e instanceof NavigationEnd) {
this.lastId = e.id;
this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
} else if (e instanceof NavigationSkipped && e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {
this.lastSource = void 0;
this.restoredId = 0;
this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);
}
});
}
consumeScrollEvents() {
return this.transitions.events.subscribe((e) => {
if (!(e instanceof Scroll)) return;
const instantScroll = {
behavior: "instant"
};
if (e.position) {
if (this.options.scrollPositionRestoration === "top") {
this.viewportScroller.scrollToPosition([0, 0], instantScroll);
} else if (this.options.scrollPositionRestoration === "enabled") {
this.viewportScroller.scrollToPosition(e.position, instantScroll);
}
} else {
if (e.anchor && this.options.anchorScrolling === "enabled") {
this.viewportScroller.scrollToAnchor(e.anchor);
} else if (this.options.scrollPositionRestoration !== "disabled") {
this.viewportScroller.scrollToPosition([0, 0]);
}
}
});
}
scheduleScrollEvent(routerEvent, anchor) {
this.zone.runOutsideAngular(() => __async(this, null, function* () {
yield new Promise((resolve) => {
setTimeout(resolve);
if (typeof requestAnimationFrame !== "undefined") {
requestAnimationFrame(resolve);
}
});
this.zone.run(() => {
this.transitions.events.next(new Scroll(routerEvent, this.lastSource === "popstate" ? this.store[this.restoredId] : null, anchor));
});
}));
}
/** @docs-private */
ngOnDestroy() {
this.routerEventsSubscription?.unsubscribe();
this.scrollEventsSubscription?.unsubscribe();
}
static \u0275fac = function RouterScroller_Factory(__ngFactoryType__) {
\u0275\u0275invalidFactory();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _RouterScroller,
factory: _RouterScroller.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterScroller, [{
type: Injectable
}], () => [{
type: UrlSerializer
}, {
type: NavigationTransitions
}, {
type: ViewportScroller
}, {
type: NgZone
}, {
type: void 0
}], null);
})();
function getLoadedRoutes(route) {
return route._loadedRoutes;
}
function getRouterInstance(injector) {
return injector.get(Router, null, {
optional: true
});
}
function navigateByUrl(router, url) {
if (!(router instanceof Router)) {
throw new Error("The provided router is not an Angular Router.");
}
return router.navigateByUrl(url);
}
function provideRouter(routes, ...features) {
if (typeof ngDevMode === "undefined" || ngDevMode) {
publishExternalGlobalUtil("\u0275getLoadedRoutes", getLoadedRoutes);
publishExternalGlobalUtil("\u0275getRouterInstance", getRouterInstance);
publishExternalGlobalUtil("\u0275navigateByUrl", navigateByUrl);
}
return makeEnvironmentProviders([{
provide: ROUTES,
multi: true,
useValue: routes
}, typeof ngDevMode === "undefined" || ngDevMode ? {
provide: ROUTER_IS_PROVIDED,
useValue: true
} : [], {
provide: ActivatedRoute,
useFactory: rootRoute,
deps: [Router]
}, {
provide: APP_BOOTSTRAP_LISTENER,
multi: true,
useFactory: getBootstrapListener
}, features.map((feature) => feature.\u0275providers)]);
}
function rootRoute(router) {
return router.routerState.root;
}
function routerFeature(kind, providers) {
return {
\u0275kind: kind,
\u0275providers: providers
};
}
var ROUTER_IS_PROVIDED = new InjectionToken("", {
providedIn: "root",
factory: () => false
});
function getBootstrapListener() {
const injector = inject(Injector);
return (bootstrappedComponentRef) => {
const ref = injector.get(ApplicationRef);
if (bootstrappedComponentRef !== ref.components[0]) {
return;
}
const router = injector.get(Router);
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
if (injector.get(INITIAL_NAVIGATION) === 1) {
router.initialNavigation();
}
injector.get(ROUTER_PRELOADER, null, {
optional: true
})?.setUpPreloading();
injector.get(ROUTER_SCROLLER, null, {
optional: true
})?.init();
router.resetRootComponentType(ref.componentTypes[0]);
if (!bootstrapDone.closed) {
bootstrapDone.next();
bootstrapDone.complete();
bootstrapDone.unsubscribe();
}
};
}
var BOOTSTRAP_DONE = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "bootstrap done indicator" : "", {
factory: () => {
return new Subject();
}
});
var INITIAL_NAVIGATION = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "initial navigation" : "", {
providedIn: "root",
factory: () => 1
/* InitialNavigation.EnabledNonBlocking */
});
function withEnabledBlockingInitialNavigation() {
const providers = [{
provide: IS_ENABLED_BLOCKING_INITIAL_NAVIGATION,
useValue: true
}, {
provide: INITIAL_NAVIGATION,
useValue: 0
/* InitialNavigation.EnabledBlocking */
}, provideAppInitializer(() => {
const injector = inject(Injector);
const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
return locationInitialized.then(() => {
return new Promise((resolve) => {
const router = injector.get(Router);
const bootstrapDone = injector.get(BOOTSTRAP_DONE);
afterNextNavigation(router, () => {
resolve(true);
});
injector.get(NavigationTransitions).afterPreactivation = () => {
resolve(true);
return bootstrapDone.closed ? of(void 0) : bootstrapDone;
};
router.initialNavigation();
});
});
})];
return routerFeature(2, providers);
}
function withDisabledInitialNavigation() {
const providers = [provideAppInitializer(() => {
inject(Router).setUpLocationChangeListener();
}), {
provide: INITIAL_NAVIGATION,
useValue: 2
/* InitialNavigation.Disabled */
}];
return routerFeature(3, providers);
}
function withDebugTracing() {
let providers = [];
if (typeof ngDevMode === "undefined" || ngDevMode) {
providers = [{
provide: ENVIRONMENT_INITIALIZER,
multi: true,
useFactory: () => {
const router = inject(Router);
return () => router.events.subscribe((e) => {
console.group?.(`Router Event: ${e.constructor.name}`);
console.log(stringifyEvent(e));
console.log(e);
console.groupEnd?.();
});
}
}];
} else {
providers = [];
}
return routerFeature(1, providers);
}
var ROUTER_PRELOADER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router preloader" : "");
function withPreloading(preloadingStrategy) {
const providers = [{
provide: ROUTER_PRELOADER,
useExisting: RouterPreloader
}, {
provide: PreloadingStrategy,
useExisting: preloadingStrategy
}];
return routerFeature(0, providers);
}
function withComponentInputBinding() {
const providers = [RoutedComponentInputBinder, {
provide: INPUT_BINDER,
useExisting: RoutedComponentInputBinder
}];
return routerFeature(8, providers);
}
function withViewTransitions(options) {
performanceMarkFeature("NgRouterViewTransitions");
const providers = [{
provide: CREATE_VIEW_TRANSITION,
useValue: createViewTransition
}, {
provide: VIEW_TRANSITION_OPTIONS,
useValue: __spreadValues({
skipNextTransition: !!options?.skipInitialTransition
}, options)
}];
return routerFeature(9, providers);
}
var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent];
var ROUTER_FORROOT_GUARD = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "router duplicate forRoot guard" : "");
var ROUTER_PROVIDERS = [
Location,
{
provide: UrlSerializer,
useClass: DefaultUrlSerializer
},
Router,
ChildrenOutletContexts,
{
provide: ActivatedRoute,
useFactory: rootRoute,
deps: [Router]
},
RouterConfigLoader,
// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can
// be removed when `provideRoutes` is removed.
typeof ngDevMode === "undefined" || ngDevMode ? {
provide: ROUTER_IS_PROVIDED,
useValue: true
} : []
];
var RouterModule = class _RouterModule {
constructor() {
if (typeof ngDevMode === "undefined" || ngDevMode) {
inject(ROUTER_FORROOT_GUARD, {
optional: true
});
}
}
/**
* Creates and configures a module with all the router providers and directives.
* Optionally sets up an application listener to perform an initial navigation.
*
* When registering the NgModule at the root, import as follows:
*
* ```ts
* @NgModule({
* imports: [RouterModule.forRoot(ROUTES)]
* })
* class MyNgModule {}
* ```
*
* @param routes An array of `Route` objects that define the navigation paths for the application.
* @param config An `ExtraOptions` configuration object that controls how navigation is performed.
* @return The new `NgModule`.
*
*/
static forRoot(routes, config) {
return {
ngModule: _RouterModule,
providers: [ROUTER_PROVIDERS, typeof ngDevMode === "undefined" || ngDevMode ? config?.enableTracing ? withDebugTracing().\u0275providers : [] : [], {
provide: ROUTES,
multi: true,
useValue: routes
}, typeof ngDevMode === "undefined" || ngDevMode ? {
provide: ROUTER_FORROOT_GUARD,
useFactory: provideForRootGuard,
deps: [[Router, new Optional(), new SkipSelf()]]
} : [], config?.errorHandler ? {
provide: NAVIGATION_ERROR_HANDLER,
useValue: config.errorHandler
} : [], {
provide: ROUTER_CONFIGURATION,
useValue: config ? config : {}
}, config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(), provideRouterScroller(), config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).\u0275providers : [], config?.initialNavigation ? provideInitialNavigation(config) : [], config?.bindToComponentInputs ? withComponentInputBinding().\u0275providers : [], config?.enableViewTransitions ? withViewTransitions().\u0275providers : [], provideRouterInitializer()]
};
}
/**
* Creates a module with all the router directives and a provider registering routes,
* without creating a new Router service.
* When registering for submodules and lazy-loaded submodules, create the NgModule as follows:
*
* ```ts
* @NgModule({
* imports: [RouterModule.forChild(ROUTES)]
* })
* class MyNgModule {}
* ```
*
* @param routes An array of `Route` objects that define the navigation paths for the submodule.
* @return The new NgModule.
*
*/
static forChild(routes) {
return {
ngModule: _RouterModule,
providers: [{
provide: ROUTES,
multi: true,
useValue: routes
}]
};
}
static \u0275fac = function RouterModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _RouterModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _RouterModule,
imports: [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent],
exports: [RouterOutlet, RouterLink, RouterLinkActive, \u0275EmptyOutletComponent]
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(RouterModule, [{
type: NgModule,
args: [{
imports: ROUTER_DIRECTIVES,
exports: ROUTER_DIRECTIVES
}]
}], () => [], null);
})();
function provideRouterScroller() {
return {
provide: ROUTER_SCROLLER,
useFactory: () => {
const viewportScroller = inject(ViewportScroller);
const zone = inject(NgZone);
const config = inject(ROUTER_CONFIGURATION);
const transitions = inject(NavigationTransitions);
const urlSerializer = inject(UrlSerializer);
if (config.scrollOffset) {
viewportScroller.setOffset(config.scrollOffset);
}
return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
}
};
}
function provideHashLocationStrategy() {
return {
provide: LocationStrategy,
useClass: HashLocationStrategy
};
}
function providePathLocationStrategy() {
return {
provide: LocationStrategy,
useClass: PathLocationStrategy
};
}
function provideForRootGuard(router) {
if (router) {
throw new RuntimeError(4007, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector. Lazy loaded modules should use RouterModule.forChild() instead.`);
}
return "guarded";
}
function provideInitialNavigation(config) {
return [config.initialNavigation === "disabled" ? withDisabledInitialNavigation().\u0275providers : [], config.initialNavigation === "enabledBlocking" ? withEnabledBlockingInitialNavigation().\u0275providers : []];
}
var ROUTER_INITIALIZER = new InjectionToken(typeof ngDevMode === "undefined" || ngDevMode ? "Router Initializer" : "");
function provideRouterInitializer() {
return [
// ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
// have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
{
provide: ROUTER_INITIALIZER,
useFactory: getBootstrapListener
},
{
provide: APP_BOOTSTRAP_LISTENER,
multi: true,
useExisting: ROUTER_INITIALIZER
}
];
}
// src/environments/environment.ts
var environment = {
production: false,
apiUrl: "https://fluffy-space-goldfish-7gqj7v4jwg9frw7-5201.app.github.dev"
};
// src/app/services/api.service.ts
var ApiService = class _ApiService {
baseUrl = environment.apiUrl;
http = inject(HttpClient);
handleError(error2) {
const apiError = error2.error ?? {
statusCode: error2.status,
errors: { general: [error2.message] }
};
return throwError(() => apiError);
}
get(path, params) {
let httpParams = new HttpParams();
if (params) {
Object.keys(params).forEach((key) => {
if (params[key] !== void 0 && params[key] !== null) {
httpParams = httpParams.set(key, params[key]);
}
});
}
return this.http.get(`${this.baseUrl}${path}`, { params: httpParams }).pipe(catchError((e) => this.handleError(e)));
}
post(path, body) {
return this.http.post(`${this.baseUrl}${path}`, body).pipe(catchError((e) => this.handleError(e)));
}
put(path, body) {
return this.http.put(`${this.baseUrl}${path}`, body).pipe(catchError((e) => this.handleError(e)));
}
patch(path, body) {
return this.http.patch(`${this.baseUrl}${path}`, body ?? {}).pipe(catchError((e) => this.handleError(e)));
}
delete(path) {
return this.http.delete(`${this.baseUrl}${path}`).pipe(catchError((e) => this.handleError(e)));
}
static \u0275fac = function ApiService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _ApiService)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ApiService, factory: _ApiService.\u0275fac, providedIn: "root" });
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ApiService, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], null, null);
})();
// src/app/services/auth.service.ts
var STORAGE_KEY = "metacourse_user";
var AuthService = class _AuthService {
api = inject(ApiService);
currentUser = signal(null, ...ngDevMode ? [{ debugName: "currentUser" }] : []);
isLoggedIn = computed(() => this.currentUser() !== null, ...ngDevMode ? [{ debugName: "isLoggedIn" }] : []);
constructor() {
this.loadFromStorage();
}
login(email, password) {
return this.api.post("/api/users/login", { email, password }).pipe(tap((user) => {
this.currentUser.set(user);
localStorage.setItem(STORAGE_KEY, JSON.stringify(user));
}));
}
register(name2, email, password) {
return this.api.post("/api/users/register", { name: name2, email, password });
}
logout() {
this.currentUser.set(null);
localStorage.removeItem(STORAGE_KEY);
}
loadFromStorage() {
try {
const stored = localStorage.getItem(STORAGE_KEY);
if (stored) {
const user = JSON.parse(stored);
this.currentUser.set(user);
}
} catch {
localStorage.removeItem(STORAGE_KEY);
}
}
static \u0275fac = function AuthService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _AuthService)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _AuthService, factory: _AuthService.\u0275fac, providedIn: "root" });
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AuthService, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
// node_modules/@angular/core/fesm2022/rxjs-interop.mjs
function takeUntilDestroyed(destroyRef) {
if (!destroyRef) {
ngDevMode && assertInInjectionContext(takeUntilDestroyed);
destroyRef = inject(DestroyRef);
}
const destroyed$ = new Observable((subscriber) => {
if (destroyRef.destroyed) {
subscriber.next();
return;
}
const unregisterFn = destroyRef.onDestroy(subscriber.next.bind(subscriber));
return unregisterFn;
});
return (source) => {
return source.pipe(takeUntil(destroyed$));
};
}
// node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
// node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
// node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
// node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: true,
configurable: true,
writable: true
}) : e[r] = t, e;
}
// node_modules/@ant-design/fast-color/es/FastColor.js
var round2 = Math.round;
function splitColorStr(str, parseNum) {
const match2 = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
const numList = match2.map((item) => parseFloat(item));
for (let i = 0; i < 3; i += 1) {
numList[i] = parseNum(numList[i] || 0, match2[i] || "", i);
}
if (match2[3]) {
numList[3] = match2[3].includes("%") ? numList[3] / 100 : numList[3];
} else {
numList[3] = 1;
}
return numList;
}
var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
function limitRange(value, max) {
const mergedMax = max || 255;
if (value > mergedMax) {
return mergedMax;
}
if (value < 0) {
return 0;
}
return value;
}
var FastColor = class _FastColor {
constructor(input2) {
_defineProperty(this, "isValid", true);
_defineProperty(this, "r", 0);
_defineProperty(this, "g", 0);
_defineProperty(this, "b", 0);
_defineProperty(this, "a", 1);
_defineProperty(this, "_h", void 0);
_defineProperty(this, "_s", void 0);
_defineProperty(this, "_l", void 0);
_defineProperty(this, "_v", void 0);
_defineProperty(this, "_max", void 0);
_defineProperty(this, "_min", void 0);
_defineProperty(this, "_brightness", void 0);
function matchFormat(str) {
return str[0] in input2 && str[1] in input2 && str[2] in input2;
}
if (!input2) {
} else if (typeof input2 === "string") {
let matchPrefix = function(prefix) {
return trimStr.startsWith(prefix);
};
const trimStr = input2.trim();
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
this.fromHexString(trimStr);
} else if (matchPrefix("rgb")) {
this.fromRgbString(trimStr);
} else if (matchPrefix("hsl")) {
this.fromHslString(trimStr);
} else if (matchPrefix("hsv") || matchPrefix("hsb")) {
this.fromHsvString(trimStr);
}
} else if (input2 instanceof _FastColor) {
this.r = input2.r;
this.g = input2.g;
this.b = input2.b;
this.a = input2.a;
this._h = input2._h;
this._s = input2._s;
this._l = input2._l;
this._v = input2._v;
} else if (matchFormat("rgb")) {
this.r = limitRange(input2.r);
this.g = limitRange(input2.g);
this.b = limitRange(input2.b);
this.a = typeof input2.a === "number" ? limitRange(input2.a, 1) : 1;
} else if (matchFormat("hsl")) {
this.fromHsl(input2);
} else if (matchFormat("hsv")) {
this.fromHsv(input2);
} else {
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input2));
}
}
// ======================= Setter =======================
setR(value) {
return this._sc("r", value);
}
setG(value) {
return this._sc("g", value);
}
setB(value) {
return this._sc("b", value);
}
setA(value) {
return this._sc("a", value, 1);
}
setHue(value) {
const hsv = this.toHsv();
hsv.h = value;
return this._c(hsv);
}
// ======================= Getter =======================
/**
* Returns the perceived luminance of a color, from 0-1.
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
*/
getLuminance() {
function adjustGamma(raw) {
const val = raw / 255;
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
}
const R = adjustGamma(this.r);
const G = adjustGamma(this.g);
const B = adjustGamma(this.b);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
getHue() {
if (typeof this._h === "undefined") {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._h = 0;
} else {
this._h = round2(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
}
}
return this._h;
}
getSaturation() {
if (typeof this._s === "undefined") {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._s = 0;
} else {
this._s = delta / this.getMax();
}
}
return this._s;
}
getLightness() {
if (typeof this._l === "undefined") {
this._l = (this.getMax() + this.getMin()) / 510;
}
return this._l;
}
getValue() {
if (typeof this._v === "undefined") {
this._v = this.getMax() / 255;
}
return this._v;
}
/**
* Returns the perceived brightness of the color, from 0-255.
* Note: this is not the b of HSB
* @see http://www.w3.org/TR/AERT#color-contrast
*/
getBrightness() {
if (typeof this._brightness === "undefined") {
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
}
return this._brightness;
}
// ======================== Func ========================
darken(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() - amount / 100;
if (l < 0) {
l = 0;
}
return this._c({
h,
s,
l,
a: this.a
});
}
lighten(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() + amount / 100;
if (l > 1) {
l = 1;
}
return this._c({
h,
s,
l,
a: this.a
});
}
/**
* Mix the current color a given amount with another color, from 0 to 100.
* 0 means no mixing (return current color).
*/
mix(input2, amount = 50) {
const color = this._c(input2);
const p = amount / 100;
const calc = (key) => (color[key] - this[key]) * p + this[key];
const rgba = {
r: round2(calc("r")),
g: round2(calc("g")),
b: round2(calc("b")),
a: round2(calc("a") * 100) / 100
};
return this._c(rgba);
}
/**
* Mix the color with pure white, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return white.
*/
tint(amount = 10) {
return this.mix({
r: 255,
g: 255,
b: 255,
a: 1
}, amount);
}
/**
* Mix the color with pure black, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return black.
*/
shade(amount = 10) {
return this.mix({
r: 0,
g: 0,
b: 0,
a: 1
}, amount);
}
onBackground(background) {
const bg = this._c(background);
const alpha = this.a + bg.a * (1 - this.a);
const calc = (key) => {
return round2((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
};
return this._c({
r: calc("r"),
g: calc("g"),
b: calc("b"),
a: alpha
});
}
// ======================= Status =======================
isDark() {
return this.getBrightness() < 128;
}
isLight() {
return this.getBrightness() >= 128;
}
// ======================== MISC ========================
equals(other) {
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
}
clone() {
return this._c(this);
}
// ======================= Format =======================
toHexString() {
let hex = "#";
const rHex = (this.r || 0).toString(16);
hex += rHex.length === 2 ? rHex : "0" + rHex;
const gHex = (this.g || 0).toString(16);
hex += gHex.length === 2 ? gHex : "0" + gHex;
const bHex = (this.b || 0).toString(16);
hex += bHex.length === 2 ? bHex : "0" + bHex;
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
const aHex = round2(this.a * 255).toString(16);
hex += aHex.length === 2 ? aHex : "0" + aHex;
}
return hex;
}
/** CSS support color pattern */
toHsl() {
return {
h: this.getHue(),
s: this.getSaturation(),
l: this.getLightness(),
a: this.a
};
}
/** CSS support color pattern */
toHslString() {
const h = this.getHue();
const s = round2(this.getSaturation() * 100);
const l = round2(this.getLightness() * 100);
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
}
/** Same as toHsb */
toHsv() {
return {
h: this.getHue(),
s: this.getSaturation(),
v: this.getValue(),
a: this.a
};
}
toRgb() {
return {
r: this.r,
g: this.g,
b: this.b,
a: this.a
};
}
toRgbString() {
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
}
toString() {
return this.toRgbString();
}
// ====================== Privates ======================
/** Return a new FastColor object with one channel changed */
_sc(rgb, value, max) {
const clone = this.clone();
clone[rgb] = limitRange(value, max);
return clone;
}
_c(input2) {
return new this.constructor(input2);
}
getMax() {
if (typeof this._max === "undefined") {
this._max = Math.max(this.r, this.g, this.b);
}
return this._max;
}
getMin() {
if (typeof this._min === "undefined") {
this._min = Math.min(this.r, this.g, this.b);
}
return this._min;
}
fromHexString(trimStr) {
const withoutPrefix = trimStr.replace("#", "");
function connectNum(index1, index2) {
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
}
if (withoutPrefix.length < 6) {
this.r = connectNum(0);
this.g = connectNum(1);
this.b = connectNum(2);
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
} else {
this.r = connectNum(0, 1);
this.g = connectNum(2, 3);
this.b = connectNum(4, 5);
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
}
}
fromHsl({
h,
s,
l,
a
}) {
this._h = h % 360;
this._s = s;
this._l = l;
this.a = typeof a === "number" ? a : 1;
if (s <= 0) {
const rgb = round2(l * 255);
this.r = rgb;
this.g = rgb;
this.b = rgb;
}
let r = 0, g = 0, b = 0;
const huePrime = h / 60;
const chroma = (1 - Math.abs(2 * l - 1)) * s;
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
if (huePrime >= 0 && huePrime < 1) {
r = chroma;
g = secondComponent;
} else if (huePrime >= 1 && huePrime < 2) {
r = secondComponent;
g = chroma;
} else if (huePrime >= 2 && huePrime < 3) {
g = chroma;
b = secondComponent;
} else if (huePrime >= 3 && huePrime < 4) {
g = secondComponent;
b = chroma;
} else if (huePrime >= 4 && huePrime < 5) {
r = secondComponent;
b = chroma;
} else if (huePrime >= 5 && huePrime < 6) {
r = chroma;
b = secondComponent;
}
const lightnessModification = l - chroma / 2;
this.r = round2((r + lightnessModification) * 255);
this.g = round2((g + lightnessModification) * 255);
this.b = round2((b + lightnessModification) * 255);
}
fromHsv({
h,
s,
v,
a
}) {
this._h = h % 360;
this._s = s;
this._v = v;
this.a = typeof a === "number" ? a : 1;
const vv = round2(v * 255);
this.r = vv;
this.g = vv;
this.b = vv;
if (s <= 0) {
return;
}
const hh = h / 60;
const i = Math.floor(hh);
const ff = hh - i;
const p = round2(v * (1 - s) * 255);
const q = round2(v * (1 - s * ff) * 255);
const t = round2(v * (1 - s * (1 - ff)) * 255);
switch (i) {
case 0:
this.g = t;
this.b = p;
break;
case 1:
this.r = q;
this.b = p;
break;
case 2:
this.r = p;
this.b = t;
break;
case 3:
this.r = p;
this.g = q;
break;
case 4:
this.r = t;
this.g = p;
break;
case 5:
default:
this.g = p;
this.b = q;
break;
}
}
fromHsvString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsv({
h: cells[0],
s: cells[1],
v: cells[2],
a: cells[3]
});
}
fromHslString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsl({
h: cells[0],
s: cells[1],
l: cells[2],
a: cells[3]
});
}
fromRgbString(trimStr) {
const cells = splitColorStr(trimStr, (num, txt) => (
// Convert percentage to number. e.g. 50% -> 128
txt.includes("%") ? round2(num / 100 * 255) : num
));
this.r = cells[0];
this.g = cells[1];
this.b = cells[2];
this.a = cells[3];
}
};
// node_modules/@ant-design/colors/es/generate.js
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
index: 7,
amount: 15
}, {
index: 6,
amount: 25
}, {
index: 5,
amount: 30
}, {
index: 5,
amount: 45
}, {
index: 5,
amount: 65
}, {
index: 5,
amount: 85
}, {
index: 4,
amount: 90
}, {
index: 3,
amount: 95
}, {
index: 2,
amount: 97
}, {
index: 1,
amount: 98
}];
function getHue(hsv, i, light) {
var hue;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
} else {
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation(hsv, i, light) {
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
var saturation;
if (light) {
saturation = hsv.s - saturationStep * i;
} else if (i === darkColorCount) {
saturation = hsv.s + saturationStep;
} else {
saturation = hsv.s + saturationStep2 * i;
}
if (saturation > 1) {
saturation = 1;
}
if (light && i === lightColorCount && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Math.round(saturation * 100) / 100;
}
function getValue(hsv, i, light) {
var value;
if (light) {
value = hsv.v + brightnessStep1 * i;
} else {
value = hsv.v - brightnessStep2 * i;
}
value = Math.max(0, Math.min(1, value));
return Math.round(value * 100) / 100;
}
function generate(color) {
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var patterns = [];
var pColor = new FastColor(color);
var hsv = pColor.toHsv();
for (var i = lightColorCount; i > 0; i -= 1) {
var c = new FastColor({
h: getHue(hsv, i, true),
s: getSaturation(hsv, i, true),
v: getValue(hsv, i, true)
});
patterns.push(c);
}
patterns.push(pColor);
for (var _i = 1; _i <= darkColorCount; _i += 1) {
var _c = new FastColor({
h: getHue(hsv, _i),
s: getSaturation(hsv, _i),
v: getValue(hsv, _i)
});
patterns.push(_c);
}
if (opts.theme === "dark") {
return darkColorMap.map(function(_ref) {
var index = _ref.index, amount = _ref.amount;
return new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString();
});
}
return patterns.map(function(c2) {
return c2.toHexString();
});
}
// node_modules/@ant-design/colors/es/presets.js
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
red.primary = red[5];
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
volcano.primary = volcano[5];
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
orange.primary = orange[5];
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
gold.primary = gold[5];
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
yellow.primary = yellow[5];
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
lime.primary = lime[5];
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
green.primary = green[5];
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
cyan.primary = cyan[5];
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
blue.primary = blue[5];
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
geekblue.primary = geekblue[5];
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
purple.primary = purple[5];
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
magenta.primary = magenta[5];
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
grey.primary = grey[5];
var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
redDark.primary = redDark[5];
var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
volcanoDark.primary = volcanoDark[5];
var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
orangeDark.primary = orangeDark[5];
var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
goldDark.primary = goldDark[5];
var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
yellowDark.primary = yellowDark[5];
var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
limeDark.primary = limeDark[5];
var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
greenDark.primary = greenDark[5];
var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
cyanDark.primary = cyanDark[5];
var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
blueDark.primary = blueDark[5];
var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
geekblueDark.primary = geekblueDark[5];
var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
purpleDark.primary = purpleDark[5];
var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
magentaDark.primary = magentaDark[5];
var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
greyDark.primary = greyDark[5];
// node_modules/@ant-design/icons-angular/fesm2022/ant-design-icons-angular.mjs
var ANT_ICON_ANGULAR_CONSOLE_PREFIX = "[@ant-design/icons-angular]:";
function error(message) {
console.error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX} ${message}.`);
}
function warn(message) {
if (isDevMode()) {
console.warn(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX} ${message}.`);
}
}
function getSecondaryColor(primaryColor) {
return generate(primaryColor)[0];
}
function withSuffix(name2, theme) {
switch (theme) {
case "fill":
return `${name2}-fill`;
case "outline":
return `${name2}-o`;
case "twotone":
return `${name2}-twotone`;
case void 0:
return name2;
default:
throw new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}Theme "${theme}" is not a recognized theme!`);
}
}
function withSuffixAndColor(name2, theme, pri, sec) {
return `${withSuffix(name2, theme)}-${pri}-${sec}`;
}
function mapAbbrToTheme(abbr) {
return abbr === "o" ? "outline" : abbr;
}
function alreadyHasAThemeSuffix(name2) {
return name2.endsWith("-fill") || name2.endsWith("-o") || name2.endsWith("-twotone");
}
function isIconDefinition(target) {
return typeof target === "object" && typeof target.name === "string" && (typeof target.theme === "string" || target.theme === void 0) && typeof target.icon === "string";
}
function getIconDefinitionFromAbbr(str) {
const arr = str.split("-");
const theme = mapAbbrToTheme(arr.splice(arr.length - 1, 1)[0]);
const name2 = arr.join("-");
return {
name: name2,
theme,
icon: ""
};
}
function cloneSVG(svg) {
return svg.cloneNode(true);
}
function replaceFillColor(raw) {
return raw.replace(/['"]#333['"]/g, '"primaryColor"').replace(/['"]#E6E6E6['"]/g, '"secondaryColor"').replace(/['"]#D9D9D9['"]/g, '"secondaryColor"').replace(/['"]#D8D8D8['"]/g, '"secondaryColor"');
}
function getNameAndNamespace(type) {
const split2 = type.split(":");
switch (split2.length) {
case 1:
return [type, ""];
case 2:
return [split2[1], split2[0]];
default:
throw new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}The icon type ${type} is not valid!`);
}
}
function hasNamespace(type) {
return getNameAndNamespace(type)[1] !== "";
}
function NameSpaceIsNotSpecifyError() {
return new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}Type should have a namespace. Try "namespace:${name}".`);
}
function IconNotFoundError(icon) {
return new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}the icon ${icon} does not exist or is not registered.`);
}
function HttpModuleNotImport() {
error(`you need to import "HttpClientModule" to use dynamic importing.`);
return null;
}
function UrlNotSafeError(url) {
return new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}The url "${url}" is unsafe.`);
}
function SVGTagNotFoundError() {
return new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}<svg> tag not found.`);
}
function DynamicLoadingTimeoutError() {
return new Error(`${ANT_ICON_ANGULAR_CONSOLE_PREFIX}Importing timeout error.`);
}
var JSONP_HANDLER_NAME = "__ant_icon_load";
var ANT_ICONS = new InjectionToken("ant_icons");
var _IconService = class _IconService {
set twoToneColor({
primaryColor,
secondaryColor
}) {
this._twoToneColorPalette.primaryColor = primaryColor;
this._twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
}
get twoToneColor() {
return __spreadValues({}, this._twoToneColorPalette);
}
/**
* Disable dynamic loading (support static loading only).
*/
get _disableDynamicLoading() {
return false;
}
constructor(_antIcons) {
this._antIcons = _antIcons;
this.defaultTheme = "outline";
this._svgDefinitions = /* @__PURE__ */ new Map();
this._svgRenderedDefinitions = /* @__PURE__ */ new Map();
this._inProgressFetches = /* @__PURE__ */ new Map();
this._assetsUrlRoot = "";
this._twoToneColorPalette = {
primaryColor: "#333333",
secondaryColor: "#E6E6E6"
};
this._enableJsonpLoading = false;
this._jsonpIconLoad$ = new Subject();
this._rendererFactory = inject(RendererFactory2);
this._handler = inject(HttpBackend, {
optional: true
});
this._document = inject(DOCUMENT);
this.sanitizer = inject(DomSanitizer);
this._renderer = this._rendererFactory.createRenderer(null, null);
if (this._handler) {
this._http = new HttpClient(this._handler);
}
if (this._antIcons) {
this.addIcon(...this._antIcons);
}
}
/**
* Call this method to switch to jsonp like loading.
*/
useJsonpLoading() {
if (!this._enableJsonpLoading) {
this._enableJsonpLoading = true;
window[JSONP_HANDLER_NAME] = (icon) => {
this._jsonpIconLoad$.next(icon);
};
} else {
warn("You are already using jsonp loading.");
}
}
/**
* Change the prefix of the inline svg resources, so they could be deployed elsewhere, like CDN.
* @param prefix
*/
changeAssetsSource(prefix) {
this._assetsUrlRoot = prefix.endsWith("/") ? prefix : prefix + "/";
}
/**
* Add icons provided by ant design.
* @param icons
*/
addIcon(...icons) {
icons.forEach((icon) => {
this._svgDefinitions.set(withSuffix(icon.name, icon.theme), icon);
});
}
/**
* Register an icon. Namespace is required.
* @param type
* @param literal
*/
addIconLiteral(type, literal) {
const [_, namespace] = getNameAndNamespace(type);
if (!namespace) {
throw NameSpaceIsNotSpecifyError();
}
this.addIcon({
name: type,
icon: literal
});
}
/**
* Remove all cache.
*/
clear() {
this._svgDefinitions.clear();
this._svgRenderedDefinitions.clear();
}
/**
* Get a rendered `SVGElement`.
* @param icon
* @param twoToneColor
*/
getRenderedContent(icon, twoToneColor) {
const definition = isIconDefinition(icon) ? icon : this._svgDefinitions.get(icon) || null;
if (!definition && this._disableDynamicLoading) {
throw IconNotFoundError(icon);
}
const $iconDefinition = definition ? of(definition) : this._loadIconDynamically(icon);
return $iconDefinition.pipe(map((i) => {
if (!i) {
throw IconNotFoundError(icon);
}
return this._loadSVGFromCacheOrCreateNew(i, twoToneColor);
}));
}
getCachedIcons() {
return this._svgDefinitions;
}
/**
* Get raw svg and assemble a `IconDefinition` object.
* @param type
*/
_loadIconDynamically(type) {
if (!this._http && !this._enableJsonpLoading) {
return of(HttpModuleNotImport());
}
let inProgress = this._inProgressFetches.get(type);
if (!inProgress) {
const [name2, namespace] = getNameAndNamespace(type);
const icon = namespace ? {
name: type,
icon: ""
} : getIconDefinitionFromAbbr(name2);
const suffix = this._enableJsonpLoading ? ".js" : ".svg";
const url = (namespace ? `${this._assetsUrlRoot}assets/${namespace}/${name2}` : `${this._assetsUrlRoot}assets/${icon.theme}/${icon.name}`) + suffix;
const safeUrl = this.sanitizer.sanitize(SecurityContext.URL, url);
if (!safeUrl) {
throw UrlNotSafeError(url);
}
const source = !this._enableJsonpLoading ? this._http.get(safeUrl, {
responseType: "text"
}).pipe(map((literal) => __spreadProps(__spreadValues({}, icon), {
icon: literal
}))) : this._loadIconDynamicallyWithJsonp(icon, safeUrl);
inProgress = source.pipe(tap((definition) => this.addIcon(definition)), finalize(() => this._inProgressFetches.delete(type)), catchError(() => of(null)), share());
this._inProgressFetches.set(type, inProgress);
}
return inProgress;
}
_loadIconDynamicallyWithJsonp(icon, url) {
return new Observable((subscriber) => {
const loader = this._document.createElement("script");
const timer = setTimeout(() => {
clean();
subscriber.error(DynamicLoadingTimeoutError());
}, 6e3);
loader.src = url;
function clean() {
loader.parentNode.removeChild(loader);
clearTimeout(timer);
}
this._document.body.appendChild(loader);
this._jsonpIconLoad$.pipe(filter((i) => i.name === icon.name && i.theme === icon.theme), take(1)).subscribe((i) => {
subscriber.next(i);
clean();
});
});
}
/**
* Render a new `SVGElement` for a given `IconDefinition`, or make a copy from cache.
* @param icon
* @param twoToneColor
*/
_loadSVGFromCacheOrCreateNew(icon, twoToneColor) {
let svg;
const pri = twoToneColor || this._twoToneColorPalette.primaryColor;
const sec = getSecondaryColor(pri) || this._twoToneColorPalette.secondaryColor;
const key = icon.theme === "twotone" ? withSuffixAndColor(icon.name, icon.theme, pri, sec) : icon.theme === void 0 ? icon.name : withSuffix(icon.name, icon.theme);
const cached = this._svgRenderedDefinitions.get(key);
if (cached) {
svg = cached.icon;
} else {
svg = this._setSVGAttribute(this._colorizeSVGIcon(
// Icons provided by ant design should be refined to remove preset colors.
this._createSVGElementFromString(hasNamespace(icon.name) ? icon.icon : replaceFillColor(icon.icon)),
icon.theme === "twotone",
pri,
sec
));
this._svgRenderedDefinitions.set(key, __spreadProps(__spreadValues({}, icon), {
icon: svg
}));
}
return cloneSVG(svg);
}
_createSVGElementFromString(str) {
const div = this._document.createElement("div");
div.innerHTML = str;
const svg = div.querySelector("svg");
if (!svg) {
throw SVGTagNotFoundError;
}
return svg;
}
_setSVGAttribute(svg) {
this._renderer.setAttribute(svg, "width", "1em");
this._renderer.setAttribute(svg, "height", "1em");
return svg;
}
_colorizeSVGIcon(svg, twotone, pri, sec) {
if (twotone) {
const children = svg.childNodes;
const length = children.length;
for (let i = 0; i < length; i++) {
const child = children[i];
if (child.getAttribute("fill") === "secondaryColor") {
this._renderer.setAttribute(child, "fill", sec);
} else {
this._renderer.setAttribute(child, "fill", pri);
}
}
}
this._renderer.setAttribute(svg, "fill", "currentColor");
return svg;
}
};
_IconService.\u0275fac = function IconService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _IconService)(\u0275\u0275inject(ANT_ICONS, 8));
};
_IconService.\u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _IconService,
factory: _IconService.\u0275fac,
providedIn: "root"
});
var IconService = _IconService;
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(IconService, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [{
type: void 0,
decorators: [{
type: Optional
}, {
type: Inject,
args: [ANT_ICONS]
}]
}], null);
})();
function checkMeta(prev, after) {
return prev.type === after.type && prev.theme === after.theme && prev.twoToneColor === after.twoToneColor;
}
var _IconDirective = class _IconDirective {
constructor(_iconService) {
this._iconService = _iconService;
this._elementRef = inject(ElementRef);
this._renderer = inject(Renderer2);
}
ngOnChanges(changes) {
if (changes.type || changes.theme || changes.twoToneColor) {
this._changeIcon();
}
}
/**
* Render a new icon in the current element. Remove the icon when `type` is falsy.
*/
_changeIcon() {
return new Promise((resolve) => {
if (!this.type) {
this._clearSVGElement();
resolve(null);
return;
}
const beforeMeta = this._getSelfRenderMeta();
this._iconService.getRenderedContent(this._parseIconType(this.type, this.theme), this.twoToneColor).subscribe((svg) => {
const afterMeta = this._getSelfRenderMeta();
if (checkMeta(beforeMeta, afterMeta)) {
this._setSVGElement(svg);
resolve(svg);
} else {
resolve(null);
}
});
});
}
_getSelfRenderMeta() {
return {
type: this.type,
theme: this.theme,
twoToneColor: this.twoToneColor
};
}
/**
* Parse a icon to the standard form, an `IconDefinition` or a string like 'account-book-fill` (with a theme suffixed).
* If namespace is specified, ignore theme because it meaningless for users' icons.
*
* @param type
* @param theme
*/
_parseIconType(type, theme) {
if (isIconDefinition(type)) {
return type;
} else {
const [name2, namespace] = getNameAndNamespace(type);
if (namespace) {
return type;
}
if (alreadyHasAThemeSuffix(name2)) {
if (theme) {
warn(`'type' ${name2} already gets a theme inside so 'theme' ${theme} would be ignored`);
}
return name2;
} else {
return withSuffix(name2, theme || this._iconService.defaultTheme);
}
}
}
_setSVGElement(svg) {
this._clearSVGElement();
this._renderer.appendChild(this._elementRef.nativeElement, svg);
}
_clearSVGElement() {
const el = this._elementRef.nativeElement;
const children = el.childNodes;
const length = children.length;
for (let i = length - 1; i >= 0; i--) {
const child = children[i];
if (child.tagName?.toLowerCase() === "svg") {
this._renderer.removeChild(el, child);
}
}
}
};
_IconDirective.\u0275fac = function IconDirective_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _IconDirective)(\u0275\u0275directiveInject(IconService));
};
_IconDirective.\u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _IconDirective,
selectors: [["", "antIcon", ""]],
inputs: {
type: "type",
theme: "theme",
twoToneColor: "twoToneColor"
},
features: [\u0275\u0275NgOnChangesFeature]
});
var IconDirective = _IconDirective;
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(IconDirective, [{
type: Directive,
args: [{
selector: "[antIcon]"
}]
}], () => [{
type: IconService
}], {
type: [{
type: Input
}],
theme: [{
type: Input
}],
twoToneColor: [{
type: Input
}]
});
})();
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-core-environments.mjs
var environment2 = {
isTestMode: false
};
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-core-logger.mjs
var record = {};
var PREFIX = "[NG-ZORRO]:";
function notRecorded(...args) {
const asRecord = args.reduce((acc, c) => acc + c.toString(), "");
if (record[asRecord]) {
return false;
} else {
record[asRecord] = true;
return true;
}
}
function consoleCommonBehavior(consoleFunc, ...args) {
if (environment2.isTestMode || isDevMode() && notRecorded(...args)) {
consoleFunc(...args);
}
}
var warn2 = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
// node_modules/@angular/cdk/fesm2022/element.mjs
function coerceNumberProperty(value, fallbackValue = 0) {
if (_isNumberValue(value)) {
return Number(value);
}
return arguments.length === 2 ? fallbackValue : 0;
}
function _isNumberValue(value) {
return !isNaN(parseFloat(value)) && !isNaN(Number(value));
}
function coerceElement(elementOrRef) {
return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
}
// node_modules/@angular/cdk/fesm2022/array.mjs
function coerceArray(value) {
return Array.isArray(value) ? value : [value];
}
// node_modules/@angular/cdk/fesm2022/css-pixel-value.mjs
function coerceCssPixelValue(value) {
if (value == null) {
return "";
}
return typeof value === "string" ? value : `${value}px`;
}
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-core-util.mjs
function isNotNil(value) {
return typeof value !== "undefined" && value !== null;
}
function isTemplateRef(value) {
return value instanceof TemplateRef;
}
function toCssPixel(value) {
return coerceCssPixelValue(value);
}
function isTouchEvent(event) {
return event.type.startsWith("touch");
}
function getEventPosition(event) {
return isTouchEvent(event) ? event.touches[0] || event.changedTouches[0] : event;
}
function isPromise2(obj) {
return !!obj && typeof obj.then === "function" && typeof obj.catch === "function";
}
var isBrowser = typeof window !== "undefined";
var isFirefox = isBrowser && window.mozInnerScreenX != null;
function wrapIntoObservable2(value) {
if (isObservable(value)) {
return value;
}
if (isPromise2(value)) {
return new Observable((subscriber) => {
Promise.resolve(value).then((result) => {
subscriber.next(result);
subscriber.complete();
}).catch((error2) => subscriber.error(error2));
});
}
return of(value);
}
function canUseDom() {
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
var MARK_KEY = `rc-util-key`;
function getMark({ mark } = {}) {
if (mark) {
return mark.startsWith("data-") ? mark : `data-${mark}`;
}
return MARK_KEY;
}
function getContainer(option) {
if (option.attachTo) {
return option.attachTo;
}
const head = document.querySelector("head");
return head || document.body;
}
function injectCSS(css, options = {}) {
if (!canUseDom()) {
return null;
}
const styleNode = document.createElement("style");
if (options.cspNonce) {
styleNode.nonce = options.cspNonce;
}
styleNode.innerHTML = css;
const container = getContainer(options);
const { firstChild } = container;
if (options.prepend && container.prepend) {
container.prepend(styleNode);
} else if (options.prepend && firstChild) {
container.insertBefore(styleNode, firstChild);
} else {
container.appendChild(styleNode);
}
return styleNode;
}
var containerCache = /* @__PURE__ */ new Map();
function findExistNode(key, option = {}) {
const container = getContainer(option);
return Array.from(containerCache.get(container)?.children || []).find((node) => node.tagName === "STYLE" && node.getAttribute(getMark(option)) === key);
}
function updateCSS(css, key, options = {}) {
const container = getContainer(options);
if (!containerCache.has(container)) {
const placeholderStyle = injectCSS("", options);
const { parentNode } = placeholderStyle;
containerCache.set(container, parentNode);
parentNode.removeChild(placeholderStyle);
}
const existNode = findExistNode(key, options);
if (existNode) {
if (options.cspNonce && existNode.nonce !== options.cspNonce) {
existNode.nonce = options.cspNonce;
}
if (existNode.innerHTML !== css) {
existNode.innerHTML = css;
}
return existNode;
}
const newNode = injectCSS(css, options);
newNode?.setAttribute(getMark(options), key);
return newNode;
}
// node_modules/@angular/cdk/fesm2022/platform2.mjs
var hasV8BreakIterator;
try {
hasV8BreakIterator = typeof Intl !== "undefined" && Intl.v8BreakIterator;
} catch {
hasV8BreakIterator = false;
}
var Platform = class _Platform {
_platformId = inject(PLATFORM_ID);
// We want to use the Angular platform check because if the Document is shimmed
// without the navigator, the following checks will fail. This is preferred because
// sometimes the Document may be shimmed without the user's knowledge or intention
/** Whether the Angular application is being rendered in the browser. */
isBrowser = this._platformId ? isPlatformBrowser(this._platformId) : typeof document === "object" && !!document;
/** Whether the current browser is Microsoft Edge. */
EDGE = this.isBrowser && /(edge)/i.test(navigator.userAgent);
/** Whether the current rendering engine is Microsoft Trident. */
TRIDENT = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);
// EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
/** Whether the current rendering engine is Blink. */
BLINK = this.isBrowser && !!(window.chrome || hasV8BreakIterator) && typeof CSS !== "undefined" && !this.EDGE && !this.TRIDENT;
// Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
// ensure that Webkit runs standalone and is not used as another engine's base.
/** Whether the current rendering engine is WebKit. */
WEBKIT = this.isBrowser && /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;
/** Whether the current platform is Apple iOS. */
IOS = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window);
// It's difficult to detect the plain Gecko engine, because most of the browsers identify
// them self as Gecko-like browsers and modify the userAgent's according to that.
// Since we only cover one explicit Firefox case, we can simply check for Firefox
// instead of having an unstable check for Gecko.
/** Whether the current browser is Firefox. */
FIREFOX = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);
/** Whether the current platform is Android. */
// Trident on mobile adds the android platform to the userAgent to trick detections.
ANDROID = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;
// Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
// this and just place the Safari keyword in the userAgent. To be more safe about Safari every
// Safari browser should also use Webkit as its layout engine.
/** Whether the current browser is Safari. */
SAFARI = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;
constructor() {
}
static \u0275fac = function Platform_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _Platform)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _Platform,
factory: _Platform.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(Platform, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
// node_modules/@angular/cdk/fesm2022/scrolling2.mjs
var RtlScrollAxisType;
(function(RtlScrollAxisType2) {
RtlScrollAxisType2[RtlScrollAxisType2["NORMAL"] = 0] = "NORMAL";
RtlScrollAxisType2[RtlScrollAxisType2["NEGATED"] = 1] = "NEGATED";
RtlScrollAxisType2[RtlScrollAxisType2["INVERTED"] = 2] = "INVERTED";
})(RtlScrollAxisType || (RtlScrollAxisType = {}));
var rtlScrollAxisType;
var scrollBehaviorSupported;
function supportsScrollBehavior() {
if (scrollBehaviorSupported == null) {
if (typeof document !== "object" || !document || typeof Element !== "function" || !Element) {
scrollBehaviorSupported = false;
return scrollBehaviorSupported;
}
if (document.documentElement?.style && "scrollBehavior" in document.documentElement.style) {
scrollBehaviorSupported = true;
} else {
const scrollToFunction = Element.prototype.scrollTo;
if (scrollToFunction) {
scrollBehaviorSupported = !/\{\s*\[native code\]\s*\}/.test(scrollToFunction.toString());
} else {
scrollBehaviorSupported = false;
}
}
}
return scrollBehaviorSupported;
}
function getRtlScrollAxisType() {
if (typeof document !== "object" || !document) {
return RtlScrollAxisType.NORMAL;
}
if (rtlScrollAxisType == null) {
const scrollContainer = document.createElement("div");
const containerStyle = scrollContainer.style;
scrollContainer.dir = "rtl";
containerStyle.width = "1px";
containerStyle.overflow = "auto";
containerStyle.visibility = "hidden";
containerStyle.pointerEvents = "none";
containerStyle.position = "absolute";
const content = document.createElement("div");
const contentStyle = content.style;
contentStyle.width = "2px";
contentStyle.height = "1px";
scrollContainer.appendChild(content);
document.body.appendChild(scrollContainer);
rtlScrollAxisType = RtlScrollAxisType.NORMAL;
if (scrollContainer.scrollLeft === 0) {
scrollContainer.scrollLeft = 1;
rtlScrollAxisType = scrollContainer.scrollLeft === 0 ? RtlScrollAxisType.NEGATED : RtlScrollAxisType.INVERTED;
}
scrollContainer.remove();
}
return rtlScrollAxisType;
}
// node_modules/@angular/cdk/fesm2022/shadow-dom.mjs
function _getEventTarget(event) {
return event.composedPath ? event.composedPath()[0] : event.target;
}
// node_modules/@angular/cdk/fesm2022/test-environment.mjs
function _isTestEnvironment() {
return (
// @ts-ignore
typeof __karma__ !== "undefined" && !!__karma__ || // @ts-ignore
typeof jasmine !== "undefined" && !!jasmine || // @ts-ignore
typeof jest !== "undefined" && !!jest || // @ts-ignore
typeof Mocha !== "undefined" && !!Mocha
);
}
// node_modules/@angular/cdk/fesm2022/platform.mjs
var PlatformModule = class _PlatformModule {
static \u0275fac = function PlatformModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _PlatformModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _PlatformModule
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PlatformModule, [{
type: NgModule,
args: [{}]
}], null, null);
})();
// node_modules/@ctrl/tinycolor/dist/module/util.js
function bound01(n, max) {
if (isOnePointZero(n)) {
n = "100%";
}
var isPercent = isPercentage(n);
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
if (isPercent) {
n = parseInt(String(n * max), 10) / 100;
}
if (Math.abs(n - max) < 1e-6) {
return 1;
}
if (max === 360) {
n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
} else {
n = n % max / parseFloat(String(max));
}
return n;
}
function clamp01(val) {
return Math.min(1, Math.max(0, val));
}
function isOnePointZero(n) {
return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
}
function isPercentage(n) {
return typeof n === "string" && n.indexOf("%") !== -1;
}
function boundAlpha(a) {
a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;
}
function convertToPercentage(n) {
if (n <= 1) {
return "".concat(Number(n) * 100, "%");
}
return n;
}
function pad2(c) {
return c.length === 1 ? "0" + c : String(c);
}
// node_modules/@ctrl/tinycolor/dist/module/conversion.js
function rgbToRgb(r, g, b) {
return {
r: bound01(r, 255) * 255,
g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255
};
}
function rgbToHsl(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h = 0;
var s = 0;
var l = (max + min) / 2;
if (max === min) {
s = 0;
h = 0;
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
default:
break;
}
h /= 6;
}
return { h, s, l };
}
function hue2rgb(p, q, t) {
if (t < 0) {
t += 1;
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * (6 * t);
}
if (t < 1 / 2) {
return q;
}
if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 6;
}
return p;
}
function hslToRgb(h, s, l) {
var r;
var g;
var b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
if (s === 0) {
g = l;
b = l;
r = l;
} else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1 / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1 / 3);
}
return { r: r * 255, g: g * 255, b: b * 255 };
}
function rgbToHsv(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h = 0;
var v = max;
var d = max - min;
var s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
default:
break;
}
h /= 6;
}
return { h, s, v };
}
function hsvToRgb(h, s, v) {
h = bound01(h, 360) * 6;
s = bound01(s, 100);
v = bound01(v, 100);
var i = Math.floor(h);
var f = h - i;
var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
var mod = i % 6;
var r = [v, q, p, p, t, v][mod];
var g = [t, v, v, q, p, p][mod];
var b = [p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };
}
function rgbToHex(r, g, b, allow3Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16))
];
if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [
pad2(Math.round(r).toString(16)),
pad2(Math.round(g).toString(16)),
pad2(Math.round(b).toString(16)),
pad2(convertDecimalToHex(a))
];
if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
function convertDecimalToHex(d) {
return Math.round(parseFloat(d) * 255).toString(16);
}
function convertHexToDecimal(h) {
return parseIntFromHex(h) / 255;
}
function parseIntFromHex(val) {
return parseInt(val, 16);
}
function numberInputToObject(color) {
return {
r: color >> 16,
g: (color & 65280) >> 8,
b: color & 255
};
}
// node_modules/@ctrl/tinycolor/dist/module/css-color-names.js
var names = {
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aqua: "#00ffff",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
black: "#000000",
blanchedalmond: "#ffebcd",
blue: "#0000ff",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
fuchsia: "#ff00ff",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
goldenrod: "#daa520",
gold: "#ffd700",
gray: "#808080",
green: "#008000",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavenderblush: "#fff0f5",
lavender: "#e6e6fa",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
lime: "#00ff00",
limegreen: "#32cd32",
linen: "#faf0e6",
magenta: "#ff00ff",
maroon: "#800000",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
navy: "#000080",
oldlace: "#fdf5e6",
olive: "#808000",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
purple: "#800080",
rebeccapurple: "#663399",
red: "#ff0000",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
silver: "#c0c0c0",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
teal: "#008080",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
white: "#ffffff",
whitesmoke: "#f5f5f5",
yellow: "#ffff00",
yellowgreen: "#9acd32"
};
// node_modules/@ctrl/tinycolor/dist/module/format-input.js
function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var a = 1;
var s = null;
var v = null;
var l = null;
var ok = false;
var format = false;
if (typeof color === "string") {
color = stringInputToObject(color);
}
if (typeof color === "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);
v = convertToPercentage(color.v);
rgb = hsvToRgb(color.h, s, v);
ok = true;
format = "hsv";
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);
l = convertToPercentage(color.l);
rgb = hslToRgb(color.h, s, l);
ok = true;
format = "hsl";
}
if (Object.prototype.hasOwnProperty.call(color, "a")) {
a = color.a;
}
}
a = boundAlpha(a);
return {
ok,
format: color.format || format,
r: Math.min(255, Math.max(rgb.r, 0)),
g: Math.min(255, Math.max(rgb.g, 0)),
b: Math.min(255, Math.max(rgb.b, 0)),
a
};
}
var CSS_INTEGER = "[-\\+]?\\d+%?";
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
var matchers = {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
function stringInputToObject(color) {
color = color.trim().toLowerCase();
if (color.length === 0) {
return false;
}
var named = false;
if (names[color]) {
color = names[color];
named = true;
} else if (color === "transparent") {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
}
var match2 = matchers.rgb.exec(color);
if (match2) {
return { r: match2[1], g: match2[2], b: match2[3] };
}
match2 = matchers.rgba.exec(color);
if (match2) {
return { r: match2[1], g: match2[2], b: match2[3], a: match2[4] };
}
match2 = matchers.hsl.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], l: match2[3] };
}
match2 = matchers.hsla.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], l: match2[3], a: match2[4] };
}
match2 = matchers.hsv.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], v: match2[3] };
}
match2 = matchers.hsva.exec(color);
if (match2) {
return { h: match2[1], s: match2[2], v: match2[3], a: match2[4] };
}
match2 = matchers.hex8.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1]),
g: parseIntFromHex(match2[2]),
b: parseIntFromHex(match2[3]),
a: convertHexToDecimal(match2[4]),
format: named ? "name" : "hex8"
};
}
match2 = matchers.hex6.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1]),
g: parseIntFromHex(match2[2]),
b: parseIntFromHex(match2[3]),
format: named ? "name" : "hex"
};
}
match2 = matchers.hex4.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1] + match2[1]),
g: parseIntFromHex(match2[2] + match2[2]),
b: parseIntFromHex(match2[3] + match2[3]),
a: convertHexToDecimal(match2[4] + match2[4]),
format: named ? "name" : "hex8"
};
}
match2 = matchers.hex3.exec(color);
if (match2) {
return {
r: parseIntFromHex(match2[1] + match2[1]),
g: parseIntFromHex(match2[2] + match2[2]),
b: parseIntFromHex(match2[3] + match2[3]),
format: named ? "name" : "hex"
};
}
return false;
}
function isValidCSSUnit(color) {
return Boolean(matchers.CSS_UNIT.exec(String(color)));
}
// node_modules/@ctrl/tinycolor/dist/module/index.js
var TinyColor = (
/** @class */
(function() {
function TinyColor2(color, opts) {
if (color === void 0) {
color = "";
}
if (opts === void 0) {
opts = {};
}
var _a;
if (color instanceof TinyColor2) {
return color;
}
if (typeof color === "number") {
color = numberInputToObject(color);
}
this.originalInput = color;
var rgb = inputToRGB(color);
this.originalInput = color;
this.r = rgb.r;
this.g = rgb.g;
this.b = rgb.b;
this.a = rgb.a;
this.roundA = Math.round(100 * this.a) / 100;
this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
this.gradientType = opts.gradientType;
if (this.r < 1) {
this.r = Math.round(this.r);
}
if (this.g < 1) {
this.g = Math.round(this.g);
}
if (this.b < 1) {
this.b = Math.round(this.b);
}
this.isValid = rgb.ok;
}
TinyColor2.prototype.isDark = function() {
return this.getBrightness() < 128;
};
TinyColor2.prototype.isLight = function() {
return !this.isDark();
};
TinyColor2.prototype.getBrightness = function() {
var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
};
TinyColor2.prototype.getLuminance = function() {
var rgb = this.toRgb();
var R;
var G;
var B;
var RsRGB = rgb.r / 255;
var GsRGB = rgb.g / 255;
var BsRGB = rgb.b / 255;
if (RsRGB <= 0.03928) {
R = RsRGB / 12.92;
} else {
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
}
if (GsRGB <= 0.03928) {
G = GsRGB / 12.92;
} else {
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
}
if (BsRGB <= 0.03928) {
B = BsRGB / 12.92;
} else {
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
}
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
};
TinyColor2.prototype.getAlpha = function() {
return this.a;
};
TinyColor2.prototype.setAlpha = function(alpha) {
this.a = boundAlpha(alpha);
this.roundA = Math.round(100 * this.a) / 100;
return this;
};
TinyColor2.prototype.isMonochrome = function() {
var s = this.toHsl().s;
return s === 0;
};
TinyColor2.prototype.toHsv = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
};
TinyColor2.prototype.toHsvString = function() {
var hsv = rgbToHsv(this.r, this.g, this.b);
var h = Math.round(hsv.h * 360);
var s = Math.round(hsv.s * 100);
var v = Math.round(hsv.v * 100);
return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHsl = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
};
TinyColor2.prototype.toHslString = function() {
var hsl = rgbToHsl(this.r, this.g, this.b);
var h = Math.round(hsl.h * 360);
var s = Math.round(hsl.s * 100);
var l = Math.round(hsl.l * 100);
return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toHex = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return rgbToHex(this.r, this.g, this.b, allow3Char);
};
TinyColor2.prototype.toHexString = function(allow3Char) {
if (allow3Char === void 0) {
allow3Char = false;
}
return "#" + this.toHex(allow3Char);
};
TinyColor2.prototype.toHex8 = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
};
TinyColor2.prototype.toHex8String = function(allow4Char) {
if (allow4Char === void 0) {
allow4Char = false;
}
return "#" + this.toHex8(allow4Char);
};
TinyColor2.prototype.toHexShortString = function(allowShortChar) {
if (allowShortChar === void 0) {
allowShortChar = false;
}
return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
};
TinyColor2.prototype.toRgb = function() {
return {
r: Math.round(this.r),
g: Math.round(this.g),
b: Math.round(this.b),
a: this.a
};
};
TinyColor2.prototype.toRgbString = function() {
var r = Math.round(this.r);
var g = Math.round(this.g);
var b = Math.round(this.b);
return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
};
TinyColor2.prototype.toPercentageRgb = function() {
var fmt = function(x) {
return "".concat(Math.round(bound01(x, 255) * 100), "%");
};
return {
r: fmt(this.r),
g: fmt(this.g),
b: fmt(this.b),
a: this.a
};
};
TinyColor2.prototype.toPercentageRgbString = function() {
var rnd = function(x) {
return Math.round(bound01(x, 255) * 100);
};
return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
};
TinyColor2.prototype.toName = function() {
if (this.a === 0) {
return "transparent";
}
if (this.a < 1) {
return false;
}
var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
var _b = _a[_i], key = _b[0], value = _b[1];
if (hex === value) {
return key;
}
}
return false;
};
TinyColor2.prototype.toString = function(format) {
var formatSet = Boolean(format);
format = format !== null && format !== void 0 ? format : this.format;
var formattedString = false;
var hasAlpha = this.a < 1 && this.a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
if (needsAlphaFormat) {
if (format === "name" && this.a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format === "rgb") {
formattedString = this.toRgbString();
}
if (format === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format === "hex" || format === "hex6") {
formattedString = this.toHexString();
}
if (format === "hex3") {
formattedString = this.toHexString(true);
}
if (format === "hex4") {
formattedString = this.toHex8String(true);
}
if (format === "hex8") {
formattedString = this.toHex8String();
}
if (format === "name") {
formattedString = this.toName();
}
if (format === "hsl") {
formattedString = this.toHslString();
}
if (format === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
};
TinyColor2.prototype.toNumber = function() {
return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
};
TinyColor2.prototype.clone = function() {
return new TinyColor2(this.toString());
};
TinyColor2.prototype.lighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l += amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.brighten = function(amount) {
if (amount === void 0) {
amount = 10;
}
var rgb = this.toRgb();
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
return new TinyColor2(rgb);
};
TinyColor2.prototype.darken = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.l -= amount / 100;
hsl.l = clamp01(hsl.l);
return new TinyColor2(hsl);
};
TinyColor2.prototype.tint = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("white", amount);
};
TinyColor2.prototype.shade = function(amount) {
if (amount === void 0) {
amount = 10;
}
return this.mix("black", amount);
};
TinyColor2.prototype.desaturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s -= amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.saturate = function(amount) {
if (amount === void 0) {
amount = 10;
}
var hsl = this.toHsl();
hsl.s += amount / 100;
hsl.s = clamp01(hsl.s);
return new TinyColor2(hsl);
};
TinyColor2.prototype.greyscale = function() {
return this.desaturate(100);
};
TinyColor2.prototype.spin = function(amount) {
var hsl = this.toHsl();
var hue = (hsl.h + amount) % 360;
hsl.h = hue < 0 ? 360 + hue : hue;
return new TinyColor2(hsl);
};
TinyColor2.prototype.mix = function(color, amount) {
if (amount === void 0) {
amount = 50;
}
var rgb1 = this.toRgb();
var rgb2 = new TinyColor2(color).toRgb();
var p = amount / 100;
var rgba = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b,
a: (rgb2.a - rgb1.a) * p + rgb1.a
};
return new TinyColor2(rgba);
};
TinyColor2.prototype.analogous = function(results, slices) {
if (results === void 0) {
results = 6;
}
if (slices === void 0) {
slices = 30;
}
var hsl = this.toHsl();
var part = 360 / slices;
var ret = [this];
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
hsl.h = (hsl.h + part) % 360;
ret.push(new TinyColor2(hsl));
}
return ret;
};
TinyColor2.prototype.complement = function() {
var hsl = this.toHsl();
hsl.h = (hsl.h + 180) % 360;
return new TinyColor2(hsl);
};
TinyColor2.prototype.monochromatic = function(results) {
if (results === void 0) {
results = 6;
}
var hsv = this.toHsv();
var h = hsv.h;
var s = hsv.s;
var v = hsv.v;
var res = [];
var modification = 1 / results;
while (results--) {
res.push(new TinyColor2({ h, s, v }));
v = (v + modification) % 1;
}
return res;
};
TinyColor2.prototype.splitcomplement = function() {
var hsl = this.toHsl();
var h = hsl.h;
return [
this,
new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
];
};
TinyColor2.prototype.onBackground = function(background) {
var fg = this.toRgb();
var bg = new TinyColor2(background).toRgb();
var alpha = fg.a + bg.a * (1 - fg.a);
return new TinyColor2({
r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
a: alpha
});
};
TinyColor2.prototype.triad = function() {
return this.polyad(3);
};
TinyColor2.prototype.tetrad = function() {
return this.polyad(4);
};
TinyColor2.prototype.polyad = function(n) {
var hsl = this.toHsl();
var h = hsl.h;
var result = [this];
var increment = 360 / n;
for (var i = 1; i < n; i++) {
result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
}
return result;
};
TinyColor2.prototype.equals = function(color) {
return this.toRgbString() === new TinyColor2(color).toRgbString();
};
return TinyColor2;
})()
);
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-core-color.mjs
var hueStep2 = 2;
var saturationStep3 = 0.16;
var saturationStep22 = 0.05;
var brightnessStep12 = 0.05;
var brightnessStep22 = 0.15;
var lightColorCount2 = 5;
var darkColorCount2 = 4;
var darkColorMap2 = [
{ index: 7, opacity: 0.15 },
{ index: 6, opacity: 0.25 },
{ index: 5, opacity: 0.3 },
{ index: 5, opacity: 0.45 },
{ index: 5, opacity: 0.65 },
{ index: 5, opacity: 0.85 },
{ index: 4, opacity: 0.9 },
{ index: 3, opacity: 0.95 },
{ index: 2, opacity: 0.97 },
{ index: 1, opacity: 0.98 }
];
function toHsv({ r, g, b }) {
const hsv = rgbToHsv(r, g, b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v };
}
function toHex({ r, g, b }) {
return `#${rgbToHex(r, g, b, false)}`;
}
function mix(rgb1, rgb2, amount) {
const p = amount / 100;
const rgb = {
r: (rgb2.r - rgb1.r) * p + rgb1.r,
g: (rgb2.g - rgb1.g) * p + rgb1.g,
b: (rgb2.b - rgb1.b) * p + rgb1.b
};
return rgb;
}
function getHue2(hsv, i, light) {
let hue;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep2 * i : Math.round(hsv.h) + hueStep2 * i;
} else {
hue = light ? Math.round(hsv.h) + hueStep2 * i : Math.round(hsv.h) - hueStep2 * i;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation2(hsv, i, light) {
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
let saturation;
if (light) {
saturation = hsv.s - saturationStep3 * i;
} else if (i === darkColorCount2) {
saturation = hsv.s + saturationStep3;
} else {
saturation = hsv.s + saturationStep22 * i;
}
if (saturation > 1) {
saturation = 1;
}
if (light && i === lightColorCount2 && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Number(saturation.toFixed(2));
}
function getValue2(hsv, i, light) {
let value;
if (light) {
value = hsv.v + brightnessStep12 * i;
} else {
value = hsv.v - brightnessStep22 * i;
}
if (value > 1) {
value = 1;
}
return Number(value.toFixed(2));
}
function generate2(color, opts = {}) {
const patterns = [];
const pColor = inputToRGB(color);
for (let i = lightColorCount2; i > 0; i -= 1) {
const hsv = toHsv(pColor);
const colorString = toHex(inputToRGB({
h: getHue2(hsv, i, true),
s: getSaturation2(hsv, i, true),
v: getValue2(hsv, i, true)
}));
patterns.push(colorString);
}
patterns.push(toHex(pColor));
for (let i = 1; i <= darkColorCount2; i += 1) {
const hsv = toHsv(pColor);
const colorString = toHex(inputToRGB({
h: getHue2(hsv, i),
s: getSaturation2(hsv, i),
v: getValue2(hsv, i)
}));
patterns.push(colorString);
}
if (opts.theme === "dark") {
return darkColorMap2.map(({ index, opacity }) => {
const darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || "#141414"), inputToRGB(patterns[index]), opacity * 100));
return darkColorString;
});
}
return patterns;
}
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-core-config.mjs
var NZ_CONFIG = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "nz-config" : "");
var dynamicStyleMark = `-ant-${Date.now()}-${Math.random()}`;
function getStyle(globalPrefixCls, theme) {
const variables = {};
const formatColor = (color, updater) => {
let clone = color.clone();
clone = updater?.(clone) || clone;
return clone.toRgbString();
};
const fillColor = (colorVal, type) => {
const baseColor = new TinyColor(colorVal);
const colorPalettes = generate2(baseColor.toRgbString());
variables[`${type}-color`] = formatColor(baseColor);
variables[`${type}-color-disabled`] = colorPalettes[1];
variables[`${type}-color-hover`] = colorPalettes[4];
variables[`${type}-color-active`] = colorPalettes[7];
variables[`${type}-color-outline`] = baseColor.clone().setAlpha(0.2).toRgbString();
variables[`${type}-color-deprecated-bg`] = colorPalettes[1];
variables[`${type}-color-deprecated-border`] = colorPalettes[3];
};
if (theme.primaryColor) {
fillColor(theme.primaryColor, "primary");
const primaryColor = new TinyColor(theme.primaryColor);
const primaryColors = generate2(primaryColor.toRgbString());
primaryColors.forEach((color, index) => {
variables[`primary-${index + 1}`] = color;
});
variables["primary-color-deprecated-l-35"] = formatColor(primaryColor, (c) => c.lighten(35));
variables["primary-color-deprecated-l-20"] = formatColor(primaryColor, (c) => c.lighten(20));
variables["primary-color-deprecated-t-20"] = formatColor(primaryColor, (c) => c.tint(20));
variables["primary-color-deprecated-t-50"] = formatColor(primaryColor, (c) => c.tint(50));
variables["primary-color-deprecated-f-12"] = formatColor(primaryColor, (c) => c.setAlpha(c.getAlpha() * 0.12));
const primaryActiveColor = new TinyColor(primaryColors[0]);
variables["primary-color-active-deprecated-f-30"] = formatColor(primaryActiveColor, (c) => c.setAlpha(c.getAlpha() * 0.3));
variables["primary-color-active-deprecated-d-02"] = formatColor(primaryActiveColor, (c) => c.darken(2));
}
if (theme.successColor) {
fillColor(theme.successColor, "success");
}
if (theme.warningColor) {
fillColor(theme.warningColor, "warning");
}
if (theme.errorColor) {
fillColor(theme.errorColor, "error");
}
if (theme.infoColor) {
fillColor(theme.infoColor, "info");
}
const cssList = Object.keys(variables).map((key) => `--${globalPrefixCls}-${key}: ${variables[key]};`);
return `
:root {
${cssList.join("\n")}
}
`.trim();
}
function registerTheme(globalPrefixCls, theme, cspNonce) {
const style = getStyle(globalPrefixCls, theme);
if (canUseDom()) {
updateCSS(style, `${dynamicStyleMark}-dynamic-theme`, {
cspNonce
});
} else {
warn2(`NzConfigService: SSR do not support dynamic theme with css variables.`);
}
}
var defaultPrefixCls = "ant";
var NzConfigService = class _NzConfigService {
configUpdated$ = new Subject();
/**
* Sharing config signals for all components, used for {@link withConfigFactory}
* @internal
* @todo use nested signal to refactor the whole config service
*/
_configMap = /* @__PURE__ */ new Map();
/** Global config holding property. */
config = inject(NZ_CONFIG, {
optional: true
}) || {};
cspNonce = inject(CSP_NONCE, {
optional: true
});
constructor() {
if (this.config.theme) {
registerTheme(this.getConfig().prefixCls?.prefixCls || defaultPrefixCls, this.config.theme, this.cspNonce);
}
}
_getConfigValue(componentName) {
let configValue = this._configMap.get(componentName);
if (configValue) {
return configValue;
}
configValue = signal(this.config[componentName]);
this._configMap.set(componentName, configValue);
return configValue;
}
getConfig() {
return this.config;
}
getConfigForComponent(componentName) {
return this.config[componentName];
}
getConfigChangeEventForComponent(componentName) {
return this.configUpdated$.pipe(filter((n) => n === componentName), map(() => void 0));
}
set(componentName, value) {
this.config[componentName] = __spreadValues(__spreadValues({}, this.config[componentName]), value);
this._configMap.get(componentName)?.set(this.config[componentName]);
if (componentName === "theme" && this.config.theme) {
registerTheme(this.getConfig().prefixCls?.prefixCls || defaultPrefixCls, this.config.theme, this.cspNonce);
}
this.configUpdated$.next(componentName);
}
static \u0275fac = function NzConfigService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NzConfigService)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NzConfigService,
factory: _NzConfigService.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzConfigService, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
function onConfigChangeEventForComponent(componentName, callback) {
if (typeof ngDevMode !== "undefined" && ngDevMode) {
assertInInjectionContext(onConfigChangeEventForComponent);
}
const destroyRef = inject(DestroyRef);
const nzConfigService = inject(NzConfigService);
let subscription = null;
const ref = afterNextRender(() => {
subscription = nzConfigService.getConfigChangeEventForComponent(componentName).pipe(takeUntilDestroyed(destroyRef)).subscribe(callback);
});
return () => {
ref.destroy();
subscription?.unsubscribe();
};
}
// node_modules/@ant-design/icons-angular/fesm2022/ant-design-icons-angular-icons.mjs
var ArrowRightOutline = {
name: "arrow-right",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z" /></svg>'
};
var BarsOutline = {
name: "bars",
theme: "outline",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" /></svg>'
};
var ArrowLeftOutline = {
name: "arrow-left",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" /></svg>'
};
var AppstoreOutline = {
name: "appstore",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z" /></svg>'
};
var BookOutline = {
name: "book",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-260 72h96v209.9L621.5 312 572 347.4V136zm220 752H232V136h280v296.9c0 3.3 1 6.6 3 9.3a15.9 15.9 0 0022.3 3.7l83.8-59.9 81.4 59.4c2.7 2 6 3.1 9.4 3.1 8.8 0 16-7.2 16-16V136h64v752z" /></svg>'
};
var BulbOutline = {
name: "bulb",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z" /></svg>'
};
var BulbFill = {
name: "bulb",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M348 676.1C250 619.4 184 513.4 184 392c0-181.1 146.9-328 328-328s328 146.9 328 328c0 121.4-66 227.4-164 284.1V792c0 17.7-14.3 32-32 32H380c-17.7 0-32-14.3-32-32V676.1zM392 888h240c4.4 0 8 3.6 8 8v32c0 17.7-14.3 32-32 32H416c-17.7 0-32-14.3-32-32v-32c0-4.4 3.6-8 8-8z" /></svg>'
};
var CaretDownFill = {
name: "caret-down",
theme: "fill",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" /></svg>'
};
var CaretDownOutline = {
name: "caret-down",
theme: "outline",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" /></svg>'
};
var CaretUpFill = {
name: "caret-up",
theme: "fill",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" /></svg>'
};
var CaretUpOutline = {
name: "caret-up",
theme: "outline",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" /></svg>'
};
var CheckCircleFill = {
name: "check-circle",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" /></svg>'
};
var CheckCircleOutline = {
name: "check-circle",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" /><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /></svg>'
};
var CheckOutline = {
name: "check",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" /></svg>'
};
var CalendarOutline = {
name: "calendar",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" /></svg>'
};
var CloseCircleFill = {
name: "close-circle",
theme: "fill",
icon: '<svg fill-rule="evenodd" viewBox="64 64 896 896" focusable="false"><path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" /></svg>'
};
var ClockCircleOutline = {
name: "clock-circle",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" /></svg>'
};
var CloseOutline = {
name: "close",
theme: "outline",
icon: '<svg fill-rule="evenodd" viewBox="64 64 896 896" focusable="false"><path d="M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" /></svg>'
};
var CloseCircleOutline = {
name: "close-circle",
theme: "outline",
icon: '<svg fill-rule="evenodd" viewBox="64 64 896 896" focusable="false"><path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" /></svg>'
};
var CopyOutline = {
name: "copy",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" /></svg>'
};
var DeleteOutline = {
name: "delete",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" /></svg>'
};
var DoubleLeftOutline = {
name: "double-left",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z" /></svg>'
};
var DoubleRightOutline = {
name: "double-right",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" /></svg>'
};
var DownOutline = {
name: "down",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" /></svg>'
};
var EditOutline = {
name: "edit",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" /></svg>'
};
var EllipsisOutline = {
name: "ellipsis",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" /></svg>'
};
var ExclamationCircleFill = {
name: "exclamation-circle",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" /></svg>'
};
var ExclamationCircleOutline = {
name: "exclamation-circle",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" /></svg>'
};
var EyeOutline = {
name: "eye",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" /></svg>'
};
var EyeInvisibleOutline = {
name: "eye-invisible",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" /><path d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" /></svg>'
};
var FileFill = {
name: "file",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2z" /></svg>'
};
var FileOutline = {
name: "file",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" /></svg>'
};
var FileTextOutline = {
name: "file-text",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" /></svg>'
};
var FilterFill = {
name: "filter",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z" /></svg>'
};
var LeftOutline = {
name: "left",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" /></svg>'
};
var InfoCircleFill = {
name: "info-circle",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" /></svg>'
};
var InfoCircleOutline = {
name: "info-circle",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" /></svg>'
};
var LinkOutline = {
name: "link",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z" /></svg>'
};
var LoadingOutline = {
name: "loading",
theme: "outline",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" /></svg>'
};
var LogoutOutline = {
name: "logout",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M868 732h-70.3c-4.8 0-9.3 2.1-12.3 5.8-7 8.5-14.5 16.7-22.4 24.5a353.84 353.84 0 01-112.7 75.9A352.8 352.8 0 01512.4 866c-47.9 0-94.3-9.4-137.9-27.8a353.84 353.84 0 01-112.7-75.9 353.28 353.28 0 01-76-112.5C167.3 606.2 158 559.9 158 512s9.4-94.2 27.8-137.8c17.8-42.1 43.4-80 76-112.5s70.5-58.1 112.7-75.9c43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 7.9 7.9 15.3 16.1 22.4 24.5 3 3.7 7.6 5.8 12.3 5.8H868c6.3 0 10.2-7 6.7-12.3C798 160.5 663.8 81.6 511.3 82 271.7 82.6 79.6 277.1 82 516.4 84.4 751.9 276.2 942 512.4 942c152.1 0 285.7-78.8 362.3-197.7 3.4-5.3-.4-12.3-6.7-12.3zm88.9-226.3L815 393.7c-5.3-4.2-13-.4-13 6.3v76H488c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h314v76c0 6.7 7.8 10.5 13 6.3l141.9-112a8 8 0 000-12.6z" /></svg>'
};
var LockOutline = {
name: "lock",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z" /></svg>'
};
var MailOutline = {
name: "mail",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 110.8V792H136V270.8l-27.6-21.5 39.3-50.5 42.8 33.3h643.1l42.8-33.3 39.3 50.5-27.7 21.5zM833.6 232L512 482 190.4 232l-42.8-33.3-39.3 50.5 27.6 21.5 341.6 265.6a55.99 55.99 0 0068.7 0L888 270.8l27.6-21.5-39.3-50.5-42.7 33.2z" /></svg>'
};
var MenuUnfoldOutline = {
name: "menu-unfold",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z" /></svg>'
};
var MenuFoldOutline = {
name: "menu-fold",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z" /></svg>'
};
var PaperClipOutline = {
name: "paper-clip",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" /></svg>'
};
var PlusOutline = {
name: "plus",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" /><path d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" /></svg>'
};
var QuestionCircleOutline = {
name: "question-circle",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" /></svg>'
};
var ReadOutline = {
name: "read",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M928 161H699.2c-49.1 0-97.1 14.1-138.4 40.7L512 233l-48.8-31.3A255.2 255.2 0 00324.8 161H96c-17.7 0-32 14.3-32 32v568c0 17.7 14.3 32 32 32h228.8c49.1 0 97.1 14.1 138.4 40.7l44.4 28.6c1.3.8 2.8 1.3 4.3 1.3s3-.4 4.3-1.3l44.4-28.6C602 807.1 650.1 793 699.2 793H928c17.7 0 32-14.3 32-32V193c0-17.7-14.3-32-32-32zM324.8 721H136V233h188.8c35.4 0 69.8 10.1 99.5 29.2l48.8 31.3 6.9 4.5v462c-47.6-25.6-100.8-39-155.2-39zm563.2 0H699.2c-54.4 0-107.6 13.4-155.2 39V298l6.9-4.5 48.8-31.3c29.7-19.1 64.1-29.2 99.5-29.2H888v488zM396.9 361H211.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5zm223.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c0-4.1-3.2-7.5-7.1-7.5H627.1c-3.9 0-7.1 3.4-7.1 7.5zM396.9 501H211.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5zm416 0H627.1c-3.9 0-7.1 3.4-7.1 7.5v45c0 4.1 3.2 7.5 7.1 7.5h185.7c3.9 0 7.1-3.4 7.1-7.5v-45c.1-4.1-3.1-7.5-7-7.5z" /></svg>'
};
var RightOutline = {
name: "right",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" /></svg>'
};
var RotateLeftOutline = {
name: "rotate-left",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><defs><style /></defs><path d="M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z" /><path d="M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z" /></svg>'
};
var RotateRightOutline = {
name: "rotate-right",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><defs><style /></defs><path d="M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z" /><path d="M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z" /></svg>'
};
var SearchOutline = {
name: "search",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" /></svg>'
};
var StarFill = {
name: "star",
theme: "fill",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" /></svg>'
};
var StarOutline = {
name: "star",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" /></svg>'
};
var SwapOutline = {
name: "swap",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" /></svg>'
};
var SwapRightOutline = {
name: "swap-right",
theme: "outline",
icon: '<svg viewBox="0 0 1024 1024" focusable="false"><path d="M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z" /></svg>'
};
var UpOutline = {
name: "up",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" /></svg>'
};
var UploadOutline = {
name: "upload",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" /></svg>'
};
var UserOutline = {
name: "user",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M858.5 763.6a374 374 0 00-80.6-119.5 375.63 375.63 0 00-119.5-80.6c-.4-.2-.8-.3-1.2-.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-.4.2-.8.3-1.2.5-44.8 18.9-85 46-119.5 80.6a375.63 375.63 0 00-80.6 119.5A371.7 371.7 0 00136 901.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c.1 4.4 3.6 7.8 8 7.8h60a8 8 0 008-8.2c-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z" /></svg>'
};
var VideoCameraOutline = {
name: "video-camera",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" /></svg>'
};
var VerticalAlignTopOutline = {
name: "vertical-align-top",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z" /></svg>'
};
var ZoomInOutline = {
name: "zoom-in",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" /></svg>'
};
var ZoomOutOutline = {
name: "zoom-out",
theme: "outline",
icon: '<svg viewBox="64 64 896 896" focusable="false"><path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" /></svg>'
};
// node_modules/ng-zorro-antd/fesm2022/ng-zorro-antd-icon.mjs
var NZ_ICONS_USED_BY_ZORRO = [BarsOutline, CalendarOutline, CaretUpFill, CaretUpOutline, CaretDownFill, CaretDownOutline, CheckCircleFill, CheckCircleOutline, CheckOutline, ClockCircleOutline, CloseCircleOutline, CloseCircleFill, CloseOutline, CopyOutline, DeleteOutline, DoubleLeftOutline, DoubleRightOutline, DownOutline, EditOutline, EllipsisOutline, ExclamationCircleFill, ExclamationCircleOutline, EyeOutline, EyeInvisibleOutline, FileFill, FileOutline, FilterFill, InfoCircleFill, InfoCircleOutline, LeftOutline, LoadingOutline, PaperClipOutline, QuestionCircleOutline, RightOutline, RotateRightOutline, RotateLeftOutline, StarFill, SearchOutline, StarFill, UploadOutline, VerticalAlignTopOutline, UpOutline, SwapOutline, SwapRightOutline, ZoomInOutline, ZoomOutOutline];
var NZ_ICONS = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "nz-icons" : "");
var NZ_ICON_DEFAULT_TWOTONE_COLOR = new InjectionToken(typeof ngDevMode !== "undefined" && ngDevMode ? "nz-icon-default-twotone-color" : "");
var DEFAULT_TWOTONE_COLOR = "#1890ff";
var NzIconService = class _NzIconService extends IconService {
nzConfigService = inject(NzConfigService);
platform = inject(Platform);
configUpdated$ = new Subject();
get _disableDynamicLoading() {
return !this.platform.isBrowser;
}
iconfontCache = /* @__PURE__ */ new Set();
normalizeSvgElement(svg) {
if (!svg.getAttribute("viewBox")) {
this._renderer.setAttribute(svg, "viewBox", "0 0 1024 1024");
}
if (!svg.getAttribute("width") || !svg.getAttribute("height")) {
this._renderer.setAttribute(svg, "width", "1em");
this._renderer.setAttribute(svg, "height", "1em");
}
if (!svg.getAttribute("fill")) {
this._renderer.setAttribute(svg, "fill", "currentColor");
}
}
fetchFromIconfont(opt) {
const {
scriptUrl
} = opt;
if (this._document && !this.iconfontCache.has(scriptUrl)) {
const script = this._renderer.createElement("script");
this._renderer.setAttribute(script, "src", scriptUrl);
this._renderer.setAttribute(script, "data-namespace", scriptUrl.replace(/^(https?|http):/g, ""));
this._renderer.appendChild(this._document.body, script);
this.iconfontCache.add(scriptUrl);
}
}
createIconfontIcon(type) {
return this._createSVGElementFromString(`<svg><use xlink:href="${type}"></svg>`);
}
constructor() {
super([...NZ_ICONS_USED_BY_ZORRO, ...inject(NZ_ICONS, {
optional: true
}) || []]);
this.onConfigChange();
this.configDefaultTwotoneColor();
this.configDefaultTheme();
}
onConfigChange() {
onConfigChangeEventForComponent("icon", () => {
this.configDefaultTwotoneColor();
this.configDefaultTheme();
this.configUpdated$.next();
});
}
configDefaultTheme() {
const iconConfig = this.getConfig();
this.defaultTheme = iconConfig.nzTheme || "outline";
}
configDefaultTwotoneColor() {
const iconConfig = this.getConfig();
const defaultTwotoneColor = iconConfig.nzTwotoneColor || DEFAULT_TWOTONE_COLOR;
let primaryColor = DEFAULT_TWOTONE_COLOR;
if (defaultTwotoneColor) {
if (defaultTwotoneColor.startsWith("#")) {
primaryColor = defaultTwotoneColor;
} else {
warn2("Twotone color must be a hex color!");
}
}
this.twoToneColor = {
primaryColor
};
}
getConfig() {
return this.nzConfigService.getConfigForComponent("icon") || {};
}
static \u0275fac = function NzIconService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NzIconService)();
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NzIconService,
factory: _NzIconService.\u0275fac,
providedIn: "root"
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzIconService, [{
type: Injectable,
args: [{
providedIn: "root"
}]
}], () => [], null);
})();
var NZ_ICONS_PATCH = new InjectionToken("nz_icons_patch");
var NzIconPatchService = class _NzIconPatchService {
rootIconService;
patched = false;
extraIcons = inject(NZ_ICONS_PATCH, {
self: true
});
constructor(rootIconService) {
this.rootIconService = rootIconService;
}
doPatch() {
if (this.patched) {
return;
}
this.extraIcons.forEach((iconDefinition) => this.rootIconService.addIcon(iconDefinition));
this.patched = true;
}
static \u0275fac = function NzIconPatchService_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NzIconPatchService)(\u0275\u0275inject(NzIconService));
};
static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({
token: _NzIconPatchService,
factory: _NzIconPatchService.\u0275fac
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzIconPatchService, [{
type: Injectable
}], () => [{
type: NzIconService
}], null);
})();
var NzIconDirective = class _NzIconDirective extends IconDirective {
iconService;
ngZone = inject(NgZone);
changeDetectorRef = inject(ChangeDetectorRef);
renderer = inject(Renderer2);
destroyRef = inject(DestroyRef);
pendingTasks = inject(PendingTasks);
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
nzSpin = false;
nzRotate = 0;
set nzType(value) {
this.type = value;
}
set nzTheme(value) {
this.theme = value;
}
set nzTwotoneColor(value) {
this.twoToneColor = value;
}
set nzIconfont(value) {
this.iconfont = value;
}
hostClass;
el;
iconfont;
constructor(iconService) {
super(iconService);
this.iconService = iconService;
inject(NzIconPatchService, {
optional: true
})?.doPatch();
this.el = this._elementRef.nativeElement;
}
ngOnChanges(changes) {
const {
nzType,
nzTwotoneColor,
nzTheme,
nzRotate,
nzSpin
} = changes;
if (nzType || nzTwotoneColor || nzTheme || nzSpin) {
this.ngZone.runOutsideAngular(() => this.changeIcon2());
} else if (nzRotate) {
this.handleRotate(this.el.firstChild);
} else {
this._setSVGElement(this.iconService.createIconfontIcon(`#${this.iconfont}`));
}
}
/**
* If custom content is provided, try to normalize SVG elements.
*/
ngAfterContentChecked() {
if (!this.type) {
const children = this.el.children;
let length = children.length;
if (!this.type && children.length) {
while (length--) {
const child = children[length];
if (child.tagName.toLowerCase() === "svg") {
this.iconService.normalizeSvgElement(child);
}
}
}
}
}
/**
* Replacement of `changeIcon` for more modifications.
*/
changeIcon2() {
const removeTask = this.pendingTasks.add();
const svgOrRemove$ = wrapIntoObservable2(this._changeIcon()).pipe(
// We need to individually debounce the icon rendering on each animation
// frame to prevent frame drops when many icons are being rendered on the
// page, such as in a `@for` loop.
debounceTime(0, this.isBrowser ? animationFrameScheduler : asapScheduler),
takeUntilDestroyed(this.destroyRef),
finalize(removeTask)
);
svgOrRemove$.subscribe({
next: (svgOrRemove) => {
this.ngZone.run(() => {
this.changeDetectorRef.detectChanges();
if (svgOrRemove) {
this.setSVGData(svgOrRemove);
this.handleRotate(svgOrRemove);
}
});
},
error: warn2
});
}
handleRotate(svg) {
if (this.nzRotate) {
this.renderer.setAttribute(svg, "style", `transform: rotate(${this.nzRotate}deg)`);
} else {
this.renderer.removeAttribute(svg, "style");
}
}
setSVGData(svg) {
this.renderer.setAttribute(svg, "data-icon", this.type);
this.renderer.setAttribute(svg, "aria-hidden", "true");
}
static \u0275fac = function NzIconDirective_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NzIconDirective)(\u0275\u0275directiveInject(NzIconService));
};
static \u0275dir = /* @__PURE__ */ \u0275\u0275defineDirective({
type: _NzIconDirective,
selectors: [["nz-icon"], ["", "nz-icon", ""]],
hostAttrs: ["role", "img", 1, "anticon"],
hostVars: 5,
hostBindings: function NzIconDirective_HostBindings(rf, ctx) {
if (rf & 2) {
\u0275\u0275attribute("aria-label", ctx.type);
\u0275\u0275classMap("anticon-" + ctx.type);
\u0275\u0275classProp("anticon-spin", ctx.nzSpin || ctx.type === "loading");
}
},
inputs: {
nzSpin: [2, "nzSpin", "nzSpin", booleanAttribute],
nzRotate: [2, "nzRotate", "nzRotate", numberAttribute],
nzType: "nzType",
nzTheme: "nzTheme",
nzTwotoneColor: "nzTwotoneColor",
nzIconfont: "nzIconfont"
},
exportAs: ["nzIcon"],
features: [\u0275\u0275InheritDefinitionFeature, \u0275\u0275NgOnChangesFeature]
});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzIconDirective, [{
type: Directive,
args: [{
selector: "nz-icon,[nz-icon]",
exportAs: "nzIcon",
host: {
class: "anticon",
"[class]": `'anticon-' + type`,
"[class.anticon-spin]": `nzSpin || type === 'loading'`,
role: "img",
"[attr.aria-label]": "type"
}
}]
}], () => [{
type: NzIconService
}], {
nzSpin: [{
type: Input,
args: [{
transform: booleanAttribute
}]
}],
nzRotate: [{
type: Input,
args: [{
transform: numberAttribute
}]
}],
nzType: [{
type: Input
}],
nzTheme: [{
type: Input
}],
nzTwotoneColor: [{
type: Input
}],
nzIconfont: [{
type: Input
}]
});
})();
var provideNzIcons = (icons) => {
return makeEnvironmentProviders([{
provide: NZ_ICONS,
useValue: icons
}]);
};
var provideNzIconsPatch = (icons) => {
return [NzIconPatchService, {
provide: NZ_ICONS_PATCH,
useValue: icons
}];
};
var NzIconModule = class _NzIconModule {
static forRoot(icons) {
return {
ngModule: _NzIconModule,
providers: [provideNzIcons(icons)]
};
}
static forChild(icons) {
return {
ngModule: _NzIconModule,
providers: [provideNzIconsPatch(icons)]
};
}
static \u0275fac = function NzIconModule_Factory(__ngFactoryType__) {
return new (__ngFactoryType__ || _NzIconModule)();
};
static \u0275mod = /* @__PURE__ */ \u0275\u0275defineNgModule({
type: _NzIconModule,
imports: [NzIconDirective],
exports: [NzIconDirective]
});
static \u0275inj = /* @__PURE__ */ \u0275\u0275defineInjector({});
};
(() => {
(typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(NzIconModule, [{
type: NgModule,
args: [{
imports: [NzIconDirective],
exports: [NzIconDirective]
}]
}], null, null);
})();
export {
getDOM,
LocationStrategy,
Location,
FormStyle,
TranslationWidth,
getLocaleDayPeriods,
formatDate,
NgIf,
NgTemplateOutlet,
DatePipe,
CommonModule,
registerLocaleData2 as registerLocaleData,
DomRendererFactory2,
bootstrapApplication,
provideHttpClient,
PRIMARY_OUTLET,
UrlSerializer,
NavigationStart,
NavigationCancel,
NavigationError,
ChildrenOutletContexts,
ActivatedRoute,
RouterOutlet,
Router,
RouterLink,
provideRouter,
ApiService,
AuthService,
takeUntilDestroyed,
_typeof,
toPropertyKey,
_defineProperty,
environment2 as environment,
warn2 as warn,
coerceNumberProperty,
coerceElement,
coerceArray,
coerceCssPixelValue,
isNotNil,
isTemplateRef,
toCssPixel,
isTouchEvent,
getEventPosition,
Platform,
RtlScrollAxisType,
supportsScrollBehavior,
getRtlScrollAxisType,
_getEventTarget,
_isTestEnvironment,
NzConfigService,
onConfigChangeEventForComponent,
ArrowRightOutline,
ArrowLeftOutline,
AppstoreOutline,
BookOutline,
BulbOutline,
BulbFill,
CheckCircleFill,
CheckCircleOutline,
CheckOutline,
CloseOutline,
DeleteOutline,
EditOutline,
EyeOutline,
FileOutline,
FileTextOutline,
LinkOutline,
LoadingOutline,
LogoutOutline,
LockOutline,
MailOutline,
MenuUnfoldOutline,
MenuFoldOutline,
PlusOutline,
ReadOutline,
SearchOutline,
StarOutline,
UserOutline,
VideoCameraOutline,
NzIconDirective,
provideNzIcons,
NzIconModule
};
/*! Bundled license information:
@angular/common/fesm2022/location.mjs:
@angular/common/fesm2022/common_module.mjs:
@angular/common/fesm2022/xhr.mjs:
@angular/common/fesm2022/common.mjs:
@angular/platform-browser/fesm2022/dom_renderer.mjs:
@angular/platform-browser/fesm2022/browser.mjs:
@angular/common/fesm2022/module.mjs:
@angular/common/fesm2022/http.mjs:
@angular/platform-browser/fesm2022/platform-browser.mjs:
@angular/router/fesm2022/router2.mjs:
@angular/router/fesm2022/router_module.mjs:
@angular/router/fesm2022/router.mjs:
@angular/core/fesm2022/rxjs-interop.mjs:
(**
* @license Angular v20.3.18
* (c) 2010-2025 Google LLC. https://angular.dev/
* License: MIT
*)
*/
//# sourceMappingURL=chunk-2TRRHRR7.js.map